Stefano Babic | b9bb053 | 2011-01-20 07:49:52 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2011 |
| 3 | * Stefano Babic, DENX Software Engineering, sbabic@denx.de. |
| 4 | * |
| 5 | * Copyright 2008-2009 Freescale Semiconductor, Inc. All Rights Reserved. |
| 6 | * |
| 7 | * See file CREDITS for list of people who contributed to this |
| 8 | * project. |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or |
| 11 | * modify it under the terms of the GNU General Public License as |
| 12 | * published by the Free Software Foundation; either version 2 of |
| 13 | * the License, or (at your option) any later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License |
| 21 | * along with this program; if not, write to the Free Software |
| 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 23 | * MA 02111-1307 USA |
| 24 | */ |
| 25 | |
| 26 | #ifndef __MACH_MX35_IOMUX_H__ |
| 27 | #define __MACH_MX35_IOMUX_H__ |
| 28 | |
| 29 | #include <asm/arch/imx-regs.h> |
| 30 | |
| 31 | /* |
| 32 | * various IOMUX functions |
| 33 | */ |
| 34 | typedef enum iomux_pin_config { |
| 35 | MUX_CONFIG_FUNC = 0, /* used as function */ |
| 36 | MUX_CONFIG_ALT1, /* used as alternate function 1 */ |
| 37 | MUX_CONFIG_ALT2, /* used as alternate function 2 */ |
| 38 | MUX_CONFIG_ALT3, /* used as alternate function 3 */ |
| 39 | MUX_CONFIG_ALT4, /* used as alternate function 4 */ |
| 40 | MUX_CONFIG_ALT5, /* used as alternate function 5 */ |
| 41 | MUX_CONFIG_ALT6, /* used as alternate function 6 */ |
| 42 | MUX_CONFIG_ALT7, /* used as alternate function 7 */ |
| 43 | MUX_CONFIG_SION = 0x1 << 4, /* used as LOOPBACK:MUX SION bit */ |
| 44 | MUX_CONFIG_GPIO = MUX_CONFIG_ALT5, /* used as GPIO */ |
| 45 | } iomux_pin_cfg_t; |
| 46 | |
| 47 | /* |
| 48 | * various IOMUX pad functions |
| 49 | */ |
| 50 | typedef enum iomux_pad_config { |
| 51 | PAD_CTL_DRV_3_3V = 0x0 << 13, |
| 52 | PAD_CTL_DRV_1_8V = 0x1 << 13, |
| 53 | PAD_CTL_HYS_CMOS = 0x0 << 8, |
| 54 | PAD_CTL_HYS_SCHMITZ = 0x1 << 8, |
| 55 | PAD_CTL_PKE_NONE = 0x0 << 7, |
| 56 | PAD_CTL_PKE_ENABLE = 0x1 << 7, |
| 57 | PAD_CTL_PUE_KEEPER = 0x0 << 6, |
| 58 | PAD_CTL_PUE_PUD = 0x1 << 6, |
| 59 | PAD_CTL_100K_PD = 0x0 << 4, |
| 60 | PAD_CTL_47K_PU = 0x1 << 4, |
| 61 | PAD_CTL_100K_PU = 0x2 << 4, |
| 62 | PAD_CTL_22K_PU = 0x3 << 4, |
| 63 | PAD_CTL_ODE_CMOS = 0x0 << 3, |
| 64 | PAD_CTL_ODE_OpenDrain = 0x1 << 3, |
| 65 | PAD_CTL_DRV_NORMAL = 0x0 << 1, |
| 66 | PAD_CTL_DRV_HIGH = 0x1 << 1, |
| 67 | PAD_CTL_DRV_MAX = 0x2 << 1, |
| 68 | PAD_CTL_SRE_SLOW = 0x0 << 0, |
| 69 | PAD_CTL_SRE_FAST = 0x1 << 0 |
| 70 | } iomux_pad_config_t; |
| 71 | |
| 72 | /* |
| 73 | * various IOMUX general purpose functions |
| 74 | */ |
| 75 | typedef enum iomux_gp_func { |
| 76 | MUX_SDCTL_CSD0_SEL = 0x1 << 0, |
| 77 | MUX_SDCTL_CSD1_SEL = 0x1 << 1, |
| 78 | MUX_TAMPER_DETECT_EN = 0x1 << 2, |
| 79 | } iomux_gp_func_t; |
| 80 | |
| 81 | /* |
| 82 | * various IOMUX input select register index |
| 83 | */ |
| 84 | typedef enum iomux_input_select { |
| 85 | MUX_IN_AMX_P5_RXCLK = 0, |
| 86 | MUX_IN_AMX_P5_RXFS, |
| 87 | MUX_IN_AMX_P6_DA, |
| 88 | MUX_IN_AMX_P6_DB, |
| 89 | MUX_IN_AMX_P6_RXCLK, |
| 90 | MUX_IN_AMX_P6_RXFS, |
| 91 | MUX_IN_AMX_P6_TXCLK, |
| 92 | MUX_IN_AMX_P6_TXFS, |
| 93 | MUX_IN_CAN1_CANRX, |
| 94 | MUX_IN_CAN2_CANRX, |
| 95 | MUX_IN_CCM_32K_MUXED, |
| 96 | MUX_IN_CCM_PMIC_RDY, |
| 97 | MUX_IN_CSPI1_SS2_B, |
| 98 | MUX_IN_CSPI1_SS3_B, |
| 99 | MUX_IN_CSPI2_CLK_IN, |
| 100 | MUX_IN_CSPI2_DATAREADY_B, |
| 101 | MUX_IN_CSPI2_MISO, |
| 102 | MUX_IN_CSPI2_MOSI, |
| 103 | MUX_IN_CSPI2_SS0_B, |
| 104 | MUX_IN_CSPI2_SS1_B, |
| 105 | MUX_IN_CSPI2_SS2_B, |
| 106 | MUX_IN_CSPI2_SS3_B, |
| 107 | MUX_IN_EMI_WEIM_DTACK_B, |
| 108 | MUX_IN_ESDHC1_DAT4_IN, |
| 109 | MUX_IN_ESDHC1_DAT5_IN, |
| 110 | MUX_IN_ESDHC1_DAT6_IN, |
| 111 | MUX_IN_ESDHC1_DAT7_IN, |
| 112 | MUX_IN_ESDHC3_CARD_CLK_IN, |
| 113 | MUX_IN_ESDHC3_CMD_IN, |
| 114 | MUX_IN_ESDHC3_DAT0, |
| 115 | MUX_IN_ESDHC3_DAT1, |
| 116 | MUX_IN_ESDHC3_DAT2, |
| 117 | MUX_IN_ESDHC3_DAT3, |
| 118 | MUX_IN_GPIO1_IN_0, |
| 119 | MUX_IN_GPIO1_IN_10, |
| 120 | MUX_IN_GPIO1_IN_11, |
| 121 | MUX_IN_GPIO1_IN_1, |
| 122 | MUX_IN_GPIO1_IN_20, |
| 123 | MUX_IN_GPIO1_IN_21, |
| 124 | MUX_IN_GPIO1_IN_22, |
| 125 | MUX_IN_GPIO1_IN_2, |
| 126 | MUX_IN_GPIO1_IN_3, |
| 127 | MUX_IN_GPIO1_IN_4, |
| 128 | MUX_IN_GPIO1_IN_5, |
| 129 | MUX_IN_GPIO1_IN_6, |
| 130 | MUX_IN_GPIO1_IN_7, |
| 131 | MUX_IN_GPIO1_IN_8, |
| 132 | MUX_IN_GPIO1_IN_9, |
| 133 | MUX_IN_GPIO2_IN_0, |
| 134 | MUX_IN_GPIO2_IN_10, |
| 135 | MUX_IN_GPIO2_IN_11, |
| 136 | MUX_IN_GPIO2_IN_12, |
| 137 | MUX_IN_GPIO2_IN_13, |
| 138 | MUX_IN_GPIO2_IN_14, |
| 139 | MUX_IN_GPIO2_IN_15, |
| 140 | MUX_IN_GPIO2_IN_16, |
| 141 | MUX_IN_GPIO2_IN_17, |
| 142 | MUX_IN_GPIO2_IN_18, |
| 143 | MUX_IN_GPIO2_IN_19, |
| 144 | MUX_IN_GPIO2_IN_20, |
| 145 | MUX_IN_GPIO2_IN_21, |
| 146 | MUX_IN_GPIO2_IN_22, |
| 147 | MUX_IN_GPIO2_IN_23, |
| 148 | MUX_IN_GPIO2_IN_24, |
| 149 | MUX_IN_GPIO2_IN_25, |
| 150 | MUX_IN_GPIO2_IN_26, |
| 151 | MUX_IN_GPIO2_IN_27, |
| 152 | MUX_IN_GPIO2_IN_28, |
| 153 | MUX_IN_GPIO2_IN_29, |
| 154 | MUX_IN_GPIO2_IN_2, |
| 155 | MUX_IN_GPIO2_IN_30, |
| 156 | MUX_IN_GPIO2_IN_31, |
| 157 | MUX_IN_GPIO2_IN_3, |
| 158 | MUX_IN_GPIO2_IN_4, |
| 159 | MUX_IN_GPIO2_IN_5, |
| 160 | MUX_IN_GPIO2_IN_6, |
| 161 | MUX_IN_GPIO2_IN_7, |
| 162 | MUX_IN_GPIO2_IN_8, |
| 163 | MUX_IN_GPIO2_IN_9, |
| 164 | MUX_IN_GPIO3_IN_0, |
| 165 | MUX_IN_GPIO3_IN_10, |
| 166 | MUX_IN_GPIO3_IN_11, |
| 167 | MUX_IN_GPIO3_IN_12, |
| 168 | MUX_IN_GPIO3_IN_13, |
| 169 | MUX_IN_GPIO3_IN_14, |
| 170 | MUX_IN_GPIO3_IN_15, |
| 171 | MUX_IN_GPIO3_IN_4, |
| 172 | MUX_IN_GPIO3_IN_5, |
| 173 | MUX_IN_GPIO3_IN_6, |
| 174 | MUX_IN_GPIO3_IN_7, |
| 175 | MUX_IN_GPIO3_IN_8, |
| 176 | MUX_IN_GPIO3_IN_9, |
| 177 | MUX_IN_I2C3_SCL_IN, |
| 178 | MUX_IN_I2C3_SDA_IN, |
| 179 | MUX_IN_IPU_DISPB_D0_VSYNC, |
| 180 | MUX_IN_IPU_DISPB_D12_VSYNC, |
| 181 | MUX_IN_IPU_DISPB_SD_D, |
| 182 | MUX_IN_IPU_SENSB_DATA_0, |
| 183 | MUX_IN_IPU_SENSB_DATA_1, |
| 184 | MUX_IN_IPU_SENSB_DATA_2, |
| 185 | MUX_IN_IPU_SENSB_DATA_3, |
| 186 | MUX_IN_IPU_SENSB_DATA_4, |
| 187 | MUX_IN_IPU_SENSB_DATA_5, |
| 188 | MUX_IN_IPU_SENSB_DATA_6, |
| 189 | MUX_IN_IPU_SENSB_DATA_7, |
| 190 | MUX_IN_KPP_COL_0, |
| 191 | MUX_IN_KPP_COL_1, |
| 192 | MUX_IN_KPP_COL_2, |
| 193 | MUX_IN_KPP_COL_3, |
| 194 | MUX_IN_KPP_COL_4, |
| 195 | MUX_IN_KPP_COL_5, |
| 196 | MUX_IN_KPP_COL_6, |
| 197 | MUX_IN_KPP_COL_7, |
| 198 | MUX_IN_KPP_ROW_0, |
| 199 | MUX_IN_KPP_ROW_1, |
| 200 | MUX_IN_KPP_ROW_2, |
| 201 | MUX_IN_KPP_ROW_3, |
| 202 | MUX_IN_KPP_ROW_4, |
| 203 | MUX_IN_KPP_ROW_5, |
| 204 | MUX_IN_KPP_ROW_6, |
| 205 | MUX_IN_KPP_ROW_7, |
| 206 | MUX_IN_OWIRE_BATTERY_LINE, |
| 207 | MUX_IN_SPDIF_HCKT_CLK2, |
| 208 | MUX_IN_SPDIF_SPDIF_IN1, |
| 209 | MUX_IN_UART3_UART_RTS_B, |
| 210 | MUX_IN_UART3_UART_RXD_MUX, |
| 211 | MUX_IN_USB_OTG_DATA_0, |
| 212 | MUX_IN_USB_OTG_DATA_1, |
| 213 | MUX_IN_USB_OTG_DATA_2, |
| 214 | MUX_IN_USB_OTG_DATA_3, |
| 215 | MUX_IN_USB_OTG_DATA_4, |
| 216 | MUX_IN_USB_OTG_DATA_5, |
| 217 | MUX_IN_USB_OTG_DATA_6, |
| 218 | MUX_IN_USB_OTG_DATA_7, |
| 219 | MUX_IN_USB_OTG_DIR, |
| 220 | MUX_IN_USB_OTG_NXT, |
| 221 | MUX_IN_USB_UH2_DATA_0, |
| 222 | MUX_IN_USB_UH2_DATA_1, |
| 223 | MUX_IN_USB_UH2_DATA_2, |
| 224 | MUX_IN_USB_UH2_DATA_3, |
| 225 | MUX_IN_USB_UH2_DATA_4, |
| 226 | MUX_IN_USB_UH2_DATA_5, |
| 227 | MUX_IN_USB_UH2_DATA_6, |
| 228 | MUX_IN_USB_UH2_DATA_7, |
| 229 | MUX_IN_USB_UH2_DIR, |
| 230 | MUX_IN_USB_UH2_NXT, |
| 231 | MUX_IN_USB_UH2_USB_OC, |
| 232 | } iomux_input_select_t; |
| 233 | |
| 234 | /* |
| 235 | * various IOMUX input functions |
| 236 | */ |
| 237 | typedef enum iomux_input_config { |
| 238 | INPUT_CTL_PATH0 = 0x0, |
| 239 | INPUT_CTL_PATH1, |
| 240 | INPUT_CTL_PATH2, |
| 241 | INPUT_CTL_PATH3, |
| 242 | INPUT_CTL_PATH4, |
| 243 | INPUT_CTL_PATH5, |
| 244 | INPUT_CTL_PATH6, |
| 245 | INPUT_CTL_PATH7, |
| 246 | } iomux_input_cfg_t; |
| 247 | |
| 248 | /* |
| 249 | * Request ownership for an IO pin. This function has to be the first one |
| 250 | * being called before that pin is used. The caller has to check the |
| 251 | * return value to make sure it returns 0. |
| 252 | * |
| 253 | * @param pin a name defined by iomux_pin_name_t |
| 254 | * @param cfg an input function as defined in iomux_pin_cfg_t |
| 255 | * |
| 256 | * @return 0 if successful; Non-zero otherwise |
| 257 | */ |
| 258 | void mxc_request_iomux(iomux_pin_name_t pin, iomux_pin_cfg_t cfg); |
| 259 | |
| 260 | /* |
| 261 | * Release ownership for an IO pin |
| 262 | * |
| 263 | * @param pin a name defined by iomux_pin_name_t |
| 264 | * @param cfg an input function as defined in iomux_pin_cfg_t |
| 265 | */ |
| 266 | void mxc_free_iomux(iomux_pin_name_t pin, iomux_pin_cfg_t cfg); |
| 267 | |
| 268 | /* |
| 269 | * This function enables/disables the general purpose function for a particular |
| 270 | * signal. |
| 271 | * |
| 272 | * @param gp one signal as defined in iomux_gp_func_t |
| 273 | * @param en 1 to enable; 0 to disable |
| 274 | */ |
| 275 | void mxc_iomux_set_gpr(iomux_gp_func_t gp, int en); |
| 276 | |
| 277 | /* |
| 278 | * This function configures the pad value for a IOMUX pin. |
| 279 | * |
| 280 | * @param pin a pin number as defined in iomux_pin_name_t |
| 281 | * @param config the ORed value of elements defined in |
| 282 | * iomux_pad_config_t |
| 283 | */ |
| 284 | void mxc_iomux_set_pad(iomux_pin_name_t pin, u32 config); |
| 285 | |
| 286 | /* |
| 287 | * This function configures input path. |
| 288 | * |
| 289 | * @param input index of input select register as defined in |
| 290 | * iomux_input_select_t |
| 291 | * @param config the binary value of elements defined in |
| 292 | * iomux_input_cfg_t |
| 293 | */ |
| 294 | void mxc_iomux_set_input(iomux_input_select_t input, u32 config); |
| 295 | #endif |