pinctrl: freescale: imx: allow mux_reg offset zero
authorAdrian Alonso <aalonso@freescale.com>
Fri, 25 Sep 2015 21:05:59 +0000 (16:05 -0500)
committerLinus Walleij <linus.walleij@linaro.org>
Fri, 2 Oct 2015 21:37:06 +0000 (14:37 -0700)
Allow mux_reg offset zero to be a valid pin_id, on imx7d
mux_conf reg offset is zero for iomuxc-lspr controller

Signed-off-by: Adrian Alonso <aalonso@freescale.com>
Acked-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/freescale/pinctrl-imx.c
drivers/pinctrl/freescale/pinctrl-imx.h

index b9c6deb969247e9cb3b0f721d23ed0a6e2a0ee3f..151d50daeb8064e4aaf3d23cde81ec5b16067f8e 100644 (file)
@@ -542,6 +542,9 @@ static int imx_pinctrl_parse_groups(struct device_node *np,
                struct imx_pin_reg *pin_reg;
                struct imx_pin *pin = &grp->pins[i];
 
+               if (!(info->flags & ZERO_OFFSET_VALID) && !mux_reg)
+                       mux_reg = -1;
+
                if (info->flags & SHARE_MUX_CONF_REG) {
                        conf_reg = mux_reg;
                } else {
@@ -550,7 +553,7 @@ static int imx_pinctrl_parse_groups(struct device_node *np,
                                conf_reg = -1;
                }
 
-               pin_id = mux_reg ? mux_reg / 4 : conf_reg / 4;
+               pin_id = (mux_reg != -1) ? mux_reg / 4 : conf_reg / 4;
                pin_reg = &info->pin_regs[pin_id];
                pin->pin = pin_id;
                grp->pin_ids[i] = pin_id;
index 2a5fe729fe069bf9907e289614fadbab7cfac66e..2a592f657c184918ab1e7fbb6d9a4d862f0a2ab5 100644 (file)
@@ -85,6 +85,7 @@ struct imx_pinctrl_soc_info {
 };
 
 #define SHARE_MUX_CONF_REG     0x1
+#define ZERO_OFFSET_VALID      0x2
 
 #define NO_MUX         0x0
 #define NO_PAD         0x0