]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
gpio: dw: Add ngpios DT-property support
authorMaksim Kiselev <bigunclemax@gmail.com>
Fri, 20 Sep 2024 09:05:23 +0000 (12:05 +0300)
committerLeo Yu-Chi Liang <ycliang@andestech.com>
Mon, 28 Oct 2024 08:11:33 +0000 (16:11 +0800)
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>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
drivers/gpio/dwapb_gpio.c

index 7a6eae9ba18654aac42df247969408449dd407af..04639a4cb68262938578ef9a30fa495c05f3add4 100644 (file)
@@ -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)) {