Merge to Fedora kernel-2.6.7-1.441
[linux-2.6.git] / drivers / ide / pci / piix.c
index 3d21a5b..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
@@ -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);
        }
@@ -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);
 }
@@ -754,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;