diff options
author | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2013-02-13 16:09:27 -0500 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2013-03-15 08:33:38 -0400 |
commit | 17dffe48d18f9c31ba7499af385e10bc02d7c7d9 (patch) | |
tree | b37a82b48c1ef03a8c3e6b52b305d12410bbbe44 | |
parent | c07f54f604b3b458f10452b60fe21c549218bf02 (diff) |
sh-pfc: Share the PORT_10_REV, PORT_32 and PORT_32_REV definitions
The macros are defined identically and used in two SoC-specific files,
share them.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | drivers/pinctrl/sh-pfc/pfc-r8a7779.c | 34 | ||||
-rw-r--r-- | drivers/pinctrl/sh-pfc/pfc-sh7734.c | 31 | ||||
-rw-r--r-- | drivers/pinctrl/sh-pfc/sh_pfc.h | 17 |
3 files changed, 32 insertions, 50 deletions
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7779.c b/drivers/pinctrl/sh-pfc/pfc-r8a7779.c index 0e536744f3d2..e9a7ead139fa 100644 --- a/drivers/pinctrl/sh-pfc/pfc-r8a7779.c +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7779.c | |||
@@ -23,11 +23,6 @@ | |||
23 | 23 | ||
24 | #include "sh_pfc.h" | 24 | #include "sh_pfc.h" |
25 | 25 | ||
26 | #define CPU_32_PORT(fn, pfx, sfx) \ | ||
27 | PORT_10(fn, pfx, sfx), PORT_10(fn, pfx##1, sfx), \ | ||
28 | PORT_10(fn, pfx##2, sfx), PORT_1(fn, pfx##30, sfx), \ | ||
29 | PORT_1(fn, pfx##31, sfx) | ||
30 | |||
31 | #define CPU_32_PORT6(fn, pfx, sfx) \ | 26 | #define CPU_32_PORT6(fn, pfx, sfx) \ |
32 | PORT_1(fn, pfx##0, sfx), PORT_1(fn, pfx##1, sfx), \ | 27 | PORT_1(fn, pfx##0, sfx), PORT_1(fn, pfx##1, sfx), \ |
33 | PORT_1(fn, pfx##2, sfx), PORT_1(fn, pfx##3, sfx), \ | 28 | PORT_1(fn, pfx##2, sfx), PORT_1(fn, pfx##3, sfx), \ |
@@ -36,12 +31,12 @@ | |||
36 | PORT_1(fn, pfx##8, sfx) | 31 | PORT_1(fn, pfx##8, sfx) |
37 | 32 | ||
38 | #define CPU_ALL_PORT(fn, pfx, sfx) \ | 33 | #define CPU_ALL_PORT(fn, pfx, sfx) \ |
39 | CPU_32_PORT(fn, pfx##_0_, sfx), \ | 34 | PORT_32(fn, pfx##_0_, sfx), \ |
40 | CPU_32_PORT(fn, pfx##_1_, sfx), \ | 35 | PORT_32(fn, pfx##_1_, sfx), \ |
41 | CPU_32_PORT(fn, pfx##_2_, sfx), \ | 36 | PORT_32(fn, pfx##_2_, sfx), \ |
42 | CPU_32_PORT(fn, pfx##_3_, sfx), \ | 37 | PORT_32(fn, pfx##_3_, sfx), \ |
43 | CPU_32_PORT(fn, pfx##_4_, sfx), \ | 38 | PORT_32(fn, pfx##_4_, sfx), \ |
44 | CPU_32_PORT(fn, pfx##_5_, sfx), \ | 39 | PORT_32(fn, pfx##_5_, sfx), \ |
45 | CPU_32_PORT6(fn, pfx##_6_, sfx) | 40 | CPU_32_PORT6(fn, pfx##_6_, sfx) |
46 | 41 | ||
47 | #define _GP_GPIO(pfx, sfx) PINMUX_GPIO(GPIO_GP##pfx, GP##pfx##_DATA) | 42 | #define _GP_GPIO(pfx, sfx) PINMUX_GPIO(GPIO_GP##pfx, GP##pfx##_DATA) |
@@ -55,21 +50,8 @@ | |||
55 | #define PINMUX_GPIO_GP_ALL() CPU_ALL_PORT(_GP_GPIO, , unused) | 50 | #define PINMUX_GPIO_GP_ALL() CPU_ALL_PORT(_GP_GPIO, , unused) |
56 | #define PINMUX_DATA_GP_ALL() CPU_ALL_PORT(_GP_DATA, , unused) | 51 | #define PINMUX_DATA_GP_ALL() CPU_ALL_PORT(_GP_DATA, , unused) |
57 | 52 | ||
58 | 53 | #define GP_INOUTSEL(bank) PORT_32_REV(_GP_INOUTSEL, _##bank##_, unused) | |
59 | #define PORT_10_REV(fn, pfx, sfx) \ | 54 | #define GP_INDT(bank) PORT_32_REV(_GP_INDT, _##bank##_, unused) |
60 | PORT_1(fn, pfx##9, sfx), PORT_1(fn, pfx##8, sfx), \ | ||
61 | PORT_1(fn, pfx##7, sfx), PORT_1(fn, pfx##6, sfx), \ | ||
62 | PORT_1(fn, pfx##5, sfx), PORT_1(fn, pfx##4, sfx), \ | ||
63 | PORT_1(fn, pfx##3, sfx), PORT_1(fn, pfx##2, sfx), \ | ||
64 | PORT_1(fn, pfx##1, sfx), PORT_1(fn, pfx##0, sfx) | ||
65 | |||
66 | #define CPU_32_PORT_REV(fn, pfx, sfx) \ | ||
67 | PORT_1(fn, pfx##31, sfx), PORT_1(fn, pfx##30, sfx), \ | ||
68 | PORT_10_REV(fn, pfx##2, sfx), PORT_10_REV(fn, pfx##1, sfx), \ | ||
69 | PORT_10_REV(fn, pfx, sfx) | ||
70 | |||
71 | #define GP_INOUTSEL(bank) CPU_32_PORT_REV(_GP_INOUTSEL, _##bank##_, unused) | ||
72 | #define GP_INDT(bank) CPU_32_PORT_REV(_GP_INDT, _##bank##_, unused) | ||
73 | 55 | ||
74 | #define PINMUX_IPSR_DATA(ipsr, fn) PINMUX_DATA(fn##_MARK, FN_##ipsr, FN_##fn) | 56 | #define PINMUX_IPSR_DATA(ipsr, fn) PINMUX_DATA(fn##_MARK, FN_##ipsr, FN_##fn) |
75 | #define PINMUX_IPSR_MODSEL_DATA(ipsr, fn, ms) PINMUX_DATA(fn##_MARK, FN_##ms, \ | 57 | #define PINMUX_IPSR_MODSEL_DATA(ipsr, fn, ms) PINMUX_DATA(fn##_MARK, FN_##ms, \ |
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7734.c b/drivers/pinctrl/sh-pfc/pfc-sh7734.c index 20c44dd7001a..99ea220269ff 100644 --- a/drivers/pinctrl/sh-pfc/pfc-sh7734.c +++ b/drivers/pinctrl/sh-pfc/pfc-sh7734.c | |||
@@ -14,11 +14,6 @@ | |||
14 | 14 | ||
15 | #include "sh_pfc.h" | 15 | #include "sh_pfc.h" |
16 | 16 | ||
17 | #define CPU_32_PORT(fn, pfx, sfx) \ | ||
18 | PORT_10(fn, pfx, sfx), PORT_10(fn, pfx##1, sfx), \ | ||
19 | PORT_10(fn, pfx##2, sfx), PORT_1(fn, pfx##30, sfx), \ | ||
20 | PORT_1(fn, pfx##31, sfx) | ||
21 | |||
22 | #define CPU_32_PORT5(fn, pfx, sfx) \ | 17 | #define CPU_32_PORT5(fn, pfx, sfx) \ |
23 | PORT_1(fn, pfx##0, sfx), PORT_1(fn, pfx##1, sfx), \ | 18 | PORT_1(fn, pfx##0, sfx), PORT_1(fn, pfx##1, sfx), \ |
24 | PORT_1(fn, pfx##2, sfx), PORT_1(fn, pfx##3, sfx), \ | 19 | PORT_1(fn, pfx##2, sfx), PORT_1(fn, pfx##3, sfx), \ |
@@ -29,11 +24,11 @@ | |||
29 | 24 | ||
30 | /* GPSR0 - GPSR5 */ | 25 | /* GPSR0 - GPSR5 */ |
31 | #define CPU_ALL_PORT(fn, pfx, sfx) \ | 26 | #define CPU_ALL_PORT(fn, pfx, sfx) \ |
32 | CPU_32_PORT(fn, pfx##_0_, sfx), \ | 27 | PORT_32(fn, pfx##_0_, sfx), \ |
33 | CPU_32_PORT(fn, pfx##_1_, sfx), \ | 28 | PORT_32(fn, pfx##_1_, sfx), \ |
34 | CPU_32_PORT(fn, pfx##_2_, sfx), \ | 29 | PORT_32(fn, pfx##_2_, sfx), \ |
35 | CPU_32_PORT(fn, pfx##_3_, sfx), \ | 30 | PORT_32(fn, pfx##_3_, sfx), \ |
36 | CPU_32_PORT(fn, pfx##_4_, sfx), \ | 31 | PORT_32(fn, pfx##_4_, sfx), \ |
37 | CPU_32_PORT5(fn, pfx##_5_, sfx) | 32 | CPU_32_PORT5(fn, pfx##_5_, sfx) |
38 | 33 | ||
39 | #define _GP_GPIO(pfx, sfx) PINMUX_GPIO(GPIO_GP##pfx, GP##pfx##_DATA) | 34 | #define _GP_GPIO(pfx, sfx) PINMUX_GPIO(GPIO_GP##pfx, GP##pfx##_DATA) |
@@ -47,20 +42,8 @@ | |||
47 | #define PINMUX_GPIO_GP_ALL() CPU_ALL_PORT(_GP_GPIO, , unused) | 42 | #define PINMUX_GPIO_GP_ALL() CPU_ALL_PORT(_GP_GPIO, , unused) |
48 | #define PINMUX_DATA_GP_ALL() CPU_ALL_PORT(_GP_DATA, , unused) | 43 | #define PINMUX_DATA_GP_ALL() CPU_ALL_PORT(_GP_DATA, , unused) |
49 | 44 | ||
50 | #define PORT_10_REV(fn, pfx, sfx) \ | 45 | #define GP_INOUTSEL(bank) PORT_32_REV(_GP_INOUTSEL, _##bank##_, unused) |
51 | PORT_1(fn, pfx##9, sfx), PORT_1(fn, pfx##8, sfx), \ | 46 | #define GP_INDT(bank) PORT_32_REV(_GP_INDT, _##bank##_, unused) |
52 | PORT_1(fn, pfx##7, sfx), PORT_1(fn, pfx##6, sfx), \ | ||
53 | PORT_1(fn, pfx##5, sfx), PORT_1(fn, pfx##4, sfx), \ | ||
54 | PORT_1(fn, pfx##3, sfx), PORT_1(fn, pfx##2, sfx), \ | ||
55 | PORT_1(fn, pfx##1, sfx), PORT_1(fn, pfx##0, sfx) | ||
56 | |||
57 | #define CPU_32_PORT_REV(fn, pfx, sfx) \ | ||
58 | PORT_1(fn, pfx##31, sfx), PORT_1(fn, pfx##30, sfx), \ | ||
59 | PORT_10_REV(fn, pfx##2, sfx), PORT_10_REV(fn, pfx##1, sfx), \ | ||
60 | PORT_10_REV(fn, pfx, sfx) | ||
61 | |||
62 | #define GP_INOUTSEL(bank) CPU_32_PORT_REV(_GP_INOUTSEL, _##bank##_, unused) | ||
63 | #define GP_INDT(bank) CPU_32_PORT_REV(_GP_INDT, _##bank##_, unused) | ||
64 | 47 | ||
65 | #define PINMUX_IPSR_DATA(ipsr, fn) PINMUX_DATA(fn##_MARK, FN_##ipsr, FN_##fn) | 48 | #define PINMUX_IPSR_DATA(ipsr, fn) PINMUX_DATA(fn##_MARK, FN_##ipsr, FN_##fn) |
66 | #define PINMUX_IPSR_MODSEL_DATA(ipsr, fn, ms) PINMUX_DATA(fn##_MARK, FN_##ms, \ | 49 | #define PINMUX_IPSR_MODSEL_DATA(ipsr, fn, ms) PINMUX_DATA(fn##_MARK, FN_##ms, \ |
diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h index f9d448099bcb..43c858d98321 100644 --- a/drivers/pinctrl/sh-pfc/sh_pfc.h +++ b/drivers/pinctrl/sh-pfc/sh_pfc.h | |||
@@ -138,6 +138,23 @@ enum { GPIO_CFG_DRYRUN, GPIO_CFG_REQ, GPIO_CFG_FREE }; | |||
138 | PORT_1(fn, pfx##6, sfx), PORT_1(fn, pfx##7, sfx), \ | 138 | PORT_1(fn, pfx##6, sfx), PORT_1(fn, pfx##7, sfx), \ |
139 | PORT_1(fn, pfx##8, sfx), PORT_1(fn, pfx##9, sfx) | 139 | PORT_1(fn, pfx##8, sfx), PORT_1(fn, pfx##9, sfx) |
140 | 140 | ||
141 | #define PORT_10_REV(fn, pfx, sfx) \ | ||
142 | PORT_1(fn, pfx##9, sfx), PORT_1(fn, pfx##8, sfx), \ | ||
143 | PORT_1(fn, pfx##7, sfx), PORT_1(fn, pfx##6, sfx), \ | ||
144 | PORT_1(fn, pfx##5, sfx), PORT_1(fn, pfx##4, sfx), \ | ||
145 | PORT_1(fn, pfx##3, sfx), PORT_1(fn, pfx##2, sfx), \ | ||
146 | PORT_1(fn, pfx##1, sfx), PORT_1(fn, pfx##0, sfx) | ||
147 | |||
148 | #define PORT_32(fn, pfx, sfx) \ | ||
149 | PORT_10(fn, pfx, sfx), PORT_10(fn, pfx##1, sfx), \ | ||
150 | PORT_10(fn, pfx##2, sfx), PORT_1(fn, pfx##30, sfx), \ | ||
151 | PORT_1(fn, pfx##31, sfx) | ||
152 | |||
153 | #define PORT_32_REV(fn, pfx, sfx) \ | ||
154 | PORT_1(fn, pfx##31, sfx), PORT_1(fn, pfx##30, sfx), \ | ||
155 | PORT_10_REV(fn, pfx##2, sfx), PORT_10_REV(fn, pfx##1, sfx), \ | ||
156 | PORT_10_REV(fn, pfx, sfx) | ||
157 | |||
141 | #define PORT_90(fn, pfx, sfx) \ | 158 | #define PORT_90(fn, pfx, sfx) \ |
142 | PORT_10(fn, pfx##1, sfx), PORT_10(fn, pfx##2, sfx), \ | 159 | PORT_10(fn, pfx##1, sfx), PORT_10(fn, pfx##2, sfx), \ |
143 | PORT_10(fn, pfx##3, sfx), PORT_10(fn, pfx##4, sfx), \ | 160 | PORT_10(fn, pfx##3, sfx), PORT_10(fn, pfx##4, sfx), \ |