All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcus Folkesson <marcus.folkesson@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Peter Rosin <peda@axentia.se>,
	Michael Hennerich <michael.hennerich@analog.com>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	Andi Shyti <andi.shyti@kernel.org>,
	Bartosz Golaszewski <brgl@kernel.org>,
	linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v6 3/5] i2c: davinci: calculate bus freq from Hz instead of kHz
Date: Tue, 17 Feb 2026 10:22:47 +0100	[thread overview]
Message-ID: <aZQzZ4iQPDswwp-t@gmail.com> (raw)
In-Reply-To: <aZQvuh1KEAWFSdRU@smile.fi.intel.com>

[-- Attachment #1: Type: text/plain, Size: 1436 bytes --]

Hi Andy,

On Tue, Feb 17, 2026 at 11:07:06AM +0200, Andy Shevchenko wrote:
> On Mon, Feb 16, 2026 at 01:38:15PM +0100, Marcus Folkesson wrote:
> > The bus frequency is unnecessarily converted between Hz and kHz in
> > several places.
> > This is probably an old legacy from the old times (pre-devicetrees)
> > when the davinci_i2c_platform_data took the bus_freq in kHz.
> > 
> > Stick to Hz.
> 
> ...
> 
> >  	/*
> >  	 * According to I2C-BUS Spec 2.1, in FAST-MODE LOW period should be at
> >  	 * least 1.3uS, which is not the case with 50% duty cycle. Driving HIGH
> >  	 * to LOW ratio as 1 to 2 is more safe.
> >  	 */
> > -	if (dev->bus_freq > 100)
> > +	if (dev->bus_freq_hz > 100000)
> 
> The 100000 has a definition in i2c.h....

Good point, thanks.
> 
> >  		clkl = (clk << 1) / 3;
> >  	else
> >  		clkl = (clk >> 1);
> 
> ...
> 
> >  	r = device_property_read_u32(&pdev->dev, "clock-frequency", &prop);
> 
> (Why not using i2c timings? The I²C core has an API to parse firmware properties.)

Actually, I found i2c_parse_fw_timings() just a day ago and have on my
TODO-list to convert all bus drivers to use it right after the work with this
series is done.

> 
> >  	if (r)
> > -		prop = DAVINCI_I2C_DEFAULT_BUS_FREQ;
> > +		prop = I2C_MAX_STANDARD_MODE_FREQ;
> 
> ...like this one.
> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
> 

Best regards,
Marcus Folkesson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2026-02-17  9:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-16 12:38 [PATCH v6 0/5] I2C Mux per channel bus speed Marcus Folkesson
2026-02-16 12:38 ` [PATCH v6 1/5] i2c: core: add callback to change bus frequency Marcus Folkesson
2026-02-16 12:38 ` [PATCH v6 2/5] i2c: mux: add support for per channel " Marcus Folkesson
2026-02-16 16:40   ` Peter Rosin
2026-02-16 18:50     ` Marcus Folkesson
2026-02-17  9:37       ` Peter Rosin
2026-02-18  7:02         ` Marcus Folkesson
2026-02-23  7:29           ` Marcus Folkesson
2026-02-16 12:38 ` [PATCH v6 3/5] i2c: davinci: calculate bus freq from Hz instead of kHz Marcus Folkesson
2026-02-17  9:07   ` Andy Shevchenko
2026-02-17  9:22     ` Marcus Folkesson [this message]
2026-02-16 12:38 ` [PATCH v6 4/5] i2c: davinci: add support for setting bus frequency Marcus Folkesson
2026-02-16 12:38 ` [PATCH v6 5/5] docs: i2c: i2c-topology: add section about bus speed Marcus Folkesson

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=aZQzZ4iQPDswwp-t@gmail.com \
    --to=marcus.folkesson@gmail.com \
    --cc=andi.shyti@kernel.org \
    --cc=andriy.shevchenko@intel.com \
    --cc=brgl@bgdev.pl \
    --cc=brgl@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.hennerich@analog.com \
    --cc=peda@axentia.se \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.