From e13ee546bb06453939014c7b854e77fb643fd6f1 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Tue, 6 Oct 2009 14:46:05 +0000 Subject: sis5513: fix PIO setup for ATAPI devices Clear prefetch setting before potentially (re-)enabling it in config_drive_art_rwp() so the transition of the device type on the port from ATA to ATAPI (i.e. during warm-plug operation) is handled correctly. This is a really old bug (it probably goes back to very early days of the driver) but it was only affecting warm-plug operation until the recent "ide: try to use PIO Mode 0 during probe if possible" change (commit 6029336426a2b43e4bc6f4a84be8789a047d139e). Signed-off-by: Bartlomiej Zolnierkiewicz Tested-by: David Fries Signed-off-by: David S. Miller --- drivers/ide/sis5513.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'drivers/ide') diff --git a/drivers/ide/sis5513.c b/drivers/ide/sis5513.c index afca22beaad..3b88eba04c9 100644 --- a/drivers/ide/sis5513.c +++ b/drivers/ide/sis5513.c @@ -2,7 +2,7 @@ * Copyright (C) 1999-2000 Andre Hedrick * Copyright (C) 2002 Lionel Bouton , Maintainer * Copyright (C) 2003 Vojtech Pavlik - * Copyright (C) 2007 Bartlomiej Zolnierkiewicz + * Copyright (C) 2007-2009 Bartlomiej Zolnierkiewicz * * May be copied or modified under the terms of the GNU General Public License * @@ -281,11 +281,13 @@ static void config_drive_art_rwp(ide_drive_t *drive) pci_read_config_byte(dev, 0x4b, ®4bh); + rw_prefetch = reg4bh & ~(0x11 << drive->dn); + if (drive->media == ide_disk) - rw_prefetch = 0x11 << drive->dn; + rw_prefetch |= 0x11 << drive->dn; - if ((reg4bh & (0x11 << drive->dn)) != rw_prefetch) - pci_write_config_byte(dev, 0x4b, reg4bh|rw_prefetch); + if (reg4bh != rw_prefetch) + pci_write_config_byte(dev, 0x4b, rw_prefetch); } static void sis_set_pio_mode(ide_drive_t *drive, const u8 pio) -- cgit v1.2.3-70-g09d2 From 032665a26f5fe230509c4d35bd53f69fb6aa45b0 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Tue, 6 Oct 2009 12:27:45 +0000 Subject: Revert "Revert "ide: try to use PIO Mode 0 during probe if possible"" This reverts commit 24df31acaff8465d797f0006437b45ad0f2a5cb1. The root cause of reported system hangs was (now fixed) sis5513 bug and not "ide: try to use PIO Mode 0 during probe if possible" change (commit 6029336426a2b43e4bc6f4a84be8789a047d139e) so the revert was incorrect (it simply replaced one regression with the other one). Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: David S. Miller --- drivers/ide/ide-probe.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'drivers/ide') diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 4d76ba47309..63c53d65e87 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c @@ -1046,6 +1046,15 @@ static void ide_port_init_devices(ide_hwif_t *hwif) if (port_ops && port_ops->init_dev) port_ops->init_dev(drive); } + + ide_port_for_each_dev(i, drive, hwif) { + /* + * default to PIO Mode 0 before we figure out + * the most suited mode for the attached device + */ + if (port_ops && port_ops->set_pio_mode) + port_ops->set_pio_mode(drive, 0); + } } static void ide_init_port(ide_hwif_t *hwif, unsigned int port, -- cgit v1.2.3-70-g09d2