Re: [PATCH v2 1/7] i3c: renesas: Fix zero I2C SCL rate on pure I3C buses

From: Diogo Ivo

Date: Fri Nov 27 2026 - 08:51:45 EST


On 11/27/2026 10:12 AM, claudiu beznea wrote:
Hi, Diogo,

On 10/26/26 13:35, Diogo Ivo wrote:
On a pure I3C bus there are no I2C devices, so the I3C core leaves
bus->scl_rate.i2c at zero if i2c-scl-hz is not specified in DT.
Deriving i2c_total_ticks from that zero rate programs a zero-width
open-drain SCL into the STDBR open-drain fields, which are still used
in pure I3C mode for example in DAA.

Fall back to the 1 MHz FM+ limit instead, the fastest rate an I2C
device could have, so that a sane open-drain timing is programmed.

Fixes: d028219a9f14 ("i3c: master: Add basic driver for the Renesas I3C controller")
Cc: stable@xxxxxxxxxxxxxxx
Reviewed-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Diogo Ivo <diogo.ivo.sx@xxxxxxxxxxx>
---
Changes in v2:
  - Substituted if/else with ternary operator
  - Picked up R-b from Wolfram Sang
---
  drivers/i3c/master/renesas-i3c.c | 10 +++++++++-
  1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/i3c/master/renesas-i3c.c b/drivers/i3c/master/ renesas-i3c.c
index 8b264f72e55c..78d0a2c4a19e 100644
--- a/drivers/i3c/master/renesas-i3c.c
+++ b/drivers/i3c/master/renesas-i3c.c
@@ -579,7 +579,15 @@ static int renesas_i3c_bus_init(struct i3c_master_controller *m)
      if (!i3c->rate)
          return -EINVAL;
-    i2c_total_ticks = DIV_ROUND_UP(i3c->rate, bus->scl_rate.i2c);
+    /*
+     * A pure I3C bus has no I2C devices, so the I3C core leaves
+     * scl_rate.i2c at zero if not explicitly defined in DT. The
+     * open-drain SCL fields of STDBR, which are used for the DAA
+     * pending read, are derived from it though, so fall back to
+     * the 1 MHz FM+ limit instead of programming a zero-width clock.
+     */
+    i2c_total_ticks = DIV_ROUND_UP(i3c->rate,
+                       bus->scl_rate.i2c ?: I3C_BUS_I2C_FM_PLUS_SCL_MAX_RATE);

The manual (at lest the RZ/G3S, Rev.1.30) mentions on the documentation of BFCTL.FMPE bit:

Set this bit to 1 when using the transmission rate within a range up to 1 Mbps (Fast-mode Plus [Fm+]) of the I3C-bus specification. Set this bit to 0 when using the transmission rate at other rates (up to 100 kbps [Sm], up to 400 kbps
[Fm]).

In case the i2c_total_ticks = I3C_BUS_I2C_FM_PLUS_SCL_MAX_RATE should the BFCTL.FMPE bit also be set for the operation you mentioned? If so, maybe set the default to I3C_BUS_I2C_FM_SCL_MAX_RATE to avoid any further changes?

I checked the RZ/G3L manual Rev 1.00 and this same block about FMPE is there. However, in that case shouldn't this be applied to the whole driver? For example on a pure I3C bus with a bus speed of 12.5 MHz what
this section says is that the bit should be enabled. I checked the driver and neither the BFCTL register nor the FMPE bit in the register
are defined, so if I understand this correctly the FMPE bit seems like
something that should be addressed for the entire driver on a separate
patch and here we can keep this speed, but please correct me if I am wrong.

Best regards,
Diogo

Thank you,
Claudiu