aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-05-15 18:51:44 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-05-15 18:51:44 -0400
commita01ba4011aa745be44d0290c5da5cb2dfb4e37ce (patch)
tree63f95042ce5efcfa430cf61c3bcb77f98e7df017 /drivers/ide/pci
parentbd203b57c7edd6bc457b769cd15fa7239cd2241e (diff)
cs5530/sc1200: DMA support cleanup
sc1200.c: * remove open-coded variant of ide_dma_host_off() (== ->dma_host_off), it is not needed because ->dma_off_quietly calls ->dma_host_off * use ->dma_host_on (== ide_dma_host_on() for this driver) instead of open-coded variant, call it from the users of sc1200_config_dma2() [ there is no need to call ->dma_host_on in sc1200_config_dma() because core code takes care of calling ->ide_dma_on on successful execution of ->ide_dma_check ] * add comment about ->tuneproc interface abuse cs5530.c/sc1200.c: * core code takes care of calling ->dma_off_quietly before calling ->ide_dma_check so there is no need to call it in ->ide_dma_check methods * bump driver version Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci')
-rw-r--r--drivers/ide/pci/cs5530.c7
-rw-r--r--drivers/ide/pci/sc1200.c27
2 files changed, 13 insertions, 21 deletions
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c
index 845500115f3c..ec52dbec675f 100644
--- a/drivers/ide/pci/cs5530.c
+++ b/drivers/ide/pci/cs5530.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/cs5530.c Version 0.71 Mar 10 2007 2 * linux/drivers/ide/pci/cs5530.c Version 0.72 Mar 10 2007
3 * 3 *
4 * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2000 Mark Lord <mlord@pobox.com> 5 * Copyright (C) 2000 Mark Lord <mlord@pobox.com>
@@ -141,11 +141,6 @@ static int cs5530_config_dma(ide_drive_t *drive)
141 unsigned long basereg; 141 unsigned long basereg;
142 u8 unit = drive->dn & 1, mode = 0; 142 u8 unit = drive->dn & 1, mode = 0;
143 143
144 /*
145 * Default to DMA-off in case we run into trouble here.
146 */
147 hwif->dma_off_quietly(drive);
148
149 if (ide_use_dma(drive)) 144 if (ide_use_dma(drive))
150 mode = ide_max_dma_mode(drive); 145 mode = ide_max_dma_mode(drive);
151 146
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c
index c0254b5e7d92..65dcabe48205 100644
--- a/drivers/ide/pci/sc1200.c
+++ b/drivers/ide/pci/sc1200.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/sc1200.c Version 0.92 Mar 10 2007 2 * linux/drivers/ide/pci/sc1200.c Version 0.93 Mar 10 2007
3 * 3 *
4 * Copyright (C) 2000-2002 Mark Lord <mlord@pobox.com> 4 * Copyright (C) 2000-2002 Mark Lord <mlord@pobox.com>
5 * Copyright (C) 2007 Bartlomiej Zolnierkiewicz 5 * Copyright (C) 2007 Bartlomiej Zolnierkiewicz
@@ -137,12 +137,6 @@ static int sc1200_config_dma2 (ide_drive_t *drive, int mode)
137 unsigned int basereg = hwif->channel ? 0x50 : 0x40; 137 unsigned int basereg = hwif->channel ? 0x50 : 0x40;
138 138
139 /* 139 /*
140 * Default to DMA-off in case we run into trouble here.
141 */
142 hwif->dma_off_quietly(drive); /* turn off DMA while we fiddle */
143 outb(inb(hwif->dma_base+2)&~(unit?0x40:0x20), hwif->dma_base+2); /* clear DMA_capable bit */
144
145 /*
146 * Tell the drive to switch to the new mode; abort on failure. 140 * Tell the drive to switch to the new mode; abort on failure.
147 */ 141 */
148 if (!mode || sc1200_set_xfer_mode(drive, mode)) { 142 if (!mode || sc1200_set_xfer_mode(drive, mode)) {
@@ -217,8 +211,6 @@ static int sc1200_config_dma2 (ide_drive_t *drive, int mode)
217 pci_write_config_dword(hwif->pci_dev, basereg+12, timings); 211 pci_write_config_dword(hwif->pci_dev, basereg+12, timings);
218 } 212 }
219 213
220 outb(inb(hwif->dma_base+2)|(unit?0x40:0x20), hwif->dma_base+2); /* set DMA_capable bit */
221
222 return 0; /* success */ 214 return 0; /* success */
223} 215}
224 216
@@ -277,6 +269,9 @@ static void sc1200_tuneproc (ide_drive_t *drive, byte pio) /* mode=255 means "au
277 static byte modes[5] = {XFER_PIO_0, XFER_PIO_1, XFER_PIO_2, XFER_PIO_3, XFER_PIO_4}; 269 static byte modes[5] = {XFER_PIO_0, XFER_PIO_1, XFER_PIO_2, XFER_PIO_3, XFER_PIO_4};
278 int mode = -1; 270 int mode = -1;
279 271
272 /*
273 * bad abuse of ->tuneproc interface
274 */
280 switch (pio) { 275 switch (pio) {
281 case 200: mode = XFER_UDMA_0; break; 276 case 200: mode = XFER_UDMA_0; break;
282 case 201: mode = XFER_UDMA_1; break; 277 case 201: mode = XFER_UDMA_1; break;
@@ -287,7 +282,9 @@ static void sc1200_tuneproc (ide_drive_t *drive, byte pio) /* mode=255 means "au
287 } 282 }
288 if (mode != -1) { 283 if (mode != -1) {
289 printk("SC1200: %s: changing (U)DMA mode\n", drive->name); 284 printk("SC1200: %s: changing (U)DMA mode\n", drive->name);
290 (void)sc1200_config_dma2(drive, mode); 285 hwif->dma_off_quietly(drive);
286 if (sc1200_config_dma2(drive, mode) == 0)
287 hwif->dma_host_on(drive);
291 return; 288 return;
292 } 289 }
293 290
@@ -421,12 +418,12 @@ static int sc1200_resume (struct pci_dev *dev)
421 for (d = 0; d < MAX_DRIVES; ++d) { 418 for (d = 0; d < MAX_DRIVES; ++d) {
422 ide_drive_t *drive = &(hwif->drives[d]); 419 ide_drive_t *drive = &(hwif->drives[d]);
423 if (drive->present && !__ide_dma_bad_drive(drive)) { 420 if (drive->present && !__ide_dma_bad_drive(drive)) {
424 int was_using_dma = drive->using_dma; 421 int enable_dma = drive->using_dma;
425 hwif->dma_off_quietly(drive); 422 hwif->dma_off_quietly(drive);
426 sc1200_config_dma(drive); 423 if (sc1200_config_dma(drive))
427 if (!was_using_dma && drive->using_dma) { 424 enable_dma = 0;
428 hwif->dma_off_quietly(drive); 425 if (enable_dma)
429 } 426 hwif->dma_host_on(drive);
430 } 427 }
431 } 428 }
432 } 429 }