kernel: move console loglevel to generic
[oweals/openwrt.git] / target / linux / sunxi / patches-4.9 / 0032-pinctrl-sunxi-Handle-bias-disable.patch
1 From 07fe64ba213f36ca8f6ffd8c4d5893f022744fdb Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime.ripard@free-electrons.com>
3 Date: Tue, 11 Oct 2016 17:46:01 +0200
4 Subject: pinctrl: sunxi: Handle bias disable
5
6 So far, putting NO_PULL in allwinner,pull was ignored, behaving like if
7 that property was not there at all.
8
9 Obviously, this is not the right thing to do, and in that case, we really
10 need to just disable the bias.
11
12 Acked-by: Chen-Yu Tsai <wens@csie.org>
13 Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
14 Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
15 ---
16  drivers/pinctrl/sunxi/pinctrl-sunxi.c | 8 ++++++++
17  1 file changed, 8 insertions(+)
18
19 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
20 +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
21 @@ -165,6 +165,8 @@ static int sunxi_pctrl_parse_bias_prop(s
22                 return -EINVAL;
23  
24         switch (val) {
25 +       case SUN4I_PINCTRL_NO_PULL:
26 +               return PIN_CONFIG_BIAS_DISABLE;
27         case SUN4I_PINCTRL_PULL_UP:
28                 return PIN_CONFIG_BIAS_PULL_UP;
29         case SUN4I_PINCTRL_PULL_DOWN:
30 @@ -401,6 +403,12 @@ static int sunxi_pconf_group_set(struct
31                                 | dlevel << sunxi_dlevel_offset(pin),
32                                 pctl->membase + sunxi_dlevel_reg(pin));
33                         break;
34 +               case PIN_CONFIG_BIAS_DISABLE:
35 +                       val = readl(pctl->membase + sunxi_pull_reg(pin));
36 +                       mask = PULL_PINS_MASK << sunxi_pull_offset(pin);
37 +                       writel((val & ~mask),
38 +                              pctl->membase + sunxi_pull_reg(pin));
39 +                       break;
40                 case PIN_CONFIG_BIAS_PULL_UP:
41                         val = readl(pctl->membase + sunxi_pull_reg(pin));
42                         mask = PULL_PINS_MASK << sunxi_pull_offset(pin);