Re: [PATCH 04/17] gpio: dwapb_gpio: Enable all clocks

Marek Vasut via U-Boot <[email protected]> Sun, 2 Aug 2026 05:34:44 +0200
Newsgroups gmane.comp.boot-loaders.u-boot
Message-ID <[email protected]>
On 7/31/26 6:33 PM, Ralph Siemsen wrote:
> On some SoC (such as RZ/N1) it is necessary to enable clocks prior to
> using the register interface.
> 
> Signed-off-by: Ralph Siemsen <[email protected]>
> ---
>   drivers/gpio/dwapb_gpio.c | 11 ++++++++++-
>   1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpio/dwapb_gpio.c b/drivers/gpio/dwapb_gpio.c
> index 7ab48780332..6fa50a2c2af 100644
> --- a/drivers/gpio/dwapb_gpio.c
> +++ b/drivers/gpio/dwapb_gpio.c
> @@ -7,6 +7,7 @@
>   
>   #include <asm/gpio.h>
>   #include <asm/io.h>
> +#include <clk.h>
>   #include <dm/device.h>
>   #include <dm/device-internal.h>
>   #include <dm/device_compat.h>
> @@ -28,6 +29,7 @@
>   
>   struct gpio_dwapb_priv {
>   	struct reset_ctl_bulk	resets;
> +	struct clk_bulk		clks;
>   };
>   
>   struct gpio_dwapb_plat {
> @@ -136,8 +138,13 @@ static int gpio_dwapb_probe(struct udevice *dev)
>   {
>   	struct gpio_dev_priv *priv = dev_get_uclass_priv(dev);
>   	struct gpio_dwapb_plat *plat = dev_get_plat(dev);
> +	struct gpio_dwapb_priv *dw_priv = dev_get_priv(dev);
>   
>   	if (!plat) {
> +		/* Enable clocks on parent device only */
> +		if (clk_get_bulk(dev, &dw_priv->clks) == 0)

You do need to handle return value here.