diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2017-07-31 09:21:08 +0300 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2017-08-14 16:01:00 +0300 |
commit | 7f6ee0a5791bf78b01232c290ce548159ceebfe2 (patch) | |
tree | fbba86f66d0d373d86c27bfd90daa1d0b1282440 /drivers/pinctrl/uniphier/pinctrl-uniphier.h | |
parent | e3829d15460feb884805012c72ec4a17402822eb (diff) | |
download | linux-7f6ee0a5791bf78b01232c290ce548159ceebfe2.tar.xz |
pinctrl: uniphier: clean up GPIO port muxing
There are a bunch of GPIO muxing data, but most of them are actually
unneeded because GPIO-to-pin mapping can be specified by "gpio-ranges"
DT properties.
Tables that contain a set of GPIO pins are still needed for the named
mapping by "gpio-ranges-group-names". This is a much cleaner way for
UniPhier SoC family where GPIO numbers are not straight mapped to pin
numbers.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/uniphier/pinctrl-uniphier.h')
-rw-r--r-- | drivers/pinctrl/uniphier/pinctrl-uniphier.h | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier.h b/drivers/pinctrl/uniphier/pinctrl-uniphier.h index 6f2f33bf788f..b040a3b56c52 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier.h +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier.h @@ -131,18 +131,11 @@ static inline unsigned int uniphier_pin_get_pull_dir(void *drv_data) UNIPHIER_PIN_PULL_DIR_MASK; } -enum uniphier_pinmux_gpio_range_type { - UNIPHIER_PINMUX_GPIO_RANGE_PORT, - UNIPHIER_PINMUX_GPIO_RANGE_IRQ, - UNIPHIER_PINMUX_GPIO_RANGE_NONE, -}; - struct uniphier_pinctrl_group { const char *name; const unsigned *pins; unsigned num_pins; const int *muxvals; - enum uniphier_pinmux_gpio_range_type range_type; }; struct uniphier_pinmux_function { @@ -158,6 +151,7 @@ struct uniphier_pinctrl_socdata { int groups_count; const struct uniphier_pinmux_function *functions; int functions_count; + int (*get_gpio_muxval)(unsigned int pin, unsigned int gpio_offset); unsigned int caps; #define UNIPHIER_PINCTRL_CAPS_PERPIN_IECTRL BIT(1) #define UNIPHIER_PINCTRL_CAPS_DBGMUX_SEPARATE BIT(0) @@ -170,33 +164,22 @@ struct uniphier_pinctrl_socdata { .drv_data = (void *)UNIPHIER_PIN_ATTR_PACKED(c, d, e, f, g), \ } -#define __UNIPHIER_PINCTRL_GROUP(grp, type) \ +#define __UNIPHIER_PINCTRL_GROUP(grp, mux) \ { \ .name = #grp, \ .pins = grp##_pins, \ .num_pins = ARRAY_SIZE(grp##_pins), \ - .muxvals = grp##_muxvals + \ - BUILD_BUG_ON_ZERO(ARRAY_SIZE(grp##_pins) != \ - ARRAY_SIZE(grp##_muxvals)), \ - .range_type = type, \ + .muxvals = mux, \ } #define UNIPHIER_PINCTRL_GROUP(grp) \ - __UNIPHIER_PINCTRL_GROUP(grp, UNIPHIER_PINMUX_GPIO_RANGE_NONE) - -#define UNIPHIER_PINCTRL_GROUP_GPIO_RANGE_PORT(grp) \ - __UNIPHIER_PINCTRL_GROUP(grp, UNIPHIER_PINMUX_GPIO_RANGE_PORT) - -#define UNIPHIER_PINCTRL_GROUP_GPIO_RANGE_IRQ(grp) \ - __UNIPHIER_PINCTRL_GROUP(grp, UNIPHIER_PINMUX_GPIO_RANGE_IRQ) + __UNIPHIER_PINCTRL_GROUP(grp, \ + grp##_muxvals + \ + BUILD_BUG_ON_ZERO(ARRAY_SIZE(grp##_pins) != \ + ARRAY_SIZE(grp##_muxvals))) -#define UNIPHIER_PINCTRL_GROUP_SINGLE(grp, array, ofst) \ - { \ - .name = #grp, \ - .pins = array##_pins + ofst, \ - .num_pins = 1, \ - .muxvals = array##_muxvals + ofst, \ - } +#define UNIPHIER_PINCTRL_GROUP_GPIO(grp) \ + __UNIPHIER_PINCTRL_GROUP(grp, NULL) #define UNIPHIER_PINMUX_FUNCTION(func) \ { \ |