aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/uniphier
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2016-05-31 04:05:17 -0400
committerLinus Walleij <linus.walleij@linaro.org>2016-05-31 06:49:48 -0400
commitaa543888ca8c033a7f06499b93cdfec84ad6ab27 (patch)
treef3ba535e18c45be3a5b0b6d4edf44a36273138f4 /drivers/pinctrl/uniphier
parentc2ebf4754b92f9fb1e422c8c068da7f0b12c9432 (diff)
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 updates the core part for that. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/uniphier')
-rw-r--r--drivers/pinctrl/uniphier/pinctrl-uniphier-core.c24
-rw-r--r--drivers/pinctrl/uniphier/pinctrl-uniphier.h1
2 files changed, 14 insertions, 11 deletions
diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c
index ca2562ac1180..d774a8e9c6a1 100644
--- a/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c
+++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c
@@ -433,22 +433,24 @@ static int uniphier_conf_pin_input_enable(struct pinctrl_dev *pctldev,
433{ 433{
434 struct uniphier_pinctrl_priv *priv = pinctrl_dev_get_drvdata(pctldev); 434 struct uniphier_pinctrl_priv *priv = pinctrl_dev_get_drvdata(pctldev);
435 unsigned int iectrl = uniphier_pin_get_iectrl(desc->drv_data); 435 unsigned int iectrl = uniphier_pin_get_iectrl(desc->drv_data);
436 unsigned int reg, mask;
436 437
437 if (enable == 0) { 438 /*
438 /* 439 * Multiple pins share one input enable, per-pin disabling is
439 * Multiple pins share one input enable, so per-pin disabling 440 * impossible.
440 * is impossible. 441 */
441 */ 442 if (!(priv->socdata->caps & UNIPHIER_PINCTRL_CAPS_PERPIN_IECTRL) &&
442 dev_err(pctldev->dev, "unable to disable input\n"); 443 !enable)
443 return -EINVAL; 444 return -EINVAL;
444 }
445 445
446 /* UNIPHIER_PIN_IECTRL_NONE means the pin is always input-enabled */
446 if (iectrl == UNIPHIER_PIN_IECTRL_NONE) 447 if (iectrl == UNIPHIER_PIN_IECTRL_NONE)
447 /* This pin is always input-enabled. nothing to do. */ 448 return enable ? 0 : -EINVAL;
448 return 0; 449
450 reg = UNIPHIER_PINCTRL_IECTRL + iectrl / 32 * 4;
451 mask = BIT(iectrl % 32);
449 452
450 return regmap_update_bits(priv->regmap, UNIPHIER_PINCTRL_IECTRL, 453 return regmap_update_bits(priv->regmap, reg, mask, enable ? mask : 0);
451 BIT(iectrl), BIT(iectrl));
452} 454}
453 455
454static int uniphier_conf_pin_config_set(struct pinctrl_dev *pctldev, 456static int uniphier_conf_pin_config_set(struct pinctrl_dev *pctldev,
diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier.h b/drivers/pinctrl/uniphier/pinctrl-uniphier.h
index 3fd50206c310..9941a4ceb5c5 100644
--- a/drivers/pinctrl/uniphier/pinctrl-uniphier.h
+++ b/drivers/pinctrl/uniphier/pinctrl-uniphier.h
@@ -166,6 +166,7 @@ struct uniphier_pinctrl_socdata {
166 const struct uniphier_pinmux_function *functions; 166 const struct uniphier_pinmux_function *functions;
167 int functions_count; 167 int functions_count;
168 unsigned int caps; 168 unsigned int caps;
169#define UNIPHIER_PINCTRL_CAPS_PERPIN_IECTRL BIT(1)
169#define UNIPHIER_PINCTRL_CAPS_DBGMUX_SEPARATE BIT(0) 170#define UNIPHIER_PINCTRL_CAPS_DBGMUX_SEPARATE BIT(0)
170}; 171};
171 172