forked from len0rd/rockbox
Cold start fixes: master_slave_select() now checks for BSY as well as RDY (since disks are BSY during powerup). Also, wait_for_bsy() looks at ATA_STATUS instead of ATA_ALT_STATUS, since the address of ATA_ALT_STATUS is not determined until later.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3822 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
efd2f356c7
commit
9f372f1f59
1 changed files with 8 additions and 8 deletions
|
|
@ -111,7 +111,7 @@ static int wait_for_bsy(void)
|
||||||
{
|
{
|
||||||
int timeout = current_tick + HZ*10;
|
int timeout = current_tick + HZ*10;
|
||||||
last_disk_activity = timeout;
|
last_disk_activity = timeout;
|
||||||
while (TIME_BEFORE(current_tick, timeout) && (ATA_ALT_STATUS & STATUS_BSY))
|
while (TIME_BEFORE(current_tick, timeout) && (ATA_STATUS & STATUS_BSY))
|
||||||
yield();
|
yield();
|
||||||
|
|
||||||
if (TIME_BEFORE(current_tick, timeout))
|
if (TIME_BEFORE(current_tick, timeout))
|
||||||
|
|
@ -676,14 +676,14 @@ static int master_slave_detect(void)
|
||||||
{
|
{
|
||||||
/* master? */
|
/* master? */
|
||||||
ATA_SELECT = 0;
|
ATA_SELECT = 0;
|
||||||
if ( ATA_STATUS & STATUS_RDY ) {
|
if ( ATA_STATUS & (STATUS_RDY|STATUS_BSY) ) {
|
||||||
ata_device = 0;
|
ata_device = 0;
|
||||||
DEBUGF("Found master harddisk\n");
|
DEBUGF("Found master harddisk\n");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* slave? */
|
/* slave? */
|
||||||
ATA_SELECT = SELECT_DEVICE1;
|
ATA_SELECT = SELECT_DEVICE1;
|
||||||
if ( ATA_STATUS & STATUS_RDY ) {
|
if ( ATA_STATUS & (STATUS_RDY|STATUS_BSY) ) {
|
||||||
ata_device = SELECT_DEVICE1;
|
ata_device = SELECT_DEVICE1;
|
||||||
DEBUGF("Found slave harddisk\n");
|
DEBUGF("Found slave harddisk\n");
|
||||||
}
|
}
|
||||||
|
|
@ -697,7 +697,7 @@ static int io_address_detect(void)
|
||||||
{
|
{
|
||||||
unsigned char tmp = ATA_STATUS & 0xf9; /* Mask the IDX and CORR bits */
|
unsigned char tmp = ATA_STATUS & 0xf9; /* Mask the IDX and CORR bits */
|
||||||
unsigned char dummy;
|
unsigned char dummy;
|
||||||
|
|
||||||
/* We compare the STATUS register with the ALT_STATUS register, which
|
/* We compare the STATUS register with the ALT_STATUS register, which
|
||||||
is located at the same address as CONTROL. If they are the same, we
|
is located at the same address as CONTROL. If they are the same, we
|
||||||
assume that we have the correct address.
|
assume that we have the correct address.
|
||||||
|
|
@ -725,7 +725,7 @@ static int io_address_detect(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Let's check again, to be sure */
|
/* Let's check again, to be sure */
|
||||||
if(tmp != ATA_CONTROL)
|
if(tmp != (ATA_ALT_STATUS & 0xf9))
|
||||||
{
|
{
|
||||||
DEBUGF("ATA I/O address detection failed\n");
|
DEBUGF("ATA I/O address detection failed\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -797,10 +797,10 @@ unsigned short* ata_get_identify(void)
|
||||||
|
|
||||||
int ata_init(void)
|
int ata_init(void)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
bool coldstart = (PACR2 & 0x4000) != 0;
|
bool coldstart = (PACR2 & 0x4000) != 0;
|
||||||
|
|
||||||
mutex_init(&ata_mtx);
|
mutex_init(&ata_mtx);
|
||||||
|
|
||||||
led(false);
|
led(false);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue