[lantiq] bump to v3.8
[openwrt.git] / target / linux / lantiq / patches-3.8 / 0005-PINCTRL-lantiq-pinconf-uses-port-instead-of-pin.patch
1 From 5e19578b807e7ef6e7baf05fb1f69433d5e74667 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 05/40] 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 diff --git a/drivers/pinctrl/pinctrl-xway.c b/drivers/pinctrl/pinctrl-xway.c
16 index 5f0eb04..69dec9b 100644
17 --- a/drivers/pinctrl/pinctrl-xway.c
18 +++ b/drivers/pinctrl/pinctrl-xway.c
19 @@ -441,17 +441,17 @@ static int xway_pinconf_get(struct pinctrl_dev *pctldev,
20                 if (port == PORT3)
21                         reg = GPIO3_OD;
22                 else
23 -                       reg = GPIO_OD(port);
24 +                       reg = GPIO_OD(pin);
25                 *config = LTQ_PINCONF_PACK(param,
26 -                       !!gpio_getbit(info->membase[0], reg, PORT_PIN(port)));
27 +                       !!gpio_getbit(info->membase[0], reg, PORT_PIN(pin)));
28                 break;
29  
30         case LTQ_PINCONF_PARAM_PULL:
31                 if (port == PORT3)
32                         reg = GPIO3_PUDEN;
33                 else
34 -                       reg = GPIO_PUDEN(port);
35 -               if (!gpio_getbit(info->membase[0], reg, PORT_PIN(port))) {
36 +                       reg = GPIO_PUDEN(pin);
37 +               if (!gpio_getbit(info->membase[0], reg, PORT_PIN(pin))) {
38                         *config = LTQ_PINCONF_PACK(param, 0);
39                         break;
40                 }
41 @@ -459,8 +459,8 @@ static int xway_pinconf_get(struct pinctrl_dev *pctldev,
42                 if (port == PORT3)
43                         reg = GPIO3_PUDSEL;
44                 else
45 -                       reg = GPIO_PUDSEL(port);
46 -               if (!gpio_getbit(info->membase[0], reg, PORT_PIN(port)))
47 +                       reg = GPIO_PUDSEL(pin);
48 +               if (!gpio_getbit(info->membase[0], reg, PORT_PIN(pin)))
49                         *config = LTQ_PINCONF_PACK(param, 2);
50                 else
51                         *config = LTQ_PINCONF_PACK(param, 1);
52 @@ -488,29 +488,29 @@ static int xway_pinconf_set(struct pinctrl_dev *pctldev,
53                 if (port == PORT3)
54                         reg = GPIO3_OD;
55                 else
56 -                       reg = GPIO_OD(port);
57 -               gpio_setbit(info->membase[0], reg, PORT_PIN(port));
58 +                       reg = GPIO_OD(pin);
59 +               gpio_setbit(info->membase[0], reg, PORT_PIN(pin));
60                 break;
61  
62         case LTQ_PINCONF_PARAM_PULL:
63                 if (port == PORT3)
64                         reg = GPIO3_PUDEN;
65                 else
66 -                       reg = GPIO_PUDEN(port);
67 +                       reg = GPIO_PUDEN(pin);
68                 if (arg == 0) {
69 -                       gpio_clearbit(info->membase[0], reg, PORT_PIN(port));
70 +                       gpio_clearbit(info->membase[0], reg, PORT_PIN(pin));
71                         break;
72                 }
73 -               gpio_setbit(info->membase[0], reg, PORT_PIN(port));
74 +               gpio_setbit(info->membase[0], reg, PORT_PIN(pin));
75  
76                 if (port == PORT3)
77                         reg = GPIO3_PUDSEL;
78                 else
79 -                       reg = GPIO_PUDSEL(port);
80 +                       reg = GPIO_PUDSEL(pin);
81                 if (arg == 1)
82 -                       gpio_clearbit(info->membase[0], reg, PORT_PIN(port));
83 +                       gpio_clearbit(info->membase[0], reg, PORT_PIN(pin));
84                 else if (arg == 2)
85 -                       gpio_setbit(info->membase[0], reg, PORT_PIN(port));
86 +                       gpio_setbit(info->membase[0], reg, PORT_PIN(pin));
87                 else
88                         dev_err(pctldev->dev, "Invalid pull value %d\n", arg);
89                 break;
90 -- 
91 1.7.10.4
92