]> err.no Git - linux-2.6/commitdiff
pata_hpt37x: Fix 2.6.22 clock PLL regression
authorAlan Cox <alan@lxorguk.ukuu.org.uk>
Tue, 24 Jul 2007 14:17:48 +0000 (15:17 +0100)
committerJeff Garzik <jeff@garzik.org>
Tue, 24 Jul 2007 20:55:02 +0000 (16:55 -0400)
Just one version of Linux ago
The PLL code broke - oh no!
But set the right mode
And fix up the code
Makes the PLL timing sync go

[whatever happened to the sailor from Nantucket, hero of many limericks?  -jg]

Closes-bug: #8791
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/ata/pata_hpt37x.c

index b0af65aadde3a9d48e84490bce15c89b9153f1fa..84d9c5568567461b782da104f41c857fb8f75f11 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/libata.h>
 
 #define DRV_NAME       "pata_hpt37x"
-#define DRV_VERSION    "0.6.6"
+#define DRV_VERSION    "0.6.7"
 
 struct hpt_clock {
        u8      xfer_speed;
@@ -1103,17 +1103,17 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 
                /* Select the DPLL clock. */
                pci_write_config_byte(dev, 0x5b, 0x21);
-               pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low);
+               pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low | 0x100);
 
                for(adjust = 0; adjust < 8; adjust++) {
                        if (hpt37x_calibrate_dpll(dev))
                                break;
                        /* See if it'll settle at a fractionally different clock */
-                       if ((adjust & 3) == 3) {
-                               f_low --;
-                               f_high ++;
-                       }
-                       pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low);
+                       if (adjust & 1)
+                               f_low -= adjust >> 1;
+                       else
+                               f_high += adjust >> 1;
+                       pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low | 0x100);
                }
                if (adjust == 8) {
                        printk(KERN_WARNING "hpt37x: DPLL did not stabilize.\n");