I believe that the code in nslu2_iic.c is based on the incorrect assumption
that setting a bit in the GPIO output enable register configures the
corresponding pin as an output.
According to the IXP425 documentation from Intel, setting a bit in GPOER
configures the relevant pin as an input.
Hmm, I think you are right. I'll commit changes later if no one objects.
@@ -134,13 +134,18 @@
reg = GPIO_CONF_READ_4(ixp425_softc, IXP425_GPIO_GPOUTR);
if ((reg & GPIO_I2C_SDA_BIT) == 0) {
reg = GPIO_CONF_READ_4(ixp425_softc, IXP425_GPIO_GPOER);
+ reg &= ~GPIO_I2C_SDA_BIT;
+ GPIO_CONF_WRITE_4(ixp425_softc, IXP425_GPIO_GPOER, reg);
+ } else {
+ /* SDA is high; disable SDA output */
+ reg = GPIO_CONF_READ_4(ixp425_softc, IXP425_GPIO_GPOER);
reg |= GPIO_I2C_SDA_BIT;
GPIO_CONF_WRITE_4(ixp425_softc, IXP425_GPIO_GPOER, reg);
}
BTW, is this else clause really needed?
I think the SDA direction is already input there.
---
Izumi Tsutsui