linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / ide / pci / amd74xx.c
index 2b0ea8b..31b6d74 100644 (file)
@@ -16,6 +16,7 @@
  * the Free Software Foundation.
  */
 
+#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/ioport.h>
@@ -75,6 +76,7 @@ static struct amd_ide_chip {
        { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE,        0x50, AMD_UDMA_133 },
        { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE,        0x50, AMD_UDMA_133 },
        { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE,        0x50, AMD_UDMA_133 },
+       { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE,        0x50, AMD_UDMA_133 },
        { PCI_DEVICE_ID_AMD_CS5536_IDE,                 0x40, AMD_UDMA_100 },
        { 0 }
 };
@@ -348,8 +350,10 @@ static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev, const ch
                        break;
 
                case AMD_UDMA_66:
-                       /* no host side cable detection */
-                       amd_80w = 0x03;
+                       pci_read_config_dword(dev, AMD_UDMA_TIMING, &u);
+                       for (i = 24; i >= 0; i -= 8)
+                               if ((u >> i) & 4)
+                                       amd_80w |= (1 << (1 - (i >> 4)));
                        break;
        }
 
@@ -385,6 +389,8 @@ static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev, const ch
        if (amd_clock < 20000 || amd_clock > 50000) {
                printk(KERN_WARNING "%s: User given PCI clock speed impossible (%d), using 33 MHz instead.\n",
                        amd_chipset->name, amd_clock);
+               printk(KERN_WARNING "%s: Use ide0=ata66 if you want to assume 80-wire cable\n",
+                       amd_chipset->name);
                amd_clock = 33333;
        }
 
@@ -491,7 +497,8 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = {
        /* 16 */ DECLARE_NV_DEV("NFORCE-MCP55"),
        /* 17 */ DECLARE_NV_DEV("NFORCE-MCP61"),
        /* 18 */ DECLARE_NV_DEV("NFORCE-MCP65"),
-       /* 19 */ DECLARE_AMD_DEV("AMD5536"),
+       /* 19 */ DECLARE_NV_DEV("NFORCE-MCP67"),
+       /* 20 */ DECLARE_AMD_DEV("AMD5536"),
 };
 
 static int __devinit amd74xx_probe(struct pci_dev *dev, const struct pci_device_id *id)
@@ -530,7 +537,8 @@ static struct pci_device_id amd74xx_pci_tbl[] = {
        { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 16 },
        { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 17 },
        { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 18 },
-       { PCI_VENDOR_ID_AMD,    PCI_DEVICE_ID_AMD_CS5536_IDE,           PCI_ANY_ID, PCI_ANY_ID, 0, 0, 19 },
+       { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 19 },
+       { PCI_VENDOR_ID_AMD,    PCI_DEVICE_ID_AMD_CS5536_IDE,           PCI_ANY_ID, PCI_ANY_ID, 0, 0, 20 },
        { 0, },
 };
 MODULE_DEVICE_TABLE(pci, amd74xx_pci_tbl);