Linux-i3c Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "NG, TZE YEE" <tze.yee.ng@altera.com>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Frank Li <Frank.Li@nxp.com>,
	"NG, ADRIAN HO YIN" <adrian.ho.yin.ng@altera.com>,
	Felix Gu <ustc.gu@gmail.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Akhil R <akhilrajeev@nvidia.com>,
	Manikanta Guntupalli <manikanta.guntupalli@amd.com>,
	Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>,
	"linux-i3c@lists.infradead.org" <linux-i3c@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4] i3c: master: dw-i3c-master: fix OD timing for first broadcast
Date: Fri, 31 Jul 2026 06:03:40 +0000	[thread overview]
Message-ID: <1c4897fb-45ad-41e7-8aba-ccc9b2781cbb@altera.com> (raw)
In-Reply-To: <20260731043516.5CD251F000E9@smtp.kernel.org>

On 31/7/2026 12:35 pm, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] Initialization failure on ACPI/DT platforms due to missing core clock fallback in dw_i3c_master_set_speed().
> --
> 
> --- Patch [1]: [PATCH v4] i3c: master: dw-i3c-master: fix OD timing for first broadcast ---
> commit c4596518222ed00cb6c15e2963a846694b7f5d55
> Author: Tze Yee Ng <tze.yee.ng@altera.com>
> 
> i3c: master: dw-i3c-master: fix OD timing for first broadcast
> 
> This commit implements the ->set_speed() callback to allow the I3C core to
> switch open-drain timings for the first broadcast address. It caches the
> normal OD register value during bus initialization and computes a separate
> od_hcnt for the slow path.
> 
>> diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
>> index 3816a50a52cc5..11ae517cf2e60 100644
>> --- a/drivers/i3c/master/dw-i3c-master.c
>> +++ b/drivers/i3c/master/dw-i3c-master.c
> 
> [ ... ]
> 
>> @@ -1531,6 +1537,50 @@ static irqreturn_t dw_i3c_master_irq_handler(int irq, void *dev_id)
>>   	return IRQ_HANDLED;
>>   }
>>   
>> +static int dw_i3c_master_set_speed(struct i3c_master_controller *m,
>> +				   enum i3c_open_drain_speed speed)
>> +{
>> +	struct dw_i3c_master *master = to_dw_i3c_master(m);
>> +	unsigned long core_rate;
>> +	u32 scl_timing, od_hcnt;
>> +	u8 lcnt;
>> +
>> +	PM_RUNTIME_ACQUIRE_AUTOSUSPEND(master->dev, pm);
>> +	if (PM_RUNTIME_ACQUIRE_ERR(&pm))
>> +		return -ENXIO;
>> +
>> +	switch (speed) {
>> +	case I3C_OPEN_DRAIN_SLOW_SPEED:
>> +		core_rate = clk_get_rate(master->core_clk);
>> +		if (!core_rate)
>> +			return -EINVAL;
> 
> [Severity: High]
> Will this cause platforms without a core clock provider to fail here?
> 
> The rest of the driver uses dw_i3c_master_get_core_rate() to fall back to
> the "clock-frequency" device property if master->core_clk is NULL (such as
> on ACPI/DT platforms). If clk_get_rate() is called directly here on those
> platforms, it appears core_rate will be 0 and the callback will abort with
> -EINVAL.
> 

Agreed. I will switch set_speed() to use dw_i3c_master_get_core_rate() 
like the rest of the driver.

Thanks,
Tze Yee

>> +
>> +		lcnt = SCL_I3C_TIMING_LCNT(master->i3c_od_timing_normal);
>> +		od_hcnt = DIV_ROUND_UP_ULL((u64)I3C_BUS_THIGH_INIT_OD_MIN_NS *
>> +					  core_rate, NSEC_PER_SEC) - 1;
> 
> [ ... ]
> 

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

      reply	other threads:[~2026-07-31  6:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31  4:23 [PATCH v4] i3c: master: dw-i3c-master: fix OD timing for first broadcast tze.yee.ng
2026-07-31  4:35 ` sashiko-bot
2026-07-31  6:03   ` NG, TZE YEE [this message]

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=1c4897fb-45ad-41e7-8aba-ccc9b2781cbb@altera.com \
    --to=tze.yee.ng@altera.com \
    --cc=Frank.Li@nxp.com \
    --cc=adrian.ho.yin.ng@altera.com \
    --cc=adrian.hunter@intel.com \
    --cc=akhilrajeev@nvidia.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linux-i3c@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manikanta.guntupalli@amd.com \
    --cc=shubhrajyoti.datta@amd.com \
    --cc=ustc.gu@gmail.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