[PATCH] ide: fix HPT3xx hotswap support
[safe/jmp/linux-2.6] / drivers / ide / pci / it821x.c
index e440036..e9bad18 100644 (file)
@@ -62,7 +62,6 @@
  *     -       Move to libata once it grows up
  */
 
-#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/module.h>
 #include <linux/pci.h>
@@ -499,9 +498,14 @@ static int config_chipset_for_dma (ide_drive_t *drive)
 {
        u8 speed        = ide_dma_speed(drive, it821x_ratemask(drive));
 
-       config_it821x_chipset_for_pio(drive, !speed);
-       it821x_tune_chipset(drive, speed);
-       return ide_dma_enable(drive);
+       if (speed) {
+               config_it821x_chipset_for_pio(drive, 0);
+               it821x_tune_chipset(drive, speed);
+
+               return ide_dma_enable(drive);
+       }
+
+       return 0;
 }
 
 /**
@@ -642,16 +646,17 @@ static void __devinit it821x_fixups(ide_hwif_t *hwif)
 
 static void __devinit init_hwif_it821x(ide_hwif_t *hwif)
 {
-       struct it821x_dev *idev = kmalloc(sizeof(struct it821x_dev), GFP_KERNEL);
+       struct it821x_dev *idev = kzalloc(sizeof(struct it821x_dev), GFP_KERNEL);
        u8 conf;
 
        if(idev == NULL) {
                printk(KERN_ERR "it821x: out of memory, falling back to legacy behaviour.\n");
                goto fallback;
        }
-       memset(idev, 0, sizeof(struct it821x_dev));
        ide_set_hwifdata(hwif, idev);
 
+       hwif->atapi_dma = 1;
+
        pci_read_config_byte(hwif->pci_dev, 0x50, &conf);
        if(conf & 1) {
                idev->smart = 1;
@@ -734,7 +739,7 @@ static void __devinit it8212_disable_raid(struct pci_dev *dev)
 
        pci_write_config_dword(dev,0x4C, 0x02040204);
        pci_write_config_byte(dev, 0x42, 0x36);
-       pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0);
+       pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x20);
 }
 
 static unsigned int __devinit init_chipset_it821x(struct pci_dev *dev, const char *name)