From 118d45eb92a423e9774c0bc9d05f487dca478d47 Mon Sep 17 00:00:00 2001 From: Jörg Hohensohn Date: Mon, 1 Sep 2003 05:48:42 +0000 Subject: 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 --- firmware/drivers/ata.c | 37 ++++++++----------------------------- 1 file changed, 8 insertions(+), 29 deletions(-) (limited to 'firmware') diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 80123fadb7..01a8fa360b 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; } -- cgit v1.2.3