All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: designware: must wait for enable
@ 2018-02-14 15:29 Ben Gardner
  2018-02-15 11:06 ` Jarkko Nikula
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ben Gardner @ 2018-02-14 15:29 UTC (permalink / raw)
  To: Jarkko Nikula, linux-i2c
  Cc: Ben Gardner, Andy Shevchenko, Mika Westerberg,
	José Roberto de Souza, linux-stable #4 . 13+

One I2C bus on my Atom E3845 board has been broken since 4.9.
It has two devices, both declared by ACPI and with built-in drivers.

There are two back-to-back transactions originating from the kernel, one
targeting each device. The first transaction works, the second one locks
up the I2C controller. The controller never recovers.

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

Waiting for the I2C controller status to indicate that it is enabled
before programming it fixes the issue.

I have tested this patch on 4.14 and 4.15.

Fixes: commit 2702ea7dbec5 ("i2c: designware: wait for disable/enable only if necessary")
Cc: linux-stable <stable@vger.kernel.org> #4.13+
Cc: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Ben Gardner <gardner.ben@gmail.com>
---
 drivers/i2c/busses/i2c-designware-master.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c
index ae69188..55926ef 100644
--- a/drivers/i2c/busses/i2c-designware-master.c
+++ b/drivers/i2c/busses/i2c-designware-master.c
@@ -209,7 +209,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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] i2c: designware: must wait for enable
  2018-02-14 15:29 [PATCH] i2c: designware: must wait for enable Ben Gardner
@ 2018-02-15 11:06 ` Jarkko Nikula
  2018-02-21  1:14 ` Souza, Jose
  2018-02-21  8:16 ` Wolfram Sang
  2 siblings, 0 replies; 5+ messages in thread
From: Jarkko Nikula @ 2018-02-15 11:06 UTC (permalink / raw)
  To: Ben Gardner, linux-i2c
  Cc: Andy Shevchenko, Mika Westerberg, José Roberto de Souza,
	linux-stable #4 . 13+

On 02/14/2018 05:29 PM, Ben Gardner wrote:
> One I2C bus on my Atom E3845 board has been broken since 4.9.
> It has two devices, both declared by ACPI and with built-in drivers.
> 
> There are two back-to-back transactions originating from the kernel, one
> targeting each device. The first transaction works, the second one locks
> up the I2C controller. The controller never recovers.
> 
> 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
> 
> Waiting for the I2C controller status to indicate that it is enabled
> before programming it fixes the issue.
> 
> I have tested this patch on 4.14 and 4.15.
> 
> Fixes: commit 2702ea7dbec5 ("i2c: designware: wait for disable/enable only if necessary")
> Cc: linux-stable <stable@vger.kernel.org> #4.13+
> Cc: José Roberto de Souza <jose.souza@intel.com>
> Signed-off-by: Ben Gardner <gardner.ben@gmail.com>
> ---
>   drivers/i2c/busses/i2c-designware-master.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c
> index ae69188..55926ef 100644
> --- a/drivers/i2c/busses/i2c-designware-master.c
> +++ b/drivers/i2c/busses/i2c-designware-master.c
> @@ -209,7 +209,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);
>   
I believe this conversion was missing from commit 2702ea7dbec5 and 
regression is better to fix this way than reverting. We'll provide 
similar fix for for v4.9..v4.12. Code have had changes and renaming.

Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] i2c: designware: must wait for enable
  2018-02-14 15:29 [PATCH] i2c: designware: must wait for enable Ben Gardner
  2018-02-15 11:06 ` Jarkko Nikula
@ 2018-02-21  1:14 ` Souza, Jose
  2018-02-21  8:16 ` Wolfram Sang
  2 siblings, 0 replies; 5+ messages in thread
From: Souza, Jose @ 2018-02-21  1:14 UTC (permalink / raw)
  To: gardner.ben, jarkko.nikula, linux-i2c
  Cc: mika.westerberg, andriy.shevchenko, stable

LGTM

On Wed, 2018-02-14 at 09:29 -0600, Ben Gardner wrote:
> One I2C bus on my Atom E3845 board has been broken since 4.9.
> It has two devices, both declared by ACPI and with built-in drivers.
> 
> There are two back-to-back transactions originating from the kernel,
> one
> targeting each device. The first transaction works, the second one
> locks
> up the I2C controller. The controller never recovers.
> 
> 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
> 
> Waiting for the I2C controller status to indicate that it is enabled
> before programming it fixes the issue.
> 
> I have tested this patch on 4.14 and 4.15.
> 
> Fixes: commit 2702ea7dbec5 ("i2c: designware: wait for disable/enable
> only if necessary")
> Cc: linux-stable <stable@vger.kernel.org> #4.13+
> Cc: José Roberto de Souza <jose.souza@intel.com>

Reviewed-by: José Roberto de Souza <jose.souza@intel.com>

> Signed-off-by: Ben Gardner <gardner.ben@gmail.com>
> ---
>  drivers/i2c/busses/i2c-designware-master.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-designware-master.c
> b/drivers/i2c/busses/i2c-designware-master.c
> index ae69188..55926ef 100644
> --- a/drivers/i2c/busses/i2c-designware-master.c
> +++ b/drivers/i2c/busses/i2c-designware-master.c
> @@ -209,7 +209,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);

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] i2c: designware: must wait for enable
  2018-02-14 15:29 [PATCH] i2c: designware: must wait for enable Ben Gardner
  2018-02-15 11:06 ` Jarkko Nikula
  2018-02-21  1:14 ` Souza, Jose
@ 2018-02-21  8:16 ` Wolfram Sang
  2 siblings, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2018-02-21  8:16 UTC (permalink / raw)
  To: Ben Gardner
  Cc: Jarkko Nikula, linux-i2c, Andy Shevchenko, Mika Westerberg,
	José Roberto de Souza, linux-stable #4 . 13+

