diff options
author | Stefan Agner <stefan.agner@toradex.com> | 2013-09-24 17:38:00 +0200 |
---|---|---|
committer | Stefan Agner <stefan.agner@toradex.com> | 2013-09-24 17:40:07 +0200 |
commit | 426b5e3157b00f34986116c2dcf93f50ea061565 (patch) | |
tree | cc607536a6b97f12f264f95390d6abdbd4da55c2 | |
parent | d09356cc2ac45f0e0537460ed8a100a8a485174a (diff) |
mvf-gpio: Don't overwrite mux flags
In order to use GPIOs in floating mode, the GPIO driver should not
alter the muxing settings made by pinmux. This patch reads the
current muxing settings and alters only the direction.
-rw-r--r-- | arch/arm/plat-mxc/gpio-mvf.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/arm/plat-mxc/gpio-mvf.c b/arch/arm/plat-mxc/gpio-mvf.c index ee1344f35573..58bdb781cf24 100644 --- a/arch/arm/plat-mxc/gpio-mvf.c +++ b/arch/arm/plat-mxc/gpio-mvf.c @@ -183,16 +183,18 @@ static void _set_gpio_direction(struct gpio_chip *chip, unsigned offset, pad_addr = MVF_IO_ADDRESS( MVF_IOMUXC_BASE_ADDR + 4 * (chip->base + offset)); + /* Get current flags, clear direction */ + l = __raw_readl(pad_addr) & ~(PAD_CTL_OBE_ENABLE | PAD_CTL_IBE_ENABLE); + if (dir) - l = MVF600_GPIO_GENERAL_CTRL | PAD_CTL_OBE_ENABLE; + l |= PAD_CTL_OBE_ENABLE; else { - l = MVF600_GPIO_GENERAL_CTRL | PAD_CTL_IBE_ENABLE; + l |= PAD_CTL_IBE_ENABLE; __raw_writel((1 << offset), port->base_int + GPIO_DFER); __raw_writel(1, port->base_int + GPIO_DFCR); __raw_writel(0xFF, port->base_int + GPIO_DFWR); } - /*Note: This will destroy the original IOMUX settings.*/ __raw_writel(l, pad_addr); spin_unlock_irqrestore(&port->lock, flags); |