[PATCH 7/15] piix: cleanup

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Bartlomiej Zolnierkiewicz
Date: Thursday, January 18, 2007 - 5:31 pm

[PATCH] 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>

---
 drivers/ide/pci/piix.c |   28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

Index: b/drivers/ide/pci/piix.c
===================================================================
--- a/drivers/ide/pci/piix.c
+++ b/drivers/ide/pci/piix.c
@@ -369,7 +369,7 @@ static int piix_config_drive_for_dma (id
 	 * If no DMA speed was available or the chipset has DMA bugs
 	 * then disable DMA and use PIO
 	 */
-	if (!speed || no_piix_dma)
+	if (!speed)
 		return 0;
 
 	(void) piix_tune_chipset(drive, speed);
@@ -444,6 +444,16 @@ static unsigned int __devinit init_chips
 	return 0;
 }
 
+static int __devinit piix_cable_detect(ide_hwif_t *hwif)
+{
+	struct pci_dev *dev = hwif->pci_dev;
+	u8 reg54h = 0, mask = hwif->channel ? 0xc0 : 0x30;
+
+	pci_read_config_byte(dev, 0x54, &reg54h);
+
+	return (reg54h & mask) ? 1 : 0;
+}
+
 /**
  *	init_hwif_piix		-	fill in the hwif for the PIIX
  *	@hwif: IDE interface
@@ -454,9 +464,6 @@ static unsigned int __devinit init_chips
 
 static void __devinit init_hwif_piix(ide_hwif_t *hwif)
 {
-	u8 reg54h = 0, reg55h = 0, ata66 = 0;
-	u8 mask = hwif->channel ? 0xc0 : 0x30;
-
 #ifndef CONFIG_IA64
 	if (!hwif->irq)
 		hwif->irq = hwif->channel ? 15 : 14;
@@ -486,9 +493,6 @@ static void __devinit init_hwif_piix(ide
 	hwif->swdma_mask = 0x04;
 
 	switch(hwif->pci_dev->device) {
-		case PCI_DEVICE_ID_INTEL_82371MX:
-			hwif->mwdma_mask = 0x80;
-			hwif->swdma_mask = 0x80;
 		case PCI_DEVICE_ID_INTEL_82371FB_0:
 		case PCI_DEVICE_ID_INTEL_82371FB_1:
 		case PCI_DEVICE_ID_INTEL_82371SB_1:
@@ -501,14 +505,14 @@ static void __devinit init_hwif_piix(ide
 			hwif->ultra_mask = 0x07;
 			break;
 		default:
-			pci_read_config_byte(hwif->pci_dev, 0x54, &reg54h);
-			pci_read_config_byte(hwif->pci_dev, 0x55, &reg55h);
-			ata66 = (reg54h & mask) ? 1 : 0;
+			if (!hwif->udma_four)
+				hwif->udma_four = piix_cable_detect(hwif);
 			break;
 	}
 
-	if (!(hwif->udma_four))
-		hwif->udma_four = ata66;
+	if (no_piix_dma)
+		hwif->ultra_mask = hwif->mwdma_mask = hwif->swdma_mask = 0;
+
 	hwif->ide_dma_check = &piix_config_drive_xfer_rate;
 	if (!noautodma)
 		hwif->autodma = 1;
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/15] IDE quilt tree updated, Bartlomiej Zolnierki ..., (Thu Jan 18, 5:30 pm)
[PATCH 1/15] ACPI support for IDE devices, Bartlomiej Zolnierki ..., (Thu Jan 18, 5:31 pm)
[PATCH 2/15] via82cxxx/pata_via: correct PCI_DEVICE_ID_VIA ..., Bartlomiej Zolnierki ..., (Thu Jan 18, 5:31 pm)
[PATCH 3/15] it8213: fix build and -&gt;ultra_mask, Bartlomiej Zolnierki ..., (Thu Jan 18, 5:31 pm)
[PATCH 4/15] ide: convert ide_hwif_t.mmio into flag, Bartlomiej Zolnierki ..., (Thu Jan 18, 5:31 pm)
[PATCH 5/15] hpt34x: hpt34x_tune_chipset() (-&gt;speedproc) fix, Bartlomiej Zolnierki ..., (Thu Jan 18, 5:31 pm)
[PATCH 6/15] atiixp/jmicron/triflex: fix PIO fallback, Bartlomiej Zolnierki ..., (Thu Jan 18, 5:31 pm)
[PATCH 7/15] piix: cleanup, Bartlomiej Zolnierki ..., (Thu Jan 18, 5:31 pm)
[PATCH 8/15] ide: disable DMA in -&gt;ide_dma_check for &quot;no I ..., Bartlomiej Zolnierki ..., (Thu Jan 18, 5:31 pm)
[PATCH 9/15] sgiioc4: fix sgiioc4_ide_dma_check() to enabl ..., Bartlomiej Zolnierki ..., (Thu Jan 18, 5:32 pm)
[PATCH 10/15] ide: add ide_set_dma() helper, Bartlomiej Zolnierki ..., (Thu Jan 18, 5:32 pm)
[PATCH 11/15] ide: make ide_hwif_t.ide_dma_{host_off,off_q ..., Bartlomiej Zolnierki ..., (Thu Jan 18, 5:32 pm)
[PATCH 12/15] ide: make ide_hwif_t.ide_dma_host_on void, Bartlomiej Zolnierki ..., (Thu Jan 18, 5:32 pm)
[PATCH 13/15] ide: fix UDMA/MWDMA/SWDMA masks, Bartlomiej Zolnierki ..., (Thu Jan 18, 5:32 pm)
[PATCH 14/15] ide: rework the code for selecting the best ..., Bartlomiej Zolnierki ..., (Thu Jan 18, 5:32 pm)
[PATCH 15/15] ide: add ide_tune_dma() helper, Bartlomiej Zolnierki ..., (Thu Jan 18, 5:32 pm)
Re: [PATCH 10/15] ide: add ide_set_dma() helper, Sergei Shtylyov, (Sat Jan 20, 1:22 pm)
Re: [PATCH 12/15] ide: make ide_hwif_t.ide_dma_host_on void, Sergei Shtylyov, (Sat Jan 20, 1:46 pm)
Re: [PATCH 13/15] ide: fix UDMA/MWDMA/SWDMA masks, Sergei Shtylyov, (Mon Jan 22, 9:19 am)
Re: [PATCH 13/15] ide: fix UDMA/MWDMA/SWDMA masks, Sergei Shtylyov, (Mon Jan 22, 11:17 am)
Re: [PATCH 13/15] ide: fix UDMA/MWDMA/SWDMA masks, Sergei Shtylyov, (Mon Jan 22, 1:28 pm)
Re: [PATCH 13/15] ide: fix UDMA/MWDMA/SWDMA masks, Jeff Garzik, (Mon Jan 22, 3:39 pm)
Re: [PATCH 13/15] ide: fix UDMA/MWDMA/SWDMA masks, Sergei Shtylyov, (Tue Jan 23, 7:51 am)
Re: [PATCH 13/15] ide: fix UDMA/MWDMA/SWDMA masks, Sergei Shtylyov, (Thu Jan 25, 8:40 am)
Re: [PATCH 13/15] ide: fix UDMA/MWDMA/SWDMA masks, Sergei Shtylyov, (Wed Jan 31, 1:38 pm)
Re: [PATCH 12/15] ide: make ide_hwif_t.ide_dma_host_on void, Sergei Shtylyov, (Mon Mar 26, 10:19 am)
Re: [PATCH 12/15] ide: make ide_hwif_t.ide_dma_host_on void, Sergei Shtylyov, (Fri Apr 20, 1:36 pm)