[PATCH 6/8] gpio: mvebu_gpio: Read number of gpios from DT

Pali Rohár pali at kernel.org
Mon Jul 25 13:56:13 CEST 2022


Device tree property "ngpios" contains number of gpios.
Use it when available.

Signed-off-by: Pali Rohár <pali at kernel.org>
---
 drivers/gpio/mvebu_gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/mvebu_gpio.c b/drivers/gpio/mvebu_gpio.c
index 888ccfe4d13e..55ed685f70f8 100644
--- a/drivers/gpio/mvebu_gpio.c
+++ b/drivers/gpio/mvebu_gpio.c
@@ -92,7 +92,7 @@ static int mvebu_gpio_probe(struct udevice *dev)
 	struct mvebu_gpio_priv *priv = dev_get_priv(dev);
 
 	priv->regs = dev_read_addr_ptr(dev);
-	uc_priv->gpio_count = MVEBU_GPIOS_PER_BANK;
+	uc_priv->gpio_count = dev_read_u32_default(dev, "ngpios", MVEBU_GPIOS_PER_BANK);
 	priv->name[0] = 'A' + dev_seq(dev);
 	uc_priv->bank_name = priv->name;
 
-- 
2.20.1



More information about the U-Boot mailing list