summaryrefslogtreecommitdiff
path: root/firmware/drivers
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-05-24 11:25:24 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-05-24 11:25:24 +0000
commita97c4419edc8c93bb6839bc6c31d8e45dbd241c4 (patch)
tree13ef19f006c50c00f43fa733e9c8613ad531157f /firmware/drivers
parent44d76bc1ae086a89dedcf5e6ed430c713f2b9cf6 (diff)
Fixed wrong reset pin. Removed unnecessary reset from init.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@691 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r--firmware/drivers/ata.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 95711c60ea..c632402483 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -197,15 +197,8 @@ int ata_write_sectors(unsigned long start,
static int check_registers(void)
{
- int ret = 0;
-
- mutex_lock(&ata_mtx);
-
if ( ATA_STATUS & STATUS_BSY )
- {
- mutex_unlock(&ata_mtx);
- return 0;
- }
+ return -1;
ATA_NSECTOR = 0xa5;
ATA_SECTOR = 0x5a;
@@ -216,10 +209,9 @@ static int check_registers(void)
(ATA_SECTOR == 0x5a) &&
(ATA_LCYL == 0xaa) &&
(ATA_HCYL == 0x55))
- ret = 1;
+ return 0;
- mutex_unlock(&ata_mtx);
- return ret;
+ return -2;
}
static int freeze_lock(void)
@@ -273,11 +265,11 @@ int ata_hard_reset(void)
mutex_lock(&ata_mtx);
- PADR &= ~0x0002;
+ PADR &= ~0x0200;
sleep(2);
- PADR |= 0x0002;
+ PADR |= 0x0200;
ret = wait_for_rdy();
@@ -337,16 +329,13 @@ int ata_init(void)
if (master_slave())
return -1;
- if (!ata_hard_reset())
- return -2;
-
- if (!check_registers())
+ if (check_registers())
return -3;
- if (freeze_lock() < 0)
+ if (freeze_lock())
return -4;
- if (ata_spindown(1) < 0)
+ if (ata_spindown(1))
return -5;
ATA_SELECT = SELECT_LBA;