aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2013-03-07 17:47:18 -0500
committerSimon Horman <horms+renesas@verge.net.au>2013-04-01 22:09:45 -0400
commit7417dae5214a19885220597562ea16f238d2c6fc (patch)
tree34826e5abf6ec156a655a5c34737a52ade752495 /drivers/pinctrl
parentc09b51d5de108acbf9ae176cc81325afd79648dd (diff)
sh-pfc: r8a7779: Don't use GPIO enum entries
Refactor the GPIO macro magic to use GPIO numbers directly instead of the GPIO_GP_x_y enum entries. This will allow removing the GPIO enum entries from the mach/r8a7779.h header. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/sh-pfc/pfc-r8a7779.c104
1 files changed, 74 insertions, 30 deletions
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7779.c b/drivers/pinctrl/sh-pfc/pfc-r8a7779.c
index 4db99445acc2..41d8bda45163 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7779.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7779.c
@@ -19,39 +19,83 @@
19 */ 19 */
20 20
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <mach/r8a7779.h>
23 22
24#include "sh_pfc.h" 23#include "sh_pfc.h"
25 24
26#define CPU_32_PORT6(fn, pfx, sfx) \ 25#define PORT_GP_1(bank, pin, fn, sfx) fn(bank, pin, GP_##bank##_##pin, sfx)
27 PORT_1(fn, pfx##0, sfx), PORT_1(fn, pfx##1, sfx), \ 26
28 PORT_1(fn, pfx##2, sfx), PORT_1(fn, pfx##3, sfx), \ 27#define PORT_GP_32(bank, fn, sfx) \
29 PORT_1(fn, pfx##4, sfx), PORT_1(fn, pfx##5, sfx), \ 28 PORT_GP_1(bank, 0, fn, sfx), PORT_GP_1(bank, 1, fn, sfx), \
30 PORT_1(fn, pfx##6, sfx), PORT_1(fn, pfx##7, sfx), \ 29 PORT_GP_1(bank, 2, fn, sfx), PORT_GP_1(bank, 3, fn, sfx), \
31 PORT_1(fn, pfx##8, sfx) 30 PORT_GP_1(bank, 4, fn, sfx), PORT_GP_1(bank, 5, fn, sfx), \
32 31 PORT_GP_1(bank, 6, fn, sfx), PORT_GP_1(bank, 7, fn, sfx), \
33#define CPU_ALL_PORT(fn, pfx, sfx) \ 32 PORT_GP_1(bank, 8, fn, sfx), PORT_GP_1(bank, 9, fn, sfx), \
34 PORT_32(fn, pfx##_0_, sfx), \ 33 PORT_GP_1(bank, 10, fn, sfx), PORT_GP_1(bank, 11, fn, sfx), \
35 PORT_32(fn, pfx##_1_, sfx), \ 34 PORT_GP_1(bank, 12, fn, sfx), PORT_GP_1(bank, 13, fn, sfx), \
36 PORT_32(fn, pfx##_2_, sfx), \ 35 PORT_GP_1(bank, 14, fn, sfx), PORT_GP_1(bank, 15, fn, sfx), \
37 PORT_32(fn, pfx##_3_, sfx), \ 36 PORT_GP_1(bank, 16, fn, sfx), PORT_GP_1(bank, 17, fn, sfx), \
38 PORT_32(fn, pfx##_4_, sfx), \ 37 PORT_GP_1(bank, 18, fn, sfx), PORT_GP_1(bank, 19, fn, sfx), \
39 PORT_32(fn, pfx##_5_, sfx), \ 38 PORT_GP_1(bank, 20, fn, sfx), PORT_GP_1(bank, 21, fn, sfx), \
40 CPU_32_PORT6(fn, pfx##_6_, sfx) 39 PORT_GP_1(bank, 22, fn, sfx), PORT_GP_1(bank, 23, fn, sfx), \
41 40 PORT_GP_1(bank, 24, fn, sfx), PORT_GP_1(bank, 25, fn, sfx), \
42#define _GP_GPIO(pfx, sfx) PINMUX_GPIO(GPIO_GP##pfx, GP##pfx##_DATA) 41 PORT_GP_1(bank, 26, fn, sfx), PORT_GP_1(bank, 27, fn, sfx), \
43#define _GP_DATA(pfx, sfx) PINMUX_DATA(GP##pfx##_DATA, GP##pfx##_FN, \ 42 PORT_GP_1(bank, 28, fn, sfx), PORT_GP_1(bank, 29, fn, sfx), \
44 GP##pfx##_IN, GP##pfx##_OUT) 43 PORT_GP_1(bank, 30, fn, sfx), PORT_GP_1(bank, 31, fn, sfx)
45 44
46#define _GP_INOUTSEL(pfx, sfx) GP##pfx##_IN, GP##pfx##_OUT 45#define PORT_GP_32_9(bank, fn, sfx) \
47#define _GP_INDT(pfx, sfx) GP##pfx##_DATA 46 PORT_GP_1(bank, 0, fn, sfx), PORT_GP_1(bank, 1, fn, sfx), \
48 47 PORT_GP_1(bank, 2, fn, sfx), PORT_GP_1(bank, 3, fn, sfx), \
49#define GP_ALL(str) CPU_ALL_PORT(_PORT_ALL, GP, str) 48 PORT_GP_1(bank, 4, fn, sfx), PORT_GP_1(bank, 5, fn, sfx), \
50#define PINMUX_GPIO_GP_ALL() CPU_ALL_PORT(_GP_GPIO, , unused) 49 PORT_GP_1(bank, 6, fn, sfx), PORT_GP_1(bank, 7, fn, sfx), \
51#define PINMUX_DATA_GP_ALL() CPU_ALL_PORT(_GP_DATA, , unused) 50 PORT_GP_1(bank, 8, fn, sfx)
52 51
53#define GP_INOUTSEL(bank) PORT_32_REV(_GP_INOUTSEL, _##bank##_, unused) 52#define PORT_GP_32_REV(bank, fn, sfx) \
54#define GP_INDT(bank) PORT_32_REV(_GP_INDT, _##bank##_, unused) 53 PORT_GP_1(bank, 31, fn, sfx), PORT_GP_1(bank, 30, fn, sfx), \
54 PORT_GP_1(bank, 29, fn, sfx), PORT_GP_1(bank, 28, fn, sfx), \
55 PORT_GP_1(bank, 27, fn, sfx), PORT_GP_1(bank, 26, fn, sfx), \
56 PORT_GP_1(bank, 25, fn, sfx), PORT_GP_1(bank, 24, fn, sfx), \
57 PORT_GP_1(bank, 23, fn, sfx), PORT_GP_1(bank, 22, fn, sfx), \
58 PORT_GP_1(bank, 21, fn, sfx), PORT_GP_1(bank, 20, fn, sfx), \
59 PORT_GP_1(bank, 19, fn, sfx), PORT_GP_1(bank, 18, fn, sfx), \
60 PORT_GP_1(bank, 17, fn, sfx), PORT_GP_1(bank, 16, fn, sfx), \
61 PORT_GP_1(bank, 15, fn, sfx), PORT_GP_1(bank, 14, fn, sfx), \
62 PORT_GP_1(bank, 13, fn, sfx), PORT_GP_1(bank, 12, fn, sfx), \
63 PORT_GP_1(bank, 11, fn, sfx), PORT_GP_1(bank, 10, fn, sfx), \
64 PORT_GP_1(bank, 9, fn, sfx), PORT_GP_1(bank, 8, fn, sfx), \
65 PORT_GP_1(bank, 7, fn, sfx), PORT_GP_1(bank, 6, fn, sfx), \
66 PORT_GP_1(bank, 5, fn, sfx), PORT_GP_1(bank, 4, fn, sfx), \
67 PORT_GP_1(bank, 3, fn, sfx), PORT_GP_1(bank, 2, fn, sfx), \
68 PORT_GP_1(bank, 1, fn, sfx), PORT_GP_1(bank, 0, fn, sfx)
69
70#define CPU_ALL_PORT(fn, sfx) \
71 PORT_GP_32(0, fn, sfx), \
72 PORT_GP_32(1, fn, sfx), \
73 PORT_GP_32(2, fn, sfx), \
74 PORT_GP_32(3, fn, sfx), \
75 PORT_GP_32(4, fn, sfx), \
76 PORT_GP_32(5, fn, sfx), \
77 PORT_GP_32_9(6, fn, sfx)
78
79#define _GP_PORT_ALL(bank, pin, name, sfx) name##_##sfx
80
81#define _GP_GPIO(bank, pin, _name, sfx) \
82 [(bank * 32) + pin] = { \
83 .name = __stringify(_name), \
84 .enum_id = _name##_DATA, \
85 }
86
87#define _GP_DATA(bank, pin, name, sfx) \
88 PINMUX_DATA(name##_DATA, name##_FN, name##_IN, name##_OUT)
89
90#define _GP_INOUTSEL(bank, pin, name, sfx) name##_IN, name##_OUT
91#define _GP_INDT(bank, pin, name, sfx) name##_DATA
92
93#define GP_ALL(str) CPU_ALL_PORT(_GP_PORT_ALL, str)
94#define PINMUX_GPIO_GP_ALL() CPU_ALL_PORT(_GP_GPIO, unused)
95#define PINMUX_DATA_GP_ALL() CPU_ALL_PORT(_GP_DATA, unused)
96
97#define GP_INOUTSEL(bank) PORT_GP_32_REV(bank, _GP_INOUTSEL, unused)
98#define GP_INDT(bank) PORT_GP_32_REV(bank, _GP_INDT, unused)
55 99
56#define PINMUX_IPSR_DATA(ipsr, fn) PINMUX_DATA(fn##_MARK, FN_##ipsr, FN_##fn) 100#define PINMUX_IPSR_DATA(ipsr, fn) PINMUX_DATA(fn##_MARK, FN_##ipsr, FN_##fn)
57#define PINMUX_IPSR_MODSEL_DATA(ipsr, fn, ms) PINMUX_DATA(fn##_MARK, FN_##ms, \ 101#define PINMUX_IPSR_MODSEL_DATA(ipsr, fn, ms) PINMUX_DATA(fn##_MARK, FN_##ms, \