diff options
Diffstat (limited to 'arch/arm/mach-shmobile/pfc-sh7367.c')
-rw-r--r-- | arch/arm/mach-shmobile/pfc-sh7367.c | 122 |
1 files changed, 24 insertions, 98 deletions
diff --git a/arch/arm/mach-shmobile/pfc-sh7367.c b/arch/arm/mach-shmobile/pfc-sh7367.c index 128555e76e43..e6e524654e67 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, |
@@ -327,41 +308,6 @@ enum { | |||
327 | PINMUX_MARK_END, | 308 | PINMUX_MARK_END, |
328 | }; | 309 | }; |
329 | 310 | ||
330 | #define PORT_DATA_I(nr) \ | ||
331 | PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_IN) | ||
332 | |||
333 | #define PORT_DATA_I_PD(nr) \ | ||
334 | PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \ | ||
335 | PORT##nr##_IN, PORT##nr##_IN_PD) | ||
336 | |||
337 | #define PORT_DATA_I_PU(nr) \ | ||
338 | PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \ | ||
339 | PORT##nr##_IN, PORT##nr##_IN_PU) | ||
340 | |||
341 | #define PORT_DATA_I_PU_PD(nr) \ | ||
342 | PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \ | ||
343 | PORT##nr##_IN, PORT##nr##_IN_PD, PORT##nr##_IN_PU) | ||
344 | |||
345 | #define PORT_DATA_O(nr) \ | ||
346 | PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT) | ||
347 | |||
348 | #define PORT_DATA_IO(nr) \ | ||
349 | PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \ | ||
350 | PORT##nr##_IN) | ||
351 | |||
352 | #define PORT_DATA_IO_PD(nr) \ | ||
353 | PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \ | ||
354 | PORT##nr##_IN, PORT##nr##_IN_PD) | ||
355 | |||
356 | #define PORT_DATA_IO_PU(nr) \ | ||
357 | PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \ | ||
358 | PORT##nr##_IN, PORT##nr##_IN_PU) | ||
359 | |||
360 | #define PORT_DATA_IO_PU_PD(nr) \ | ||
361 | PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \ | ||
362 | PORT##nr##_IN, PORT##nr##_IN_PD, PORT##nr##_IN_PU) | ||
363 | |||
364 | |||
365 | static pinmux_enum_t pinmux_data[] = { | 311 | static pinmux_enum_t pinmux_data[] = { |
366 | 312 | ||
367 | /* specify valid pin states for each pin in GPIO mode */ | 313 | /* specify valid pin states for each pin in GPIO mode */ |
@@ -1098,13 +1044,9 @@ static pinmux_enum_t pinmux_data[] = { | |||
1098 | PINMUX_DATA(DIVLOCK_MARK, PORT272_FN1), | 1044 | PINMUX_DATA(DIVLOCK_MARK, PORT272_FN1), |
1099 | }; | 1045 | }; |
1100 | 1046 | ||
1101 | #define _GPIO_PORT(pfx, sfx) PINMUX_GPIO(GPIO_PORT##pfx, PORT##pfx##_DATA) | ||
1102 | #define GPIO_PORT_273() _273(_GPIO_PORT, , unused) | ||
1103 | #define GPIO_FN(str) PINMUX_GPIO(GPIO_FN_##str, str##_MARK) | ||
1104 | |||
1105 | static struct pinmux_gpio pinmux_gpios[] = { | 1047 | static struct pinmux_gpio pinmux_gpios[] = { |
1106 | /* 49-1 -> 49-6 (GPIO) */ | 1048 | /* 49-1 -> 49-6 (GPIO) */ |
1107 | GPIO_PORT_273(), | 1049 | GPIO_PORT_ALL(), |
1108 | 1050 | ||
1109 | /* Special Pull-up / Pull-down Functions */ | 1051 | /* Special Pull-up / Pull-down Functions */ |
1110 | GPIO_FN(PORT48_KEYIN0_PU), GPIO_FN(PORT49_KEYIN1_PU), | 1052 | GPIO_FN(PORT48_KEYIN0_PU), GPIO_FN(PORT49_KEYIN1_PU), |
@@ -1345,22 +1287,6 @@ static struct pinmux_gpio pinmux_gpios[] = { | |||
1345 | GPIO_FN(DIVLOCK), | 1287 | GPIO_FN(DIVLOCK), |
1346 | }; | 1288 | }; |
1347 | 1289 | ||
1348 | /* helper for top 4 bits in PORTnCR */ | ||
1349 | #define PCRH(in, in_pd, in_pu, out) \ | ||
1350 | 0, (out), (in), 0, \ | ||
1351 | 0, 0, 0, 0, \ | ||
1352 | 0, 0, (in_pd), 0, \ | ||
1353 | 0, 0, (in_pu), 0 | ||
1354 | |||
1355 | #define PORTCR(nr, reg) \ | ||
1356 | { PINMUX_CFG_REG("PORT" nr "CR", reg, 8, 4) { \ | ||
1357 | PCRH(PORT##nr##_IN, PORT##nr##_IN_PD, \ | ||
1358 | PORT##nr##_IN_PU, PORT##nr##_OUT), \ | ||
1359 | PORT##nr##_FN0, PORT##nr##_FN1, PORT##nr##_FN2, \ | ||
1360 | PORT##nr##_FN3, PORT##nr##_FN4, PORT##nr##_FN5, \ | ||
1361 | PORT##nr##_FN6, PORT##nr##_FN7 } \ | ||
1362 | } | ||
1363 | |||
1364 | static struct pinmux_cfg_reg pinmux_config_regs[] = { | 1290 | static struct pinmux_cfg_reg pinmux_config_regs[] = { |
1365 | PORTCR(0, 0xe6050000), /* PORT0CR */ | 1291 | PORTCR(0, 0xe6050000), /* PORT0CR */ |
1366 | PORTCR(1, 0xe6050001), /* PORT1CR */ | 1292 | PORTCR(1, 0xe6050001), /* PORT1CR */ |