Re: [PATCH v4 2/2] hwrng: bcm2835: add reset support

Philipp Zabel
2021-03-03T18:11:08Z

Hi Álvaro,

On Wed, 2021-02-24 at 09:22 +0100, Álvaro Fernández Rojas wrote:
[...]
> @@ -115,6 +121,8 @@ static void bcm2835_rng_cleanup(struct hwrng *rng)
> /* disable rng hardware */
> rng_writel(priv, 0, RNG_CTRL);
>
> + reset_control_rearm(priv->reset);
> +
> if (!IS_ERR(priv->clk))
> clk_disable_unprepare(priv->clk);
> }
> @@ -159,6 +167,10 @@ static int bcm2835_rng_probe(struct platform_device *pdev)
> if (PTR_ERR(priv->clk) == -EPROBE_DEFER)
> return -EPROBE_DEFER;
>
> + priv->reset = devm_reset_control_get_optional_exclusive(dev, NULL);
> + if (IS_ERR(priv->reset))
> + return PTR_ERR(priv->reset);
> +
> priv->rng.name = pdev->name;
> priv->rng.init = bcm2835_rng_init;
> priv->rng.read = bcm2835_rng_read;

That doesn't seem right. reset_control_rearm() doesn't do anything if
the reset control is exclusive. Either the reset control should be
requested as shared, or the _rearm should be removed.

regards
Philipp