Linux-i3c Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Diogo Ivo" <diogo.ivo.sx@renesas.com>
Cc: linux-i3c@lists.infradead.org, devicetree@vger.kernel.org,
	linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org, Frank.Li@kernel.org,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	wsa+renesas@sang-engineering.com
Subject: Re: [PATCH v3 1/6] i3c: renesas: Fix zero I2C SCL rate on pure I3C buses
Date: Fri, 04 Dec 2026 13:44:18 +0000	[thread overview]
Message-ID: <sashiko-outbox-249892@kernel.org> (raw)
In-Reply-To: <20261204-divo-ssgrlpcsrc-2966-i3c-v3-1-f502c6f6947d@renesas.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] i3c: renesas: uncapped 1 MHz OD fallback exceeds low
  i3c-scl-hz
--

commit ea7d51bd4ae0958787be77dec64c429b5eefe33b
Author: Diogo Ivo <diogo.ivo.sx@renesas.com>

i3c: renesas: Fix zero I2C SCL rate on pure I3C buses

This patch falls back to I3C_BUS_I2C_FM_PLUS_SCL_MAX_RATE (1 MHz) when
calculating i2c_total_ticks in renesas_i3c_bus_init() if bus->scl_rate.i2c
is zero on a pure I3C bus.

> diff --git a/drivers/i3c/master/renesas-i3c.c b/drivers/i3c/master/renesas-i3c.c
> index 5719b78f05036..9ae901008c6c5 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);
>  	i3c_total_ticks = DIV_ROUND_UP(i3c->rate, bus->scl_rate.i3c);

[Severity: Medium]
Can this fall back to 1 MHz even when bus->scl_rate.i3c is configured
below 1 MHz?

On a pure I3C bus with i2c-scl-hz omitted, i3c_bus_set_mode() allows any
i3c-scl-hz below 1 MHz while leaving bus->scl_rate.i2c at zero.  In that
case open-drain SCL runs faster than the configured push-pull rate.

The shared cks prescaler loop also halves i2c_total_ticks alongside
i3c_total_ticks to fit pp_low_ticks.  At 25 kHz on a 200 MHz tclk,
i2c_total_ticks shrinks to 1 with od_low_ticks = 1, leaving
od_high_ticks = 0 in STDBR_SBRHO and breaking open-drain transfers.

Capping the fallback to min_t(unsigned long, bus->scl_rate.i3c,
I3C_BUS_I2C_FM_PLUS_SCL_MAX_RATE) would keep open-drain SCL bounded by
the configured I3C rate.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204-divo-ssgrlpcsrc-2966-i3c-v3-0-f502c6f6947d@renesas.com?part=1

-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

  reply	other threads:[~2026-12-04 13:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 13:22 [PATCH v3 0/6] i3c: renesas: Add RZ/G3L support Diogo Ivo
2026-12-04 13:22 ` [PATCH v3 1/6] i3c: renesas: Fix zero I2C SCL rate on pure I3C buses Diogo Ivo
2026-12-04 13:44   ` sashiko-bot [this message]
2026-12-04 18:48     ` Diogo Ivo
2026-12-04 13:22 ` [PATCH v3 2/6] i3c: renesas: Drop comma after OF match table sentinel Diogo Ivo
2026-12-04 13:22 ` [PATCH v3 3/6] dt-bindings: i3c: renesas,i3c: Add RZ/G3L support Diogo Ivo
2026-12-04 13:22 ` [PATCH v3 4/6] pinctrl: renesas: rzg2l: Split SoC-specific masks in struct rzg2l_register_masks Diogo Ivo
2026-12-04 13:22 ` [PATCH v3 5/6] pinctrl: renesas: rzg2l: Add RZ/G3L support for selecting I3C power source Diogo Ivo
2026-12-04 13:22 ` [PATCH v3 6/6] 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=sashiko-outbox-249892@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=diogo.ivo.sx@renesas.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-i3c@lists.infradead.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --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