kernel: update 3.10 to 3.10.32
[openwrt.git] / target / linux / ramips / patches-3.10 / 999-pinctrl_fixes.patch
1 --- a/drivers/pinctrl/pinctrl-rt2880.c
2 +++ b/drivers/pinctrl/pinctrl-rt2880.c
3 @@ -204,6 +204,7 @@ static int rt2880_pmx_group_enable(struc
4  {
5         struct rt2880_priv *p = pinctrl_dev_get_drvdata(pctrldev);
6          u32 mode = 0;
7 +       int i;
8  
9         /* dont allow double use */
10         if (p->groups[group].enabled) {
11 @@ -217,16 +218,16 @@ static int rt2880_pmx_group_enable(struc
12         mode = rt_sysc_r32(SYSC_REG_GPIO_MODE);
13         mode &= ~(p->groups[group].mask << p->groups[group].shift);
14  
15 +       /* mark the pins as gpio */
16 +       for (i = 0; i < p->groups[group].func[0].pin_count; i++)
17 +               p->gpio[p->groups[group].func[0].pins[i]] = 1;
18 +
19         /* function 0 is gpio and needs special handling */
20         if (func == 0) {
21 -               int i;
22 -
23 -
24                 mode |= p->groups[group].gpio << p->groups[group].shift;
25 -               /* mark the pins as gpio */
26 -               for (i = 0; i < p->groups[group].func[0].pin_count; i++)
27 -                       p->gpio[p->groups[group].func[0].pins[i]] = 1;
28         } else {
29 +               for (i = 0; i < p->func[func]->pin_count; i++)
30 +                       p->gpio[p->func[func]->pins[i]] = 0;
31                 mode |= p->func[func]->value << p->groups[group].shift;
32         }
33         rt_sysc_w32(mode, SYSC_REG_GPIO_MODE);