Re: [PATCH v2 2/2] i2c: rcar: add R-Car Gen5 support

Geert Uytterhoeven <[email protected]> Mon, 3 Aug 2026 15:14:11 +0200
Newsgroups org.kernel.vger.linux-i2c,org.kernel.vger.linux-renesas-soc
Message-ID <CAMuHMdVAgjguscFMKd7u1XPuZEkB7mH9-G-Y8nYfXqbzJ2hH9Q@mail.gmail.com>
Hi Wolfram,

On Mon, 27 Jul 2026 at 14:26, Wolfram Sang
<[email protected]> wrote:
> To support the next generation of R-Car SoCs, we need to skip polling
> the reset status. SCMI doesn't support it and the firmware must take
> care of this anyhow. Other than that, the driver works fine as-is.
>
> Signed-off-by: Wolfram Sang <[email protected]>

Thanks for your patch, which is now commit 87e713f200481106 ("i2c:
rcar: add R-Car Gen5 support") in i2c/i2c/i2c-next.

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

> @@ -900,8 +901,12 @@ static int rcar_i2c_do_reset(struct rcar_i2c_priv *priv)
>         if (ret)
>                 return ret;
>
> -       return read_poll_timeout_atomic(reset_control_status, ret, ret == 0, 1,
> -                                       100, false, priv->rstc);
> +       /* SCMI based resets don't need to poll for success */
> +       if (priv->devtype < I2C_RCAR_GEN5)
> +               return read_poll_timeout_atomic(reset_control_status, ret, ret == 0,
> +                                               1, 100, false, priv->rstc);

How to differentiate between using SCMI and running on bare metal?
The latter still needs polling.

I think you should call reset_control_status() first, and check for
-ENOTSUPP, which would indicate that reset status is not available.

> +
> +       return 0;
>  }
>
>  static int rcar_i2c_master_xfer(struct i2c_adapter *adap,

> @@ -1194,9 +1200,15 @@ static int rcar_i2c_probe(struct platform_device *pdev)
>                         goto out_pm_put;
>                 }
>
> -               ret = reset_control_status(priv->rstc);
> -               if (ret < 0)
> -                       goto out_pm_put;
> +               /*
> +                * Gen5+ uses SCMI based reset which cannot report status.
> +                * Firmware has to ensure proper reset
> +                */
> +               if (priv->devtype < I2C_RCAR_GEN5) {
> +                       ret = reset_control_status(priv->rstc);
> +                       if (ret < 0)
> +                               goto out_pm_put;
> +               }

Likewise, i.e. call reset_control_status() unconditionally, and
ignore -ENOTSUPP.

>
>                 /* hard reset disturbs HostNotify local target, so disable it */
>                 priv->flags &= ~ID_P_HOST_NOTIFY;

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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