Re: [PATCH RFT 1/2] i2c: rcar: reset controller is mandatory for Gen3+

From: Geert Uytterhoeven
Date: Tue Sep 19 2023 - 05:27:47 EST


Hi Wolfram,

On Tue, Sep 19, 2023 at 11:19 AM Wolfram Sang
<wsa+renesas@xxxxxxxxxxxxxxxxxxxx> wrote:
> > > + ret = reset_control_status(priv->rstc);
> > > + if (ret < 0)
> > > + return ret;
> >
> > This is a pre-existing check, but do you really need it?
> > This condition will be true if the reset is still asserted, which
> > could happen due to some glitch, or force-booting into a new kernel
> > using kexec. And AFAIUI, that should be resolved by the call to
> > rcar_i2c_do_reset() above.
>
> This check is needed to ensure reset_control_status() really works
> because we need it in rcar_i2c_do_reset(). From the docs:
>
> "reset_control_status - returns a negative errno if not supported,..."
>
> The code only checks for that, not for the status of the reset line.

Right, I missed the negative.
I don't think this can fail on R-Car Gen2+ (using the CPG/MSSR driver)
if devm_reset_control_get_exclusive() succeeded, but it's prudent, in
case the block is every reused on a different SoC family.

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