[U-Boot] [PATCH v4] gpio: dwapb_gpio: Add reset ctrl to driver

Marek Vasut marex at denx.de
Thu Aug 30 09:07:02 UTC 2018


On 08/30/2018 02:45 AM, Ley Foon Tan wrote:
> On Wed, Aug 29, 2018 at 7:57 PM Marek Vasut <marex at denx.de> wrote:
>>
>> On 08/29/2018 10:44 AM, Ley Foon Tan wrote:
>>> Add code to reset all reset signals as in gpio DT node. A reset property
>>> is an optional feature, so only print out a warning and do not fail if a
>>> reset property is not present.
>>>
>>> If a reset property is discovered, then use it to deassert, thus
>>> bringing the IP out of reset.
>>>
>>> Signed-off-by: Ley Foon Tan <ley.foon.tan at intel.com>
>>
>> This is much better.
>>
>>> +static int gpio_dwapb_reset(struct udevice *dev)
>>> +{
>>> +     int ret;
>>> +     struct gpio_dwapb_priv *priv = dev_get_priv(dev);
>>> +
>>> +     ret = reset_get_bulk(dev, &priv->resets);
>>> +     if (ret) {
>>> +             dev_warn(dev, "Can't get reset: %d\n", ret);
>>
>> Won't this barf on machines which either don't have DM_RESET enabled or
>> don't have it described in DT ?
> By default, dev_warn() is not show up. Or we can move this dev_warn
> when "return ret" error below.

I think that'd be better. If there is no reset support, no point in
warning. Or what do you think ?

btw you could then also flatten the indent with some
ret = reset....
if (ret == -ENOENT || ....)
 return 0;

dev_warn();
return ret;

>>> +             /* Return 0 if error due to !CONFIG_DM_RESET and reset
>>> +              * DT property is not present.
>>> +              */
>>> +             if (ret == -ENOENT || ret == -ENOTSUPP)
>>> +                     return 0;
>>> +             else
>>> +                     return ret;
>>> +     }
>> [...]
>>
>> --
>> Best regards,
>> Marek Vasut


-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list