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

Diogo Ivo diogo.ivo.sx at renesas.com
Tue Oct 20 07:13:07 PDT 2026


Hi Geert,

On 10/20/2026 10:27 AM, Geert Uytterhoeven wrote:
> 
> Hi Diogo,
> 
> On Tue, 20 Oct 2026 at 11:15, Diogo Ivo <diogo.ivo.sx at renesas.com> 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 at vger.kernel.org
>> Signed-off-by: Diogo Ivo <diogo.ivo.sx at renesas.com>
> 
> Thanks for your patch!
> 
>> --- a/drivers/i3c/master/renesas-i3c.c
>> +++ b/drivers/i3c/master/renesas-i3c.c
>> @@ -579,7 +579,18 @@ 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.
>> +        */
>> +       if (!bus->scl_rate.i2c)
>> +               i2c_total_ticks = DIV_ROUND_UP(i3c->rate, I3C_BUS_I2C_FM_PLUS_SCL_MAX_RATE);
>> +       else
>> +               i2c_total_ticks = DIV_ROUND_UP(i3c->rate, bus->scl_rate.i2c);
>> +
>>          i3c_total_ticks = DIV_ROUND_UP(i3c->rate, bus->scl_rate.i3c);
> 
> This looks like a good opportunity to use the shortened tertiary ?:-operator:
> 
>      bus->scl_rate.i2c ?: I3C_BUS_I2C_FM_PLUS_SCL_MAX_RATE

Ack, will change in v2.

Thanks for the review,
Diogo

>>
>>          i2c_parse_fw_timings(&m->dev, &t, true);
> 
> Gr{oetje,eeting}s,
> 
>                          Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                  -- Linus Torvalds




More information about the linux-i3c mailing list