pinctrl: fsl: imx: Check for 0 config register
authorMarkus Pargmann <mpa@pengutronix.de>
Tue, 24 Mar 2015 15:26:18 +0000 (16:26 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 7 Apr 2015 13:11:00 +0000 (15:11 +0200)
0 is used in all pinfunction definitions when a config register is not
available, for example imx25-pinfunc.h. If a configuration value is used
for such a pinfunction the driver will always write it to the
configuration register if it is not -1. For a 0 configuration register
the configuration value is written to offset 0x0. This can lead to a
crashing/hanging system without any warning message.

This patch checks for 0 config register and sets the internal value to
-1. If the configuration value is not NO_PADCTL this leads to an error
message that applying the configuration failed.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tested-by: Stefan Agner <stefan@agner.ch>
Acked-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/freescale/pinctrl-imx.c

index 2ee0d9228e63ae804a4c88ebfb8b1b16ffc940d3..e261f1cf85c6c41feb14ce95c7661c0c30a96df4 100644 (file)
@@ -542,10 +542,13 @@ 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 & SHARE_MUX_CONF_REG)
+               if (info->flags & SHARE_MUX_CONF_REG) {
                        conf_reg = mux_reg;
-               else
+               } else {
                        conf_reg = be32_to_cpu(*list++);
+                       if (!conf_reg)
+                               conf_reg = -1;
+               }
 
                pin_id = mux_reg ? mux_reg / 4 : conf_reg / 4;
                pin_reg = &info->pin_regs[pin_id];
This page took 0.024667 seconds and 5 git commands to generate.