logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

cvs: firmware/drivers ata.c,1.92,1.93: msg#00001

Subject: cvs: firmware/drivers ata.c,1.92,1.93
Update of /cvsroot/rockbox/firmware/drivers
In directory sc8-pr-cvs1:/tmp/cvs-serv7842/firmware/drivers

Modified Files:
        ata.c 
Log Message:
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.

Index: ata.c
===================================================================
RCS file: /cvsroot/rockbox/firmware/drivers/ata.c,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -b -r1.92 -r1.93
--- ata.c       18 Jul 2003 21:55:06 -0000      1.92
+++ ata.c       1 Sep 2003 05:48:42 -0000       1.93
@@ -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 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;
 }
 




<Prev in Thread] Current Thread [Next in Thread>