diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2016-03-24 22:32:45 +0900 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2016-04-01 00:56:07 +0900 |
commit | 3b05b5f0e450bbe8414d60c6c1ff44ef0cf3174a (patch) | |
tree | 05b91eab11527186569c5b90cc9e595a9471ad2a /drivers/pinctrl/uniphier | |
parent | 8cc92b996ddecd4c364d0bbb474c3569ebec55c7 (diff) | |
download | u-boot-3b05b5f0e450bbe8414d60c6c1ff44ef0cf3174a.tar.gz u-boot-3b05b5f0e450bbe8414d60c6c1ff44ef0cf3174a.tar.xz u-boot-3b05b5f0e450bbe8414d60c6c1ff44ef0cf3174a.zip |
pinctrl: uniphier: support per-pin input enable for new SoCs
Upcoming new pinctrl drivers for PH1-LD11 and PH-LD20 support input
signal gating for each pin. (While, existing ones only support it
per pin-group.) This commit prepares the core part for that.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'drivers/pinctrl/uniphier')
-rw-r--r-- | drivers/pinctrl/uniphier/pinctrl-uniphier-core.c | 28 | ||||
-rw-r--r-- | drivers/pinctrl/uniphier/pinctrl-uniphier.h | 1 |
2 files changed, 28 insertions, 1 deletions
diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c index bb7a088746..b8e26d90e2 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c @@ -44,7 +44,23 @@ static const char *uniphier_pinmux_get_function_name(struct udevice *dev, return priv->socdata->functions[selector]; } -static void uniphier_pinconf_input_enable(struct udevice *dev, unsigned pin) +static void uniphier_pinconf_input_enable_perpin(struct udevice *dev, + unsigned pin) +{ + struct uniphier_pinctrl_priv *priv = dev_get_priv(dev); + unsigned reg; + u32 mask, tmp; + + reg = UNIPHIER_PINCTRL_IECTRL + pin / 32 * 4; + mask = BIT(pin % 32); + + tmp = readl(priv->base + reg); + tmp |= mask; + writel(tmp, priv->base + reg); +} + +static void uniphier_pinconf_input_enable_legacy(struct udevice *dev, + unsigned pin) { struct uniphier_pinctrl_priv *priv = dev_get_priv(dev); int pins_count = priv->socdata->pins_count; @@ -64,6 +80,16 @@ static void uniphier_pinconf_input_enable(struct udevice *dev, unsigned pin) } } +static void uniphier_pinconf_input_enable(struct udevice *dev, unsigned pin) +{ + struct uniphier_pinctrl_priv *priv = dev_get_priv(dev); + + if (priv->socdata->caps & UNIPHIER_PINCTRL_CAPS_PERPIN_IECTRL) + uniphier_pinconf_input_enable_perpin(dev, pin); + else + uniphier_pinconf_input_enable_legacy(dev, pin); +} + static void uniphier_pinmux_set_one(struct udevice *dev, unsigned pin, unsigned muxval) { diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier.h b/drivers/pinctrl/uniphier/pinctrl-uniphier.h index d582317291..2b438482b1 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier.h +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier.h @@ -70,6 +70,7 @@ struct uniphier_pinctrl_socdata { const char * const *functions; int functions_count; unsigned caps; +#define UNIPHIER_PINCTRL_CAPS_PERPIN_IECTRL BIT(1) #define UNIPHIER_PINCTRL_CAPS_DBGMUX_SEPARATE BIT(0) }; |