[lantiq] add linux-v3.7
[openwrt/svn-archive/archive.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 diff --git a/drivers/pinctrl/pinctrl-xway.c b/drivers/pinctrl/pinctrl-xway.c
16 index b9bcaec..48ab09b 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