All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/1] i2c: rcar: handle RXDMA HW bug on Gen3
@ 2018-05-29 10:58 Wolfram Sang
  2018-05-29 10:58 ` [RFC PATCH 1/1] " Wolfram Sang
  0 siblings, 1 reply; 19+ messages in thread
From: Wolfram Sang @ 2018-05-29 10:58 UTC (permalink / raw)
  To: linux-i2c
  Cc: linux-renesas-soc, Yoshihiro Shimoda, Hiromitsu Yamasaki, Wolfram Sang

As mentioned in the patch description, this patch works around a HW bug on
Renesas R-Car Gen3 SoCs. It had not been discovered yet because it only happens
when clearing DMA enable bits is too late because of latency. To reproduce the
problem reliably, the below patch was used [1].

To the best of my knowledge, all Gen3 SoCs are affected, so I didn't add any
soc_device_match kind of matching for now. If the situation changes, we can add
it. For now, priv->devtype is good.

The improvement can be shown by using the following command. Before the patch,
executed on a Salvator-X / R-Car M3-W ES1.0:

# i2ctransfer -y 2 w1@0x10 0 r16 w1 0 r16
0x0f 0x07 0x3f 0x20 0x20 0x55 0x05 0x07 0x0f 0x07 0x3f 0x00 0x00 0x00 0x00 0x00
0xfe 0x0f 0x07 0x3f 0x20 0x20 0x55 0x05 0x07 0x0f 0x07 0x3f 0x00 0x00 0x00 0x00
# i2ctransfer -y 2 w1@0x10 0 r16 w1 0 r16
0xfe 0x0f 0x07 0x3f 0x20 0x20 0x55 0x05 0x07 0x0f 0x07 0x3f 0x00 0x00 0x00 0x00
0xfe 0x0f 0x07 0x3f 0x20 0x20 0x55 0x05 0x07 0x0f 0x07 0x3f 0x00 0x00 0x00 0x00

Note the broken first byte (0xfe) after the first successful RXDMA transfer.
After the patch (tested with and without CONFIG_RESET_CONTROLLER):

# i2ctransfer -y 2 w1@0x10 0 r16 w1 0 r16
0x0f 0x07 0x3f 0x20 0x20 0x55 0x05 0x07 0x0f 0x07 0x3f 0x00 0x00 0x00 0x00 0x00
0x0f 0x07 0x3f 0x20 0x20 0x55 0x05 0x07 0x0f 0x07 0x3f 0x00 0x00 0x00 0x00 0x00
# i2ctransfer -y 2 w1@0x10 0 r16 w1 0 r16
0x0f 0x07 0x3f 0x20 0x20 0x55 0x05 0x07 0x0f 0x07 0x3f 0x00 0x00 0x00 0x00 0x00
0x0f 0x07 0x3f 0x20 0x20 0x55 0x05 0x07 0x0f 0x07 0x3f 0x00 0x00 0x00 0x00 0x00

Looks way better!

Patch was tested with current renesas-drivers/master, but should also apply cleanly
on i2c/for-next or v4.17-rc7. Please test and comment.

Kind regards,

   Wolfram


Wolfram Sang (1):
  i2c: rcar: handle RXDMA HW bug on Gen3

 drivers/i2c/busses/i2c-rcar.c | 29 ++++++++++++++++++++++++++---
 1 file changed, 26 insertions(+), 3 deletions(-)


[1] Testcase patch:

diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index d445b5891280..e42cd0121862 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -353,6 +353,7 @@ static void rcar_i2c_dma_unmap(struct rcar_i2c_priv *priv)
 	struct dma_chan *chan = priv->dma_direction == DMA_FROM_DEVICE
 		? priv->dma_rx : priv->dma_tx;
 
+	mdelay(10);
 	/* Disable DMA Master Received/Transmitted */
 	rcar_i2c_write(priv, ICDMAER, 0);
 
-- 
2.11.0

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

end of thread, other threads:[~2018-06-28  7:33 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-29 10:58 [RFC PATCH 0/1] i2c: rcar: handle RXDMA HW bug on Gen3 Wolfram Sang
2018-05-29 10:58 ` [RFC PATCH 1/1] " Wolfram Sang
2018-05-30  8:35   ` Yoshihiro Shimoda
2018-05-31  8:31     ` Wolfram Sang
2018-05-31  9:22       ` Yoshihiro Shimoda
2018-05-31  8:45     ` Geert Uytterhoeven
2018-05-31  9:12       ` Yoshihiro Shimoda
2018-06-07  5:36         ` Yoshihiro Shimoda
2018-06-07 10:08           ` Geert Uytterhoeven
2018-06-26  3:05             ` Wolfram Sang
2018-06-26  8:38               ` Yoshihiro Shimoda
2018-06-26  8:58                 ` Geert Uytterhoeven
2018-06-26  9:26                   ` Yoshihiro Shimoda
2018-06-27  8:44                   ` Wolfram Sang
2018-06-27  8:51                     ` Geert Uytterhoeven
2018-06-27  9:10                       ` Wolfram Sang
2018-06-27  9:48                     ` Yoshihiro Shimoda
2018-06-28  5:13                       ` Wolfram Sang
2018-06-28  7:33                   ` Wolfram Sang

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.