X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=drivers%2Fgpio%2Fmxs_gpio.c;h=367b852039da52ccd23b9f99162cc53984dcc516;hb=ca75159d8abc085b39e3e468ca34ccb2940d2bf5;hp=da0199b168ad68c8c69307e829c8fa715e3a86e4;hpb=4b0561d84198f8d696fd51cfc27aeac8c7482a8c;p=u-boot diff --git a/drivers/gpio/mxs_gpio.c b/drivers/gpio/mxs_gpio.c index da0199b168..367b852039 100644 --- a/drivers/gpio/mxs_gpio.c +++ b/drivers/gpio/mxs_gpio.c @@ -8,8 +8,7 @@ */ #include -#include -#include +#include #include #include #include @@ -114,3 +113,18 @@ int gpio_free(unsigned gpio) { return 0; } + +int name_to_gpio(const char *name) +{ + unsigned bank, pin; + char *end; + + bank = simple_strtoul(name, &end, 10); + + if (!*end || *end != ':') + return bank; + + pin = simple_strtoul(end + 1, NULL, 10); + + return (bank << MXS_PAD_BANK_SHIFT) | (pin << MXS_PAD_PIN_SHIFT); +}