mux.h 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  1. /*
  2. * arch/arm/plat-omap/include/mach/mux.h
  3. *
  4. * Table of the Omap register configurations for the FUNC_MUX and
  5. * PULL_DWN combinations.
  6. *
  7. * Copyright (C) 2004 - 2008 Texas Instruments Inc.
  8. * Copyright (C) 2003 - 2008 Nokia Corporation
  9. *
  10. * Written by Tony Lindgren
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation; either version 2 of the License, or
  15. * (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program; if not, write to the Free Software
  24. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  25. *
  26. * NOTE: Please use the following naming style for new pin entries.
  27. * For example, W8_1610_MMC2_DAT0, where:
  28. * - W8 = ball
  29. * - 1610 = 1510 or 1610, none if common for both 1510 and 1610
  30. * - MMC2_DAT0 = function
  31. */
  32. #ifndef __ASM_ARCH_MUX_H
  33. #define __ASM_ARCH_MUX_H
  34. #define PU_PD_SEL_NA 0 /* No pu_pd reg available */
  35. #define PULL_DWN_CTRL_NA 0 /* No pull-down control needed */
  36. #ifdef CONFIG_OMAP_MUX_DEBUG
  37. #define MUX_REG(reg, mode_offset, mode) .mux_reg_name = "FUNC_MUX_CTRL_"#reg, \
  38. .mux_reg = FUNC_MUX_CTRL_##reg, \
  39. .mask_offset = mode_offset, \
  40. .mask = mode,
  41. #define PULL_REG(reg, bit, status) .pull_name = "PULL_DWN_CTRL_"#reg, \
  42. .pull_reg = PULL_DWN_CTRL_##reg, \
  43. .pull_bit = bit, \
  44. .pull_val = status,
  45. #define PU_PD_REG(reg, status) .pu_pd_name = "PU_PD_SEL_"#reg, \
  46. .pu_pd_reg = PU_PD_SEL_##reg, \
  47. .pu_pd_val = status,
  48. #define MUX_REG_7XX(reg, mode_offset, mode) .mux_reg_name = "OMAP7XX_IO_CONF_"#reg, \
  49. .mux_reg = OMAP7XX_IO_CONF_##reg, \
  50. .mask_offset = mode_offset, \
  51. .mask = mode,
  52. #define PULL_REG_7XX(reg, bit, status) .pull_name = "OMAP7XX_IO_CONF_"#reg, \
  53. .pull_reg = OMAP7XX_IO_CONF_##reg, \
  54. .pull_bit = bit, \
  55. .pull_val = status,
  56. #else
  57. #define MUX_REG(reg, mode_offset, mode) .mux_reg = FUNC_MUX_CTRL_##reg, \
  58. .mask_offset = mode_offset, \
  59. .mask = mode,
  60. #define PULL_REG(reg, bit, status) .pull_reg = PULL_DWN_CTRL_##reg, \
  61. .pull_bit = bit, \
  62. .pull_val = status,
  63. #define PU_PD_REG(reg, status) .pu_pd_reg = PU_PD_SEL_##reg, \
  64. .pu_pd_val = status,
  65. #define MUX_REG_7XX(reg, mode_offset, mode) \
  66. .mux_reg = OMAP7XX_IO_CONF_##reg, \
  67. .mask_offset = mode_offset, \
  68. .mask = mode,
  69. #define PULL_REG_7XX(reg, bit, status) .pull_reg = OMAP7XX_IO_CONF_##reg, \
  70. .pull_bit = bit, \
  71. .pull_val = status,
  72. #endif /* CONFIG_OMAP_MUX_DEBUG */
  73. #define MUX_CFG(desc, mux_reg, mode_offset, mode, \
  74. pull_reg, pull_bit, pull_status, \
  75. pu_pd_reg, pu_pd_status, debug_status) \
  76. { \
  77. .name = desc, \
  78. .debug = debug_status, \
  79. MUX_REG(mux_reg, mode_offset, mode) \
  80. PULL_REG(pull_reg, pull_bit, pull_status) \
  81. PU_PD_REG(pu_pd_reg, pu_pd_status) \
  82. },
  83. /*
  84. * OMAP730/850 has a slightly different config for the pin mux.
  85. * - config regs are the OMAP7XX_IO_CONF_x regs (see omap7xx.h) regs and
  86. * not the FUNC_MUX_CTRL_x regs from hardware.h
  87. * - for pull-up/down, only has one enable bit which is is in the same register
  88. * as mux config
  89. */
  90. #define MUX_CFG_7XX(desc, mux_reg, mode_offset, mode, \
  91. pull_bit, pull_status, debug_status)\
  92. { \
  93. .name = desc, \
  94. .debug = debug_status, \
  95. MUX_REG_7XX(mux_reg, mode_offset, mode) \
  96. PULL_REG_7XX(mux_reg, pull_bit, pull_status) \
  97. PU_PD_REG(NA, 0) \
  98. },
  99. struct pin_config {
  100. char *name;
  101. const unsigned int mux_reg;
  102. unsigned char debug;
  103. const unsigned char mask_offset;
  104. const unsigned char mask;
  105. const char *pull_name;
  106. const unsigned int pull_reg;
  107. const unsigned char pull_val;
  108. const unsigned char pull_bit;
  109. const char *pu_pd_name;
  110. const unsigned int pu_pd_reg;
  111. const unsigned char pu_pd_val;
  112. #if defined(CONFIG_OMAP_MUX_DEBUG) || defined(CONFIG_OMAP_MUX_WARNINGS)
  113. const char *mux_reg_name;
  114. #endif
  115. };
  116. enum omap7xx_index {
  117. /* OMAP 730 keyboard */
  118. E2_7XX_KBR0,
  119. J7_7XX_KBR1,
  120. E1_7XX_KBR2,
  121. F3_7XX_KBR3,
  122. D2_7XX_KBR4,
  123. C2_7XX_KBC0,
  124. D3_7XX_KBC1,
  125. E4_7XX_KBC2,
  126. F4_7XX_KBC3,
  127. E3_7XX_KBC4,
  128. /* USB */
  129. AA17_7XX_USB_DM,
  130. W16_7XX_USB_PU_EN,
  131. W17_7XX_USB_VBUSI,
  132. W18_7XX_USB_DMCK_OUT,
  133. W19_7XX_USB_DCRST,
  134. /* MMC */
  135. MMC_7XX_CMD,
  136. MMC_7XX_CLK,
  137. MMC_7XX_DAT0,
  138. /* I2C */
  139. I2C_7XX_SCL,
  140. I2C_7XX_SDA,
  141. /* SPI */
  142. SPI_7XX_1,
  143. SPI_7XX_2,
  144. SPI_7XX_3,
  145. SPI_7XX_4,
  146. SPI_7XX_5,
  147. SPI_7XX_6,
  148. /* UART */
  149. UART_7XX_1,
  150. UART_7XX_2,
  151. };
  152. enum omap1xxx_index {
  153. /* UART1 (BT_UART_GATING)*/
  154. UART1_TX = 0,
  155. UART1_RTS,
  156. /* UART2 (COM_UART_GATING)*/
  157. UART2_TX,
  158. UART2_RX,
  159. UART2_CTS,
  160. UART2_RTS,
  161. /* UART3 (GIGA_UART_GATING) */
  162. UART3_TX,
  163. UART3_RX,
  164. UART3_CTS,
  165. UART3_RTS,
  166. UART3_CLKREQ,
  167. UART3_BCLK, /* 12MHz clock out */
  168. Y15_1610_UART3_RTS,
  169. /* PWT & PWL */
  170. PWT,
  171. PWL,
  172. /* USB master generic */
  173. R18_USB_VBUS,
  174. R18_1510_USB_GPIO0,
  175. W4_USB_PUEN,
  176. W4_USB_CLKO,
  177. W4_USB_HIGHZ,
  178. W4_GPIO58,
  179. /* USB1 master */
  180. USB1_SUSP,
  181. USB1_SEO,
  182. W13_1610_USB1_SE0,
  183. USB1_TXEN,
  184. USB1_TXD,
  185. USB1_VP,
  186. USB1_VM,
  187. USB1_RCV,
  188. USB1_SPEED,
  189. R13_1610_USB1_SPEED,
  190. R13_1710_USB1_SE0,
  191. /* USB2 master */
  192. USB2_SUSP,
  193. USB2_VP,
  194. USB2_TXEN,
  195. USB2_VM,
  196. USB2_RCV,
  197. USB2_SEO,
  198. USB2_TXD,
  199. /* OMAP-1510 GPIO */
  200. R18_1510_GPIO0,
  201. R19_1510_GPIO1,
  202. M14_1510_GPIO2,
  203. /* OMAP1610 GPIO */
  204. P18_1610_GPIO3,
  205. Y15_1610_GPIO17,
  206. /* OMAP-1710 GPIO */
  207. R18_1710_GPIO0,
  208. V2_1710_GPIO10,
  209. N21_1710_GPIO14,
  210. W15_1710_GPIO40,
  211. /* MPUIO */
  212. MPUIO2,
  213. N15_1610_MPUIO2,
  214. MPUIO4,
  215. MPUIO5,
  216. T20_1610_MPUIO5,
  217. W11_1610_MPUIO6,
  218. V10_1610_MPUIO7,
  219. W11_1610_MPUIO9,
  220. V10_1610_MPUIO10,
  221. W10_1610_MPUIO11,
  222. E20_1610_MPUIO13,
  223. U20_1610_MPUIO14,
  224. E19_1610_MPUIO15,
  225. /* MCBSP2 */
  226. MCBSP2_CLKR,
  227. MCBSP2_CLKX,
  228. MCBSP2_DR,
  229. MCBSP2_DX,
  230. MCBSP2_FSR,
  231. MCBSP2_FSX,
  232. /* MCBSP3 */
  233. MCBSP3_CLKX,
  234. /* Misc ballouts */
  235. BALLOUT_V8_ARMIO3,
  236. N20_HDQ,
  237. /* OMAP-1610 MMC2 */
  238. W8_1610_MMC2_DAT0,
  239. V8_1610_MMC2_DAT1,
  240. W15_1610_MMC2_DAT2,
  241. R10_1610_MMC2_DAT3,
  242. Y10_1610_MMC2_CLK,
  243. Y8_1610_MMC2_CMD,
  244. V9_1610_MMC2_CMDDIR,
  245. V5_1610_MMC2_DATDIR0,
  246. W19_1610_MMC2_DATDIR1,
  247. R18_1610_MMC2_CLKIN,
  248. /* OMAP-1610 External Trace Interface */
  249. M19_1610_ETM_PSTAT0,
  250. L15_1610_ETM_PSTAT1,
  251. L18_1610_ETM_PSTAT2,
  252. L19_1610_ETM_D0,
  253. J19_1610_ETM_D6,
  254. J18_1610_ETM_D7,
  255. /* OMAP16XX GPIO */
  256. P20_1610_GPIO4,
  257. V9_1610_GPIO7,
  258. W8_1610_GPIO9,
  259. N20_1610_GPIO11,
  260. N19_1610_GPIO13,
  261. P10_1610_GPIO22,
  262. V5_1610_GPIO24,
  263. AA20_1610_GPIO_41,
  264. W19_1610_GPIO48,
  265. M7_1610_GPIO62,
  266. V14_16XX_GPIO37,
  267. R9_16XX_GPIO18,
  268. L14_16XX_GPIO49,
  269. /* OMAP-1610 uWire */
  270. V19_1610_UWIRE_SCLK,
  271. U18_1610_UWIRE_SDI,
  272. W21_1610_UWIRE_SDO,
  273. N14_1610_UWIRE_CS0,
  274. P15_1610_UWIRE_CS3,
  275. N15_1610_UWIRE_CS1,
  276. /* OMAP-1610 SPI */
  277. U19_1610_SPIF_SCK,
  278. U18_1610_SPIF_DIN,
  279. P20_1610_SPIF_DIN,
  280. W21_1610_SPIF_DOUT,
  281. R18_1610_SPIF_DOUT,
  282. N14_1610_SPIF_CS0,
  283. N15_1610_SPIF_CS1,
  284. T19_1610_SPIF_CS2,
  285. P15_1610_SPIF_CS3,
  286. /* OMAP-1610 Flash */
  287. L3_1610_FLASH_CS2B_OE,
  288. M8_1610_FLASH_CS2B_WE,
  289. /* First MMC */
  290. MMC_CMD,
  291. MMC_DAT1,
  292. MMC_DAT2,
  293. MMC_DAT0,
  294. MMC_CLK,
  295. MMC_DAT3,
  296. /* OMAP-1710 MMC CMDDIR and DATDIR0 */
  297. M15_1710_MMC_CLKI,
  298. P19_1710_MMC_CMDDIR,
  299. P20_1710_MMC_DATDIR0,
  300. /* OMAP-1610 USB0 alternate pin configuration */
  301. W9_USB0_TXEN,
  302. AA9_USB0_VP,
  303. Y5_USB0_RCV,
  304. R9_USB0_VM,
  305. V6_USB0_TXD,
  306. W5_USB0_SE0,
  307. V9_USB0_SPEED,
  308. V9_USB0_SUSP,
  309. /* USB2 */
  310. W9_USB2_TXEN,
  311. AA9_USB2_VP,
  312. Y5_USB2_RCV,
  313. R9_USB2_VM,
  314. V6_USB2_TXD,
  315. W5_USB2_SE0,
  316. /* 16XX UART */
  317. R13_1610_UART1_TX,
  318. V14_16XX_UART1_RX,
  319. R14_1610_UART1_CTS,
  320. AA15_1610_UART1_RTS,
  321. R9_16XX_UART2_RX,
  322. L14_16XX_UART3_RX,
  323. /* I2C OMAP-1610 */
  324. I2C_SCL,
  325. I2C_SDA,
  326. /* Keypad */
  327. F18_1610_KBC0,
  328. D20_1610_KBC1,
  329. D19_1610_KBC2,
  330. E18_1610_KBC3,
  331. C21_1610_KBC4,
  332. G18_1610_KBR0,
  333. F19_1610_KBR1,
  334. H14_1610_KBR2,
  335. E20_1610_KBR3,
  336. E19_1610_KBR4,
  337. N19_1610_KBR5,
  338. /* Power management */
  339. T20_1610_LOW_PWR,
  340. /* MCLK Settings */
  341. V5_1710_MCLK_ON,
  342. V5_1710_MCLK_OFF,
  343. R10_1610_MCLK_ON,
  344. R10_1610_MCLK_OFF,
  345. /* CompactFlash controller */
  346. P11_1610_CF_CD2,
  347. R11_1610_CF_IOIS16,
  348. V10_1610_CF_IREQ,
  349. W10_1610_CF_RESET,
  350. W11_1610_CF_CD1,
  351. /* parallel camera */
  352. J15_1610_CAM_LCLK,
  353. J18_1610_CAM_D7,
  354. J19_1610_CAM_D6,
  355. J14_1610_CAM_D5,
  356. K18_1610_CAM_D4,
  357. K19_1610_CAM_D3,
  358. K15_1610_CAM_D2,
  359. K14_1610_CAM_D1,
  360. L19_1610_CAM_D0,
  361. L18_1610_CAM_VS,
  362. L15_1610_CAM_HS,
  363. M19_1610_CAM_RSTZ,
  364. Y15_1610_CAM_OUTCLK,
  365. /* serial camera */
  366. H19_1610_CAM_EXCLK,
  367. Y12_1610_CCP_CLKP,
  368. W13_1610_CCP_CLKM,
  369. W14_1610_CCP_DATAP,
  370. Y14_1610_CCP_DATAM,
  371. };
  372. struct omap_mux_cfg {
  373. struct pin_config *pins;
  374. unsigned long size;
  375. int (*cfg_reg)(const struct pin_config *cfg);
  376. };
  377. #ifdef CONFIG_OMAP_MUX
  378. /* setup pin muxing in Linux */
  379. extern int omap1_mux_init(void);
  380. extern int omap_mux_register(struct omap_mux_cfg *);
  381. extern int omap_cfg_reg(unsigned long reg_cfg);
  382. #else
  383. /* boot loader does it all (no warnings from CONFIG_OMAP_MUX_WARNINGS) */
  384. static inline int omap1_mux_init(void) { return 0; }
  385. static inline int omap_cfg_reg(unsigned long reg_cfg) { return 0; }
  386. #endif
  387. extern int omap2_mux_init(void);
  388. #endif