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 /firmware | |
parent | 20b61a2e8895e638fd64c4591a9d3bb1f5e5f098 (diff) | |
download | rockbox-118d45eb92a423e9774c0bc9d05f487dca478d47.tar.gz rockbox-118d45eb92a423e9774c0bc9d05f487dca478d47.zip |
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
Diffstat (limited to 'firmware')
-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 80123fadb7..01a8fa360b 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include "usb.h" | 28 | #include "usb.h" |
29 | #include "power.h" | 29 | #include "power.h" |
30 | #include "string.h" | 30 | #include "string.h" |
31 | #include "hwcompat.h" | ||
31 | 32 | ||
32 | #define SECTOR_SIZE 512 | 33 | #define SECTOR_SIZE 512 |
33 | #define ATA_DATA (*((volatile unsigned short*)0x06104100)) | 34 | #define ATA_DATA (*((volatile unsigned short*)0x06104100)) |
@@ -697,42 +698,20 @@ static int master_slave_detect(void) | |||
697 | } | 698 | } |
698 | 699 | ||
699 | static int io_address_detect(void) | 700 | static int io_address_detect(void) |
700 | { | 701 | { /* now, use the HW mask instead of probing */ |
701 | unsigned char tmp = ATA_STATUS & 0xf9; /* Mask the IDX and CORR bits */ | 702 | if (read_hw_mask() & ATA_ADDRESS_200) |
702 | unsigned char dummy; | ||
703 | |||
704 | /* We compare the STATUS register with the ALT_STATUS register, which | ||
705 | is located at the same address as CONTROL. If they are the same, we | ||
706 | assume that we have the correct address. | ||
707 | |||
708 | We can't read the ATA_STATUS directly, since the read data will stay | ||
709 | on the data bus if the following read does not assert the Chip Select | ||
710 | to the ATA controller. We read a register that we know exists to make | ||
711 | sure that the data on the bus isn't identical to the STATUS register | ||
712 | contents. */ | ||
713 | ATA_SECTOR = 0; | ||
714 | dummy = ATA_SECTOR; | ||
715 | if(tmp == ((*ATA_CONTROL2) & 0xf9)) | ||
716 | { | ||
717 | DEBUGF("CONTROL is at 0x306\n"); | ||
718 | ata_io_address = 0x300; /* For debug purposes only */ | ||
719 | old_recorder = true; | ||
720 | ata_control = ATA_CONTROL2; | ||
721 | } | ||
722 | else | ||
723 | { | 703 | { |
724 | DEBUGF("CONTROL is at 0x206\n"); | ||
725 | ata_io_address = 0x200; /* For debug purposes only */ | 704 | ata_io_address = 0x200; /* For debug purposes only */ |
726 | old_recorder = false; | 705 | old_recorder = false; |
727 | ata_control = ATA_CONTROL1; | 706 | ata_control = ATA_CONTROL1; |
728 | } | 707 | } |
729 | 708 | else | |
730 | /* Let's check again, to be sure */ | ||
731 | if(tmp != (ATA_ALT_STATUS & 0xf9)) | ||
732 | { | 709 | { |
733 | DEBUGF("ATA I/O address detection failed\n"); | 710 | ata_io_address = 0x300; /* For debug purposes only */ |
734 | return -1; | 711 | old_recorder = true; |
712 | ata_control = ATA_CONTROL2; | ||
735 | } | 713 | } |
714 | |||
736 | return 0; | 715 | return 0; |
737 | } | 716 | } |
738 | 717 | ||