mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Diogo Ivo <diogo.ivo.sx@renesas.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Frank Li <Frank.Li@nxp.com>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Magnus Damm <magnus.damm@gmail.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Brian Masney <bmasney+clk@redhat.com>,
	Jerome Brunet <jbrunet+clk@baylibre.com>,
	Linus Walleij <linusw@kernel.org>,
	linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH 1/8] i3c: renesas: Fix zero I2C SCL rate on pure I3C buses
Date: Tue, 20 Oct 2026 15:13:07 +0100	[thread overview]
Message-ID: <c4677ed8-d682-4d05-afbb-d517e59de391@renesas.com> (raw)
In-Reply-To: <CAMuHMdWt8KV02C+N1dj=gcdJwX4s-_=+zRpsh+Za+f0HeHOkuw@mail.gmail.com>

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@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@vger.kernel.org
>> Signed-off-by: Diogo Ivo <diogo.ivo.sx@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@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


  reply	other threads:[~2026-10-20 14:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20  9:14 [PATCH 0/8] i3c: renesas: Add RZ/G3L support Diogo Ivo
2026-10-20  9:14 ` [PATCH 1/8] i3c: renesas: Fix zero I2C SCL rate on pure I3C buses Diogo Ivo
2026-10-20  9:27   ` Geert Uytterhoeven
2026-10-20 14:13     ` Diogo Ivo [this message]
2026-10-20  9:14 ` [PATCH 2/8] i3c: renesas: Drop comma after OF match table sentinel Diogo Ivo
2026-10-20 19:20   ` Frank Li
2026-10-20  9:14 ` [PATCH 3/8] dt-bindings: i3c: renesas,i3c: Add RZ/G3L support Diogo Ivo
2026-10-20 19:23   ` Frank Li
2026-10-20  9:14 ` [PATCH 4/8] i3c: renesas: " Diogo Ivo
2026-10-20 19:29   ` Frank Li
2026-10-20  9:14 ` [PATCH 5/8] clk: renesas: r9a08g046: Add I3C clocks and resets Diogo Ivo
2026-10-20  9:15 ` [PATCH 6/8] pinctrl: renesas: rzg2l: Split SoC-specific masks in struct rzg2l_register_masks Diogo Ivo
2026-10-20  9:15 ` [PATCH 7/8] pinctrl: renesas: rzg2l: Add RZ/G3L support for selecting I3C power source Diogo Ivo
2026-10-20  9:15 ` [PATCH 8/8] arm64: dts: renesas: r9a08g046: Add I3C support Diogo Ivo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c4677ed8-d682-4d05-afbb-d517e59de391@renesas.com \
    --to=diogo.ivo.sx@renesas.com \
    --cc=Frank.Li@nxp.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=bmasney+clk@redhat.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=jbrunet+clk@baylibre.com \
    --cc=krzk+dt@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-i3c@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tommaso.merciai.xr@bp.renesas.com \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®