pinctrl: gemini: Mask and set properly
authorLinus Walleij <linus.walleij@linaro.org>
Tue, 9 Oct 2018 08:11:53 +0000 (10:11 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 24 Nov 2019 07:23:29 +0000 (08:23 +0100)
[ Upstream commit d17f477c5bc6b4a5dd9f51ae263870da132a8e89 ]

The code was written under the assumption that the
regmap_update_bits() would mask the bits in the mask and
set the bits in the value.

It missed the points that it will not set bits in the value
unless these are also masked in the mask. Set value bits
that are not in the mask will simply be ignored.

Fixes: 06351d133dea ("pinctrl: add a Gemini SoC pin controller")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pinctrl/pinctrl-gemini.c

index 39e6221e71000e735dfe35f71a1596865904246f..05441dc2519d2e7b99f00b7fb6389d904ed03d3c 100644 (file)
@@ -2164,7 +2164,8 @@ static int gemini_pmx_set_mux(struct pinctrl_dev *pctldev,
                 func->name, grp->name);
 
        regmap_read(pmx->map, GLOBAL_MISC_CTRL, &before);
-       regmap_update_bits(pmx->map, GLOBAL_MISC_CTRL, grp->mask,
+       regmap_update_bits(pmx->map, GLOBAL_MISC_CTRL,
+                          grp->mask | grp->value,
                           grp->value);
        regmap_read(pmx->map, GLOBAL_MISC_CTRL, &after);