]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
gpio: da8xx_gpio: Fix gpio name with address
authorchao zeng <chao.zeng@siemens.com>
Fri, 7 Jan 2022 03:26:24 +0000 (11:26 +0800)
committerTom Rini <trini@konsulko.com>
Sun, 16 Jan 2022 13:31:03 +0000 (08:31 -0500)
The GPIO bank numbers do not appear in the device tree,
so make the gpio name based on the address
(ie gpio@42110000_25 vs 25)

Signed-off-by: chao zeng <chao.zeng@siemens.com>
drivers/gpio/da8xx_gpio.c

index d106e9846dfb2ddacee98767ec27ff51131d2662..b310f2dbf65183dc0c7463c32d349c759e4c9596 100644 (file)
@@ -545,12 +545,20 @@ static int davinci_gpio_of_to_plat(struct udevice *dev)
 {
        struct davinci_gpio_plat *plat = dev_get_plat(dev);
        fdt_addr_t addr;
+       char name[18], *str;
 
        addr = dev_read_addr(dev);
        if (addr == FDT_ADDR_T_NONE)
                return -EINVAL;
 
        plat->base = addr;
+
+       sprintf(name, "gpio@%4x_", (unsigned int)plat->base);
+       str = strdup(name);
+       if (!str)
+               return -ENOMEM;
+       plat->port_name = str;
+
        return 0;
 }