Re: ALi driver bug in new kernel

From: Jan Niehusmann (list005@gondor.com)
Date: Mon May 29 2000 - 05:17:55 EST


> The cable detection result is meaningless for chip revision < 0xC2,
> I suggest change the block of code to:
> unsigned int __init ata66_ali15x3 (ide_hwif_t *hwif) {
> ...
> return (hwif->channel) ? cable_80_pin[1] : cable_80_pin[0] ;
> }

Here is a patch. Additionally it moves cable_80_pin into the function
(not used anywhere else), and deletes ata66mask (not needed any more):

--- linux-2.4.0-test1/drivers/ide/alim15x3.c.orig Wed May 24 03:06:47 2000
+++ linux-2.4.0-test1/drivers/ide/alim15x3.c Mon May 29 12:12:59 2000
@@ -237,7 +237,6 @@
 
 static byte m5229_revision = 0;
 static byte chip_is_1543c_e = 0;
-static byte cable_80_pin[2] = { 0, 0 };
 
 byte ali_proc = 0;
 static struct pci_dev *isa_dev;
@@ -539,11 +538,16 @@
         return 0;
 }
 
+/*
+ * This checks if the controller and the cable are capable
+ * of UDMA66 transfers. It doesn't check the drives.
+ * But see note 2 below!
+ */
 unsigned int __init ata66_ali15x3 (ide_hwif_t *hwif)
 {
         struct pci_dev *dev = hwif->pci_dev;
- byte ata66mask = hwif->channel ? 0x02 : 0x01;
         unsigned int ata66 = 0;
+ byte cable_80_pin[2] = { 0, 0 };
 
         unsigned long flags;
         byte tmpbyte;
@@ -596,6 +600,11 @@
                  * has 80-pin (from host view)
                  */
                 if (!(tmpbyte & 0x02)) cable_80_pin[1] = 1;
+
+ /*
+ * Allow ata66 if cable of current channel has 80 pins
+ */
+ ata66 = (hwif->chanel)?cable_80_pin[1]:cable_80_pin[0];
         } else {
                 /*
                  * revision 0x20 (1543-E, 1543-F)
@@ -625,18 +634,6 @@
 
         pci_write_config_byte(dev, 0x53, tmpbyte);
 
- /*
- * Ultra66 cable detection (from Host View)
- * m5229, 0x4a, bit0: primary, bit1: secondary 80 pin
- *
- * 0x4a, bit0 is 0 => primary channel
- * has 80-pin (from host view)
- *
- * 0x4a, bit1 is 0 => secondary channel
- * has 80-pin (from host view)
- */
- pci_read_config_byte(dev, 0x4a, &tmpbyte);
- ata66 = (!(tmpbyte & ata66mask)) ? 1 : 0;
         __restore_flags(flags);
 
         return(ata66);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed May 31 2000 - 21:00:20 EST