3cc7bad8b84c40c2582c4ee6057dc9b70d6c2c36
[openwrt/openwrt.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 diff --git a/drivers/pinctrl/pinctrl-gemini.c b/drivers/pinctrl/pinctrl-gemini.c
21 index fa7d998e1d5a..1e484a36ff07 100644
22 --- a/drivers/pinctrl/pinctrl-gemini.c
23 +++ b/drivers/pinctrl/pinctrl-gemini.c
24 @@ -2184,7 +2184,8 @@ static int gemini_pmx_set_mux(struct pinctrl_dev *pctldev,
25 func->name, grp->name);
26
27 regmap_read(pmx->map, GLOBAL_MISC_CTRL, &before);
28 - regmap_update_bits(pmx->map, GLOBAL_MISC_CTRL, grp->mask,
29 + regmap_update_bits(pmx->map, GLOBAL_MISC_CTRL,
30 + grp->mask | grp->value,
31 grp->value);
32 regmap_read(pmx->map, GLOBAL_MISC_CTRL, &after);
33
34 --
35 2.19.2
36