Skip to contentSkip to conversation

IDE updates/fixes

PATCH In review Bartlomiej Zolnierkiewicz 2 participants 3 messages May 16, 2007 libata

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IDE updates/fixes

This time:

* host driver fixes:
- pdc202xx_old: mode programming rewrite (a lot of bugs fixed)
- serverworks/sis5513: PIO mode setup fixes
- sl82c105: MWDMA0/1 support by Sergei
- cs5530/sc1200/sl82c105: ->speedproc support ("hdparm -X")

* 2nd part of cleanups basing on DMA tuning rework (which was merged in the previous IDE update) - quite straightforward code re-factoring (no functionality changes) and removal of no longer needed functions.

This results in simpler, more generic code and in ~300 LOCs gone.

* some misc fixes/updates

Please pull from:

master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6.git/

to receive the following updates:

 drivers/ide/Kconfig            |   15 +---
 drivers/ide/cris/ide-cris.c    |   14 +---
 drivers/ide/ide-dma.c          |   53 +++---------
 drivers/ide/ide-io.c           |    1 +
 drivers/ide/ide-lib.c          |   12 ---
 drivers/ide/ide.c              |    1 +
 drivers/ide/pci/alim15x3.c     |   69 ++--------------
 drivers/ide/pci/cmd64x.c       |   15 +---
 drivers/ide/pci/cs5530.c       |  160 +++++++++++++++++------------------
 drivers/ide/pci/it821x.c       |   21 +-----
 drivers/ide/pci/pdc202xx_new.c |   29 +------
 drivers/ide/pci/pdc202xx_old.c |  184 +++++++++-------------------------------
 drivers/ide/pci/sc1200.c       |  161 +++++++++++++++++------------------
 drivers/ide/pci/scc_pata.c     |   22 +-----
 drivers/ide/pci/serverworks.c  |   77 +++--------------
 drivers/ide/pci/siimage.c      |   24 +-----
 drivers/ide/pci/sis5513.c      |   85 ++++++++-----------
 drivers/ide/pci/sl82c105.c     |   76 ++++++++++++++---
 include/linux/ide.h            |    3 -
 19 files changed, 340 insertions(+), 682 deletions(-)

Alan Cox (1):
sl82c105: Switch to ref counting API

Bartlomiej Zolnierkiewicz (13):
pdc202xx_old: rewrite mode programming code (v2)
serverworks: PIO mode setup fixes
sis5513: PIO mode setup fixes
alim15x3: use ide_tune_dma()
pdc202xx_new: use ide_tune_dma()
ide: always disable DMA before tuning it cs5530/sc1200: add ->udma_filter methods
ide: use ide_tune_dma() part #2
cs5530/sc1200: DMA support cleanup
cs5530/sc1200: add ->speedproc support
ide: remove ide_dma_enable()
ide: add missing validity checks for identify words 62 and 63
ide: remove ide_use_dma()

Jan Engelhardt (1):
Use menuconfig objects: IDE

Sergei Shtylyov (1):
sl82c105: add speedproc() method and MWDMA0/1 support

drivers/ide/Kconfig +4 -11
index 9040809..b1a9b81 100644
@@ -4,13 +4,10 @@
 # Andre Hedrick <[email protected]>
 #
 
-if BLOCK
-
-menu "ATA/ATAPI/MFM/RLL support"
-	depends on HAS_IOMEM
-
-config IDE
+menuconfig IDE
 	tristate "ATA/ATAPI/MFM/RLL support"
+	depends on BLOCK
+	depends on HAS_IOMEM
 	---help---
 	  If you say Y here, your kernel will be able to manage low cost mass
 	  storage units such as ATA/(E)IDE and ATAPI units. The most common
@@ -1099,8 +1096,4 @@ config BLK_DEV_HD_ONLY
 config BLK_DEV_HD
 	def_bool BLK_DEV_HD_IDE || BLK_DEV_HD_ONLY
 
-endif
-
-endmenu
-
-endif
+endif # IDE
drivers/ide/cris/ide-cris.c +1 -13
index c04cb25..ca0341c 100644
@@ -1002,18 +1002,6 @@ static int cris_ide_build_dmatable (ide_drive_t *drive)
 	return 1;	/* let the PIO routines handle this weirdness */
 }
 
