summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAdam Ford <aford173@gmail.com>2018-06-11 20:05:38 -0500
committerTom Rini <trini@konsulko.com>2018-06-18 14:43:14 -0400
commitb4c3fb087b06ec56cc325e2e73f8f497be89d129 (patch)
treef835d3cbb1e6e2e751af7ae356e9fa9e2ddba7cc /drivers
parentbd8a9c14c91c61980e1f68ac1e6e1f22632f4c98 (diff)
gpio: omap_gpio: Name GPIO's by bank and index with DM_GPIO
There are multiple GPIO banks with up to 32 pins / bank. When using 'gpio status -a' to read the pins, this patch displays both GPIO<bank>_<index> similar to how the device trees display in addition to displaying gpio_# Signed-off-by: Adam Ford <aford173@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpio/omap_gpio.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/gpio/omap_gpio.c b/drivers/gpio/omap_gpio.c
index d128f942a0..79a975ce71 100644
--- a/drivers/gpio/omap_gpio.c
+++ b/drivers/gpio/omap_gpio.c
@@ -288,11 +288,17 @@ static int omap_gpio_probe(struct udevice *dev)
struct gpio_bank *bank = dev_get_priv(dev);
struct omap_gpio_platdata *plat = dev_get_platdata(dev);
struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
+ int banknum;
+ char name[18], *str;
- uc_priv->bank_name = plat->port_name;
+ banknum = plat->bank_index;
+ sprintf(name, "GPIO%d_", banknum + 1);
+ str = strdup(name);
+ if (!str)
+ return -ENOMEM;
+ uc_priv->bank_name = str;
uc_priv->gpio_count = GPIO_PER_BANK;
bank->base = (void *)plat->base;
-
return 0;
}