]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/pci/hpt34x.c
cmd64x: procfs code fixes/cleanups (take 2)
[linux-2.6-omap-h63xx.git] / drivers / ide / pci / hpt34x.c
index 7da550281cf23a112d61b6cc68d946ad0e540d19..924eaa3a5708890e592dce1d7d130b769c37f25b 100644 (file)
@@ -24,7 +24,6 @@
  * Non-bootable card or HPT343 :: pcicmd == 0x05
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
@@ -49,19 +48,6 @@ static u8 hpt34x_ratemask (ide_drive_t *drive)
        return 1;
 }
 
-static void hpt34x_clear_chipset (ide_drive_t *drive)
-{
-       struct pci_dev *dev     = HWIF(drive)->pci_dev;
-       u32 reg1 = 0, tmp1 = 0, reg2 = 0, tmp2 = 0;
-
-       pci_read_config_dword(dev, 0x44, &reg1);
-       pci_read_config_dword(dev, 0x48, &reg2);
-       tmp1 = ((0x00 << (3*drive->dn)) | (reg1 & ~(7 << (3*drive->dn))));
-       tmp2 = (reg2 & ~(0x11 << drive->dn));
-       pci_write_config_dword(dev, 0x44, tmp1);
-       pci_write_config_dword(dev, 0x48, tmp2);
-}
-
 static int hpt34x_tune_chipset (ide_drive_t *drive, u8 xferspeed)
 {
        struct pci_dev *dev     = HWIF(drive)->pci_dev;
@@ -82,7 +68,7 @@ static int hpt34x_tune_chipset (ide_drive_t *drive, u8 xferspeed)
        pci_read_config_dword(dev, 0x44, &reg1);
        pci_read_config_dword(dev, 0x48, &reg2);
        tmp1 = ((lo_speed << (3*drive->dn)) | (reg1 & ~(7 << (3*drive->dn))));
-       tmp2 = ((hi_speed << drive->dn) | reg2);
+       tmp2 = ((hi_speed << drive->dn) | (reg2 & ~(0x11 << drive->dn)));
        pci_write_config_dword(dev, 0x44, tmp1);
        pci_write_config_dword(dev, 0x48, tmp2);
 
@@ -100,7 +86,6 @@ static int hpt34x_tune_chipset (ide_drive_t *drive, u8 xferspeed)
 static void hpt34x_tune_drive (ide_drive_t *drive, u8 pio)
 {
        pio = ide_get_best_pio_mode(drive, pio, 5, NULL);
-       hpt34x_clear_chipset(drive);
        (void) hpt34x_tune_chipset(drive, (XFER_PIO_0 + pio));
 }
 
@@ -118,38 +103,25 @@ static int config_chipset_for_dma (ide_drive_t *drive)
        if (!(speed))
                return 0;
 
-       hpt34x_clear_chipset(drive);
        (void) hpt34x_tune_chipset(drive, speed);
        return ide_dma_enable(drive);
 }
 
 static int hpt34x_config_drive_xfer_rate (ide_drive_t *drive)
 {
-       ide_hwif_t *hwif        = HWIF(drive);
-       struct hd_driveid *id   = drive->id;
-
        drive->init_speed = 0;
 
-       if (id && (id->capability & 1) && drive->autodma) {
-
-               if (ide_use_dma(drive)) {
-                       if (config_chipset_for_dma(drive))
+       if (ide_use_dma(drive) && config_chipset_for_dma(drive))
 #ifndef CONFIG_HPT34X_AUTODMA
-                               return hwif->ide_dma_off_quietly(drive);
+               return -1;
 #else
-                               return hwif->ide_dma_on(drive);
+               return 0;
 #endif
-               }
-
-               goto fast_ata_pio;
 
-       } else if ((id->capability & 8) || (id->field_valid & 2)) {
-fast_ata_pio:
+       if (ide_use_fast_pio(drive))
                hpt34x_tune_drive(drive, 255);
-               return hwif->ide_dma_off_quietly(drive);
-       }
-       /* IORDY not supported */
-       return 0;
+
+       return -1;
 }
 
 /*
@@ -210,7 +182,6 @@ static void __devinit init_hwif_hpt34x(ide_hwif_t *hwif)
 
        hwif->tuneproc = &hpt34x_tune_drive;
        hwif->speedproc = &hpt34x_tune_chipset;
-       hwif->no_dsc = 1;
        hwif->drives[0].autotune = 1;
        hwif->drives[1].autotune = 1;
 
@@ -266,7 +237,7 @@ static struct pci_driver driver = {
        .probe          = hpt34x_init_one,
 };
 
-static int hpt34x_ide_init(void)
+static int __init hpt34x_ide_init(void)
 {
        return ide_pci_register_driver(&driver);
 }