[PATCH v6 3/5] i2c: davinci: calculate bus freq from Hz instead of kHz
Andy Shevchenko
andriy.shevchenko at intel.com
Tue Feb 17 01:07:06 PST 2026
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....
> 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.)
> if (r)
> - prop = DAVINCI_I2C_DEFAULT_BUS_FREQ;
> + prop = I2C_MAX_STANDARD_MODE_FREQ;
...like this one.
--
With Best Regards,
Andy Shevchenko
More information about the linux-arm-kernel
mailing list