aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/cmd64x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/pci/cmd64x.c')
-rw-r--r--drivers/ide/pci/cmd64x.c47
1 files changed, 16 insertions, 31 deletions
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
index aee947e8fc38..49df27513da7 100644
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -466,36 +466,21 @@ static int config_chipset_for_dma (ide_drive_t *drive)
466 if (!speed) 466 if (!speed)
467 return 0; 467 return 0;
468 468
469 if(ide_set_xfer_rate(drive, speed)) 469 if (cmd64x_tune_chipset(drive, speed))
470 return 0; 470 return 0;
471
472 if (!drive->init_speed)
473 drive->init_speed = speed;
474 471
475 return ide_dma_enable(drive); 472 return ide_dma_enable(drive);
476} 473}
477 474
478static int cmd64x_config_drive_for_dma (ide_drive_t *drive) 475static int cmd64x_config_drive_for_dma (ide_drive_t *drive)
479{ 476{
480 ide_hwif_t *hwif = HWIF(drive); 477 if (ide_use_dma(drive) && config_chipset_for_dma(drive))
481 struct hd_driveid *id = drive->id; 478 return 0;
482
483 if ((id != NULL) && ((id->capability & 1) != 0) && drive->autodma) {
484
485 if (ide_use_dma(drive)) {
486 if (config_chipset_for_dma(drive))
487 return hwif->ide_dma_on(drive);
488 }
489
490 goto fast_ata_pio;
491 479
492 } else if ((id->capability & 8) || (id->field_valid & 2)) { 480 if (ide_use_fast_pio(drive))
493fast_ata_pio:
494 config_chipset_for_pio(drive, 1); 481 config_chipset_for_pio(drive, 1);
495 return hwif->ide_dma_off_quietly(drive); 482
496 } 483 return -1;
497 /* IORDY not supported */
498 return 0;
499} 484}
500 485
501static int cmd64x_alt_dma_status (struct pci_dev *dev) 486static int cmd64x_alt_dma_status (struct pci_dev *dev)
@@ -518,13 +503,13 @@ static int cmd64x_ide_dma_end (ide_drive_t *drive)
518 503
519 drive->waiting_for_dma = 0; 504 drive->waiting_for_dma = 0;
520 /* read DMA command state */ 505 /* read DMA command state */
521 dma_cmd = hwif->INB(hwif->dma_command); 506 dma_cmd = inb(hwif->dma_command);
522 /* stop DMA */ 507 /* stop DMA */
523 hwif->OUTB((dma_cmd & ~1), hwif->dma_command); 508 outb(dma_cmd & ~1, hwif->dma_command);
524 /* get DMA status */ 509 /* get DMA status */
525 dma_stat = hwif->INB(hwif->dma_status); 510 dma_stat = inb(hwif->dma_status);
526 /* clear the INTR & ERROR bits */ 511 /* clear the INTR & ERROR bits */
527 hwif->OUTB(dma_stat|6, hwif->dma_status); 512 outb(dma_stat | 6, hwif->dma_status);
528 if (cmd64x_alt_dma_status(dev)) { 513 if (cmd64x_alt_dma_status(dev)) {
529 u8 dma_intr = 0; 514 u8 dma_intr = 0;
530 u8 dma_mask = (hwif->channel) ? ARTTIM23_INTR_CH1 : 515 u8 dma_mask = (hwif->channel) ? ARTTIM23_INTR_CH1 :
@@ -546,7 +531,7 @@ static int cmd64x_ide_dma_test_irq (ide_drive_t *drive)
546 struct pci_dev *dev = hwif->pci_dev; 531 struct pci_dev *dev = hwif->pci_dev;
547 u8 dma_alt_stat = 0, mask = (hwif->channel) ? MRDMODE_INTR_CH1 : 532 u8 dma_alt_stat = 0, mask = (hwif->channel) ? MRDMODE_INTR_CH1 :
548 MRDMODE_INTR_CH0; 533 MRDMODE_INTR_CH0;
549 u8 dma_stat = hwif->INB(hwif->dma_status); 534 u8 dma_stat = inb(hwif->dma_status);
550 535
551 (void) pci_read_config_byte(dev, MRDMODE, &dma_alt_stat); 536 (void) pci_read_config_byte(dev, MRDMODE, &dma_alt_stat);
552#ifdef DEBUG 537#ifdef DEBUG
@@ -576,13 +561,13 @@ static int cmd646_1_ide_dma_end (ide_drive_t *drive)
576 561
577 drive->waiting_for_dma = 0; 562 drive->waiting_for_dma = 0;
578 /* get DMA status */ 563 /* get DMA status */
579 dma_stat = hwif->INB(hwif->dma_status); 564 dma_stat = inb(hwif->dma_status);
580 /* read DMA command state */ 565 /* read DMA command state */
581 dma_cmd = hwif->INB(hwif->dma_command); 566 dma_cmd = inb(hwif->dma_command);
582 /* stop DMA */ 567 /* stop DMA */
583 hwif->OUTB((dma_cmd & ~1), hwif->dma_command); 568 outb(dma_cmd & ~1, hwif->dma_command);
584 /* clear the INTR & ERROR bits */ 569 /* clear the INTR & ERROR bits */
585 hwif->OUTB(dma_stat|6, hwif->dma_status); 570 outb(dma_stat | 6, hwif->dma_status);
586 /* and free any DMA resources */ 571 /* and free any DMA resources */
587 ide_destroy_dmatable(drive); 572 ide_destroy_dmatable(drive);
588 /* verify good DMA status */ 573 /* verify good DMA status */