slc90e66: fix UDMA handling
[safe/jmp/linux-2.6] / drivers / ide / sis5513.c
index ad32e18..3b88eba 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1999-2000     Andre Hedrick <andre@linux-ide.org>
  * Copyright (C) 2002          Lionel Bouton <Lionel.Bouton@inet6.fr>, Maintainer
  * Copyright (C) 2003          Vojtech Pavlik <vojtech@suse.cz>
- * Copyright (C) 2007          Bartlomiej Zolnierkiewicz
+ * Copyright (C) 2007-2009     Bartlomiej Zolnierkiewicz
  *
  * May be copied or modified under the terms of the GNU General Public License
  *
@@ -274,18 +274,20 @@ static void sis_program_timings(ide_drive_t *drive, const u8 mode)
 
 static void config_drive_art_rwp(ide_drive_t *drive)
 {
-       ide_hwif_t *hwif        = HWIF(drive);
+       ide_hwif_t *hwif        = drive->hwif;
        struct pci_dev *dev     = to_pci_dev(hwif->dev);
        u8 reg4bh               = 0;
        u8 rw_prefetch          = 0;
 
        pci_read_config_byte(dev, 0x4b, &reg4bh);
 
+       rw_prefetch = reg4bh & ~(0x11 << drive->dn);
+
        if (drive->media == ide_disk)
-               rw_prefetch = 0x11 << drive->dn;
+               rw_prefetch |= 0x11 << drive->dn;
 
-       if ((reg4bh & (0x11 << drive->dn)) != rw_prefetch)
-               pci_write_config_byte(dev, 0x4b, reg4bh|rw_prefetch);
+       if (reg4bh != rw_prefetch)
+               pci_write_config_byte(dev, 0x4b, rw_prefetch);
 }
 
 static void sis_set_pio_mode(ide_drive_t *drive, const u8 pio)
@@ -447,7 +449,7 @@ static int __devinit sis_find_family(struct pci_dev *dev)
        return chipset_family;
 }
 
-static unsigned int init_chipset_sis5513(struct pci_dev *dev)
+static int init_chipset_sis5513(struct pci_dev *dev)
 {
        /* Make general config ops here
           1/ tell IDE channels to operate in Compatibility mode only
@@ -563,7 +565,7 @@ static const struct ide_port_info sis5513_chipset __devinitdata = {
        .name           = DRV_NAME,
        .init_chipset   = init_chipset_sis5513,
        .enablebits     = { {0x4a, 0x02, 0x02}, {0x4a, 0x04, 0x04} },
-       .host_flags     = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_NO_AUTODMA,
+       .host_flags     = IDE_HFLAG_NO_AUTODMA,
        .pio_mask       = ATA_PIO4,
        .mwdma_mask     = ATA_MWDMA2,
 };