Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: zychen <zychennvt@gmail.com>
To: Andi Shyti <andi.shyti@kernel.org>
Cc: linux-i2c@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Jacky Huang <ychuang3@nuvoton.com>,
	Shan-Chun Hung <schung@nuvoton.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Andrew Jeffery <andrew@codeconstruct.com.au>
Subject: Re: [PATCH RESEND v12 2/3] i2c: ma35d1: Add Nuvoton MA35D1 I2C driver support
Date: Thu, 3 Dec 2026 08:48:48 +0800	[thread overview]
Message-ID: <ac11805c-241a-4740-abcd-86423573e518@gmail.com> (raw)
In-Reply-To: <axAxYeQGI5HEZ-yi@zenone.zhora.eu>



Andi Shyti 於 2026/12/2 下午 11:09 寫道:
> Hi Zi-Yu,
> 
> ...
> 
>> +	if (!device_property_read_u32(dev, "clock-frequency", &val)) {
>> +		if (val != 0 && val <= MEGA)
>> +			busfreq = val;
>> +	}
>> +	/* Calculate divider based on the current peripheral clock rate */
>> +	clkdiv = DIV_ROUND_CLOSEST(clk_get_rate(i2c->clk), busfreq * 4) - 1;
> 
> I would use DIV_ROUND_UP() here: rounding the divisor to the
> nearest integer can make SCL exceed the requested bus frequency.
> 
> Andi
> 
Agreed. DIV_ROUND_UP() is more appropriate here.

Thanks,
Zi-Yu

>> +	if (clkdiv < 0 || clkdiv > 0x3ff)
>> +		return dev_err_probe(dev, -EINVAL, "invalid clkdiv value: %d\n",
>> +				     clkdiv);



  reply	other threads:[~2026-12-03  0:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  3:23 [PATCH RESEND v12 0/3] i2c: ma35d1: Add support for MA35D1 I2C controller Zi-Yu Chen
2026-11-30  3:23 ` [PATCH RESEND v12 1/3] dt-bindings: i2c: nuvoton,ma35d1-i2c: Add " Zi-Yu Chen
2026-11-30  3:23 ` [PATCH RESEND v12 2/3] i2c: ma35d1: Add Nuvoton MA35D1 I2C driver support Zi-Yu Chen
2026-12-01 10:25   ` Philipp Zabel
2026-12-02  3:05     ` zychen
2026-12-02 15:09   ` Andi Shyti
2026-12-03  0:48     ` zychen [this message]
2026-11-30  3:23 ` [PATCH RESEND v12 3/3] arm64: dts: nuvoton: Add I2C nodes for MA35D1 SoC Zi-Yu Chen

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=ac11805c-241a-4740-abcd-86423573e518@gmail.com \
    --to=zychennvt@gmail.com \
    --cc=andi.shyti@kernel.org \
    --cc=andrew@codeconstruct.com.au \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=robh@kernel.org \
    --cc=schung@nuvoton.com \
    --cc=ychuang3@nuvoton.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