diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2011-11-10 21:45:33 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2011-11-11 02:45:33 -0500 |
commit | 972c3fb69cd1cd8d549b8a06ce42611eab405c20 (patch) | |
tree | 958d994516ba847b88f747524a127190d2b9784d | |
parent | bd8d0cbaa00883c84741b98264f8318cdade9c71 (diff) |
ARM: mach-shmobile: move helper macro PORT_xx to sh_pfc.h
This patch moves PORT_xx helper macro to sh_pfc.h,
and it expects CPU_ALL_PORT() macro for each CPU
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r-- | arch/arm/mach-shmobile/pfc-sh7367.c | 71 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/pfc-sh7372.c | 32 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/pfc-sh7377.c | 103 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/pfc-sh73a0.c | 108 | ||||
-rw-r--r-- | include/linux/sh_pfc.h | 23 |
5 files changed, 140 insertions, 197 deletions
diff --git a/arch/arm/mach-shmobile/pfc-sh7367.c b/arch/arm/mach-shmobile/pfc-sh7367.c index 25181166e2d8..32fbf0206b38 100644 --- a/arch/arm/mach-shmobile/pfc-sh7367.c +++ b/arch/arm/mach-shmobile/pfc-sh7367.c | |||
@@ -21,68 +21,49 @@ | |||
21 | #include <linux/gpio.h> | 21 | #include <linux/gpio.h> |
22 | #include <mach/sh7367.h> | 22 | #include <mach/sh7367.h> |
23 | 23 | ||
24 | #define _1(fn, pfx, sfx) fn(pfx, sfx) | 24 | #define CPU_ALL_PORT(fn, pfx, sfx) \ |
25 | 25 | PORT_10(fn, pfx, sfx), PORT_90(fn, pfx, sfx), \ | |
26 | #define _10(fn, pfx, sfx) \ | 26 | PORT_10(fn, pfx##10, sfx), PORT_90(fn, pfx##1, sfx), \ |
27 | _1(fn, pfx##0, sfx), _1(fn, pfx##1, sfx), \ | 27 | PORT_10(fn, pfx##20, sfx), PORT_10(fn, pfx##21, sfx), \ |
28 | _1(fn, pfx##2, sfx), _1(fn, pfx##3, sfx), \ | 28 | PORT_10(fn, pfx##22, sfx), PORT_10(fn, pfx##23, sfx), \ |
29 | _1(fn, pfx##4, sfx), _1(fn, pfx##5, sfx), \ | 29 | PORT_10(fn, pfx##24, sfx), PORT_10(fn, pfx##25, sfx), \ |
30 | _1(fn, pfx##6, sfx), _1(fn, pfx##7, sfx), \ | 30 | PORT_10(fn, pfx##26, sfx), PORT_1(fn, pfx##270, sfx), \ |
31 | _1(fn, pfx##8, sfx), _1(fn, pfx##9, sfx) | 31 | PORT_1(fn, pfx##271, sfx), PORT_1(fn, pfx##272, sfx) |
32 | |||
33 | #define _90(fn, pfx, sfx) \ | ||
34 | _10(fn, pfx##1, sfx), _10(fn, pfx##2, sfx), \ | ||
35 | _10(fn, pfx##3, sfx), _10(fn, pfx##4, sfx), \ | ||
36 | _10(fn, pfx##5, sfx), _10(fn, pfx##6, sfx), \ | ||
37 | _10(fn, pfx##7, sfx), _10(fn, pfx##8, sfx), \ | ||
38 | _10(fn, pfx##9, sfx) | ||
39 | |||
40 | #define _273(fn, pfx, sfx) \ | ||
41 | _10(fn, pfx, sfx), _90(fn, pfx, sfx), \ | ||
42 | _10(fn, pfx##10, sfx), _90(fn, pfx##1, sfx), \ | ||
43 | _10(fn, pfx##20, sfx), _10(fn, pfx##21, sfx), \ | ||
44 | _10(fn, pfx##22, sfx), _10(fn, pfx##23, sfx), \ | ||
45 | _10(fn, pfx##24, sfx), _10(fn, pfx##25, sfx), \ | ||
46 | _10(fn, pfx##26, sfx), _1(fn, pfx##270, sfx), \ | ||
47 | _1(fn, pfx##271, sfx), _1(fn, pfx##272, sfx) | ||
48 | |||
49 | #define _PORT(pfx, sfx) pfx##_##sfx | ||
50 | #define PORT_273(str) _273(_PORT, PORT, str) | ||
51 | 32 | ||
52 | enum { | 33 | enum { |
53 | PINMUX_RESERVED = 0, | 34 | PINMUX_RESERVED = 0, |
54 | 35 | ||
55 | PINMUX_DATA_BEGIN, | 36 | PINMUX_DATA_BEGIN, |
56 | PORT_273(DATA), /* PORT0_DATA -> PORT272_DATA */ | 37 | PORT_ALL(DATA), /* PORT0_DATA -> PORT272_DATA */ |
57 | PINMUX_DATA_END, | 38 | PINMUX_DATA_END, |
58 | 39 | ||
59 | PINMUX_INPUT_BEGIN, | 40 | PINMUX_INPUT_BEGIN, |
60 | PORT_273(IN), /* PORT0_IN -> PORT272_IN */ | 41 | PORT_ALL(IN), /* PORT0_IN -> PORT272_IN */ |
61 | PINMUX_INPUT_END, | 42 | PINMUX_INPUT_END, |
62 | 43 | ||
63 | PINMUX_INPUT_PULLUP_BEGIN, | 44 | PINMUX_INPUT_PULLUP_BEGIN, |
64 | PORT_273(IN_PU), /* PORT0_IN_PU -> PORT272_IN_PU */ | 45 | PORT_ALL(IN_PU), /* PORT0_IN_PU -> PORT272_IN_PU */ |
65 | PINMUX_INPUT_PULLUP_END, | 46 | PINMUX_INPUT_PULLUP_END, |
66 | 47 | ||
67 | PINMUX_INPUT_PULLDOWN_BEGIN, | 48 | PINMUX_INPUT_PULLDOWN_BEGIN, |
68 | PORT_273(IN_PD), /* PORT0_IN_PD -> PORT272_IN_PD */ | 49 | PORT_ALL(IN_PD), /* PORT0_IN_PD -> PORT272_IN_PD */ |
69 | PINMUX_INPUT_PULLDOWN_END, | 50 | PINMUX_INPUT_PULLDOWN_END, |
70 | 51 | ||
71 | PINMUX_OUTPUT_BEGIN, | 52 | PINMUX_OUTPUT_BEGIN, |
72 | PORT_273(OUT), /* PORT0_OUT -> PORT272_OUT */ | 53 | PORT_ALL(OUT), /* PORT0_OUT -> PORT272_OUT */ |
73 | PINMUX_OUTPUT_END, | 54 | PINMUX_OUTPUT_END, |
74 | 55 | ||
75 | PINMUX_FUNCTION_BEGIN, | 56 | PINMUX_FUNCTION_BEGIN, |
76 | PORT_273(FN_IN), /* PORT0_FN_IN -> PORT272_FN_IN */ | 57 | PORT_ALL(FN_IN), /* PORT0_FN_IN -> PORT272_FN_IN */ |
77 | PORT_273(FN_OUT), /* PORT0_FN_OUT -> PORT272_FN_OUT */ | 58 | PORT_ALL(FN_OUT), /* PORT0_FN_OUT -> PORT272_FN_OUT */ |
78 | PORT_273(FN0), /* PORT0_FN0 -> PORT272_FN0 */ | 59 | PORT_ALL(FN0), /* PORT0_FN0 -> PORT272_FN0 */ |
79 | PORT_273(FN1), /* PORT0_FN1 -> PORT272_FN1 */ | 60 | PORT_ALL(FN1), /* PORT0_FN1 -> PORT272_FN1 */ |
80 | PORT_273(FN2), /* PORT0_FN2 -> PORT272_FN2 */ | 61 | PORT_ALL(FN2), /* PORT0_FN2 -> PORT272_FN2 */ |
81 | PORT_273(FN3), /* PORT0_FN3 -> PORT272_FN3 */ | 62 | PORT_ALL(FN3), /* PORT0_FN3 -> PORT272_FN3 */ |
82 | PORT_273(FN4), /* PORT0_FN4 -> PORT272_FN4 */ | 63 | PORT_ALL(FN4), /* PORT0_FN4 -> PORT272_FN4 */ |
83 | PORT_273(FN5), /* PORT0_FN5 -> PORT272_FN5 */ | 64 | PORT_ALL(FN5), /* PORT0_FN5 -> PORT272_FN5 */ |
84 | PORT_273(FN6), /* PORT0_FN6 -> PORT272_FN6 */ | 65 | PORT_ALL(FN6), /* PORT0_FN6 -> PORT272_FN6 */ |
85 | PORT_273(FN7), /* PORT0_FN7 -> PORT272_FN7 */ | 66 | PORT_ALL(FN7), /* PORT0_FN7 -> PORT272_FN7 */ |
86 | 67 | ||
87 | MSELBCR_MSEL2_1, MSELBCR_MSEL2_0, | 68 | MSELBCR_MSEL2_1, MSELBCR_MSEL2_0, |
88 | PINMUX_FUNCTION_END, | 69 | PINMUX_FUNCTION_END, |
@@ -1063,13 +1044,9 @@ static pinmux_enum_t pinmux_data[] = { | |||
1063 | PINMUX_DATA(DIVLOCK_MARK, PORT272_FN1), | 1044 | PINMUX_DATA(DIVLOCK_MARK, PORT272_FN1), |
1064 | }; | 1045 | }; |
1065 | 1046 | ||
1066 | #define _GPIO_PORT(pfx, sfx) PINMUX_GPIO(GPIO_PORT##pfx, PORT##pfx##_DATA) | ||
1067 | #define GPIO_PORT_273() _273(_GPIO_PORT, , unused) | ||
1068 | #define GPIO_FN(str) PINMUX_GPIO(GPIO_FN_##str, str##_MARK) | ||
1069 | |||
1070 | static struct pinmux_gpio pinmux_gpios[] = { | 1047 | static struct pinmux_gpio pinmux_gpios[] = { |
1071 | /* 49-1 -> 49-6 (GPIO) */ | 1048 | /* 49-1 -> 49-6 (GPIO) */ |
1072 | GPIO_PORT_273(), | 1049 | GPIO_PORT_ALL(), |
1073 | 1050 | ||
1074 | /* Special Pull-up / Pull-down Functions */ | 1051 | /* Special Pull-up / Pull-down Functions */ |
1075 | GPIO_FN(PORT48_KEYIN0_PU), GPIO_FN(PORT49_KEYIN1_PU), | 1052 | GPIO_FN(PORT48_KEYIN0_PU), GPIO_FN(PORT49_KEYIN1_PU), |
diff --git a/arch/arm/mach-shmobile/pfc-sh7372.c b/arch/arm/mach-shmobile/pfc-sh7372.c index 34d6d763ec45..4b43626598ca 100644 --- a/arch/arm/mach-shmobile/pfc-sh7372.c +++ b/arch/arm/mach-shmobile/pfc-sh7372.c | |||
@@ -25,27 +25,13 @@ | |||
25 | #include <linux/gpio.h> | 25 | #include <linux/gpio.h> |
26 | #include <mach/sh7372.h> | 26 | #include <mach/sh7372.h> |
27 | 27 | ||
28 | #define _1(fn, pfx, sfx) fn(pfx, sfx) | 28 | #define CPU_ALL_PORT(fn, pfx, sfx) \ |
29 | 29 | PORT_10(fn, pfx, sfx), PORT_90(fn, pfx, sfx), \ | |
30 | #define _10(fn, pfx, sfx) \ | 30 | PORT_10(fn, pfx##10, sfx), PORT_10(fn, pfx##11, sfx), \ |
31 | _1(fn, pfx##0, sfx), _1(fn, pfx##1, sfx), \ | 31 | PORT_10(fn, pfx##12, sfx), PORT_10(fn, pfx##13, sfx), \ |
32 | _1(fn, pfx##2, sfx), _1(fn, pfx##3, sfx), \ | 32 | PORT_10(fn, pfx##14, sfx), PORT_10(fn, pfx##15, sfx), \ |
33 | _1(fn, pfx##4, sfx), _1(fn, pfx##5, sfx), \ | 33 | PORT_10(fn, pfx##16, sfx), PORT_10(fn, pfx##17, sfx), \ |
34 | _1(fn, pfx##6, sfx), _1(fn, pfx##7, sfx), \ | 34 | PORT_10(fn, pfx##18, sfx), PORT_1(fn, pfx##190, sfx) |
35 | _1(fn, pfx##8, sfx), _1(fn, pfx##9, sfx) | ||
36 | |||
37 | #define _80(fn, pfx, sfx) \ | ||
38 | _10(fn, pfx##1, sfx), _10(fn, pfx##2, sfx), \ | ||
39 | _10(fn, pfx##3, sfx), _10(fn, pfx##4, sfx), \ | ||
40 | _10(fn, pfx##5, sfx), _10(fn, pfx##6, sfx), \ | ||
41 | _10(fn, pfx##7, sfx), _10(fn, pfx##8, sfx) | ||
42 | |||
43 | #define _190(fn, pfx, sfx) \ | ||
44 | _10(fn, pfx, sfx), _80(fn, pfx, sfx), _10(fn, pfx##9, sfx), \ | ||
45 | _10(fn, pfx##10, sfx), _80(fn, pfx##1, sfx), _1(fn, pfx##190, sfx) | ||
46 | |||
47 | #define _PORT(pfx, sfx) pfx##_##sfx | ||
48 | #define PORT_ALL(str) _190(_PORT, PORT, str) | ||
49 | 35 | ||
50 | enum { | 36 | enum { |
51 | PINMUX_RESERVED = 0, | 37 | PINMUX_RESERVED = 0, |
@@ -942,10 +928,6 @@ static pinmux_enum_t pinmux_data[] = { | |||
942 | PINMUX_DATA(MFIv4_MARK, MSEL4CR_6_1), | 928 | PINMUX_DATA(MFIv4_MARK, MSEL4CR_6_1), |
943 | }; | 929 | }; |
944 | 930 | ||
945 | #define _GPIO_PORT(pfx, sfx) PINMUX_GPIO(GPIO_PORT##pfx, PORT##pfx##_DATA) | ||
946 | #define GPIO_PORT_ALL() _190(_GPIO_PORT, , unused) | ||
947 | #define GPIO_FN(str) PINMUX_GPIO(GPIO_FN_##str, str##_MARK) | ||
948 | |||
949 | static struct pinmux_gpio pinmux_gpios[] = { | 931 | static struct pinmux_gpio pinmux_gpios[] = { |
950 | 932 | ||
951 | /* PORT */ | 933 | /* PORT */ |
diff --git a/arch/arm/mach-shmobile/pfc-sh7377.c b/arch/arm/mach-shmobile/pfc-sh7377.c index e4c70183e54e..fb3cfd3cff46 100644 --- a/arch/arm/mach-shmobile/pfc-sh7377.c +++ b/arch/arm/mach-shmobile/pfc-sh7377.c | |||
@@ -22,84 +22,65 @@ | |||
22 | #include <linux/gpio.h> | 22 | #include <linux/gpio.h> |
23 | #include <mach/sh7377.h> | 23 | #include <mach/sh7377.h> |
24 | 24 | ||
25 | #define _1(fn, pfx, sfx) fn(pfx, sfx) | 25 | #define CPU_ALL_PORT(fn, pfx, sfx) \ |
26 | 26 | PORT_10(fn, pfx, sfx), PORT_90(fn, pfx, sfx), \ | |
27 | #define _10(fn, pfx, sfx) \ | 27 | PORT_10(fn, pfx##10, sfx), \ |
28 | _1(fn, pfx##0, sfx), _1(fn, pfx##1, sfx), \ | 28 | PORT_1(fn, pfx##110, sfx), PORT_1(fn, pfx##111, sfx), \ |
29 | _1(fn, pfx##2, sfx), _1(fn, pfx##3, sfx), \ | 29 | PORT_1(fn, pfx##112, sfx), PORT_1(fn, pfx##113, sfx), \ |
30 | _1(fn, pfx##4, sfx), _1(fn, pfx##5, sfx), \ | 30 | PORT_1(fn, pfx##114, sfx), PORT_1(fn, pfx##115, sfx), \ |
31 | _1(fn, pfx##6, sfx), _1(fn, pfx##7, sfx), \ | 31 | PORT_1(fn, pfx##116, sfx), PORT_1(fn, pfx##117, sfx), \ |
32 | _1(fn, pfx##8, sfx), _1(fn, pfx##9, sfx) | 32 | PORT_1(fn, pfx##118, sfx), \ |
33 | 33 | PORT_1(fn, pfx##128, sfx), PORT_1(fn, pfx##129, sfx), \ | |
34 | #define _90(fn, pfx, sfx) \ | 34 | PORT_10(fn, pfx##13, sfx), PORT_10(fn, pfx##14, sfx), \ |
35 | _10(fn, pfx##1, sfx), _10(fn, pfx##2, sfx), \ | 35 | PORT_10(fn, pfx##15, sfx), \ |
36 | _10(fn, pfx##3, sfx), _10(fn, pfx##4, sfx), \ | 36 | PORT_1(fn, pfx##160, sfx), PORT_1(fn, pfx##161, sfx), \ |
37 | _10(fn, pfx##5, sfx), _10(fn, pfx##6, sfx), \ | 37 | PORT_1(fn, pfx##162, sfx), PORT_1(fn, pfx##163, sfx), \ |
38 | _10(fn, pfx##7, sfx), _10(fn, pfx##8, sfx), \ | 38 | PORT_1(fn, pfx##164, sfx), \ |
39 | _10(fn, pfx##9, sfx) | 39 | PORT_1(fn, pfx##192, sfx), PORT_1(fn, pfx##193, sfx), \ |
40 | 40 | PORT_1(fn, pfx##194, sfx), PORT_1(fn, pfx##195, sfx), \ | |
41 | #define _265(fn, pfx, sfx) \ | 41 | PORT_1(fn, pfx##196, sfx), PORT_1(fn, pfx##197, sfx), \ |
42 | _10(fn, pfx, sfx), _90(fn, pfx, sfx), \ | 42 | PORT_1(fn, pfx##198, sfx), PORT_1(fn, pfx##199, sfx), \ |
43 | _10(fn, pfx##10, sfx), \ | 43 | PORT_10(fn, pfx##20, sfx), PORT_10(fn, pfx##21, sfx), \ |
44 | _1(fn, pfx##110, sfx), _1(fn, pfx##111, sfx), \ | 44 | PORT_10(fn, pfx##22, sfx), PORT_10(fn, pfx##23, sfx), \ |
45 | _1(fn, pfx##112, sfx), _1(fn, pfx##113, sfx), \ | 45 | PORT_10(fn, pfx##24, sfx), PORT_10(fn, pfx##25, sfx), \ |
46 | _1(fn, pfx##114, sfx), _1(fn, pfx##115, sfx), \ | 46 | PORT_1(fn, pfx##260, sfx), PORT_1(fn, pfx##261, sfx), \ |
47 | _1(fn, pfx##116, sfx), _1(fn, pfx##117, sfx), \ | 47 | PORT_1(fn, pfx##262, sfx), PORT_1(fn, pfx##263, sfx), \ |
48 | _1(fn, pfx##118, sfx), \ | 48 | PORT_1(fn, pfx##264, sfx) |
49 | _1(fn, pfx##128, sfx), _1(fn, pfx##129, sfx), \ | ||
50 | _10(fn, pfx##13, sfx), _10(fn, pfx##14, sfx), \ | ||
51 | _10(fn, pfx##15, sfx), \ | ||
52 | _1(fn, pfx##160, sfx), _1(fn, pfx##161, sfx), \ | ||
53 | _1(fn, pfx##162, sfx), _1(fn, pfx##163, sfx), \ | ||
54 | _1(fn, pfx##164, sfx), \ | ||
55 | _1(fn, pfx##192, sfx), _1(fn, pfx##193, sfx), \ | ||
56 | _1(fn, pfx##194, sfx), _1(fn, pfx##195, sfx), \ | ||
57 | _1(fn, pfx##196, sfx), _1(fn, pfx##197, sfx), \ | ||
58 | _1(fn, pfx##198, sfx), _1(fn, pfx##199, sfx), \ | ||
59 | _10(fn, pfx##20, sfx), _10(fn, pfx##21, sfx), \ | ||
60 | _10(fn, pfx##22, sfx), _10(fn, pfx##23, sfx), \ | ||
61 | _10(fn, pfx##24, sfx), _10(fn, pfx##25, sfx), \ | ||
62 | _1(fn, pfx##260, sfx), _1(fn, pfx##261, sfx), \ | ||
63 | _1(fn, pfx##262, sfx), _1(fn, pfx##263, sfx), \ | ||
64 | _1(fn, pfx##264, sfx) | ||
65 | |||
66 | #define _PORT(pfx, sfx) pfx##_##sfx | ||
67 | #define PORT_265(str) _265(_PORT, PORT, str) | ||
68 | 49 | ||
69 | enum { | 50 | enum { |
70 | PINMUX_RESERVED = 0, | 51 | PINMUX_RESERVED = 0, |
71 | 52 | ||
72 | PINMUX_DATA_BEGIN, | 53 | PINMUX_DATA_BEGIN, |
73 | PORT_265(DATA), /* PORT0_DATA -> PORT264_DATA */ | 54 | PORT_ALL(DATA), /* PORT0_DATA -> PORT264_DATA */ |
74 | PINMUX_DATA_END, | 55 | PINMUX_DATA_END, |
75 | 56 | ||
76 | PINMUX_INPUT_BEGIN, | 57 | PINMUX_INPUT_BEGIN, |
77 | PORT_265(IN), /* PORT0_IN -> PORT264_IN */ | 58 | PORT_ALL(IN), /* PORT0_IN -> PORT264_IN */ |
78 | PINMUX_INPUT_END, | 59 | PINMUX_INPUT_END, |
79 | 60 | ||
80 | PINMUX_INPUT_PULLUP_BEGIN, | 61 | PINMUX_INPUT_PULLUP_BEGIN, |
81 | PORT_265(IN_PU), /* PORT0_IN_PU -> PORT264_IN_PU */ | 62 | PORT_ALL(IN_PU), /* PORT0_IN_PU -> PORT264_IN_PU */ |
82 | PINMUX_INPUT_PULLUP_END, | 63 | PINMUX_INPUT_PULLUP_END, |
83 | 64 | ||
84 | PINMUX_INPUT_PULLDOWN_BEGIN, | 65 | PINMUX_INPUT_PULLDOWN_BEGIN, |
85 | PORT_265(IN_PD), /* PORT0_IN_PD -> PORT264_IN_PD */ | 66 | PORT_ALL(IN_PD), /* PORT0_IN_PD -> PORT264_IN_PD */ |
86 | PINMUX_INPUT_PULLDOWN_END, | 67 | PINMUX_INPUT_PULLDOWN_END, |
87 | 68 | ||
88 | PINMUX_OUTPUT_BEGIN, | 69 | PINMUX_OUTPUT_BEGIN, |
89 | PORT_265(OUT), /* PORT0_OUT -> PORT264_OUT */ | 70 | PORT_ALL(OUT), /* PORT0_OUT -> PORT264_OUT */ |
90 | PINMUX_OUTPUT_END, | 71 | PINMUX_OUTPUT_END, |
91 | 72 | ||
92 | PINMUX_FUNCTION_BEGIN, | 73 | PINMUX_FUNCTION_BEGIN, |
93 | PORT_265(FN_IN), /* PORT0_FN_IN -> PORT264_FN_IN */ | 74 | PORT_ALL(FN_IN), /* PORT0_FN_IN -> PORT264_FN_IN */ |
94 | PORT_265(FN_OUT), /* PORT0_FN_OUT -> PORT264_FN_OUT */ | 75 | PORT_ALL(FN_OUT), /* PORT0_FN_OUT -> PORT264_FN_OUT */ |
95 | PORT_265(FN0), /* PORT0_FN0 -> PORT264_FN0 */ | 76 | PORT_ALL(FN0), /* PORT0_FN0 -> PORT264_FN0 */ |
96 | PORT_265(FN1), /* PORT0_FN1 -> PORT264_FN1 */ | 77 | PORT_ALL(FN1), /* PORT0_FN1 -> PORT264_FN1 */ |
97 | PORT_265(FN2), /* PORT0_FN2 -> PORT264_FN2 */ | 78 | PORT_ALL(FN2), /* PORT0_FN2 -> PORT264_FN2 */ |
98 | PORT_265(FN3), /* PORT0_FN3 -> PORT264_FN3 */ | 79 | PORT_ALL(FN3), /* PORT0_FN3 -> PORT264_FN3 */ |
99 | PORT_265(FN4), /* PORT0_FN4 -> PORT264_FN4 */ | 80 | PORT_ALL(FN4), /* PORT0_FN4 -> PORT264_FN4 */ |
100 | PORT_265(FN5), /* PORT0_FN5 -> PORT264_FN5 */ | 81 | PORT_ALL(FN5), /* PORT0_FN5 -> PORT264_FN5 */ |
101 | PORT_265(FN6), /* PORT0_FN6 -> PORT264_FN6 */ | 82 | PORT_ALL(FN6), /* PORT0_FN6 -> PORT264_FN6 */ |
102 | PORT_265(FN7), /* PORT0_FN7 -> PORT264_FN7 */ | 83 | PORT_ALL(FN7), /* PORT0_FN7 -> PORT264_FN7 */ |
103 | 84 | ||
104 | MSELBCR_MSEL17_1, MSELBCR_MSEL17_0, | 85 | MSELBCR_MSEL17_1, MSELBCR_MSEL17_0, |
105 | MSELBCR_MSEL16_1, MSELBCR_MSEL16_0, | 86 | MSELBCR_MSEL16_1, MSELBCR_MSEL16_0, |
@@ -1039,13 +1020,9 @@ static pinmux_enum_t pinmux_data[] = { | |||
1039 | PINMUX_DATA(RESETOUTS_MARK, PORT264_FN1), | 1020 | PINMUX_DATA(RESETOUTS_MARK, PORT264_FN1), |
1040 | }; | 1021 | }; |
1041 | 1022 | ||
1042 | #define _GPIO_PORT(pfx, sfx) PINMUX_GPIO(GPIO_PORT##pfx, PORT##pfx##_DATA) | ||
1043 | #define GPIO_PORT_265() _265(_GPIO_PORT, , unused) | ||
1044 | #define GPIO_FN(str) PINMUX_GPIO(GPIO_FN_##str, str##_MARK) | ||
1045 | |||
1046 | static struct pinmux_gpio pinmux_gpios[] = { | 1023 | static struct pinmux_gpio pinmux_gpios[] = { |
1047 | /* 55-1 -> 55-5 (GPIO) */ | 1024 | /* 55-1 -> 55-5 (GPIO) */ |
1048 | GPIO_PORT_265(), | 1025 | GPIO_PORT_ALL(), |
1049 | 1026 | ||
1050 | /* Special Pull-up / Pull-down Functions */ | 1027 | /* Special Pull-up / Pull-down Functions */ |
1051 | GPIO_FN(PORT66_KEYIN0_PU), GPIO_FN(PORT67_KEYIN1_PU), | 1028 | GPIO_FN(PORT66_KEYIN0_PU), GPIO_FN(PORT67_KEYIN1_PU), |
diff --git a/arch/arm/mach-shmobile/pfc-sh73a0.c b/arch/arm/mach-shmobile/pfc-sh73a0.c index f860caa96671..a1ea11956b15 100644 --- a/arch/arm/mach-shmobile/pfc-sh73a0.c +++ b/arch/arm/mach-shmobile/pfc-sh73a0.c | |||
@@ -24,83 +24,71 @@ | |||
24 | #include <mach/sh73a0.h> | 24 | #include <mach/sh73a0.h> |
25 | #include <mach/irqs.h> | 25 | #include <mach/irqs.h> |
26 | 26 | ||
27 | #define _1(fn, pfx, sfx) fn(pfx, sfx) | 27 | #define CPU_ALL_PORT(fn, pfx, sfx) \ |
28 | 28 | PORT_10(fn, pfx, sfx), PORT_10(fn, pfx##1, sfx), \ | |
29 | #define _10(fn, pfx, sfx) \ | 29 | PORT_10(fn, pfx##2, sfx), PORT_10(fn, pfx##3, sfx), \ |
30 | _1(fn, pfx##0, sfx), _1(fn, pfx##1, sfx), \ | 30 | PORT_10(fn, pfx##4, sfx), PORT_10(fn, pfx##5, sfx), \ |
31 | _1(fn, pfx##2, sfx), _1(fn, pfx##3, sfx), \ | 31 | PORT_10(fn, pfx##6, sfx), PORT_10(fn, pfx##7, sfx), \ |
32 | _1(fn, pfx##4, sfx), _1(fn, pfx##5, sfx), \ | 32 | PORT_10(fn, pfx##8, sfx), PORT_10(fn, pfx##9, sfx), \ |
33 | _1(fn, pfx##6, sfx), _1(fn, pfx##7, sfx), \ | 33 | PORT_10(fn, pfx##10, sfx), \ |
34 | _1(fn, pfx##8, sfx), _1(fn, pfx##9, sfx) | 34 | PORT_1(fn, pfx##110, sfx), PORT_1(fn, pfx##111, sfx), \ |
35 | 35 | PORT_1(fn, pfx##112, sfx), PORT_1(fn, pfx##113, sfx), \ | |
36 | #define _310(fn, pfx, sfx) \ | 36 | PORT_1(fn, pfx##114, sfx), PORT_1(fn, pfx##115, sfx), \ |
37 | _10(fn, pfx, sfx), _10(fn, pfx##1, sfx), \ | 37 | PORT_1(fn, pfx##116, sfx), PORT_1(fn, pfx##117, sfx), \ |
38 | _10(fn, pfx##2, sfx), _10(fn, pfx##3, sfx), \ | 38 | PORT_1(fn, pfx##118, sfx), \ |
39 | _10(fn, pfx##4, sfx), _10(fn, pfx##5, sfx), \ | 39 | PORT_1(fn, pfx##128, sfx), PORT_1(fn, pfx##129, sfx), \ |
40 | _10(fn, pfx##6, sfx), _10(fn, pfx##7, sfx), \ | 40 | PORT_10(fn, pfx##13, sfx), PORT_10(fn, pfx##14, sfx), \ |
41 | _10(fn, pfx##8, sfx), _10(fn, pfx##9, sfx), \ | 41 | PORT_10(fn, pfx##15, sfx), \ |
42 | _10(fn, pfx##10, sfx), \ | 42 | PORT_1(fn, pfx##160, sfx), PORT_1(fn, pfx##161, sfx), \ |
43 | _1(fn, pfx##110, sfx), _1(fn, pfx##111, sfx), \ | 43 | PORT_1(fn, pfx##162, sfx), PORT_1(fn, pfx##163, sfx), \ |
44 | _1(fn, pfx##112, sfx), _1(fn, pfx##113, sfx), \ | 44 | PORT_1(fn, pfx##164, sfx), \ |
45 | _1(fn, pfx##114, sfx), _1(fn, pfx##115, sfx), \ | 45 | PORT_1(fn, pfx##192, sfx), PORT_1(fn, pfx##193, sfx), \ |
46 | _1(fn, pfx##116, sfx), _1(fn, pfx##117, sfx), \ | 46 | PORT_1(fn, pfx##194, sfx), PORT_1(fn, pfx##195, sfx), \ |
47 | _1(fn, pfx##118, sfx), \ | 47 | PORT_1(fn, pfx##196, sfx), PORT_1(fn, pfx##197, sfx), \ |
48 | _1(fn, pfx##128, sfx), _1(fn, pfx##129, sfx), \ | 48 | PORT_1(fn, pfx##198, sfx), PORT_1(fn, pfx##199, sfx), \ |
49 | _10(fn, pfx##13, sfx), _10(fn, pfx##14, sfx), \ | 49 | PORT_10(fn, pfx##20, sfx), PORT_10(fn, pfx##21, sfx), \ |
50 | _10(fn, pfx##15, sfx), \ | 50 | PORT_10(fn, pfx##22, sfx), PORT_10(fn, pfx##23, sfx), \ |
51 | _1(fn, pfx##160, sfx), _1(fn, pfx##161, sfx), \ | 51 | PORT_10(fn, pfx##24, sfx), PORT_10(fn, pfx##25, sfx), \ |
52 | _1(fn, pfx##162, sfx), _1(fn, pfx##163, sfx), \ | 52 | PORT_10(fn, pfx##26, sfx), PORT_10(fn, pfx##27, sfx), \ |
53 | _1(fn, pfx##164, sfx), \ | 53 | PORT_1(fn, pfx##280, sfx), PORT_1(fn, pfx##281, sfx), \ |
54 | _1(fn, pfx##192, sfx), _1(fn, pfx##193, sfx), \ | 54 | PORT_1(fn, pfx##282, sfx), \ |
55 | _1(fn, pfx##194, sfx), _1(fn, pfx##195, sfx), \ | 55 | PORT_1(fn, pfx##288, sfx), PORT_1(fn, pfx##289, sfx), \ |
56 | _1(fn, pfx##196, sfx), _1(fn, pfx##197, sfx), \ | 56 | PORT_10(fn, pfx##29, sfx), PORT_10(fn, pfx##30, sfx) |
57 | _1(fn, pfx##198, sfx), _1(fn, pfx##199, sfx), \ | ||
58 | _10(fn, pfx##20, sfx), _10(fn, pfx##21, sfx), \ | ||
59 | _10(fn, pfx##22, sfx), _10(fn, pfx##23, sfx), \ | ||
60 | _10(fn, pfx##24, sfx), _10(fn, pfx##25, sfx), \ | ||
61 | _10(fn, pfx##26, sfx), _10(fn, pfx##27, sfx), \ | ||
62 | _1(fn, pfx##280, sfx), _1(fn, pfx##281, sfx), \ | ||
63 | _1(fn, pfx##282, sfx), \ | ||
64 | _1(fn, pfx##288, sfx), _1(fn, pfx##289, sfx), \ | ||
65 | _10(fn, pfx##29, sfx), _10(fn, pfx##30, sfx) | ||
66 | |||
67 | #define _PORT(pfx, sfx) pfx##_##sfx | ||
68 | #define PORT_310(str) _310(_PORT, PORT, str) | ||
69 | 57 | ||
70 | enum { | 58 | enum { |
71 | PINMUX_RESERVED = 0, | 59 | PINMUX_RESERVED = 0, |
72 | 60 | ||
73 | PINMUX_DATA_BEGIN, | 61 | PINMUX_DATA_BEGIN, |
74 | PORT_310(DATA), /* PORT0_DATA -> PORT309_DATA */ | 62 | PORT_ALL(DATA), /* PORT0_DATA -> PORT309_DATA */ |
75 | PINMUX_DATA_END, | 63 | PINMUX_DATA_END, |
76 | 64 | ||
77 | PINMUX_INPUT_BEGIN, | 65 | PINMUX_INPUT_BEGIN, |
78 | PORT_310(IN), /* PORT0_IN -> PORT309_IN */ | 66 | PORT_ALL(IN), /* PORT0_IN -> PORT309_IN */ |
79 | PINMUX_INPUT_END, | 67 | PINMUX_INPUT_END, |
80 | 68 | ||
81 | PINMUX_INPUT_PULLUP_BEGIN, | 69 | PINMUX_INPUT_PULLUP_BEGIN, |
82 | PORT_310(IN_PU), /* PORT0_IN_PU -> PORT309_IN_PU */ | 70 | PORT_ALL(IN_PU), /* PORT0_IN_PU -> PORT309_IN_PU */ |
83 | PINMUX_INPUT_PULLUP_END, | 71 | PINMUX_INPUT_PULLUP_END, |
84 | 72 | ||
85 | PINMUX_INPUT_PULLDOWN_BEGIN, | 73 | PINMUX_INPUT_PULLDOWN_BEGIN, |
86 | PORT_310(IN_PD), /* PORT0_IN_PD -> PORT309_IN_PD */ | 74 | PORT_ALL(IN_PD), /* PORT0_IN_PD -> PORT309_IN_PD */ |
87 | PINMUX_INPUT_PULLDOWN_END, | 75 | PINMUX_INPUT_PULLDOWN_END, |
88 | 76 | ||
89 | PINMUX_OUTPUT_BEGIN, | 77 | PINMUX_OUTPUT_BEGIN, |
90 | PORT_310(OUT), /* PORT0_OUT -> PORT309_OUT */ | 78 | PORT_ALL(OUT), /* PORT0_OUT -> PORT309_OUT */ |
91 | PINMUX_OUTPUT_END, | 79 | PINMUX_OUTPUT_END, |
92 | 80 | ||
93 | PINMUX_FUNCTION_BEGIN, | 81 | PINMUX_FUNCTION_BEGIN, |
94 | PORT_310(FN_IN), /* PORT0_FN_IN -> PORT309_FN_IN */ | 82 | PORT_ALL(FN_IN), /* PORT0_FN_IN -> PORT309_FN_IN */ |
95 | PORT_310(FN_OUT), /* PORT0_FN_OUT -> PORT309_FN_OUT */ | 83 | PORT_ALL(FN_OUT), /* PORT0_FN_OUT -> PORT309_FN_OUT */ |
96 | PORT_310(FN0), /* PORT0_FN0 -> PORT309_FN0 */ | 84 | PORT_ALL(FN0), /* PORT0_FN0 -> PORT309_FN0 */ |
97 | PORT_310(FN1), /* PORT0_FN1 -> PORT309_FN1 */ | 85 | PORT_ALL(FN1), /* PORT0_FN1 -> PORT309_FN1 */ |
98 | PORT_310(FN2), /* PORT0_FN2 -> PORT309_FN2 */ | 86 | PORT_ALL(FN2), /* PORT0_FN2 -> PORT309_FN2 */ |
99 | PORT_310(FN3), /* PORT0_FN3 -> PORT309_FN3 */ | 87 | PORT_ALL(FN3), /* PORT0_FN3 -> PORT309_FN3 */ |
100 | PORT_310(FN4), /* PORT0_FN4 -> PORT309_FN4 */ | 88 | PORT_ALL(FN4), /* PORT0_FN4 -> PORT309_FN4 */ |
101 | PORT_310(FN5), /* PORT0_FN5 -> PORT309_FN5 */ | 89 | PORT_ALL(FN5), /* PORT0_FN5 -> PORT309_FN5 */ |
102 | PORT_310(FN6), /* PORT0_FN6 -> PORT309_FN6 */ | 90 | PORT_ALL(FN6), /* PORT0_FN6 -> PORT309_FN6 */ |
103 | PORT_310(FN7), /* PORT0_FN7 -> PORT309_FN7 */ | 91 | PORT_ALL(FN7), /* PORT0_FN7 -> PORT309_FN7 */ |
104 | 92 | ||
105 | MSEL2CR_MSEL19_0, MSEL2CR_MSEL19_1, | 93 | MSEL2CR_MSEL19_0, MSEL2CR_MSEL19_1, |
106 | MSEL2CR_MSEL18_0, MSEL2CR_MSEL18_1, | 94 | MSEL2CR_MSEL18_0, MSEL2CR_MSEL18_1, |
@@ -1555,12 +1543,8 @@ static pinmux_enum_t pinmux_data[] = { | |||
1555 | PINMUX_DATA(FSIAISLD_PU_MARK, PORT55_FN1, PORT55_IN_PU), | 1543 | PINMUX_DATA(FSIAISLD_PU_MARK, PORT55_FN1, PORT55_IN_PU), |
1556 | }; | 1544 | }; |
1557 | 1545 | ||
1558 | #define _GPIO_PORT(pfx, sfx) PINMUX_GPIO(GPIO_PORT##pfx, PORT##pfx##_DATA) | ||
1559 | #define GPIO_PORT_310() _310(_GPIO_PORT, , unused) | ||
1560 | #define GPIO_FN(str) PINMUX_GPIO(GPIO_FN_##str, str##_MARK) | ||
1561 | |||
1562 | static struct pinmux_gpio pinmux_gpios[] = { | 1546 | static struct pinmux_gpio pinmux_gpios[] = { |
1563 | GPIO_PORT_310(), | 1547 | GPIO_PORT_ALL(), |
1564 | 1548 | ||
1565 | /* Table 25-1 (Functions 0-7) */ | 1549 | /* Table 25-1 (Functions 0-7) */ |
1566 | GPIO_FN(VBUS_0), | 1550 | GPIO_FN(VBUS_0), |
diff --git a/include/linux/sh_pfc.h b/include/linux/sh_pfc.h index 5585f280dc1d..5f6322ac63e7 100644 --- a/include/linux/sh_pfc.h +++ b/include/linux/sh_pfc.h | |||
@@ -104,6 +104,29 @@ struct pinmux_info { | |||
104 | int register_pinmux(struct pinmux_info *pip); | 104 | int register_pinmux(struct pinmux_info *pip); |
105 | int unregister_pinmux(struct pinmux_info *pip); | 105 | int unregister_pinmux(struct pinmux_info *pip); |
106 | 106 | ||
107 | /* helper macro for port */ | ||
108 | #define PORT_1(fn, pfx, sfx) fn(pfx, sfx) | ||
109 | |||
110 | #define PORT_10(fn, pfx, sfx) \ | ||
111 | PORT_1(fn, pfx##0, sfx), PORT_1(fn, pfx##1, sfx), \ | ||
112 | PORT_1(fn, pfx##2, sfx), PORT_1(fn, pfx##3, sfx), \ | ||
113 | PORT_1(fn, pfx##4, sfx), PORT_1(fn, pfx##5, sfx), \ | ||
114 | PORT_1(fn, pfx##6, sfx), PORT_1(fn, pfx##7, sfx), \ | ||
115 | PORT_1(fn, pfx##8, sfx), PORT_1(fn, pfx##9, sfx) | ||
116 | |||
117 | #define PORT_90(fn, pfx, sfx) \ | ||
118 | PORT_10(fn, pfx##1, sfx), PORT_10(fn, pfx##2, sfx), \ | ||
119 | PORT_10(fn, pfx##3, sfx), PORT_10(fn, pfx##4, sfx), \ | ||
120 | PORT_10(fn, pfx##5, sfx), PORT_10(fn, pfx##6, sfx), \ | ||
121 | PORT_10(fn, pfx##7, sfx), PORT_10(fn, pfx##8, sfx), \ | ||
122 | PORT_10(fn, pfx##9, sfx) | ||
123 | |||
124 | #define _PORT_ALL(pfx, sfx) pfx##_##sfx | ||
125 | #define _GPIO_PORT(pfx, sfx) PINMUX_GPIO(GPIO_PORT##pfx, PORT##pfx##_DATA) | ||
126 | #define PORT_ALL(str) CPU_ALL_PORT(_PORT_ALL, PORT, str) | ||
127 | #define GPIO_PORT_ALL() CPU_ALL_PORT(_GPIO_PORT, , unused) | ||
128 | #define GPIO_FN(str) PINMUX_GPIO(GPIO_FN_##str, str##_MARK) | ||
129 | |||
107 | /* helper macro for pinmux_enum_t */ | 130 | /* helper macro for pinmux_enum_t */ |
108 | #define PORT_DATA_I(nr) \ | 131 | #define PORT_DATA_I(nr) \ |
109 | PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_IN) | 132 | PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_IN) |