-static int cris_config_drive_for_dma (ide_drive_t *drive)
-{
-	u8 speed = ide_max_dma_mode(drive);
-
-	if (!speed)
-		return 0;
-
-	speed_cris_ide(drive, speed);
-
-	return ide_dma_enable(drive);
-}
-
 /*
  * cris_dma_intr() is the handler for disk read/write DMA interrupts
  */
@@ -1043,7 +1031,7 @@ static ide_startstop_t cris_dma_intr (ide_drive_t *drive)
 
 static int cris_dma_check(ide_drive_t *drive)
 {
-	if (ide_use_dma(drive) && cris_config_drive_for_dma(drive))
+	if (ide_tune_dma(drive))
 		return 0;
 
 	return -1;
drivers/ide/ide-dma.c +12 -41

80 lines not on this page · raw message

drivers/ide/ide-io.c +1 -0
index 8e56814..bfe8f1b 100644
@@ -223,6 +223,7 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *
 			break;
 		if (drive->hwif->ide_dma_check == NULL)
 			break;
+		drive->hwif->dma_off_quietly(drive);
 		ide_set_dma(drive);
 		break;
 	}
drivers/ide/ide-lib.c +0 -12
index 3be3c69..074bb32 100644
@@ -111,18 +111,6 @@ u8 ide_rate_filter(ide_drive_t *drive, u8 speed)
 
 EXPORT_SYMBOL(ide_rate_filter);
 
-int ide_dma_enable (ide_drive_t *drive)
-{
-	ide_hwif_t *hwif	= HWIF(drive);
-	struct hd_driveid *id	= drive->id;
-
-	return ((int)	((((id->dma_ultra >> 8) & hwif->ultra_mask) ||
-			  ((id->dma_mword >> 8) & hwif->mwdma_mask) ||
-			  ((id->dma_1word >> 8) & hwif->swdma_mask)) ? 1 : 0));
-}
-
-EXPORT_SYMBOL(ide_dma_enable);
-
 int ide_use_fast_pio(ide_drive_t *drive)
 {
 	struct hd_driveid *id = drive->id;
drivers/ide/ide.c +1 -0
index f2b547f..6002713 100644
@@ -910,6 +910,7 @@ int set_using_dma(ide_drive_t *drive, int arg)
 	err = 0;
 
 	if (arg) {
+		hwif->dma_off_quietly(drive);
 		if (ide_set_dma(drive) || hwif->ide_dma_on(drive))
 			err = -EIO;
 	} else
drivers/ide/pci/alim15x3.c +7 -62

90 lines not on this page · raw message

drivers/ide/pci/cmd64x.c +1 -14
index 61ea96b..7c57dc6 100644
@@ -352,22 +352,9 @@ static int cmd64x_tune_chipset (ide_drive_t *drive, u8 speed)
 	return ide_config_drive_speed(drive, speed);
 }
 
