aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-02-16 20:40:23 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-02-16 20:40:23 -0500
commit74594fd1454e3588564311f8cd7260edf85204cb (patch)
tree43571f954472990351ba778e061b7416195a60f8 /drivers/ide
parent946f8e4abb1e30a5b69e388543f665e5e424d2fe (diff)
piix: cleanup
* disable DMA masks if no_piix_dma is set and remove now not needed no_piix_dma_check from piix_config_drive_for_dma() * there is no need to read register 0x55 in init_hwif_piix() * move cable detection code to piix_cable_detect() * remove unreachable 82371MX code from init_hwif_piix() Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/pci/piix.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c
index f530bf4bf0f0..247334473519 100644
--- a/drivers/ide/pci/piix.c
+++ b/drivers/ide/pci/piix.c
@@ -369,7 +369,7 @@ static int piix_config_drive_for_dma (ide_drive_t *drive)
369 * If no DMA speed was available or the chipset has DMA bugs 369 * If no DMA speed was available or the chipset has DMA bugs
370 * then disable DMA and use PIO 370 * then disable DMA and use PIO
371 */ 371 */
372 if (!speed || no_piix_dma) 372 if (!speed)
373 return 0; 373 return 0;
374 374
375 (void) piix_tune_chipset(drive, speed); 375 (void) piix_tune_chipset(drive, speed);
@@ -479,6 +479,16 @@ static void piix_dma_clear_irq(ide_drive_t *drive)
479 hwif->OUTB(dma_stat, hwif->dma_status); 479 hwif->OUTB(dma_stat, hwif->dma_status);
480} 480}
481 481
482static int __devinit piix_cable_detect(ide_hwif_t *hwif)
483{
484 struct pci_dev *dev = hwif->pci_dev;
485 u8 reg54h = 0, mask = hwif->channel ? 0xc0 : 0x30;
486
487 pci_read_config_byte(dev, 0x54, &reg54h);
488
489 return (reg54h & mask) ? 1 : 0;
490}
491
482/** 492/**
483 * init_hwif_piix - fill in the hwif for the PIIX 493 * init_hwif_piix - fill in the hwif for the PIIX
484 * @hwif: IDE interface 494 * @hwif: IDE interface
@@ -489,9 +499,6 @@ static void piix_dma_clear_irq(ide_drive_t *drive)
489 499
490static void __devinit init_hwif_piix(ide_hwif_t *hwif) 500static void __devinit init_hwif_piix(ide_hwif_t *hwif)
491{ 501{
492 u8 reg54h = 0, reg55h = 0, ata66 = 0;
493 u8 mask = hwif->channel ? 0xc0 : 0x30;
494
495#ifndef CONFIG_IA64 502#ifndef CONFIG_IA64
496 if (!hwif->irq) 503 if (!hwif->irq)
497 hwif->irq = hwif->channel ? 15 : 14; 504 hwif->irq = hwif->channel ? 15 : 14;
@@ -521,9 +528,6 @@ static void __devinit init_hwif_piix(ide_hwif_t *hwif)
521 hwif->swdma_mask = 0x04; 528 hwif->swdma_mask = 0x04;
522 529
523 switch(hwif->pci_dev->device) { 530 switch(hwif->pci_dev->device) {
524 case PCI_DEVICE_ID_INTEL_82371MX:
525 hwif->mwdma_mask = 0x80;
526 hwif->swdma_mask = 0x80;
527 case PCI_DEVICE_ID_INTEL_82371FB_0: 531 case PCI_DEVICE_ID_INTEL_82371FB_0:
528 case PCI_DEVICE_ID_INTEL_82371FB_1: 532 case PCI_DEVICE_ID_INTEL_82371FB_1:
529 case PCI_DEVICE_ID_INTEL_82371SB_1: 533 case PCI_DEVICE_ID_INTEL_82371SB_1:
@@ -536,14 +540,14 @@ static void __devinit init_hwif_piix(ide_hwif_t *hwif)
536 hwif->ultra_mask = 0x07; 540 hwif->ultra_mask = 0x07;
537 break; 541 break;
538 default: 542 default:
539 pci_read_config_byte(hwif->pci_dev, 0x54, &reg54h); 543 if (!hwif->udma_four)
540 pci_read_config_byte(hwif->pci_dev, 0x55, &reg55h); 544 hwif->udma_four = piix_cable_detect(hwif);
541 ata66 = (reg54h & mask) ? 1 : 0;
542 break; 545 break;
543 } 546 }
544 547
545 if (!(hwif->udma_four)) 548 if (no_piix_dma)
546 hwif->udma_four = ata66; 549 hwif->ultra_mask = hwif->mwdma_mask = hwif->swdma_mask = 0;
550
547 hwif->ide_dma_check = &piix_config_drive_xfer_rate; 551 hwif->ide_dma_check = &piix_config_drive_xfer_rate;
548 if (!noautodma) 552 if (!noautodma)
549 hwif->autodma = 1; 553 hwif->autodma = 1;