gpio: mxc_gpio: change gpio index for i.MX8
authorYe Li <ye.li@nxp.com>
Wed, 10 Jun 2020 03:28:02 +0000 (20:28 -0700)
committerStefano Babic <sbabic@denx.de>
Mon, 22 Jun 2020 22:08:53 +0000 (00:08 +0200)
Since the i.MX8 GPIO banks are indexed from 0 not 1 on other i.MX
platforms, so we have to adjust the index accordingly.

Signed-off-by: Adrian Alonso <adrian.alonso@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
drivers/gpio/mxc_gpio.c

index c924e52f0713109f069875a4033d2c9a5daff242..316dcc757b242e093b8ebbd8e3db360877f0a3ab 100644 (file)
@@ -281,7 +281,10 @@ static int mxc_gpio_probe(struct udevice *dev)
        char name[18], *str;
 
        banknum = plat->bank_index;
-       sprintf(name, "GPIO%d_", banknum + 1);
+       if (IS_ENABLED(CONFIG_ARCH_IMX8))
+               sprintf(name, "GPIO%d_", banknum);
+       else
+               sprintf(name, "GPIO%d_", banknum + 1);
        str = strdup(name);
        if (!str)
                return -ENOMEM;