-static int config_chipset_for_dma (ide_drive_t *drive)
-{
-	u8 speed = ide_max_dma_mode(drive);
-
-	if (!speed)
-		return 0;
-
-	if (cmd64x_tune_chipset(drive, speed))
-		return 0;
-
-	return ide_dma_enable(drive);
-}
-
 static int cmd64x_config_drive_for_dma (ide_drive_t *drive)
 {
-	if (ide_use_dma(drive) && config_chipset_for_dma(drive))
+	if (ide_tune_dma(drive))
 		return 0;
 
 	if (ide_use_fast_pio(drive))
drivers/ide/pci/cs5530.c +79 -81

219 lines not on this page · raw message

drivers/ide/pci/it821x.c +1 -20
index 442f658..5faaff8 100644
@@ -464,25 +464,6 @@ static int it821x_tune_chipset (ide_drive_t *drive, byte xferspeed)
 }
 
 /**
- *	config_chipset_for_dma	-	configure for DMA
- *	@drive: drive to configure
- *
- *	Called by the IDE layer when it wants the timings set up.
- */
-
-static int config_chipset_for_dma (ide_drive_t *drive)
-{
-	u8 speed = ide_max_dma_mode(drive);
-
-	if (speed == 0)
-		return 0;
-
-	it821x_tune_chipset(drive, speed);
-
-	return ide_dma_enable(drive);
-}
-
-/**
  *	it821x_configure_drive_for_dma	-	set up for DMA transfers
  *	@drive: drive we are going to set up
  *
@@ -494,7 +475,7 @@ static int config_chipset_for_dma (ide_drive_t *drive)
 
 static int it821x_config_drive_for_dma (ide_drive_t *drive)
 {
-	if (ide_use_dma(drive) && config_chipset_for_dma(drive))
+	if (ide_tune_dma(drive))
 		return 0;
 
 	it821x_tuneproc(drive, 255);
drivers/ide/pci/pdc202xx_new.c +1 -28
index 65b1e12..cc0bfdc 100644
@@ -228,38 +228,11 @@ static u8 pdcnew_cable_detect(ide_hwif_t *hwif)
 	return get_indexed_reg(hwif, 0x0b) & 0x04;
 }
 
-static int config_chipset_for_dma(ide_drive_t *drive)
-{
-	struct hd_driveid *id	= drive->id;
-	ide_hwif_t *hwif	= HWIF(drive);
-	u8 speed;
-
-	if (id->capability & 4) {
-		/*
-		 * Set IORDY_EN & PREFETCH_EN (this seems to have
-		 * NO real effect since this register is reloaded
-		 * by hardware when the transfer mode is selected)
-		 */
-		u8 tmp, adj = (drive->dn & 1) ? 0x08 : 0x00;
-
-		tmp = get_indexed_reg(hwif, 0x13 + adj);
-		set_indexed_reg(hwif, 0x13 + adj, tmp | 0x03);
-	}
-
-	speed = ide_max_dma_mode(drive);
-
-	if (!speed)
-		return 0;
-
-	(void) hwif->speedproc(drive, speed);
-	return ide_dma_enable(drive);
-}
-
 static int pdcnew_config_drive_xfer_rate(ide_drive_t *drive)
 {
 	drive->init_speed = 0;
 
-	if (ide_use_dma(drive) && config_chipset_for_dma(drive))
+	if (ide_tune_dma(drive))
 		return 0;
 
 	if (ide_use_fast_pio(drive))
drivers/ide/pci/pdc202xx_old.c +41 -143

249 lines not on this page · raw message

drivers/ide/pci/sc1200.c +77 -84

247 lines not on this page · raw message

drivers/ide/pci/scc_pata.c +1 -21
index cbf9363..55bc0a3 100644
@@ -322,26 +322,6 @@ static int scc_tune_chipset(ide_drive_t *drive, byte xferspeed)
 }
 
 /**
- *	scc_config_chipset_for_dma	-	configure for DMA
- *	@drive: drive to configure
- *
- *	Called by scc_config_drive_for_dma().
- */
-
-static int scc_config_chipset_for_dma(ide_drive_t *drive)
-{
-	u8 speed = ide_max_dma_mode(drive);
-
-	if (!speed)
-		return 0;
-
-	if (scc_tune_chipset(drive, speed))
-		return 0;
-
-	return ide_dma_enable(drive);
-}
-
-/**
  *	scc_configure_drive_for_dma	-	set up for DMA transfers
  *	@drive: drive we are going to set up
  *
@@ -354,7 +334,7 @@ static int scc_config_chipset_for_dma(ide_drive_t *drive)
 
 static int scc_config_drive_for_dma(ide_drive_t *drive)
 {
-	if (ide_use_dma(drive) && scc_config_chipset_for_dma(drive))
+	if (ide_tune_dma(drive))
 		return 0;
 
 	if (ide_use_fast_pio(drive))
drivers/ide/pci/serverworks.c +14 -63

126 lines not on this page · raw message

drivers/ide/pci/siimage.c +1 -23
index d09e74c..1a4444e 100644
@@ -375,28 +375,6 @@ static int siimage_tune_chipset (ide_drive_t *drive, byte xferspeed)
 }
 
 /**
- *	config_chipset_for_dma	-	configure for DMA
- *	@drive: drive to configure
- *
- *	Called by the IDE layer when it wants the timings set up.
- *	For the CMD680 we also need to set up the PIO timings and
- *	enable DMA.
- */
- 
-static int config_chipset_for_dma (ide_drive_t *drive)
-{
-	u8 speed = ide_max_dma_mode(drive);
-
-	if (!speed)
-		return 0;
-
-	if (siimage_tune_chipset(drive, speed))
-		return 0;
-
-	return ide_dma_enable(drive);
-}
-
-/**
  *	siimage_configure_drive_for_dma	-	set up for DMA transfers
  *	@drive: drive we are going to set up
  *
@@ -408,7 +386,7 @@ static int config_chipset_for_dma (ide_drive_t *drive)
  
 static int siimage_config_drive_for_dma (ide_drive_t *drive)
 {
-	if (ide_use_dma(drive) && config_chipset_for_dma(drive))
+	if (ide_tune_dma(drive))
 		return 0;
 
 	if (ide_use_fast_pio(drive))
drivers/ide/pci/sis5513.c +36 -49

161 lines not on this page · raw message

drivers/ide/pci/sl82c105.c +62 -14

133 lines not on this page · raw message

include/linux/ide.h +0 -3
index df4e6a5..07aba87 100644
@@ -1281,7 +1281,6 @@ struct drive_list_entry {
 int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *);
 int __ide_dma_bad_drive(ide_drive_t *);
 int __ide_dma_good_drive(ide_drive_t *);
-int ide_use_dma(ide_drive_t *);
 u8 ide_max_dma_mode(ide_drive_t *);
 int ide_tune_dma(ide_drive_t *);
 void ide_dma_off(ide_drive_t *);
@@ -1309,7 +1308,6 @@ extern int __ide_dma_timeout(ide_drive_t *);
 #endif /* CONFIG_BLK_DEV_IDEDMA_PCI */
 
 #else
