12 #include <linux/kernel.h>
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)
22 #define CPU_32_PORT5(fn, pfx, sfx) \
23 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), \
25 PORT_1(fn, pfx##4, sfx), PORT_1(fn, pfx##5, sfx), \
26 PORT_1(fn, pfx##6, sfx), PORT_1(fn, pfx##7, sfx), \
27 PORT_1(fn, pfx##8, sfx), PORT_1(fn, pfx##9, sfx), \
28 PORT_1(fn, pfx##10, sfx), PORT_1(fn, pfx##11, sfx)
31 #define CPU_ALL_PORT(fn, pfx, sfx) \
32 CPU_32_PORT(fn, pfx##_0_, sfx), \
33 CPU_32_PORT(fn, pfx##_1_, sfx), \
34 CPU_32_PORT(fn, pfx##_2_, sfx), \
35 CPU_32_PORT(fn, pfx##_3_, sfx), \
36 CPU_32_PORT(fn, pfx##_4_, sfx), \
37 CPU_32_PORT5(fn, pfx##_5_, sfx)
39 #define _GP_GPIO(pfx, sfx) PINMUX_GPIO(GPIO_GP##pfx, GP##pfx##_DATA)
40 #define _GP_DATA(pfx, sfx) PINMUX_DATA(GP##pfx##_DATA, GP##pfx##_FN, \
41 GP##pfx##_IN, GP##pfx##_OUT)
43 #define _GP_INOUTSEL(pfx, sfx) GP##pfx##_IN, GP##pfx##_OUT
44 #define _GP_INDT(pfx, sfx) GP##pfx##_DATA
46 #define GP_ALL(str) CPU_ALL_PORT(_PORT_ALL, GP, str)
47 #define PINMUX_GPIO_GP_ALL() CPU_ALL_PORT(_GP_GPIO, , unused)
48 #define PINMUX_DATA_GP_ALL() CPU_ALL_PORT(_GP_DATA, , unused)
50 #define PORT_10_REV(fn, pfx, sfx) \
51 PORT_1(fn, pfx##9, sfx), PORT_1(fn, pfx##8, sfx), \
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)
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)
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)
65 #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, \
1841 0, 0, 0, 0, 0, 0, 0, 0,
1842 0, 0, 0, 0, 0, 0, 0, 0,
1843 0, 0, 0, 0, 0, 0, 0, 0,
1844 0, 0, 0, 0, 0, 0, 0, 0,
1845 0, 0, 0, 0, 0, 0, 0, 0,
1848 0, 0, 0, 0, 0, 0, 0, 0,
1857 2, 2, 2, 2, 2, 2, 2, 2,
1858 2, 2, 2, 2, 2, 2, 2, 2) {
1894 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2) {
1929 1, 3, 3, 2, 3, 3, 3, 3, 3, 3, 2, 3) {
1965 2, 3, 3, 3, 1, 2, 3, 3, 3, 3, 3, 1, 2) {
2002 2, 2, 2, 2, 2, 2 , 2, 3, 3, 3, 3, 3, 3) {
2037 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3) {
2077 1, 1, 1, 1, 1, 1, 1, 1,
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ATA, GP_5_6_DATA, GP_5_5_DATA, GP_5_4_DATA,
2449 GP_5_3_DATA, GP_5_2_DATA, GP_5_1_DATA, GP_5_0_DATA }
2454 static struct resource sh7734_pfc_resources[] = {
2456 .start = 0xFFFC0000,
2461 .start = 0xFFC40000,
2468 .name =
"sh7734_pfc",
2470 .resource = sh7734_pfc_resources,
2471 .num_resources =
ARRAY_SIZE(sh7734_pfc_resources),
2473 .unlock_reg = 0xFFFC0000,
2485 .gpios = pinmux_gpios,
2486 .cfg_regs = pinmux_config_regs,
2487 .data_regs = pinmux_data_regs,
2489 .gpio_data = pinmux_data,
2493 static int __init plat_pinmux_setup(
void)
2495 return register_pinmux(&sh7734_pinmux_info);