diff mbox series

[v1,1/2] gpio: dw: Add ngpios DT-property support

Message ID 20240920090532.280504-2-bigunclemax@gmail.com
State New
Headers show
Series riscv: add GPIO support for the LicheePi4A | expand

Commit Message

Maxim Kiselev Sept. 20, 2024, 9:05 a.m. UTC
From: Maksim Kiselev <bigunclemax@gmail.com>

Starting with Linux commit 7569486d79ae ("gpio: dwapb: Add ngpios
DT-property support") the "snps,nr-gpios" property was marked
as deprecated.

And since all newly added dw-apb-gpio nodes are described using generic
"ngpios" property, it's time to add support for it.

Signed-off-by: Maksim Kiselev <bigunclemax@gmail.com>
---
 drivers/gpio/dwapb_gpio.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/gpio/dwapb_gpio.c b/drivers/gpio/dwapb_gpio.c
index 7a6eae9ba1..04639a4cb6 100644
--- a/drivers/gpio/dwapb_gpio.c
+++ b/drivers/gpio/dwapb_gpio.c
@@ -177,7 +177,9 @@  static int gpio_dwapb_bind(struct udevice *dev)
 
 		plat->base = (void *)base;
 		plat->bank = bank;
-		plat->pins = ofnode_read_u32_default(node, "snps,nr-gpios", 0);
+
+		if (ofnode_read_u32(node, "ngpios", &plat->pins))
+			plat->pins = ofnode_read_u32_default(node, "snps,nr-gpios", 0);
 
 		if (ofnode_read_string_index(node, "bank-name", 0,
 					     &plat->name)) {