2007-09-20 04:46:41 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
2007-09-22 15:43:38 +00:00
|
|
|
* $Id$
|
2007-09-20 04:46:41 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2007 by Karl Kurbjun
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2007-09-20 04:46:41 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "cpu.h"
|
|
|
|
#include "kernel.h"
|
|
|
|
#include "thread.h"
|
|
|
|
#include "system.h"
|
|
|
|
#include "power.h"
|
|
|
|
#include "panic.h"
|
|
|
|
#include "pcf50606.h"
|
2008-09-10 20:14:22 +00:00
|
|
|
#include "ata.h"
|
2007-09-20 04:46:41 +00:00
|
|
|
#include "ata-target.h"
|
|
|
|
#include "backlight-target.h"
|
|
|
|
|
|
|
|
/* ARESET on C7C68300 and RESET on ATA interface (Active Low) */
|
2007-09-25 01:44:57 +00:00
|
|
|
#define ATA_RESET_ENABLE (IO_GIO_BITCLR0 = 1 << 10)
|
|
|
|
#define ATA_RESET_DISABLE (IO_GIO_BITSET0 = 1 << 10)
|
2007-09-20 04:46:41 +00:00
|
|
|
|
|
|
|
/* ATA_EN on C7C68300 */
|
2007-09-25 01:44:57 +00:00
|
|
|
#define USB_ATA_ENABLE (IO_GIO_BITSET0 = 1 << 2)
|
|
|
|
#define USB_ATA_DISABLE (IO_GIO_BITCLR0 = 1 << 2)
|
2007-09-20 04:46:41 +00:00
|
|
|
|
|
|
|
void ata_reset(void)
|
|
|
|
{
|
|
|
|
ATA_RESET_ENABLE;
|
|
|
|
sleep(1); /* > 25us */
|
|
|
|
ATA_RESET_DISABLE;
|
|
|
|
sleep(1); /* > 2ms */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This function is called before enabling the USB bus */
|
|
|
|
void ata_enable(bool on)
|
|
|
|
{
|
|
|
|
if(on)
|
|
|
|
USB_ATA_DISABLE;
|
|
|
|
else
|
|
|
|
USB_ATA_ENABLE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ata_is_coldstart(void)
|
|
|
|
{
|
2007-09-25 01:44:57 +00:00
|
|
|
return true;
|
2007-09-20 04:46:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ata_device_init(void)
|
|
|
|
{
|
|
|
|
/* ATA reset */
|
|
|
|
ATA_RESET_DISABLE; /* Set the pin to disable an active low reset */
|
2007-09-25 01:44:57 +00:00
|
|
|
IO_GIO_DIR0&=~(1<<10);
|
2007-09-20 04:46:41 +00:00
|
|
|
}
|
|
|
|
|