1
0
Fork 0
forked from len0rd/rockbox

Archos: Moved the ata_address_detect() code into ata_device_init(), removing the associated #ifdef and some public #defines. Saves a tiny bit of code as well.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11812 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2006-12-19 09:27:41 +00:00
parent 3bceded793
commit 28fd4b7228
3 changed files with 17 additions and 22 deletions

View file

@ -909,6 +909,7 @@ int ata_init(void)
{
int rc;
bool coldstart = ata_is_coldstart();
/* must be called before ata_device_init() */
mutex_init(&ata_mtx);
@ -924,13 +925,10 @@ int ata_init(void)
sleep(HZ); /* allow voltage to build up */
}
#ifdef ATA_ADDRESS_DETECT
ata_address_detect();
#endif
/* first try, hard reset at cold start only */
rc = init_and_check(coldstart);
rc = init_and_check(coldstart);
if (rc)
if (rc)
{ /* failed? -> second try, always with hard reset */
DEBUGF("ata: init failed, retrying...\n");
rc = init_and_check(true);

View file

@ -25,6 +25,9 @@
#include "ata-target.h"
#include "hwcompat.h"
#define ATA_CONTROL1 ((volatile unsigned char*)0x06200206)
#define ATA_CONTROL2 ((volatile unsigned char*)0x06200306)
volatile unsigned char* ata_control;
int ata_io_address; /* 0x300 or 0x200 */
@ -39,20 +42,6 @@ void ata_reset(void)
sleep(1); /* > 2ms */
}
void ata_address_detect(void)
{
if (read_hw_mask() & ATA_ADDRESS_200)
{
ata_io_address = 0x200; /* For debug purposes only */
ata_control = ATA_CONTROL1;
}
else
{
ata_io_address = 0x300; /* For debug purposes only */
ata_control = ATA_CONTROL2;
}
}
void ata_enable(bool on)
{
if(on)
@ -68,6 +57,17 @@ void ata_device_init(void)
or_b(0x02, &PAIORH); /* output for ATA reset */
or_b(0x02, &PADRH); /* release ATA reset */
PACR2 &= 0xBFFF; /* GPIO function for PA7 (IDE enable) */
if (read_hw_mask() & ATA_ADDRESS_200)
{
ata_io_address = 0x200; /* For debug purposes only */
ata_control = ATA_CONTROL1;
}
else
{
ata_io_address = 0x300; /* For debug purposes only */
ata_control = ATA_CONTROL2;
}
}
bool ata_is_coldstart(void)

View file

@ -22,14 +22,11 @@
/* asm optimised read & write loops */
#define ATA_OPTIMIZED_READING
#define ATA_OPTIMIZED_WRITING
#define ATA_ADDRESS_DETECT /* need address detection */
#define SWAP_WORDS
#define ATA_IOBASE 0x06100100
#define ATA_DATA (*((volatile unsigned short*)0x06104100))
#define ATA_CONTROL1 ((volatile unsigned char*)0x06200206)
#define ATA_CONTROL2 ((volatile unsigned char*)0x06200306)
#define ATA_CONTROL (*ata_control)
#define ATA_ERROR (*((volatile unsigned char*)ATA_IOBASE + 1))