Skip to contentSkip to conversation

cy82c693: add ->set_dma_mode method

PATCH In review Bartlomiej Zolnierkiewicz 2 participants 3 messages Nov 12, 2007 – Feb 16, 2008 libata

lore
Share & tools
lore
#0 lore raw

PATCH 5/13 cy82c693: add ->set_dma_mode method

* Fix SWDMA/MWDMA masks in cy82c693_chipset.

* Add IDE_HFLAG_CY82C693 host flag and use it in ide_tune_dma() to check whether the DMA should be enabled even if ide_max_dma_mode() fails.

* Convert cy82c693_dma_enable() to become cy82c693_set_dma_mode() and remove no longer needed cy82c693_ide_dma_on(). Then set IDE_HFLAG_CY82C693 instead of IDE_HFLAG_TRUST_BIOS_FOR_DMA in cy82c693_chipset.

* Bump driver version.

As a result of this patch cy82c693 driver will configure and use DMA on all SWDMA0-2 and MWDMA0-2 capable ATA devices instead of relying on BIOS.

---
 drivers/ide/ide-dma.c      |   15 +++++++---
 drivers/ide/pci/cy82c693.c |   64 +++++++--------------------------------------
 include/linux/ide.h        |    2 +
 3 files changed, 24 insertions(+), 57 deletions(-)
