summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/pinctrl-at91.c
diff options
context:
space:
mode:
authorWenyou Yang <wenyou.yang@atmel.com>2014-09-11 16:40:15 +0200
committerLinus Walleij <linus.walleij@linaro.org>2014-09-23 16:59:55 +0200
commit3d78427397daea47b5a38642f46f75ef993de571 (patch)
treecec67819ee95331748d6c128ee78565511a42a76 /drivers/pinctrl/pinctrl-at91.c
parent7471725f618b95d2a61a4bf789dbdc5c7805ffa9 (diff)
downloadlinux-3d78427397daea47b5a38642f46f75ef993de571.tar.gz
linux-3d78427397daea47b5a38642f46f75ef993de571.tar.bz2
linux-3d78427397daea47b5a38642f46f75ef993de571.zip
pinctrl: at91: disable PD or PU before enabling PU or PD
Disable Pull-Down or Pull-Up property before enabling Pull-Up or Pull-Down, because the pin's Pull-Up and Pull-Down property is mutually exclusive. Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinctrl-at91.c')
-rw-r--r--drivers/pinctrl/pinctrl-at91.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index 51d094cc3f10..09de74964276 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -371,6 +371,9 @@ static unsigned at91_mux_get_pullup(void __iomem *pio, unsigned pin)
static void at91_mux_set_pullup(void __iomem *pio, unsigned mask, bool on)
{
+ if (on)
+ writel_relaxed(mask, pio + PIO_PPDDR);
+
writel_relaxed(mask, pio + (on ? PIO_PUER : PIO_PUDR));
}
@@ -499,6 +502,9 @@ static bool at91_mux_pio3_get_pulldown(void __iomem *pio, unsigned pin)
static void at91_mux_pio3_set_pulldown(void __iomem *pio, unsigned mask, bool is_on)
{
+ if (is_on)
+ __raw_writel(mask, pio + PIO_PUDR);
+
__raw_writel(mask, pio + (is_on ? PIO_PPDER : PIO_PPDDR));
}