Re: [PATCH v2 2/2] i2c: rcar: improve accuracy for R-Car Gen3+

From: Geert Uytterhoeven
Date: Wed Sep 20 2023 - 05:47:35 EST


Hi Wolfram,

On Tue, Sep 19, 2023 at 8:45 PM Wolfram Sang
<wsa+renesas@xxxxxxxxxxxxxxxxxxxx> wrote:
> With some new registers, SCL can be calculated to be closer to the
> desired rate. Apply the new formula for R-Car Gen3 device types.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>
> ---
>
> Changes since v1:
> * fixed two whitespace issues
> * use dedicated variables for scld and schd
> * explicitly say "2 * smd" in the comment explaining the new formula
> * use correct division 'clkp/SCL' in the same comment
> * updated debug printout to use the new variables

Thanks for the update!

Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

But given you have to respin 1/2 anyway, what about...

> --- a/drivers/i2c/busses/i2c-rcar.c
> +++ b/drivers/i2c/busses/i2c-rcar.c

> @@ -128,6 +146,8 @@ struct rcar_i2c_priv {
>
> int pos;
> u32 icccr;
> + u16 scld;
> + u16 schd;

... changing the order, to match alphabetical and register offset order.

> +
> + priv->icccr = cdf;
> + priv->scld = RCAR_SCLD_RATIO * x;
> + priv->schd = RCAR_SCHD_RATIO * x;

Likewise.

> +
> + dev_dbg(dev, "clk %u/%u(%lu), round %u, CDF: %u SCLD %u SCHD %u\n",
> + scl, t.bus_freq_hz, rate, round, cdf, priv->scld, priv->schd);
> + }
>
> return 0;

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds