3bf9341e34f08d4ef75b941e05ee73a63754a880
[openwrt/staging/wigyori.git] / target / linux / gemini / patches-4.19 / 0001-pinctrl-gemini-Mask-and-set-properly.patch
1 From f8ac3d3472a8dc99c8647a637611d146d88be8cb Mon Sep 17 00:00:00 2001
2 From: Linus Walleij <linus.walleij@linaro.org>
3 Date: Tue, 9 Oct 2018 10:09:14 +0200
4 Subject: [PATCH 01/18] pinctrl: gemini: Mask and set properly
5
6 The code was written under the assumption that the
7 regmap_update_bits() would mask the bits in the mask and
8 set the bits in the value.
9
10 It missed the points that it will not set bits in the value
11 unless these are also masked in the mask. Set value bits
12 that are not in the mask will simply be ignored.
13
14 Fixes: 06351d133dea ("pinctrl: add a Gemini SoC pin controller")
15 Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
16 ---
17 drivers/pinctrl/pinctrl-gemini.c | 3 ++-
18 1 file changed, 2 insertions(+), 1 deletion(-)
19
20 --- a/drivers/pinctrl/pinctrl-gemini.c
21 +++ b/drivers/pinctrl/pinctrl-gemini.c
22 @@ -2184,7 +2184,8 @@ static int gemini_pmx_set_mux(struct pin
23 func->name, grp->name);
24
25 regmap_read(pmx->map, GLOBAL_MISC_CTRL, &before);
26 - regmap_update_bits(pmx->map, GLOBAL_MISC_CTRL, grp->mask,
27 + regmap_update_bits(pmx->map, GLOBAL_MISC_CTRL,
28 + grp->mask | grp->value,
29 grp->value);
30 regmap_read(pmx->map, GLOBAL_MISC_CTRL, &after);
31