firewall: update to git head
[openwrt.git] / target / linux / lantiq / patches-3.7 / 0107-PINCTRL-lantiq-pinconf-uses-port-instead-of-pin.patch
1 From 84ce6d4b2802fd428a76e5f2692fd4c102ed35ea Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Fri, 30 Nov 2012 21:11:22 +0100
4 Subject: [PATCH 107/123] PINCTRL: lantiq: pinconf uses port instead of pin
5
6 The XWAY pinctrl driver invalidly uses the port and not the pin number to work
7 out the registeres and bits to be set for the opendrain and pullup/down
8 resistors.
9
10 Signed-off-by: John Crispin <blogic@openwrt.org>
11 ---
12  drivers/pinctrl/pinctrl-xway.c |   28 ++++++++++++++--------------
13  1 file changed, 14 insertions(+), 14 deletions(-)
14
15 --- a/drivers/pinctrl/pinctrl-xway.c
16 +++ b/drivers/pinctrl/pinctrl-xway.c
17 @@ -441,17 +441,17 @@ static int xway_pinconf_get(struct pinct
18                 if (port == PORT3)
19                         reg = GPIO3_OD;
20                 else
21 -                       reg = GPIO_OD(port);
22 +                       reg = GPIO_OD(pin);
23                 *config = LTQ_PINCONF_PACK(param,
24 -                       !!gpio_getbit(info->membase[0], reg, PORT_PIN(port)));
25 +                       !!gpio_getbit(info->membase[0], reg, PORT_PIN(pin)));
26                 break;
27  
28         case LTQ_PINCONF_PARAM_PULL:
29                 if (port == PORT3)
30                         reg = GPIO3_PUDEN;
31                 else
32 -                       reg = GPIO_PUDEN(port);
33 -               if (!gpio_getbit(info->membase[0], reg, PORT_PIN(port))) {
34 +                       reg = GPIO_PUDEN(pin);
35 +               if (!gpio_getbit(info->membase[0], reg, PORT_PIN(pin))) {
36                         *config = LTQ_PINCONF_PACK(param, 0);
37                         break;
38                 }
39 @@ -459,8 +459,8 @@ static int xway_pinconf_get(struct pinct
40                 if (port == PORT3)
41                         reg = GPIO3_PUDSEL;
42                 else
43 -                       reg = GPIO_PUDSEL(port);
44 -               if (!gpio_getbit(info->membase[0], reg, PORT_PIN(port)))
45 +                       reg = GPIO_PUDSEL(pin);
46 +               if (!gpio_getbit(info->membase[0], reg, PORT_PIN(pin)))
47                         *config = LTQ_PINCONF_PACK(param, 2);
48                 else
49                         *config = LTQ_PINCONF_PACK(param, 1);
50 @@ -488,29 +488,29 @@ static int xway_pinconf_set(struct pinct
51                 if (port == PORT3)
52                         reg = GPIO3_OD;
53                 else
54 -                       reg = GPIO_OD(port);
55 -               gpio_setbit(info->membase[0], reg, PORT_PIN(port));
56 +                       reg = GPIO_OD(pin);
57 +               gpio_setbit(info->membase[0], reg, PORT_PIN(pin));
58                 break;
59  
60         case LTQ_PINCONF_PARAM_PULL:
61                 if (port == PORT3)
62                         reg = GPIO3_PUDEN;
63                 else
64 -                       reg = GPIO_PUDEN(port);
65 +                       reg = GPIO_PUDEN(pin);
66                 if (arg == 0) {
67 -                       gpio_clearbit(info->membase[0], reg, PORT_PIN(port));
68 +                       gpio_clearbit(info->membase[0], reg, PORT_PIN(pin));
69                         break;
70                 }
71 -               gpio_setbit(info->membase[0], reg, PORT_PIN(port));
72 +               gpio_setbit(info->membase[0], reg, PORT_PIN(pin));
73  
74                 if (port == PORT3)
75                         reg = GPIO3_PUDSEL;
76                 else
77 -                       reg = GPIO_PUDSEL(port);
78 +                       reg = GPIO_PUDSEL(pin);
79                 if (arg == 1)
80 -                       gpio_clearbit(info->membase[0], reg, PORT_PIN(port));
81 +                       gpio_clearbit(info->membase[0], reg, PORT_PIN(pin));
82                 else if (arg == 2)
83 -                       gpio_setbit(info->membase[0], reg, PORT_PIN(port));
84 +                       gpio_setbit(info->membase[0], reg, PORT_PIN(pin));
85                 else
86                         dev_err(pctldev->dev, "Invalid pull value %d\n", arg);
87                 break;