]> err.no Git - linux-2.6/commitdiff
ide: remove ->dma_master field from ide_hwif_t (take 5)
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Fri, 25 Jan 2008 21:17:05 +0000 (22:17 +0100)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Fri, 25 Jan 2008 21:17:05 +0000 (22:17 +0100)
* Convert cmd64x, hpt366 and pdc202xx_old host drivers to use
  pci_resource_start(hwif->pci_dev, 4) instead of hwif->dma_master.

* Remove no longer needed ->dma_master field from ide_hwif_t.

v2:
* Use the more readable 'hwif->dma_base - (hwif->channel * 8)' instead of
  pci_resource_start(hwif->pci_dev, 4).

v3:
* Use hwif->extra_base in hpt366/pdc20xx_old + some cosmetic fixups over v2
  (suggested by Sergei).

v4:
* Correct offsets in hpt3xxn_set_clock().

v5:
* Use hwif->extra_base in hpt366 for _real_ this time. (Noticed by Sergei)

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/ide-dma.c
drivers/ide/ide.c
drivers/ide/pci/cmd64x.c
drivers/ide/pci/hpt366.c
drivers/ide/pci/pdc202xx_old.c
include/linux/ide.h

index 4703837bf1fcdab9b6523c2fa4d5ff70bccd50a3..7568c3e81f2f3fcef0ba7d76a3ce5f057f206573 100644 (file)
@@ -968,11 +968,6 @@ void ide_setup_dma(ide_hwif_t *hwif, unsigned long base, unsigned num_ports)
 
        hwif->dma_base = base;
 
-       if (hwif->mate)
-               hwif->dma_master = hwif->channel ? hwif->mate->dma_base : base;
-       else
-               hwif->dma_master = base;
-
        if (!(hwif->dma_command))
                hwif->dma_command       = hwif->dma_base;
        if (!(hwif->dma_vendor1))
@@ -1014,8 +1009,6 @@ void ide_setup_dma(ide_hwif_t *hwif, unsigned long base, unsigned num_ports)
                       hwif->drives[1].name, (dma_stat & 0x40) ? "DMA" : "pio");
        }
        printk("\n");
-
-       BUG_ON(!hwif->dma_master);
 }
 
 EXPORT_SYMBOL_GPL(ide_setup_dma);
index 54943da6e4e5cfa45c80ac73a86f6c9de3a10769..9ab5458fe950eee798f3371f4e7a0368896d81a6 100644 (file)
@@ -468,7 +468,6 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif)
 #endif
 
        hwif->dma_base                  = tmp_hwif->dma_base;
-       hwif->dma_master                = tmp_hwif->dma_master;
        hwif->dma_command               = tmp_hwif->dma_command;
        hwif->dma_vendor1               = tmp_hwif->dma_vendor1;
        hwif->dma_status                = tmp_hwif->dma_status;
@@ -602,7 +601,6 @@ void ide_unregister(unsigned int index)
                (void) ide_release_dma(hwif);
 
                hwif->dma_base = 0;
-               hwif->dma_master = 0;
                hwif->dma_command = 0;
                hwif->dma_vendor1 = 0;
                hwif->dma_status = 0;
index bc553337b1be38548d155ed6ea4db0fbffa417e0..f3613bac9dbeb778ab68b659c4568d563c358783 100644 (file)
@@ -333,14 +333,15 @@ static void cmd64x_set_dma_mode(ide_drive_t *drive, const u8 speed)
 static int cmd648_ide_dma_end (ide_drive_t *drive)
 {
        ide_hwif_t *hwif        = HWIF(drive);
+       unsigned long base      = hwif->dma_base - (hwif->channel * 8);
        int err                 = __ide_dma_end(drive);
        u8  irq_mask            = hwif->channel ? MRDMODE_INTR_CH1 :
                                                  MRDMODE_INTR_CH0;
-       u8  mrdmode             = inb(hwif->dma_master + 0x01);
+       u8  mrdmode             = inb(base + 1);
 
        /* clear the interrupt bit */
        outb((mrdmode & ~(MRDMODE_INTR_CH0 | MRDMODE_INTR_CH1)) | irq_mask,
-            hwif->dma_master + 0x01);
+            base + 1);
 
        return err;
 }
