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

From: Florian Fainelli
Date: Wed Mar 03 2021 - 14:38:39 EST


On 3/3/21 6:06 AM, Álvaro Fernández Rojas wrote:
> Hi Philipp,
>
>> El 3 mar 2021, a las 14:52, Philipp Zabel <p.zabel@xxxxxxxxxxxxxx> escribió:
>>
>> 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.
>
> In only added reset_control_rearm() because Florian requested it…
> I think it’s not needed, so we can use v3, since it was the only change between v3 and v4...

Not the first time I am confused by the reset API not sure if I will
ever get it one day, so apologies for suggesting something incorrect here.
--
Florian