diff options
Diffstat (limited to 'drivers/ide/pci/sl82c105.c')
-rw-r--r-- | drivers/ide/pci/sl82c105.c | 39 |
1 files changed, 13 insertions, 26 deletions
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c index 170a26199050..3a8a76fc78c7 100644 --- a/drivers/ide/pci/sl82c105.c +++ b/drivers/ide/pci/sl82c105.c | |||
@@ -161,14 +161,14 @@ static int sl82c105_check_drive (ide_drive_t *drive) | |||
161 | if (id->field_valid & 2) { | 161 | if (id->field_valid & 2) { |
162 | if ((id->dma_mword & hwif->mwdma_mask) || | 162 | if ((id->dma_mword & hwif->mwdma_mask) || |
163 | (id->dma_1word & hwif->swdma_mask)) | 163 | (id->dma_1word & hwif->swdma_mask)) |
164 | return hwif->ide_dma_on(drive); | 164 | return 0; |
165 | } | 165 | } |
166 | 166 | ||
167 | if (__ide_dma_good_drive(drive)) | 167 | if (__ide_dma_good_drive(drive) && id->eide_dma_time < 150) |
168 | return hwif->ide_dma_on(drive); | 168 | return 0; |
169 | } while (0); | 169 | } while (0); |
170 | 170 | ||
171 | return hwif->ide_dma_off_quietly(drive); | 171 | return -1; |
172 | } | 172 | } |
173 | 173 | ||
174 | /* | 174 | /* |
@@ -215,7 +215,7 @@ static int sl82c105_ide_dma_lost_irq(ide_drive_t *drive) | |||
215 | * Was DMA enabled? If so, disable it - we're resetting the | 215 | * Was DMA enabled? If so, disable it - we're resetting the |
216 | * host. The IDE layer will be handling the drive for us. | 216 | * host. The IDE layer will be handling the drive for us. |
217 | */ | 217 | */ |
218 | val = hwif->INB(dma_base); | 218 | val = inb(dma_base); |
219 | if (val & 1) { | 219 | if (val & 1) { |
220 | outb(val & ~1, dma_base); | 220 | outb(val & ~1, dma_base); |
221 | printk("sl82c105: DMA was enabled\n"); | 221 | printk("sl82c105: DMA was enabled\n"); |
@@ -259,28 +259,22 @@ static int sl82c105_ide_dma_on (ide_drive_t *drive) | |||
259 | { | 259 | { |
260 | DBG(("sl82c105_ide_dma_on(drive:%s)\n", drive->name)); | 260 | DBG(("sl82c105_ide_dma_on(drive:%s)\n", drive->name)); |
261 | 261 | ||
262 | if (config_for_dma(drive)) { | 262 | if (config_for_dma(drive)) |
263 | config_for_pio(drive, 4, 0, 0); | 263 | return 1; |
264 | return HWIF(drive)->ide_dma_off_quietly(drive); | ||
265 | } | ||
266 | printk(KERN_INFO "%s: DMA enabled\n", drive->name); | 264 | printk(KERN_INFO "%s: DMA enabled\n", drive->name); |
267 | return __ide_dma_on(drive); | 265 | return __ide_dma_on(drive); |
268 | } | 266 | } |
269 | 267 | ||
270 | static int sl82c105_ide_dma_off_quietly (ide_drive_t *drive) | 268 | static void sl82c105_dma_off_quietly(ide_drive_t *drive) |
271 | { | 269 | { |
272 | u8 speed = XFER_PIO_0; | 270 | u8 speed = XFER_PIO_0; |
273 | int rc; | ||
274 | |||
275 | DBG(("sl82c105_ide_dma_off_quietly(drive:%s)\n", drive->name)); | ||
276 | 271 | ||
277 | rc = __ide_dma_off_quietly(drive); | 272 | DBG(("sl82c105_dma_off_quietly(drive:%s)\n", drive->name)); |
273 | |||
274 | ide_dma_off_quietly(drive); | ||
278 | if (drive->pio_speed) | 275 | if (drive->pio_speed) |
279 | speed = drive->pio_speed - XFER_PIO_0; | 276 | speed = drive->pio_speed - XFER_PIO_0; |
280 | config_for_pio(drive, speed, 0, 1); | 277 | config_for_pio(drive, speed, 0, 1); |
281 | drive->current_speed = drive->pio_speed; | ||
282 | |||
283 | return rc; | ||
284 | } | 278 | } |
285 | 279 | ||
286 | /* | 280 | /* |
@@ -401,11 +395,9 @@ static unsigned int __devinit init_chipset_sl82c105(struct pci_dev *dev, const c | |||
401 | /* | 395 | /* |
402 | * Initialise the chip | 396 | * Initialise the chip |
403 | */ | 397 | */ |
404 | |||
405 | static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif) | 398 | static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif) |
406 | { | 399 | { |
407 | unsigned int rev; | 400 | unsigned int rev; |
408 | u8 dma_state; | ||
409 | 401 | ||
410 | DBG(("init_hwif_sl82c105(hwif: ide%d)\n", hwif->index)); | 402 | DBG(("init_hwif_sl82c105(hwif: ide%d)\n", hwif->index)); |
411 | 403 | ||
@@ -431,7 +423,6 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif) | |||
431 | if (!hwif->dma_base) | 423 | if (!hwif->dma_base) |
432 | return; | 424 | return; |
433 | 425 | ||
434 | dma_state = hwif->INB(hwif->dma_base + 2) & ~0x60; | ||
435 | rev = sl82c105_bridge_revision(hwif->pci_dev); | 426 | rev = sl82c105_bridge_revision(hwif->pci_dev); |
436 | if (rev <= 5) { | 427 | if (rev <= 5) { |
437 | /* | 428 | /* |
@@ -441,15 +432,12 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif) | |||
441 | printk(" %s: Winbond 553 bridge revision %d, BM-DMA disabled\n", | 432 | printk(" %s: Winbond 553 bridge revision %d, BM-DMA disabled\n", |
442 | hwif->name, rev); | 433 | hwif->name, rev); |
443 | } else { | 434 | } else { |
444 | dma_state |= 0x60; | ||
445 | |||
446 | hwif->atapi_dma = 1; | 435 | hwif->atapi_dma = 1; |
447 | hwif->mwdma_mask = 0x07; | 436 | hwif->mwdma_mask = 0x04; |
448 | hwif->swdma_mask = 0x07; | ||
449 | 437 | ||
450 | hwif->ide_dma_check = &sl82c105_check_drive; | 438 | hwif->ide_dma_check = &sl82c105_check_drive; |
451 | hwif->ide_dma_on = &sl82c105_ide_dma_on; | 439 | hwif->ide_dma_on = &sl82c105_ide_dma_on; |
452 | hwif->ide_dma_off_quietly = &sl82c105_ide_dma_off_quietly; | 440 | hwif->dma_off_quietly = &sl82c105_dma_off_quietly; |
453 | hwif->ide_dma_lostirq = &sl82c105_ide_dma_lost_irq; | 441 | hwif->ide_dma_lostirq = &sl82c105_ide_dma_lost_irq; |
454 | hwif->dma_start = &sl82c105_ide_dma_start; | 442 | hwif->dma_start = &sl82c105_ide_dma_start; |
455 | hwif->ide_dma_timeout = &sl82c105_ide_dma_timeout; | 443 | hwif->ide_dma_timeout = &sl82c105_ide_dma_timeout; |
@@ -462,7 +450,6 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif) | |||
462 | if (hwif->mate) | 450 | if (hwif->mate) |
463 | hwif->serialized = hwif->mate->serialized = 1; | 451 | hwif->serialized = hwif->mate->serialized = 1; |
464 | } | 452 | } |
465 | hwif->OUTB(dma_state, hwif->dma_base + 2); | ||
466 | } | 453 | } |
467 | 454 | ||
468 | static ide_pci_device_t sl82c105_chipset __devinitdata = { | 455 | static ide_pci_device_t sl82c105_chipset __devinitdata = { |