@@ -365,10 +366,11 @@ static int cmd64x_ide_dma_end (ide_drive_t *drive)
 static int cmd648_ide_dma_test_irq (ide_drive_t *drive)
 {
        ide_hwif_t *hwif        = HWIF(drive);
+       unsigned long base      = hwif->dma_base - (hwif->channel * 8);
        u8 irq_mask             = hwif->channel ? MRDMODE_INTR_CH1 :
                                                  MRDMODE_INTR_CH0;
        u8 dma_stat             = inb(hwif->dma_status);
-       u8 mrdmode              = inb(hwif->dma_master + 0x01);
+       u8 mrdmode              = inb(base + 1);
 
 #ifdef DEBUG
        printk("%s: dma_stat: 0x%02x mrdmode: 0x%02x irq_mask: 0x%02x\n",
index df14d692743cd4bb26b1336482857990a5364ecd..d3826a66834d370e070ed5ee72b6064b589c82a6 100644 (file)
@@ -894,32 +894,33 @@ static int hpt374_ide_dma_end(ide_drive_t *drive)
 
 static void hpt3xxn_set_clock(ide_hwif_t *hwif, u8 mode)
 {
-       u8 scr2 = inb(hwif->dma_master + 0x7b);
+       unsigned long base = hwif->extra_base;
+       u8 scr2 = inb(base + 0x6b);
 
        if ((scr2 & 0x7f) == mode)
                return;
 
        /* Tristate the bus */
-       outb(0x80, hwif->dma_master + 0x73);
-       outb(0x80, hwif->dma_master + 0x77);
+       outb(0x80, base + 0x63);
+       outb(0x80, base + 0x67);
 
        /* Switch clock and reset channels */
-       outb(mode, hwif->dma_master + 0x7b);
-       outb(0xc0, hwif->dma_master + 0x79);
+       outb(mode, base + 0x6b);
+       outb(0xc0, base + 0x69);
 
        /*
         * Reset the state machines.
         * NOTE: avoid accidentally enabling the disabled channels.
         */
-       outb(inb(hwif->dma_master + 0x70) | 0x32, hwif->dma_master + 0x70);
-       outb(inb(hwif->dma_master + 0x74) | 0x32, hwif->dma_master + 0x74);
+       outb(inb(base + 0x60) | 0x32, base + 0x60);
+       outb(inb(base + 0x64) | 0x32, base + 0x64);
 
        /* Complete reset */
-       outb(0x00, hwif->dma_master + 0x79);
+       outb(0x00, base + 0x69);
 
        /* Reconnect channels to bus */
-       outb(0x00, hwif->dma_master + 0x73);
-       outb(0x00, hwif->dma_master + 0x77);
+       outb(0x00, base + 0x63);
+       outb(0x00, base + 0x67);
 }
 
 /**
index e09742e2ba592607e31dd3356099fabf8fae5ea8..22c7a7533b696dd9785975e775b24d18a84c90cb 100644 (file)
@@ -162,7 +162,7 @@ static u8 pdc202xx_old_cable_detect (ide_hwif_t *hwif)
  */
 static void pdc_old_enable_66MHz_clock(ide_hwif_t *hwif)
 {
-       unsigned long clock_reg = hwif->dma_master + 0x11;
+       unsigned long clock_reg = hwif->extra_base + 0x01;
        u8 clock = inb(clock_reg);
 
        outb(clock | (hwif->channel ? 0x08 : 0x02), clock_reg);
@@ -170,7 +170,7 @@ static void pdc_old_enable_66MHz_clock(ide_hwif_t *hwif)
 
 static void pdc_old_disable_66MHz_clock(ide_hwif_t *hwif)
 {
-       unsigned long clock_reg = hwif->dma_master + 0x11;
+       unsigned long clock_reg = hwif->extra_base + 0x01;
        u8 clock = inb(clock_reg);
 
        outb(clock & ~(hwif->channel ? 0x08 : 0x02), clock_reg);
@@ -193,7 +193,7 @@ static void pdc202xx_old_ide_dma_start(ide_drive_t *drive)
        if (drive->media != ide_disk || drive->addressing == 1) {
                struct request *rq      = HWGROUP(drive)->rq;
                ide_hwif_t *hwif        = HWIF(drive);
-               unsigned long high_16   = hwif->dma_master;
+               unsigned long high_16   = hwif->extra_base - 16;
                unsigned long atapi_reg = high_16 + (hwif->channel ? 0x24 : 0x20);
                u32 word_count  = 0;
                u8 clock = inb(high_16 + 0x11);
@@ -212,7 +212,7 @@ static int pdc202xx_old_ide_dma_end(ide_drive_t *drive)
 {
        if (drive->media != ide_disk || drive->addressing == 1) {
                ide_hwif_t *hwif        = HWIF(drive);
-               unsigned long high_16   = hwif->dma_master;
+               unsigned long high_16   = hwif->extra_base - 16;
                unsigned long atapi_reg = high_16 + (hwif->channel ? 0x24 : 0x20);
                u8 clock                = 0;
 
@@ -228,7 +228,7 @@ static int pdc202xx_old_ide_dma_end(ide_drive_t *drive)
 static int pdc202xx_old_ide_dma_test_irq(ide_drive_t *drive)
 {
        ide_hwif_t *hwif        = HWIF(drive);
-       unsigned long high_16   = hwif->dma_master;
+       unsigned long high_16   = hwif->extra_base - 16;
        u8 dma_stat             = inb(hwif->dma_status);
        u8 sc1d                 = inb(high_16 + 0x001d);
 
@@ -271,7 +271,7 @@ static void pdc202xx_dma_timeout(ide_drive_t *drive)
 
 static void pdc202xx_reset_host (ide_hwif_t *hwif)
 {
-       unsigned long high_16   = hwif->dma_master;
+       unsigned long high_16   = hwif->extra_base - 16;
        u8 udma_speed_flag      = inb(high_16 | 0x001f);
 
        outb(udma_speed_flag | 0x10, high_16 | 0x001f);
index 9a6a41e7079ff942ec4d204ae20011ee7987d6a2..1fb03b6306761a7d2edea057d6f37ab061ba261f 100644 (file)
@@ -766,7 +766,6 @@ typedef struct hwif_s {
        int             rqsize;         /* max sectors per request */
        int             irq;            /* our irq number */
 
-       unsigned long   dma_master;     /* reference base addr dmabase */
        unsigned long   dma_base;       /* base addr for dma ports */
        unsigned long   dma_command;    /* dma command register */
        unsigned long   dma_vendor1;    /* dma vendor 1 register */