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

Marek Vasut marex at denx.de
Wed Aug 29 11:35:07 UTC 2018


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 ?

> +		/* 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


More information about the U-Boot mailing list