[-- Attachment #1: Type: text/plain, Size: 1101 bytes --]

On Wed, Feb 14, 2018 at 09:29:52AM -0600, Ben Gardner wrote:
> One I2C bus on my Atom E3845 board has been broken since 4.9.
> It has two devices, both declared by ACPI and with built-in drivers.
> 
> There are two back-to-back transactions originating from the kernel, one
> targeting each device. The first transaction works, the second one locks
> up the I2C controller. The controller never recovers.
> 
> 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
> 
> Waiting for the I2C controller status to indicate that it is enabled
> before programming it fixes the issue.
> 
> I have tested this patch on 4.14 and 4.15.
> 
> Fixes: commit 2702ea7dbec5 ("i2c: designware: wait for disable/enable only if necessary")
> Cc: linux-stable <stable@vger.kernel.org> #4.13+
> Cc: José Roberto de Souza <jose.souza@intel.com>
> Signed-off-by: Ben Gardner <gardner.ben@gmail.com>

Applied to for-current, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] i2c: designware: must wait for enable
@ 2018-02-27 12:06 Jarkko Nikula
  0 siblings, 0 replies; 5+ messages in thread
From: Jarkko Nikula @ 2018-02-27 12:06 UTC (permalink / raw)
  To: stable; +Cc: Ben Gardner, Jarkko Nikula

From: Ben Gardner <gardner.ben@gmail.com>

commit fba4adbbf670577e605f9ad306629db6031cd48b upstream.

One I2C bus on my Atom E3845 board has been broken since 4.9.
It has two devices, both declared by ACPI and with built-in drivers.

There are two back-to-back transactions originating from the kernel, one
targeting each device. The first transaction works, the second one locks
up the I2C controller. The controller never recovers.

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

Waiting for the I2C controller status to indicate that it is enabled
before programming it fixes the issue.

I have tested this patch on 4.14 and 4.15.

Fixes: commit 2702ea7dbec5 ("i2c: designware: wait for disable/enable only if necessary")
Cc: linux-stable <stable@vger.kernel.org> # v4.9..v4.12
Signed-off-by: Ben Gardner <gardner.ben@gmail.com>
[Jarkko: Backported to v4.9..v4.12 before i2c-designware-core.c was
renamed to i2c-designware-master.c]
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
 drivers/i2c/busses/i2c-designware-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c
index 809f4d4e93a0..340e037b3224 100644
--- a/drivers/i2c/busses/i2c-designware-core.c
+++ b/drivers/i2c/busses/i2c-designware-core.c
@@ -507,7 +507,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.16.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-02-27 12:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-14 15:29 [PATCH] i2c: designware: must wait for enable Ben Gardner
2018-02-15 11:06 ` Jarkko Nikula
2018-02-21  1:14 ` Souza, Jose
2018-02-21  8:16 ` Wolfram Sang
2018-02-27 12:06 Jarkko Nikula

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.