diff options
| author | Jörg Hohensohn <hohensoh@rockbox.org> | 2003-09-01 05:48:42 +0000 |
|---|---|---|
| committer | Jörg Hohensohn <hohensoh@rockbox.org> | 2003-09-01 05:48:42 +0000 |
| commit | 118d45eb92a423e9774c0bc9d05f487dca478d47 (patch) | |
| tree | 9b0b7c73b5a8939484fc7b8de91c05e2683dd569 | |
| parent | 20b61a2e8895e638fd64c4591a9d3bb1f5e5f098 (diff) | |
| download | rockbox-118d45eb92a423e9774c0bc9d05f487dca478d47.zip rockbox-118d45eb92a423e9774c0bc9d05f487dca478d47.tar.gz rockbox-118d45eb92a423e9774c0bc9d05f487dca478d47.tar.bz2 rockbox-118d45eb92a423e9774c0bc9d05f487dca478d47.tar.xz | |
ATA io_address_detect() now doesn't probe any more, but uses the h/w mask. Probing failed for some flash users. I hope this works for everybody, we have to try to find out.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3946 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | firmware/drivers/ata.c | 37 |
1 files changed, 8 insertions, 29 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 80123fa..01a8fa3 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c @@ -28,6 +28,7 @@ #include "usb.h" #include "power.h" #include "string.h" +#include "hwcompat.h" #define SECTOR_SIZE 512 #define ATA_DATA (*((volatile unsigned short*)0x06104100)) @@ -697,42 +698,20 @@ static int master_slave_detect(void) } static int io_address_detect(void) -{ - unsigned char tmp = ATA_STATUS & 0xf9; /* Mask the IDX and CORR bits */ - unsigned char dummy; - - /* 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 - assume that we have the correct address. - - We can't read the ATA_STATUS directly, since the read data will stay - on the data bus if the following read does not assert the Chip Select - to the ATA controller. We read a register that we know exists to make - sure that the data on the bus isn't identical to the STATUS register - contents. */ - ATA_SECTOR = 0; - dummy = ATA_SECTOR; - if(tmp == ((*ATA_CONTROL2) & 0xf9)) - { - DEBUGF("CONTROL is at 0x306\n"); - ata_io_address = 0x300; /* For debug purposes only */ - old_recorder = true; - ata_control = ATA_CONTROL2; - } - else +{ /* now, use the HW mask instead of probing */ + if (read_hw_mask() & ATA_ADDRESS_200) { - DEBUGF("CONTROL is at 0x206\n"); ata_io_address = 0x200; /* For debug purposes only */ old_recorder = false; ata_control = ATA_CONTROL1; } - - /* Let's check again, to be sure */ - if(tmp != (ATA_ALT_STATUS & 0xf9)) + else { - DEBUGF("ATA I/O address detection failed\n"); - return -1; + ata_io_address = 0x300; /* For debug purposes only */ + old_recorder = true; + ata_control = ATA_CONTROL2; } + return 0; } |