From: Troy Mitchell <troy.mitchell@linux.spacemit.com>
To: Alex Elder <elder@riscstar.com>,
Troy Mitchell <troy.mitchell@linux.spacemit.com>,
Lee Jones <lee@kernel.org>, Yixun Lan <dlan@gentoo.org>,
Andi Shyti <andi.shyti@kernel.org>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
spacemit@lists.linux.dev, linux-i2c@vger.kernel.org,
linux-rtc@vger.kernel.org
Subject: Re: [PATCH v3 1/4] i2c: spacemit: configure ILCR for accurate SCL frequency
Date: Mon, 29 Dec 2025 09:20:08 +0800 [thread overview]
Message-ID: <20BB6D852C5C87DF+aVHXSI7Mn5GH-xBF@kernel.org> (raw)
In-Reply-To: <4a76e9bf-926e-4b77-a2f8-ee4a72b2f1dd@riscstar.com>
On Sun, Dec 28, 2025 at 06:58:00PM -0600, Alex Elder wrote:
> On 12/26/25 1:52 AM, Troy Mitchell wrote:
> > > > > +static int spacemit_i2c_clk_set_rate(struct clk_hw *hw, unsigned long rate,
> > > > > + unsigned long parent_rate)
> > > > > +{
> > > > > + struct spacemit_i2c_dev *i2c = container_of(hw, struct spacemit_i2c_dev, scl_clk_hw);
> > > > > + u32 lv, lcr, mask, shift, max_lv;
> > > > > +
> > > > > + lv = DIV_ROUND_UP(parent_rate, rate);
> > > >
> > > > Would DIV_ROUND_CLOSEST() give a more accurate value?
> > > I'll test it.
> > Same result. So I'll keep it.
>
> Is that true for all clock rates?
I only test 400k.
> Anyway, it's not
> a huge deal, but especially when the number of rates
> isn't very high this can make a difference.
I'll test more. Thanks!
- Troy
next prev parent reply other threads:[~2025-12-29 1:22 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-18 6:08 [PATCH v3 0/4] fix the SpacemiT P1 Kconfig and resend the K1 I2C ILCR patch Troy Mitchell
2025-11-18 6:08 ` [PATCH v3 1/4] i2c: spacemit: configure ILCR for accurate SCL frequency Troy Mitchell
2025-11-18 17:32 ` Alex Elder
2025-12-26 5:58 ` Troy Mitchell
2025-12-26 7:52 ` Troy Mitchell
2025-12-29 0:58 ` Alex Elder
2025-12-29 1:20 ` Troy Mitchell [this message]
2025-11-18 6:08 ` [PATCH v3 2/4] rtc: spacemit: MFD_SPACEMIT_P1 as dependencies Troy Mitchell
2025-11-18 17:32 ` Alex Elder
2025-12-08 22:10 ` (subset) " Alexandre Belloni
2025-11-18 6:08 ` [PATCH v3 3/4] regulator: " Troy Mitchell
2025-11-18 17:32 ` Alex Elder
2025-11-18 6:08 ` [PATCH v3 4/4] mfd: simple-mfd-i2c: add default value Troy Mitchell
2025-11-18 16:16 ` Emil Renner Berthing
2025-11-18 17:32 ` Alex Elder
2025-12-19 8:10 ` [PATCH v3 0/4] fix the SpacemiT P1 Kconfig and resend the K1 I2C ILCR patch patchwork-bot+linux-riscv
2025-12-19 11:26 ` Lee Jones
2025-12-22 9:36 ` Troy Mitchell
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=20BB6D852C5C87DF+aVHXSI7Mn5GH-xBF@kernel.org \
--to=troy.mitchell@linux.spacemit.com \
--cc=alexandre.belloni@bootlin.com \
--cc=andi.shyti@kernel.org \
--cc=broonie@kernel.org \
--cc=dlan@gentoo.org \
--cc=elder@riscstar.com \
--cc=lee@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-rtc@vger.kernel.org \
--cc=spacemit@lists.linux.dev \
/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