summaryrefslogtreecommitdiff
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2016-09-26 15:34:59 -0700
committerStefan Agner <stefan.agner@toradex.com>2016-09-29 13:58:31 -0700
commitfa359d75f35900293ca8ee3189d9f0f867f4f8c0 (patch)
tree30338f45c3c73efc815822afd6176f3a56d7258f /drivers/pinctrl
parent624f65bc460ad13e7f164386b9b54a8ed7961e1b (diff)
pinctrl: freescale: avoid overwriting pin config when freeing GPIO
If a GPIO gets freed after selecting a new pinctrl configuration the driver should not change pinctrl anymore. Otherwise this will likely lead to a unusable pin configuration for the newly selected pinctrl. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/freescale/pinctrl-imx.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index a7e1cc80d904..3035d33f5957 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -363,8 +363,13 @@ static void imx_pmx_gpio_disable_free(struct pinctrl_dev *pctldev,
if (pin_reg->mux_reg == -1)
return;
- /* Clear IBE/OBE/PUE to disable the pin (Hi-Z) */
reg = readl(ipctl->base + pin_reg->mux_reg);
+
+ /* Only change pad configuration if pad is still a GPIO */
+ if (reg & (0x7 << 20))
+ return;
+
+ /* Clear IBE/OBE/PUE to disable the pin (Hi-Z) */
reg &= ~0x7;
writel(reg, ipctl->base + pin_reg->mux_reg);
}