Re: [PATCH 2/2] i2c: rcar: add FastMode+ support for Gen4

From: Geert Uytterhoeven
Date: Tue Sep 19 2023 - 05:52:20 EST


Hi Wolfram,

On Thu, Sep 14, 2023 at 1:16 AM Wolfram Sang
<wsa+renesas@xxxxxxxxxxxxxxxxxxxx> wrote:
> To support FM+, we mainly need to turn the SMD constant into a parameter
> and set it accordingly. Then, activating the enable bit for FM+ is all
> we need to do. Tested with a Renesas Falcon board using R-Car V3U.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>

Thanks for your patch!

> --- a/drivers/i2c/busses/i2c-rcar.c
> +++ b/drivers/i2c/busses/i2c-rcar.c
> @@ -297,11 +307,18 @@ static int rcar_i2c_clock_calculate(struct rcar_i2c_priv *priv)
> * clkp : peripheral_clk
> * F[] : integer up-valuation
> */
> - rate = clk_get_rate(priv->clk);
> - cdf = rate / 20000000;
> - cdf_width = (priv->devtype == I2C_RCAR_GEN1) ? 2 : 3;
> - if (cdf >= 1U << cdf_width)
> - goto err_no_val;
> + if (t.bus_freq_hz > I2C_MAX_FAST_MODE_FREQ && priv->devtype >= I2C_RCAR_GEN4) {
> + priv->flags |= ID_P_FMPLUS;
> + /* FM+ needs lower SMD and no filters */
> + priv->smd /= 2;
> + cdf = 0;

Is this documented somewhere in the R-Car Gen4 docs?
Assumed this is true, the rest LGTM, modulo the few fixes that should be
moved to "[PATCH RFT 2/2] i2c: rcar: improve accuracy for R-Car Gen3+".

> + } else {
> + priv->flags &= ~ID_P_FMPLUS;
> + cdf = rate / 20000000;
> + cdf_width = (priv->devtype == I2C_RCAR_GEN1) ? 2 : 3;
> + if (cdf >= 1U << cdf_width)
> + goto err_no_val;
> + }
>

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