diff options
Diffstat (limited to 'include/linux/sh_pfc.h')
| -rw-r--r-- | include/linux/sh_pfc.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/include/linux/sh_pfc.h b/include/linux/sh_pfc.h index bc8c9208f7e2..8446789216e5 100644 --- a/include/linux/sh_pfc.h +++ b/include/linux/sh_pfc.h | |||
| @@ -104,4 +104,80 @@ 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 | |||
| 130 | /* helper macro for pinmux_enum_t */ | ||
| 131 | #define PORT_DATA_I(nr) \ | ||
| 132 | PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_IN) | ||
| 133 | |||
| 134 | #define PORT_DATA_I_PD(nr) \ | ||
| 135 | PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \ | ||
| 136 | PORT##nr##_IN, PORT##nr##_IN_PD) | ||
| 137 | |||
| 138 | #define PORT_DATA_I_PU(nr) \ | ||
| 139 | PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \ | ||
| 140 | PORT##nr##_IN, PORT##nr##_IN_PU) | ||
| 141 | |||
| 142 | #define PORT_DATA_I_PU_PD(nr) \ | ||
| 143 | PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \ | ||
| 144 | PORT##nr##_IN, PORT##nr##_IN_PD, PORT##nr##_IN_PU) | ||
| 145 | |||
| 146 | #define PORT_DATA_O(nr) \ | ||
| 147 | PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT) | ||
| 148 | |||
| 149 | #define PORT_DATA_IO(nr) \ | ||
| 150 | PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \ | ||
| 151 | PORT##nr##_IN) | ||
| 152 | |||
| 153 | #define PORT_DATA_IO_PD(nr) \ | ||
| 154 | PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \ | ||
| 155 | PORT##nr##_IN, PORT##nr##_IN_PD) | ||
| 156 | |||
| 157 | #define PORT_DATA_IO_PU(nr) \ | ||
| 158 | PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \ | ||
| 159 | PORT##nr##_IN, PORT##nr##_IN_PU) | ||
| 160 | |||
| 161 | #define PORT_DATA_IO_PU_PD(nr) \ | ||
| 162 | PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \ | ||
| 163 | PORT##nr##_IN, PORT##nr##_IN_PD, PORT##nr##_IN_PU) | ||
| 164 | |||
| 165 | /* helper macro for top 4 bits in PORTnCR */ | ||
| 166 | #define _PCRH(in, in_pd, in_pu, out) \ | ||
| 167 | 0, (out), (in), 0, \ | ||
| 168 | 0, 0, 0, 0, \ | ||
| 169 | 0, 0, (in_pd), 0, \ | ||
| 170 | 0, 0, (in_pu), 0 | ||
| 171 | |||
| 172 | #define PORTCR(nr, reg) \ | ||
| 173 | { \ | ||
| 174 | PINMUX_CFG_REG("PORT" nr "CR", reg, 8, 4) { \ | ||
| 175 | _PCRH(PORT##nr##_IN, PORT##nr##_IN_PD, \ | ||
| 176 | PORT##nr##_IN_PU, PORT##nr##_OUT), \ | ||
| 177 | PORT##nr##_FN0, PORT##nr##_FN1, \ | ||
| 178 | PORT##nr##_FN2, PORT##nr##_FN3, \ | ||
| 179 | PORT##nr##_FN4, PORT##nr##_FN5, \ | ||
| 180 | PORT##nr##_FN6, PORT##nr##_FN7 } \ | ||
| 181 | } | ||
| 182 | |||
| 107 | #endif /* __SH_PFC_H */ | 183 | #endif /* __SH_PFC_H */ |
