* [PATCH 1/2] i3c: dw: Return the length from a read priv_xfer
2023-03-30 6:15 [PATCH 0/2] i3c: dw: minor changes Jeremy Kerr
@ 2023-03-30 6:15 ` Jeremy Kerr
2023-03-30 6:15 ` [PATCH 2/2] i3c: dw: use bus mode rather than device reg for conditional tCAS setting Jeremy Kerr
2023-04-27 21:50 ` [PATCH 0/2] i3c: dw: minor changes Alexandre Belloni
2 siblings, 0 replies; 4+ messages in thread
From: Jeremy Kerr @ 2023-03-30 6:15 UTC (permalink / raw)
To: linux-i3c; +Cc: Matt Johnston, Vitor Soares, Alexandre Belloni, Jack Chen
From: Matt Johnston <matt@codeconstruct.com.au>
We currently assume that the rx_len of a read command will be as
submitted, but we may have a shorter read than expected.
This change populates the output i3c xfer length from the actually-read
length.
Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
---
drivers/i3c/master/dw-i3c-master.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
index 48954d3e6571..97a5442b1ad8 100644
--- a/drivers/i3c/master/dw-i3c-master.c
+++ b/drivers/i3c/master/dw-i3c-master.c
@@ -887,6 +887,13 @@ static int dw_i3c_master_priv_xfers(struct i3c_dev_desc *dev,
if (!wait_for_completion_timeout(&xfer->comp, XFER_TIMEOUT))
dw_i3c_master_dequeue_xfer(master, xfer);
+ for (i = 0; i < i3c_nxfers; i++) {
+ struct dw_i3c_cmd *cmd = &xfer->cmds[i];
+
+ if (i3c_xfers[i].rnw)
+ i3c_xfers[i].len = cmd->rx_len;
+ }
+
ret = xfer->ret;
dw_i3c_master_free_xfer(xfer);
--
2.39.2
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] i3c: dw: use bus mode rather than device reg for conditional tCAS setting
2023-03-30 6:15 [PATCH 0/2] i3c: dw: minor changes Jeremy Kerr
2023-03-30 6:15 ` [PATCH 1/2] i3c: dw: Return the length from a read priv_xfer Jeremy Kerr
@ 2023-03-30 6:15 ` Jeremy Kerr
2023-04-27 21:50 ` [PATCH 0/2] i3c: dw: minor changes Alexandre Belloni
2 siblings, 0 replies; 4+ messages in thread
From: Jeremy Kerr @ 2023-03-30 6:15 UTC (permalink / raw)
To: linux-i3c; +Cc: Matt Johnston, Vitor Soares, Alexandre Belloni, Jack Chen
In the clock setup path, we set the hardware DEV_CTRL_I2C_SLAVE_PRESENT
bit on a shared mode bus, then read-back this bit for the conditional
tCAS set.
Instead, just use the bus->mode setting for the conditional test.
While we're at it, add a little comment about why the conditional is
there.
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
---
drivers/i3c/master/dw-i3c-master.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
index 97a5442b1ad8..1c146a39e1bd 100644
--- a/drivers/i3c/master/dw-i3c-master.c
+++ b/drivers/i3c/master/dw-i3c-master.c
@@ -538,7 +538,11 @@ static int dw_i3c_clk_cfg(struct dw_i3c_master *master)
scl_timing = SCL_I3C_TIMING_HCNT(hcnt) | SCL_I3C_TIMING_LCNT(lcnt);
writel(scl_timing, master->regs + SCL_I3C_PP_TIMING);
- if (!(readl(master->regs + DEVICE_CTRL) & DEV_CTRL_I2C_SLAVE_PRESENT))
+ /*
+ * In pure i3c mode, MST_FREE represents tCAS. In shared mode, this
+ * will be set up by dw_i2c_clk_cfg as tLOW.
+ */
+ if (master->base.bus.mode == I3C_BUS_MODE_PURE)
writel(BUS_I3C_MST_FREE(lcnt), master->regs + BUS_FREE_TIMING);
lcnt = max_t(u8,
--
2.39.2
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] i3c: dw: minor changes
2023-03-30 6:15 [PATCH 0/2] i3c: dw: minor changes Jeremy Kerr
2023-03-30 6:15 ` [PATCH 1/2] i3c: dw: Return the length from a read priv_xfer Jeremy Kerr
2023-03-30 6:15 ` [PATCH 2/2] i3c: dw: use bus mode rather than device reg for conditional tCAS setting Jeremy Kerr
@ 2023-04-27 21:50 ` Alexandre Belloni
2 siblings, 0 replies; 4+ messages in thread
From: Alexandre Belloni @ 2023-04-27 21:50 UTC (permalink / raw)
To: linux-i3c, Jeremy Kerr; +Cc: Matt Johnston, Vitor Soares, Jack Chen
On Thu, 30 Mar 2023 14:15:31 +0800, Jeremy Kerr wrote:
> This series contains a minor fix for the dw driver, and a small cleanup
> + comment.
>
> Jeremy Kerr (1):
> i3c: dw: use bus mode rather than device reg for conditional tCAS
> setting
>
> [...]
Applied, thanks!
[1/2] i3c: dw: Return the length from a read priv_xfer
commit: 67df5ce9dd8870d3e53de5ebd6aecf609b713044
[2/2] i3c: dw: use bus mode rather than device reg for conditional tCAS setting
commit: 66b32e3d2c6daeeafb80fa41f3a41e4c0ab85cc6
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
^ permalink raw reply [flat|nested] 4+ messages in thread