drivers/ide/ide-dma.c +11 -4
Index: b/drivers/ide/ide-dma.c
===================================================================
@@ -758,6 +758,7 @@ EXPORT_SYMBOL_GPL(ide_find_dma_mode);
 
 static int ide_tune_dma(ide_drive_t *drive)
 {
+	ide_hwif_t *hwif = drive->hwif;
 	u8 speed;
 
 	if (noautodma || drive->nodma || (drive->id->capability & 1) == 0)
@@ -767,15 +768,21 @@ static int ide_tune_dma(ide_drive_t *dri
 	if (__ide_dma_bad_drive(drive))
 		return 0;
 
-	if (drive->hwif->host_flags & IDE_HFLAG_TRUST_BIOS_FOR_DMA)
+	if (hwif->host_flags & IDE_HFLAG_TRUST_BIOS_FOR_DMA)
 		return config_drive_for_dma(drive);
 
 	speed = ide_max_dma_mode(drive);
 
-	if (!speed)
-		return 0;
+	if (!speed) {
+		 /* is this really correct/needed? */
+		if ((hwif->host_flags & IDE_HFLAG_CY82C693) &&
+		    ide_dma_good_drive(drive))
+			return 1;
+		else
+			return 0;
+	}
 
-	if (drive->hwif->host_flags & IDE_HFLAG_NO_SET_MODE)
+	if (hwif->host_flags & IDE_HFLAG_NO_SET_MODE)
 		return 0;
 
 	if (ide_set_dma_mode(drive, speed))
drivers/ide/pci/cy82c693.c +11 -53

108 lines not on this page · raw message

include/linux/ide.h +2 -0
Index: b/include/linux/ide.h
===================================================================
@@ -1095,6 +1095,8 @@ enum {
 	/* unmask IRQs */
 	IDE_HFLAG_UNMASK_IRQS		= (1 << 25),
 	IDE_HFLAG_ABUSE_SET_DMA_MODE	= (1 << 26),
+	/* host is CY82C693 */
+	IDE_HFLAG_CY82C693		= (1 << 27),
 };
 
 #ifdef CONFIG_BLK_DEV_OFFBOARD
#1 lore raw
Quoted 5 lines · Bartlomiej Zolnierkiewicz

* Fix SWDMA/MWDMA masks in cy82c693_chipset.

* Add IDE_HFLAG_CY82C693 host flag and use it in ide_tune_dma() to check whether the DMA should be enabled even if ide_max_dma_mode() fails.

I didn't get why this was necessary...

Quoted 25 lines

* Convert cy82c693_dma_enable() to become cy82c693_set_dma_mode() and remove no longer needed cy82c693_ide_dma_on(). Then set IDE_HFLAG_CY82C693 instead of IDE_HFLAG_TRUST_BIOS_FOR_DMA in cy82c693_chipset.

* Bump driver version.

As a result of this patch cy82c693 driver will configure and use DMA on all SWDMA0-2 and MWDMA0-2 capable ATA devices instead of relying on BIOS.

Index: b/drivers/ide/pci/cy82c693.c
===================================================================

drivers/ide/pci/cy82c693.c +1 -1
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/ide/pci/cy82c693.c		Version 0.43	Nov 7, 2007
+ * linux/drivers/ide/pci/cy82c693.c		Version 0.44	Nov 8, 2007
  *
  *  Copyright (C) 1998-2000 Andreas S. Krebs ([email protected]), Maintainer
  *  Copyright (C) 1998-2002 Andre Hedrick <[email protected]>, Integrator

drivers/ide/pci/cy82c693.c static void compute_clocks (u8 pio, pio_ · line 182

Quoted 9 lines
drivers/ide/pci/cy82c693.c +3 -2
@@ -176,14 +176,12 @@ static void compute_clocks (u8 pio, pio_
  * set DMA mode a specific channel for CY82C693
  */
 
-static void cy82c693_dma_enable (ide_drive_t *drive, int mode, int single)
+static void cy82c693_set_dma_mode(ide_drive_t *drive, const u8 mode)
 {
-	u8 index = 0, data = 0;
+	ide_hwif_t *hwif = drive->hwif;
+	u8 single = (mode & 0x10) >> 4, index = 0, data = 0;

Useless intializers for 'index' and 'data'.

MBR, Sergei

#2 lore raw

[ Sorry for the late reply. ]

Quoted 9 lines · Sergei Shtylyov
Quoted 5 lines · Bartlomiej Zolnierkiewicz

* Fix SWDMA/MWDMA masks in cy82c693_chipset.

* Add IDE_HFLAG_CY82C693 host flag and use it in ide_tune_dma() to check whether the DMA should be enabled even if ide_max_dma_mode() fails.

I didn't get why this was necessary...

"paranoia" ;-)

Care to send a patch removing it?

Quoted 28 lines
Quoted 28 lines

* Convert cy82c693_dma_enable() to become cy82c693_set_dma_mode() and remove no longer needed cy82c693_ide_dma_on(). Then set IDE_HFLAG_CY82C693 instead of IDE_HFLAG_TRUST_BIOS_FOR_DMA in cy82c693_chipset.

* Bump driver version.

As a result of this patch cy82c693 driver will configure and use DMA on all SWDMA0-2 and MWDMA0-2 capable ATA devices instead of relying on BIOS.

Index: b/drivers/ide/pci/cy82c693.c
===================================================================

drivers/ide/pci/cy82c693.c +1 -1
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/ide/pci/cy82c693.c		Version 0.43	Nov 7, 2007
+ * linux/drivers/ide/pci/cy82c693.c		Version 0.44	Nov 8, 2007
  *
  *  Copyright (C) 1998-2000 Andreas S. Krebs ([email protected]), Maintainer
  *  Copyright (C) 1998-2002 Andre Hedrick <[email protected]>, Integrator
@@ -176,14 +176,12 @@ static void compute_clocks (u8 pio, pio_
  * set DMA mode a specific channel for CY82C693
  */
 
Quoted 8 lines

drivers/ide/pci/cy82c693.c static void compute_clocks (u8 pio, pio_ · line 182

Quoted 6 lines
drivers/ide/pci/cy82c693.c +3 -2
-static void cy82c693_dma_enable (ide_drive_t *drive, int mode, int single)
+static void cy82c693_set_dma_mode(ide_drive_t *drive, const u8 mode)
 {
-	u8 index = 0, data = 0;
+	ide_hwif_t *hwif = drive->hwif;
+	u8 single = (mode & 0x10) >> 4, index = 0, data = 0;

Useless intializers for 'index' and 'data'.

ditto

Thanks,
Bart