Skip to contentSkip to conversation

i2c: designware: Fix failure on baytrail

PATCH In review Ben Gardner 2 participants 3 messages Feb 12, 2018 – Feb 13, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: designware: Fix failure on baytrail

The I2C driver for my Atom E3845 board has been broken since 4.9. My board has two I2C devices on a bus that are declared via ACPI. At startup, both drivers attempt to access the devices at the same time, resulting in two back-to-back I2C transactions initiated by the kernel. The second transaction fails.

The root issue is that the I2C port takes a while to enable and somewhere along the way, the 'enable-and-wait' approach to enabling the adapter was changed to 'enable'.
That caused the driver and hardware to get out of sync and fail.

These kernel logs show up whenever an I2C transaction is attempted after this failure.
i2c-designware-pci 0000:00:18.3: timeout in disabling adapter i2c-designware-pci 0000:00:18.3: timeout waiting for bus ready

The driver is unable to recover the bus at this point, but that is a separate issue.

This patch has been tested on 4.9.

---
 drivers/i2c/busses/i2c-designware-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-designware-core.c +1 -1
index b403fa5..980e5a1 100644
@@ -509,7 +509,7 @@ static void i2c_dw_xfer_init(struct dw_i2c_dev *dev)
 	i2c_dw_disable_int(dev);
 
 	/* Enable the adapter */
-	__i2c_dw_enable(dev, true);
+	__i2c_dw_enable_and_wait(dev, true);
 
 	/* Clear and enable interrupts */
 	dw_readl(dev, DW_IC_CLR_INTR);
Signature · 1 line
2.7.4
#1 lore raw

I didn't make it clear in the subject line, but this patch is intended for the 4.9 kernel.
The earlier patch (Feb 9, 2018) was for 4.14, 4.15 and future.

Quoted 42 lines · Ben Gardner

The I2C driver for my Atom E3845 board has been broken since 4.9. My board has two I2C devices on a bus that are declared via ACPI. At startup, both drivers attempt to access the devices at the same time, resulting in two back-to-back I2C transactions initiated by the kernel. The second transaction fails.

The root issue is that the I2C port takes a while to enable and somewhere along the way, the 'enable-and-wait' approach to enabling the adapter was changed to 'enable'.
That caused the driver and hardware to get out of sync and fail.

These kernel logs show up whenever an I2C transaction is attempted after this failure.
i2c-designware-pci 0000:00:18.3: timeout in disabling adapter i2c-designware-pci 0000:00:18.3: timeout waiting for bus ready

The driver is unable to recover the bus at this point, but that is a separate issue.

This patch has been tested on 4.9.

---
 drivers/i2c/busses/i2c-designware-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-designware-core.c +1 -2
index b403fa5..980e5a1 100644
@@ -509,7 +509,7 @@ static void i2c_dw_xfer_init(struct dw_i2c_dev *dev)
        i2c_dw_disable_int(dev);
 
        /* Enable the adapter */
-       __i2c_dw_enable(dev, true);
+       __i2c_dw_enable_and_wait(dev, true);
 
        /* Clear and enable interrupts */
        dw_readl(dev, DW_IC_CLR_INTR);
--

2.7.4

#2 lore raw
Quoted 4 lines · Ben Gardner

I didn't make it clear in the subject line, but this patch is intended for the 4.9 kernel.
The earlier patch (Feb 9, 2018) was for 4.14, 4.15 and future.

I think we need to handle this patch once earlier patch is applied by following the Option 3 rule in Documentation/process/stable-kernel-rules.rst.

Signature · 1 line
Jarkko