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