Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b10a0686 authored by Sergei Shtylyov's avatar Sergei Shtylyov Committed by Linus Torvalds
Browse files

[PATCH] pdc202xx_new: fix PIO mode setup



Fix pdcnew_tune_drive() to always set the PIO mode requested, not pick the
best possible one, change pdcnew_config_drive_xfer_rate() accordingly, and
get rid of the duplicate tuneproc() call in config_chipset_for_dma().

Signed-off-by: default avatarSergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b1489009
Loading
Loading
Loading
Loading
+5 −10
Original line number Original line Diff line number Diff line
@@ -9,6 +9,7 @@
 *  Split from:
 *  Split from:
 *  linux/drivers/ide/pdc202xx.c	Version 0.35	Mar. 30, 2002
 *  linux/drivers/ide/pdc202xx.c	Version 0.35	Mar. 30, 2002
 *  Copyright (C) 1998-2002		Andre Hedrick <andre@linux-ide.org>
 *  Copyright (C) 1998-2002		Andre Hedrick <andre@linux-ide.org>
 *  Copyright (C) 2005-2006		MontaVista Software, Inc.
 *  Portions Copyright (C) 1999 Promise Technology, Inc.
 *  Portions Copyright (C) 1999 Promise Technology, Inc.
 *  Author: Frank Tiernan (frankt@promise.com)
 *  Author: Frank Tiernan (frankt@promise.com)
 *  Released under terms of General Public License
 *  Released under terms of General Public License
@@ -168,12 +169,8 @@ static int pdcnew_new_tune_chipset (ide_drive_t *drive, u8 xferspeed)
 */
 */
static void pdcnew_tune_drive(ide_drive_t *drive, u8 pio)
static void pdcnew_tune_drive(ide_drive_t *drive, u8 pio)
{
{
	u8 speed;
	pio = ide_get_best_pio_mode(drive, pio, 4, NULL);

	(void)pdcnew_new_tune_chipset(drive, XFER_PIO_0 + pio);
	if (pio == 5) pio = 4;
	speed = XFER_PIO_0 + ide_get_best_pio_mode(drive, 255, pio, NULL);

	(void)pdcnew_new_tune_chipset(drive, speed);
}
}


static u8 pdcnew_new_cable_detect (ide_hwif_t *hwif)
static u8 pdcnew_new_cable_detect (ide_hwif_t *hwif)
@@ -207,10 +204,8 @@ static int config_chipset_for_dma (ide_drive_t *drive)


	speed = ide_dma_speed(drive, pdcnew_ratemask(drive));
	speed = ide_dma_speed(drive, pdcnew_ratemask(drive));


	if (!(speed)) {
	if (!speed)
		hwif->tuneproc(drive, 5);
		return 0;
		return 0;
	}


	(void) hwif->speedproc(drive, speed);
	(void) hwif->speedproc(drive, speed);
	return ide_dma_enable(drive);
	return ide_dma_enable(drive);
@@ -234,7 +229,7 @@ static int pdcnew_config_drive_xfer_rate (ide_drive_t *drive)


	} else if ((id->capability & 8) || (id->field_valid & 2)) {
	} else if ((id->capability & 8) || (id->field_valid & 2)) {
fast_ata_pio:
fast_ata_pio:
		hwif->tuneproc(drive, 5);
		hwif->tuneproc(drive, 255);
		return hwif->ide_dma_off_quietly(drive);
		return hwif->ide_dma_off_quietly(drive);
	}
	}
	/* IORDY not supported */
	/* IORDY not supported */