forked from len0rd/rockbox
Updated power-on procedure
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2896 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
657a2f3d1c
commit
7249c8807c
1 changed files with 10 additions and 19 deletions
|
@ -102,6 +102,7 @@ static unsigned short identify_info[SECTOR_SIZE];
|
||||||
|
|
||||||
static int ata_power_on(void);
|
static int ata_power_on(void);
|
||||||
static int perform_soft_reset(void);
|
static int perform_soft_reset(void);
|
||||||
|
static int set_multiple_mode(int sectors);
|
||||||
|
|
||||||
static int wait_for_bsy(void) __attribute__ ((section (".icode")));
|
static int wait_for_bsy(void) __attribute__ ((section (".icode")));
|
||||||
static int wait_for_bsy(void)
|
static int wait_for_bsy(void)
|
||||||
|
@ -524,21 +525,18 @@ int ata_hard_reset(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
mutex_lock(&ata_mtx);
|
|
||||||
|
|
||||||
PADR &= ~0x0200;
|
PADR &= ~0x0200;
|
||||||
|
|
||||||
sleep(2);
|
sleep(2);
|
||||||
|
|
||||||
PADR |= 0x0200;
|
PADR |= 0x0200;
|
||||||
|
|
||||||
ret = wait_for_rdy();
|
ret = wait_for_bsy();
|
||||||
|
|
||||||
/* Massage the return code so it is 0 on success and -1 on failure */
|
/* Massage the return code so it is 0 on success and -1 on failure */
|
||||||
ret = ret?0:-1;
|
ret = ret?0:-1;
|
||||||
|
|
||||||
sleeping = false;
|
sleeping = false;
|
||||||
mutex_unlock(&ata_mtx);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -582,26 +580,19 @@ int ata_soft_reset(void)
|
||||||
|
|
||||||
static int ata_power_on(void)
|
static int ata_power_on(void)
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
int retry_count;
|
|
||||||
|
|
||||||
ide_power_enable(true);
|
ide_power_enable(true);
|
||||||
sleep(HZ/2);
|
if( ata_hard_reset() )
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
ATA_SELECT = SELECT_LBA;
|
||||||
ATA_CONTROL = CONTROL_nIEN;
|
ATA_CONTROL = CONTROL_nIEN;
|
||||||
|
|
||||||
/* This little sucker can take up to 30 seconds */
|
if (set_multiple_mode(multisectors))
|
||||||
retry_count = 8;
|
return -2;
|
||||||
do
|
|
||||||
{
|
|
||||||
ret = wait_for_rdy();
|
|
||||||
} while(!ret && retry_count--);
|
|
||||||
|
|
||||||
/* Massage the return code so it is 0 on success and -1 on failure */
|
|
||||||
ret = ret?0:-1;
|
|
||||||
|
|
||||||
sleeping = false;
|
sleeping = false;
|
||||||
return ret;
|
poweroff = false;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int master_slave_detect(void)
|
static int master_slave_detect(void)
|
||||||
|
@ -752,7 +743,7 @@ int ata_init(void)
|
||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
if (set_multiple_mode(multisectors))
|
if (set_multiple_mode(multisectors))
|
||||||
return -6;
|
return -6;
|
||||||
|
|
||||||
ATA_SELECT = SELECT_LBA;
|
ATA_SELECT = SELECT_LBA;
|
||||||
ATA_CONTROL = CONTROL_nIEN;
|
ATA_CONTROL = CONTROL_nIEN;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue