Well, yes. Though I hoped that you would at least give a try to fixing
IDE core to program PIO0 initially for all host drivers that implement
->set_pio_mode method...
Sorry, I didn't noticed your hint... Sure, I can give it a try ;-)
Maybe with a little help, but I can try. You mean, when the host driver
is registered (ide_host_register, or ide_host_add that later calls
ide_host_register), maybe in the 'ide_init_port' method (sorry, I need
some guidance here...) check if the 'set_pio_mode' method is
implemented, and after initializing each port (d->init_hwif(hwif))
default it to PIO Mode 0, calling set_pio_mode method.
ide_init_port() seems OK but I think that ide_port_init_devices()
[it is called after ide_init_port()] would be a bit safer and more
flexible (some host drivers may also require special ->init_dev
setup first) and the check for ->set_pio_mode method presence can
be done just before actually using the method, i.e.
const struct ide_port_ops *port_ops = hwif->port_ops;
if (port_ops && port_ops->set_pio_mode)
port_ops->set_pio_mode(...)
Ok, so the patch for this is attached in this e-mail.
Please confirm and make your comments.
Best regards,
João Ramos
--
************************************************************************
João Ramos <joao.ramos@xxxxxxx>
INOV INESC Inovação - ESTG Leiria
Escola Superior de Tecnologia e Gestão de Leiria
Edíficio C1, Campus 2
Morro do Lena, Alto do Vieiro
Leiria
2411-901 Leiria
Portugal
Tel: +351244843424
Fax: +351244843424
************************************************************************
Initially set PIO Mode 0 for all host drivers that use PIO transfer mode
(and export a 'set_pio_mode' method) before the IDE core figures out
the most suited PIO mode for the attached device.
Signed-off-by: Joao Ramos <joao.ramos@xxxxxxx>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@xxxxxxxxx>
Cc: Sergei Shtylyov <sshtylyov@xxxxxxxxxxxxxxxxx>
Cc: Alan Cox <alan@xxxxxxxxxxxxxxxxxxx>
---
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 7f264ed..f92cac4 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1031,6 +1031,13 @@ static void ide_port_init_devices(ide_hwif_t *hwif)
if (port_ops && port_ops->init_dev)
port_ops->init_dev(drive);
+
+ /*
+ * if driver uses PIO mode, 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);
}
}