ide: remove SATA_*_REG macros
[powerpc.git] / drivers / ide / pci / sc1200.c
index 8a94c3e..561aa47 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * linux/drivers/ide/pci/sc1200.c              Version 0.97    Aug 3 2007
- *
  * Copyright (C) 2000-2002             Mark Lord <mlord@pobox.com>
  * Copyright (C)      2007             Bartlomiej Zolnierkiewicz
  *
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
-#include <linux/delay.h>
-#include <linux/timer.h>
-#include <linux/mm.h>
-#include <linux/ioport.h>
-#include <linux/blkdev.h>
 #include <linux/hdreg.h>
-#include <linux/interrupt.h>
 #include <linux/pci.h>
 #include <linux/init.h>
 #include <linux/ide.h>
 #include <linux/pm.h>
+
 #include <asm/io.h>
-#include <asm/irq.h>
 
 #define SC1200_REV_A   0x00
 #define SC1200_REV_B1  0x01
@@ -87,7 +79,7 @@ static const unsigned int sc1200_pio_timings[4][5] =
 static void sc1200_tunepio(ide_drive_t *drive, u8 pio)
 {
        ide_hwif_t *hwif = drive->hwif;
-       struct pci_dev *pdev = hwif->pci_dev;
+       struct pci_dev *pdev = to_pci_dev(hwif->dev);
        unsigned int basereg = hwif->channel ? 0x50 : 0x40, format = 0;
 
        pci_read_config_dword(pdev, basereg + 4, &format);
@@ -130,6 +122,7 @@ out:
 static void sc1200_set_dma_mode(ide_drive_t *drive, const u8 mode)
 {
        ide_hwif_t              *hwif = HWIF(drive);
+       struct pci_dev          *dev = to_pci_dev(hwif->dev);
        int                     unit = drive->select.b.unit;
        unsigned int            reg, timings;
        unsigned short          pci_clock;
@@ -160,12 +153,11 @@ static void sc1200_set_dma_mode(ide_drive_t *drive, const u8 mode)
                timings = mwdma_timing[pci_clock][mode - XFER_MW_DMA_0];
 
        if (unit == 0) {                        /* are we configuring drive0? */
-               pci_read_config_dword(hwif->pci_dev, basereg+4, &reg);
+               pci_read_config_dword(dev, basereg + 4, &reg);
                timings |= reg & 0x80000000;    /* preserve PIO format bit */
-               pci_write_config_dword(hwif->pci_dev, basereg+4, timings);
-       } else {
-               pci_write_config_dword(hwif->pci_dev, basereg+12, timings);
-       }
+               pci_write_config_dword(dev, basereg + 4, timings);
+       } else
+               pci_write_config_dword(dev, basereg + 12, timings);
 }
 
 /*  Replacement for the standard ide_dma_end action in
@@ -221,8 +213,8 @@ static void sc1200_set_pio_mode(ide_drive_t *drive, const u8 pio)
        if (mode != -1) {
                printk("SC1200: %s: changing (U)DMA mode\n", drive->name);
                ide_dma_off_quietly(drive);
-               if (ide_set_dma_mode(drive, mode) == 0)
-                       hwif->dma_host_on(drive);
+               if (ide_set_dma_mode(drive, mode) == 0 && drive->using_dma)
+                       hwif->dma_host_set(drive, 1);
                return;
        }