aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide')
-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 }