patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / drivers / ide / pci / piix.c
index 1126ed9..fec700b 100644 (file)
@@ -49,9 +49,9 @@
  * pci_read_config_word(HWIF(drive)->pci_dev, 0x40, &reg40);
  * pci_read_config_word(HWIF(drive)->pci_dev, 0x42, &reg42);
  * pci_read_config_word(HWIF(drive)->pci_dev, 0x44, &reg44);
- * pci_read_config_word(HWIF(drive)->pci_dev, 0x48, &reg48);
+ * pci_read_config_byte(HWIF(drive)->pci_dev, 0x48, &reg48);
  * pci_read_config_word(HWIF(drive)->pci_dev, 0x4a, &reg4a);
- * pci_read_config_word(HWIF(drive)->pci_dev, 0x54, &reg54);
+ * pci_read_config_byte(HWIF(drive)->pci_dev, 0x54, &reg54);
  *
  * Documentation
  *     Publically available from Intel web site. Errata documentation
@@ -153,7 +153,7 @@ static int piix_get_info (char *buffer, char **addr, off_t offset, int count)
                        case PCI_DEVICE_ID_INTEL_82801EB_11:
                        case PCI_DEVICE_ID_INTEL_82801E_11:
                        case PCI_DEVICE_ID_INTEL_ESB_2:
-                       case PCI_DEVICE_ID_INTEL_ICH6_2:
+                       case PCI_DEVICE_ID_INTEL_ICH6_19:
                                p += sprintf(p, "PIIX4 Ultra 100 ");
                                break;
                        case PCI_DEVICE_ID_INTEL_82372FB_1:
@@ -292,7 +292,7 @@ static u8 piix_ratemask (ide_drive_t *drive)
                case PCI_DEVICE_ID_INTEL_82801DB_11:
                case PCI_DEVICE_ID_INTEL_82801EB_11:
                case PCI_DEVICE_ID_INTEL_ESB_2:
-               case PCI_DEVICE_ID_INTEL_ICH6_2:
+               case PCI_DEVICE_ID_INTEL_ICH6_19:
                        mode = 3;
                        break;
                /* UDMA 66 capable */
@@ -432,15 +432,14 @@ static int piix_tune_chipset (ide_drive_t *drive, u8 xferspeed)
        int w_flag              = 0x10 << drive->dn;
        int u_speed             = 0;
        int                     sitre;
-       u16                     reg4042, reg44, reg48, reg4a, reg54;
-       u8                      reg55;
+       u16                     reg4042, reg4a;
+       u8                      reg48, reg54, reg55;
 
        pci_read_config_word(dev, maslave, &reg4042);
        sitre = (reg4042 & 0x4000) ? 1 : 0;
-       pci_read_config_word(dev, 0x44, &reg44);
-       pci_read_config_word(dev, 0x48, &reg48);
+       pci_read_config_byte(dev, 0x48, &reg48);
        pci_read_config_word(dev, 0x4a, &reg4a);