-static inline int ide_use_dma(ide_drive_t *drive) { return 0; }
 static inline u8 ide_max_dma_mode(ide_drive_t *drive) { return 0; }
 static inline int ide_tune_dma(ide_drive_t *drive) { return 0; }
 static inline void ide_dma_off(ide_drive_t *drive) { ; }
@@ -1357,7 +1355,6 @@ static inline void ide_set_hwifdata (ide_hwif_t * hwif, void *data)
 
 /* ide-lib.c */
 u8 ide_rate_filter(ide_drive_t *, u8);
-extern int ide_dma_enable(ide_drive_t *drive);
 extern char *ide_xfer_verbose(u8 xfer_rate);
 extern void ide_toggle_bounce(ide_drive_t *drive, int on);
 extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate);
#1 lore raw
Quoted 7 lines · Bartlomiej Zolnierkiewicz

* host driver fixes:
- pdc202xx_old: mode programming rewrite (a lot of bugs fixed)
- serverworks/sis5513: PIO mode setup fixes
- sl82c105: MWDMA0/1 support by Sergei
- cs5530/sc1200/sl82c105: ->speedproc support ("hdparm -X")

Quoted 7 lines

* 2nd part of cleanups basing on DMA tuning rework (which was merged in the previous IDE update) - quite straightforward code re-factoring (no functionality changes) and removal of no longer needed functions.

This results in simpler, more generic code and in ~300 LOCs gone.

* some misc fixes/updates

Bartlomiej, this really was too late for the 2.6.22 merge window. I'm going to pull it, since it seems borderline mostly fixes and the refactoring should hopefully not change any functionality, but I really don't enjoy it. Please don't do this again.

Linus

#2 lore raw
Quoted 13 lines · Linus Torvalds
Quoted 11 lines · Bartlomiej Zolnierkiewicz

* host driver fixes:
- pdc202xx_old: mode programming rewrite (a lot of bugs fixed)
- serverworks/sis5513: PIO mode setup fixes
- sl82c105: MWDMA0/1 support by Sergei
- cs5530/sc1200/sl82c105: ->speedproc support ("hdparm -X")

* 2nd part of cleanups basing on DMA tuning rework (which was merged in the previous IDE update) - quite straightforward code re-factoring (no functionality changes) and removal of no longer needed functions.

Quoted 6 lines
Quoted 3 lines

This results in simpler, more generic code and in ~300 LOCs gone.

* some misc fixes/updates

Bartlomiej, this really was too late for the 2.6.22 merge window. I'm going to pull it, since it seems borderline mostly fixes and the

Thanks.

Quoted 1 line

refactoring should hopefully not change any functionality, but I really

Moreover most of these patches have been in IDE tree and -mm for over 2 months so they really should be fine.

Quoted 1 line

don't enjoy it. Please don't do this again.

OK and sorry for that.

Bart