summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/freescale/pinctrl-vf610.c
diff options
context:
space:
mode:
authorDong Aisheng <aisheng.dong@nxp.com>2017-07-25 21:41:55 +0800
committerLinus Walleij <linus.walleij@linaro.org>2017-08-14 15:01:01 +0200
commit3be6f65102a859d0a4b1b6448df8f4214f3d45ae (patch)
treeb57f2697a8168ab245e6febce4f8b8b1e7f167b5 /drivers/pinctrl/freescale/pinctrl-vf610.c
parenta5c771e6cbdbe026d933c28a7705f6246bac7e64 (diff)
downloadlinux-3be6f65102a859d0a4b1b6448df8f4214f3d45ae.tar.gz
linux-3be6f65102a859d0a4b1b6448df8f4214f3d45ae.tar.bz2
linux-3be6f65102a859d0a4b1b6448df8f4214f3d45ae.zip
pinctrl: imx: make imx_pmx_ops.gpio_set_direction platform specific callbacks
Various IMX platforms may have different imx_pmx_ops.gpio_set_direction implementations, so let's make it platform specific callbacks instead of the fixed common one. Currently only VF610 platform implements it. No function level changes. Cc: Alexandre Courbot <gnurou@gmail.com> Cc: Shawn Guo <shawnguo@kernel.org> Acked-by: Stefan Agner <stefan@agner.ch> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/freescale/pinctrl-vf610.c')
-rw-r--r--drivers/pinctrl/freescale/pinctrl-vf610.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/pinctrl/freescale/pinctrl-vf610.c b/drivers/pinctrl/freescale/pinctrl-vf610.c
index 3bd85564d1e4..ac18bb6d6d5e 100644
--- a/drivers/pinctrl/freescale/pinctrl-vf610.c
+++ b/drivers/pinctrl/freescale/pinctrl-vf610.c
@@ -295,10 +295,35 @@ static const struct pinctrl_pin_desc vf610_pinctrl_pads[] = {
IMX_PINCTRL_PIN(VF610_PAD_PTA7),
};
+static int vf610_pmx_gpio_set_direction(struct pinctrl_dev *pctldev,
+ struct pinctrl_gpio_range *range,
+ unsigned offset, bool input)
+{
+ struct imx_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev);
+ struct imx_pinctrl_soc_info *info = ipctl->info;
+ const struct imx_pin_reg *pin_reg;
+ u32 reg;
+
+ pin_reg = &info->pin_regs[offset];
+ if (pin_reg->mux_reg == -1)
+ return -EINVAL;
+
+ /* IBE always enabled allows us to read the value "on the wire" */
+ reg = readl(ipctl->base + pin_reg->mux_reg);
+ if (input)
+ reg &= ~0x2;
+ else
+ reg |= 0x2;
+ writel(reg, ipctl->base + pin_reg->mux_reg);
+
+ return 0;
+}
+
static struct imx_pinctrl_soc_info vf610_pinctrl_info = {
.pins = vf610_pinctrl_pads,
.npins = ARRAY_SIZE(vf610_pinctrl_pads),
.flags = SHARE_MUX_CONF_REG | ZERO_OFFSET_VALID,
+ .gpio_set_direction = vf610_pmx_gpio_set_direction,
.mux_mask = 0x700000,
.mux_shift = 20,
};