-       pci_read_config_word(dev, 0x54, &reg54);
+       pci_read_config_byte(dev, 0x54, &reg54);
        pci_read_config_byte(dev, 0x55, &reg55);
 
        switch(speed) {
@@ -462,30 +461,26 @@ static int piix_tune_chipset (ide_drive_t *drive, u8 xferspeed)
 
        if (speed >= XFER_UDMA_0) {
                if (!(reg48 & u_flag))
-                       pci_write_config_word(dev, 0x48, reg48|u_flag);
+                       pci_write_config_byte(dev, 0x48, reg48 | u_flag);
                if (speed == XFER_UDMA_5) {
                        pci_write_config_byte(dev, 0x55, (u8) reg55|w_flag);
                } else {
                        pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag);
                }
-               if (!(reg4a & u_speed)) {
-                       pci_write_config_word(dev, 0x4a, reg4a & ~a_speed);
-                       pci_write_config_word(dev, 0x4a, reg4a|u_speed);
-               }
+               if ((reg4a & a_speed) != u_speed)
+                       pci_write_config_word(dev, 0x4a, (reg4a & ~a_speed) | u_speed);
                if (speed > XFER_UDMA_2) {
-                       if (!(reg54 & v_flag)) {
-                               pci_write_config_word(dev, 0x54, reg54|v_flag);
-                       }
-               } else {
-                       pci_write_config_word(dev, 0x54, reg54 & ~v_flag);
-               }
+                       if (!(reg54 & v_flag))
+                               pci_write_config_byte(dev, 0x54, reg54 | v_flag);
+               } else
+                       pci_write_config_byte(dev, 0x54, reg54 & ~v_flag);
        } else {
                if (reg48 & u_flag)
-                       pci_write_config_word(dev, 0x48, reg48 & ~u_flag);
+                       pci_write_config_byte(dev, 0x48, reg48 & ~u_flag);
                if (reg4a & a_speed)
                        pci_write_config_word(dev, 0x4a, reg4a & ~a_speed);
                if (reg54 & v_flag)
-                       pci_write_config_word(dev, 0x54, reg54 & ~v_flag);
+                       pci_write_config_byte(dev, 0x54, reg54 & ~v_flag);
                if (reg55 & w_flag)
                        pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag);
        }
@@ -627,7 +622,7 @@ static unsigned int __devinit init_chipset_piix (struct pci_dev *dev, const char
                case PCI_DEVICE_ID_INTEL_82801EB_11:
                case PCI_DEVICE_ID_INTEL_82801E_11:
                case PCI_DEVICE_ID_INTEL_ESB_2:
-               case PCI_DEVICE_ID_INTEL_ICH6_2:
+               case PCI_DEVICE_ID_INTEL_ICH6_19:
                {
                        unsigned int extra = 0;
                        pci_read_config_dword(dev, 0x54, &extra);
@@ -655,8 +650,8 @@ static unsigned int __devinit init_chipset_piix (struct pci_dev *dev, const char
  *     Set up the ide_hwif_t for the PIIX interface according to the
  *     capabilities of the hardware.
  */
-static void __init init_hwif_piix (ide_hwif_t *hwif)
+
+static void __devinit init_hwif_piix(ide_hwif_t *hwif)
 {
        u8 reg54h = 0, reg55h = 0, ata66 = 0;
        u8 mask = hwif->channel ? 0xc0 : 0x30;
@@ -725,8 +720,8 @@ static void __init init_hwif_piix (ide_hwif_t *hwif)
  *     Enable the xp fixup for the PIIX controller and then perform
  *     a standard ide PCI setup
  */
-static void __init init_setup_piix (struct pci_dev *dev, ide_pci_device_t *d)
+
+static void __devinit init_setup_piix(struct pci_dev *dev, ide_pci_device_t *d)
 {
        ide_setup_pci_device(dev, d);
 }
@@ -744,8 +739,6 @@ static int __devinit piix_init_one(struct pci_dev *dev, const struct pci_device_
 {
        ide_pci_device_t *d = &piix_pci_info[id->driver_data];
 
-       if (dev->device != d->device)
-               BUG();
        d->init_setup(dev, d);
        return 0;
 }
@@ -756,8 +749,8 @@ static int __devinit piix_init_one(struct pci_dev *dev, const struct pci_device_
  *     Check for the present of 450NX errata #19 and errata #25. If
  *     they are found, disable use of DMA IDE
  */
-static void __init piix_check_450nx(void)
+
+static void __devinit piix_check_450nx(void)
 {
        struct pci_dev *pdev = NULL;
        u16 cfg;
@@ -804,7 +797,7 @@ static struct pci_device_id piix_pci_tbl[] = {
        { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 18},
 #endif /* !CONFIG_SCSI_SATA */
        { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 19},
-       { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 20},
+       { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_19, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 20},
        { 0, },
 };
 MODULE_DEVICE_TABLE(pci, piix_pci_tbl);