pinmux.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  1. /*
  2. * Copyright (c) 2010-2013, NVIDIA CORPORATION. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms and conditions of the GNU General Public License,
  6. * version 2, as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope it will be useful, but WITHOUT
  9. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  11. * more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #ifndef _TEGRA114_PINMUX_H_
  17. #define _TEGRA114_PINMUX_H_
  18. /*
  19. * Pin groups which we adjust. There are three basic attributes of each pin
  20. * group which use this enum:
  21. *
  22. * - function
  23. * - pullup / pulldown
  24. * - tristate or normal
  25. */
  26. enum pmux_pingrp {
  27. PINGRP_ULPI_DATA0 = 0, /* offset 0x3000 */
  28. PINGRP_ULPI_DATA1,
  29. PINGRP_ULPI_DATA2,
  30. PINGRP_ULPI_DATA3,
  31. PINGRP_ULPI_DATA4,
  32. PINGRP_ULPI_DATA5,
  33. PINGRP_ULPI_DATA6,
  34. PINGRP_ULPI_DATA7,
  35. PINGRP_ULPI_CLK,
  36. PINGRP_ULPI_DIR,
  37. PINGRP_ULPI_NXT,
  38. PINGRP_ULPI_STP,
  39. PINGRP_DAP3_FS,
  40. PINGRP_DAP3_DIN,
  41. PINGRP_DAP3_DOUT,
  42. PINGRP_DAP3_SCLK,
  43. PINGRP_GPIO_PV0,
  44. PINGRP_GPIO_PV1,
  45. PINGRP_SDMMC1_CLK,
  46. PINGRP_SDMMC1_CMD,
  47. PINGRP_SDMMC1_DAT3,
  48. PINGRP_SDMMC1_DAT2,
  49. PINGRP_SDMMC1_DAT1,
  50. PINGRP_SDMMC1_DAT0,
  51. PINGRP_CLK2_OUT = PINGRP_SDMMC1_DAT0 + 3,
  52. PINGRP_CLK2_REQ,
  53. PINGRP_HDMI_INT = PINGRP_CLK2_REQ + 41,
  54. PINGRP_DDC_SCL,
  55. PINGRP_DDC_SDA,
  56. PINGRP_UART2_RXD = PINGRP_DDC_SDA + 19,
  57. PINGRP_UART2_TXD,
  58. PINGRP_UART2_RTS_N,
  59. PINGRP_UART2_CTS_N,
  60. PINGRP_UART3_TXD,
  61. PINGRP_UART3_RXD,
  62. PINGRP_UART3_CTS_N,
  63. PINGRP_UART3_RTS_N,
  64. PINGRP_GPIO_PU0,
  65. PINGRP_GPIO_PU1,
  66. PINGRP_GPIO_PU2,
  67. PINGRP_GPIO_PU3,
  68. PINGRP_GPIO_PU4,
  69. PINGRP_GPIO_PU5,
  70. PINGRP_GPIO_PU6,
  71. PINGRP_GEN1_I2C_SDA,
  72. PINGRP_GEN1_I2C_SCL,
  73. PINGRP_DAP4_FS,
  74. PINGRP_DAP4_DIN,
  75. PINGRP_DAP4_DOUT,
  76. PINGRP_DAP4_SCLK,
  77. PINGRP_CLK3_OUT,
  78. PINGRP_CLK3_REQ,
  79. PINGRP_GMI_WP_N,
  80. PINGRP_GMI_IORDY,
  81. PINGRP_GMI_WAIT,
  82. PINGRP_GMI_ADV_N,
  83. PINGRP_GMI_CLK,
  84. PINGRP_GMI_CS0_N,
  85. PINGRP_GMI_CS1_N,
  86. PINGRP_GMI_CS2_N,
  87. PINGRP_GMI_CS3_N,
  88. PINGRP_GMI_CS4_N,
  89. PINGRP_GMI_CS6_N,
  90. PINGRP_GMI_CS7_N,
  91. PINGRP_GMI_AD0,
  92. PINGRP_GMI_AD1,
  93. PINGRP_GMI_AD2,
  94. PINGRP_GMI_AD3,
  95. PINGRP_GMI_AD4,
  96. PINGRP_GMI_AD5,
  97. PINGRP_GMI_AD6,
  98. PINGRP_GMI_AD7,
  99. PINGRP_GMI_AD8,
  100. PINGRP_GMI_AD9,
  101. PINGRP_GMI_AD10,
  102. PINGRP_GMI_AD11,
  103. PINGRP_GMI_AD12,
  104. PINGRP_GMI_AD13,
  105. PINGRP_GMI_AD14,
  106. PINGRP_GMI_AD15,
  107. PINGRP_GMI_A16,
  108. PINGRP_GMI_A17,
  109. PINGRP_GMI_A18,
  110. PINGRP_GMI_A19,
  111. PINGRP_GMI_WR_N,
  112. PINGRP_GMI_OE_N,
  113. PINGRP_GMI_DQS,
  114. PINGRP_GMI_RST_N,
  115. PINGRP_GEN2_I2C_SCL,
  116. PINGRP_GEN2_I2C_SDA,
  117. PINGRP_SDMMC4_CLK,
  118. PINGRP_SDMMC4_CMD,
  119. PINGRP_SDMMC4_DAT0,
  120. PINGRP_SDMMC4_DAT1,
  121. PINGRP_SDMMC4_DAT2,
  122. PINGRP_SDMMC4_DAT3,
  123. PINGRP_SDMMC4_DAT4,
  124. PINGRP_SDMMC4_DAT5,
  125. PINGRP_SDMMC4_DAT6,
  126. PINGRP_SDMMC4_DAT7,
  127. PINGRP_CAM_MCLK = PINGRP_SDMMC4_DAT7 + 2,
  128. PINGRP_GPIO_PCC1,
  129. PINGRP_GPIO_PBB0,
  130. PINGRP_CAM_I2C_SCL,
  131. PINGRP_CAM_I2C_SDA,
  132. PINGRP_GPIO_PBB3,
  133. PINGRP_GPIO_PBB4,
  134. PINGRP_GPIO_PBB5,
  135. PINGRP_GPIO_PBB6,
  136. PINGRP_GPIO_PBB7,
  137. PINGRP_GPIO_PCC2,
  138. PINGRP_JTAG_RTCK,
  139. PINGRP_PWR_I2C_SCL,
  140. PINGRP_PWR_I2C_SDA,
  141. PINGRP_KB_ROW0,
  142. PINGRP_KB_ROW1,
  143. PINGRP_KB_ROW2,
  144. PINGRP_KB_ROW3,
  145. PINGRP_KB_ROW4,
  146. PINGRP_KB_ROW5,
  147. PINGRP_KB_ROW6,
  148. PINGRP_KB_ROW7,
  149. PINGRP_KB_ROW8,
  150. PINGRP_KB_ROW9,
  151. PINGRP_KB_ROW10,
  152. PINGRP_KB_COL0 = PINGRP_KB_ROW10 + 6,
  153. PINGRP_KB_COL1,
  154. PINGRP_KB_COL2,
  155. PINGRP_KB_COL3,
  156. PINGRP_KB_COL4,
  157. PINGRP_KB_COL5,
  158. PINGRP_KB_COL6,
  159. PINGRP_KB_COL7,
  160. PINGRP_CLK_32K_OUT,
  161. PINGRP_SYS_CLK_REQ,
  162. PINGRP_CORE_PWR_REQ,
  163. PINGRP_CPU_PWR_REQ,
  164. PINGRP_PWR_INT_N,
  165. PINGRP_CLK_32K_IN,
  166. PINGRP_OWR,
  167. PINGRP_DAP1_FS,
  168. PINGRP_DAP1_DIN,
  169. PINGRP_DAP1_DOUT,
  170. PINGRP_DAP1_SCLK,
  171. PINGRP_CLK1_REQ,
  172. PINGRP_CLK1_OUT,
  173. PINGRP_SPDIF_IN,
  174. PINGRP_SPDIF_OUT,
  175. PINGRP_DAP2_FS,
  176. PINGRP_DAP2_DIN,
  177. PINGRP_DAP2_DOUT,
  178. PINGRP_DAP2_SCLK,
  179. PINGRP_DVFS_PWM,
  180. PINGRP_GPIO_X1_AUD,
  181. PINGRP_GPIO_X3_AUD,
  182. PINGRP_DVFS_CLK,
  183. PINGRP_GPIO_X4_AUD,
  184. PINGRP_GPIO_X5_AUD,
  185. PINGRP_GPIO_X6_AUD,
  186. PINGRP_GPIO_X7_AUD,
  187. PINGRP_SDMMC3_CLK = PINGRP_GPIO_X7_AUD + 3,
  188. PINGRP_SDMMC3_CMD,
  189. PINGRP_SDMMC3_DAT0,
  190. PINGRP_SDMMC3_DAT1,
  191. PINGRP_SDMMC3_DAT2,
  192. PINGRP_SDMMC3_DAT3,
  193. PINGRP_HDMI_CEC = PINGRP_SDMMC3_DAT3 + 15, /* offset 0x33e0 */
  194. PINGRP_SDMMC1_WP_N,
  195. PINGRP_SDMMC3_CD_N,
  196. PINGRP_GPIO_W2_AUD,
  197. PINGRP_GPIO_W3_AUD,
  198. PINGRP_USB_VBUS_EN0, /* offset 0x33f4 */
  199. PINGRP_USB_VBUS_EN1,
  200. PINGRP_SDMMC3_CLK_LB_IN,
  201. PINGRP_SDMMC3_CLK_LB_OUT,
  202. PINGRP_RESET_OUT_N = PINGRP_SDMMC3_CLK_LB_OUT + 2,
  203. PINGRP_COUNT,
  204. };
  205. enum pdrive_pingrp {
  206. PDRIVE_PINGROUP_AO1 = 0, /* offset 0x868 */
  207. PDRIVE_PINGROUP_AO2,
  208. PDRIVE_PINGROUP_AT1,
  209. PDRIVE_PINGROUP_AT2,
  210. PDRIVE_PINGROUP_AT3,
  211. PDRIVE_PINGROUP_AT4,
  212. PDRIVE_PINGROUP_AT5,
  213. PDRIVE_PINGROUP_CDEV1,
  214. PDRIVE_PINGROUP_CDEV2,
  215. PDRIVE_PINGROUP_CSUS,
  216. PDRIVE_PINGROUP_DAP1,
  217. PDRIVE_PINGROUP_DAP2,
  218. PDRIVE_PINGROUP_DAP3,
  219. PDRIVE_PINGROUP_DAP4,
  220. PDRIVE_PINGROUP_DBG,
  221. PDRIVE_PINGROUP_SDIO3,
  222. PDRIVE_PINGROUP_SPI,
  223. PDRIVE_PINGROUP_UAA,
  224. PDRIVE_PINGROUP_UAB,
  225. PDRIVE_PINGROUP_UART2,
  226. PDRIVE_PINGROUP_UART3,
  227. PDRIVE_PINGROUP_SDIO1 = 33, /* offset 0x8ec */
  228. PDRIVE_PINGROUP_CRT = 36, /* offset 0x8f8 */
  229. PDRIVE_PINGROUP_DDC,
  230. PDRIVE_PINGROUP_GMA,
  231. PDRIVE_PINGROUP_GME,
  232. PDRIVE_PINGROUP_GMF,
  233. PDRIVE_PINGROUP_GMG,
  234. PDRIVE_PINGROUP_GMH,
  235. PDRIVE_PINGROUP_OWR,
  236. PDRIVE_PINGROUP_UAD,
  237. PDRIVE_PINGROUP_GPV,
  238. PDRIVE_PINGROUP_DEV3 = 49, /* offset 0x92c */
  239. PDRIVE_PINGROUP_CEC = 52, /* offset 0x938 */
  240. PDRIVE_PINGROUP_AT6,
  241. PDRIVE_PINGROUP_DAP5,
  242. PDRIVE_PINGROUP_VBUS,
  243. PDRIVE_PINGROUP_COUNT,
  244. };
  245. /*
  246. * Functions which can be assigned to each of the pin groups. The values here
  247. * bear no relation to the values programmed into pinmux registers and are
  248. * purely a convenience. The translation is done through a table search.
  249. */
  250. enum pmux_func {
  251. PMUX_FUNC_AHB_CLK,
  252. PMUX_FUNC_APB_CLK,
  253. PMUX_FUNC_AUDIO_SYNC,
  254. PMUX_FUNC_CRT,
  255. PMUX_FUNC_DAP1,
  256. PMUX_FUNC_DAP2,
  257. PMUX_FUNC_DAP3,
  258. PMUX_FUNC_DAP4,
  259. PMUX_FUNC_DAP5,
  260. PMUX_FUNC_DISPA,
  261. PMUX_FUNC_DISPB,
  262. PMUX_FUNC_EMC_TEST0_DLL,
  263. PMUX_FUNC_EMC_TEST1_DLL,
  264. PMUX_FUNC_GMI,
  265. PMUX_FUNC_GMI_INT,
  266. PMUX_FUNC_HDMI,
  267. PMUX_FUNC_I2C1,
  268. PMUX_FUNC_I2C2,
  269. PMUX_FUNC_I2C3,
  270. PMUX_FUNC_IDE,
  271. PMUX_FUNC_KBC,
  272. PMUX_FUNC_MIO,
  273. PMUX_FUNC_MIPI_HS,
  274. PMUX_FUNC_NAND,
  275. PMUX_FUNC_OSC,
  276. PMUX_FUNC_OWR,
  277. PMUX_FUNC_PCIE,
  278. PMUX_FUNC_PLLA_OUT,
  279. PMUX_FUNC_PLLC_OUT1,
  280. PMUX_FUNC_PLLM_OUT1,
  281. PMUX_FUNC_PLLP_OUT2,
  282. PMUX_FUNC_PLLP_OUT3,
  283. PMUX_FUNC_PLLP_OUT4,
  284. PMUX_FUNC_PWM,
  285. PMUX_FUNC_PWR_INTR,
  286. PMUX_FUNC_PWR_ON,
  287. PMUX_FUNC_RTCK,
  288. PMUX_FUNC_SDMMC1,
  289. PMUX_FUNC_SDMMC2,
  290. PMUX_FUNC_SDMMC3,
  291. PMUX_FUNC_SDMMC4,
  292. PMUX_FUNC_SFLASH,
  293. PMUX_FUNC_SPDIF,
  294. PMUX_FUNC_SPI1,
  295. PMUX_FUNC_SPI2,
  296. PMUX_FUNC_SPI2_ALT,
  297. PMUX_FUNC_SPI3,
  298. PMUX_FUNC_SPI4,
  299. PMUX_FUNC_TRACE,
  300. PMUX_FUNC_TWC,
  301. PMUX_FUNC_UARTA,
  302. PMUX_FUNC_UARTB,
  303. PMUX_FUNC_UARTC,
  304. PMUX_FUNC_UARTD,
  305. PMUX_FUNC_UARTE,
  306. PMUX_FUNC_ULPI,
  307. PMUX_FUNC_VI,
  308. PMUX_FUNC_VI_SENSOR_CLK,
  309. PMUX_FUNC_XIO,
  310. /* End of Tegra2 MUX selectors */
  311. PMUX_FUNC_BLINK,
  312. PMUX_FUNC_CEC,
  313. PMUX_FUNC_CLK12,
  314. PMUX_FUNC_DAP,
  315. PMUX_FUNC_DAPSDMMC2,
  316. PMUX_FUNC_DDR,
  317. PMUX_FUNC_DEV3,
  318. PMUX_FUNC_DTV,
  319. PMUX_FUNC_VI_ALT1,
  320. PMUX_FUNC_VI_ALT2,
  321. PMUX_FUNC_VI_ALT3,
  322. PMUX_FUNC_EMC_DLL,
  323. PMUX_FUNC_EXTPERIPH1,
  324. PMUX_FUNC_EXTPERIPH2,
  325. PMUX_FUNC_EXTPERIPH3,
  326. PMUX_FUNC_GMI_ALT,
  327. PMUX_FUNC_HDA,
  328. PMUX_FUNC_HSI,
  329. PMUX_FUNC_I2C4,
  330. PMUX_FUNC_I2C5,
  331. PMUX_FUNC_I2CPWR,
  332. PMUX_FUNC_I2S0,
  333. PMUX_FUNC_I2S1,
  334. PMUX_FUNC_I2S2,
  335. PMUX_FUNC_I2S3,
  336. PMUX_FUNC_I2S4,
  337. PMUX_FUNC_NAND_ALT,
  338. PMUX_FUNC_POPSDIO4,
  339. PMUX_FUNC_POPSDMMC4,
  340. PMUX_FUNC_PWM0,
  341. PMUX_FUNC_PWM1,
  342. PMUX_FUNC_PWM2,
  343. PMUX_FUNC_PWM3,
  344. PMUX_FUNC_SATA,
  345. PMUX_FUNC_SPI5,
  346. PMUX_FUNC_SPI6,
  347. PMUX_FUNC_SYSCLK,
  348. PMUX_FUNC_VGP1,
  349. PMUX_FUNC_VGP2,
  350. PMUX_FUNC_VGP3,
  351. PMUX_FUNC_VGP4,
  352. PMUX_FUNC_VGP5,
  353. PMUX_FUNC_VGP6,
  354. /* End of Tegra3 MUX selectors */
  355. PMUX_FUNC_USB,
  356. PMUX_FUNC_SOC,
  357. PMUX_FUNC_CPU,
  358. PMUX_FUNC_CLK,
  359. PMUX_FUNC_PWRON,
  360. PMUX_FUNC_PMI,
  361. PMUX_FUNC_CLDVFS,
  362. PMUX_FUNC_RESET_OUT_N,
  363. /* End of Tegra114 MUX selectors */
  364. PMUX_FUNC_SAFE,
  365. PMUX_FUNC_MAX,
  366. PMUX_FUNC_INVALID = 0x4000,
  367. PMUX_FUNC_RSVD1 = 0x8000,
  368. PMUX_FUNC_RSVD2 = 0x8001,
  369. PMUX_FUNC_RSVD3 = 0x8002,
  370. PMUX_FUNC_RSVD4 = 0x8003,
  371. };
  372. /* return 1 if a pmux_func is in range */
  373. #define pmux_func_isvalid(func) ((((func) >= 0) && ((func) < PMUX_FUNC_MAX)) \
  374. || (((func) >= PMUX_FUNC_RSVD1) && ((func) <= PMUX_FUNC_RSVD4)))
  375. /* return 1 if a pingrp is in range */
  376. #define pmux_pingrp_isvalid(pin) (((pin) >= 0) && ((pin) < PINGRP_COUNT))
  377. /* The pullup/pulldown state of a pin group */
  378. enum pmux_pull {
  379. PMUX_PULL_NORMAL = 0,
  380. PMUX_PULL_DOWN,
  381. PMUX_PULL_UP,
  382. };
  383. /* return 1 if a pin_pupd_is in range */
  384. #define pmux_pin_pupd_isvalid(pupd) (((pupd) >= PMUX_PULL_NORMAL) && \
  385. ((pupd) <= PMUX_PULL_UP))
  386. /* Defines whether a pin group is tristated or in normal operation */
  387. enum pmux_tristate {
  388. PMUX_TRI_NORMAL = 0,
  389. PMUX_TRI_TRISTATE = 1,
  390. };
  391. /* return 1 if a pin_tristate_is in range */
  392. #define pmux_pin_tristate_isvalid(tristate) (((tristate) >= PMUX_TRI_NORMAL) \
  393. && ((tristate) <= PMUX_TRI_TRISTATE))
  394. enum pmux_pin_io {
  395. PMUX_PIN_OUTPUT = 0,
  396. PMUX_PIN_INPUT = 1,
  397. PMUX_PIN_NONE,
  398. };
  399. /* return 1 if a pin_io_is in range */
  400. #define pmux_pin_io_isvalid(io) (((io) >= PMUX_PIN_OUTPUT) && \
  401. ((io) <= PMUX_PIN_INPUT))
  402. enum pmux_pin_lock {
  403. PMUX_PIN_LOCK_DEFAULT = 0,
  404. PMUX_PIN_LOCK_DISABLE,
  405. PMUX_PIN_LOCK_ENABLE,
  406. };
  407. /* return 1 if a pin_lock is in range */
  408. #define pmux_pin_lock_isvalid(lock) (((lock) >= PMUX_PIN_LOCK_DEFAULT) && \
  409. ((lock) <= PMUX_PIN_LOCK_ENABLE))
  410. enum pmux_pin_od {
  411. PMUX_PIN_OD_DEFAULT = 0,
  412. PMUX_PIN_OD_DISABLE,
  413. PMUX_PIN_OD_ENABLE,
  414. };
  415. /* return 1 if a pin_od is in range */
  416. #define pmux_pin_od_isvalid(od) (((od) >= PMUX_PIN_OD_DEFAULT) && \
  417. ((od) <= PMUX_PIN_OD_ENABLE))
  418. enum pmux_pin_ioreset {
  419. PMUX_PIN_IO_RESET_DEFAULT = 0,
  420. PMUX_PIN_IO_RESET_DISABLE,
  421. PMUX_PIN_IO_RESET_ENABLE,
  422. };
  423. /* return 1 if a pin_ioreset_is in range */
  424. #define pmux_pin_ioreset_isvalid(ioreset) \
  425. (((ioreset) >= PMUX_PIN_IO_RESET_DEFAULT) && \
  426. ((ioreset) <= PMUX_PIN_IO_RESET_ENABLE))
  427. enum pmux_pin_rcv_sel {
  428. PMUX_PIN_RCV_SEL_DEFAULT = 0,
  429. PMUX_PIN_RCV_SEL_NORMAL,
  430. PMUX_PIN_RCV_SEL_HIGH,
  431. };
  432. /* return 1 if a pin_rcv_sel_is in range */
  433. #define pmux_pin_rcv_sel_isvalid(rcv_sel) \
  434. (((rcv_sel) >= PMUX_PIN_RCV_SEL_DEFAULT) && \
  435. ((rcv_sel) <= PMUX_PIN_RCV_SEL_HIGH))
  436. /* Available power domains used by pin groups */
  437. enum pmux_vddio {
  438. PMUX_VDDIO_BB = 0,
  439. PMUX_VDDIO_LCD,
  440. PMUX_VDDIO_VI,
  441. PMUX_VDDIO_UART,
  442. PMUX_VDDIO_DDR,
  443. PMUX_VDDIO_NAND,
  444. PMUX_VDDIO_SYS,
  445. PMUX_VDDIO_AUDIO,
  446. PMUX_VDDIO_SD,
  447. PMUX_VDDIO_CAM,
  448. PMUX_VDDIO_GMI,
  449. PMUX_VDDIO_PEXCTL,
  450. PMUX_VDDIO_SDMMC1,
  451. PMUX_VDDIO_SDMMC3,
  452. PMUX_VDDIO_SDMMC4,
  453. PMUX_VDDIO_NONE
  454. };
  455. /* T114 pin drive group and pin mux registers */
  456. #define PDRIVE_PINGROUP_OFFSET (0x868 >> 2)
  457. #define PMUX_OFFSET ((0x3000 >> 2) - PDRIVE_PINGROUP_OFFSET - \
  458. PDRIVE_PINGROUP_COUNT)
  459. struct pmux_tri_ctlr {
  460. uint pmt_reserved0; /* ABP_MISC_PP_ reserved offset 00 */
  461. uint pmt_reserved1; /* ABP_MISC_PP_ reserved offset 04 */
  462. uint pmt_strap_opt_a; /* _STRAPPING_OPT_A_0, offset 08 */
  463. uint pmt_reserved2; /* ABP_MISC_PP_ reserved offset 0C */
  464. uint pmt_reserved3; /* ABP_MISC_PP_ reserved offset 10 */
  465. uint pmt_reserved4[4]; /* _TRI_STATE_REG_A/B/C/D in t20 */
  466. uint pmt_cfg_ctl; /* _CONFIG_CTL_0, offset 24 */
  467. uint pmt_reserved[528]; /* ABP_MISC_PP_ reserved offs 28-864 */
  468. uint pmt_drive[PDRIVE_PINGROUP_COUNT]; /* pin drive grps offs 868 */
  469. uint pmt_reserved5[PMUX_OFFSET];
  470. uint pmt_ctl[PINGRP_COUNT]; /* mux/pupd/tri regs, offset 0x3000 */
  471. };
  472. /*
  473. * This defines the configuration for a pin, including the function assigned,
  474. * pull up/down settings and tristate settings. Having set up one of these
  475. * you can call pinmux_config_pingroup() to configure a pin in one step. Also
  476. * available is pinmux_config_table() to configure a list of pins.
  477. */
  478. struct pingroup_config {
  479. enum pmux_pingrp pingroup; /* pin group PINGRP_... */
  480. enum pmux_func func; /* function to assign FUNC_... */
  481. enum pmux_pull pull; /* pull up/down/normal PMUX_PULL_...*/
  482. enum pmux_tristate tristate; /* tristate or normal PMUX_TRI_... */
  483. enum pmux_pin_io io; /* input or output PMUX_PIN_... */
  484. enum pmux_pin_lock lock; /* lock enable/disable PMUX_PIN... */
  485. enum pmux_pin_od od; /* open-drain or push-pull driver */
  486. enum pmux_pin_ioreset ioreset; /* input/output reset PMUX_PIN... */
  487. enum pmux_pin_rcv_sel rcv_sel; /* select between High and Normal */
  488. /* VIL/VIH receivers */
  489. };
  490. /* Set a pin group to tristate */
  491. void pinmux_tristate_enable(enum pmux_pingrp pin);
  492. /* Set a pin group to normal (non tristate) */
  493. void pinmux_tristate_disable(enum pmux_pingrp pin);
  494. /* Set the pull up/down feature for a pin group */
  495. void pinmux_set_pullupdown(enum pmux_pingrp pin, enum pmux_pull pupd);
  496. /* Set the mux function for a pin group */
  497. void pinmux_set_func(enum pmux_pingrp pin, enum pmux_func func);
  498. /* Set the complete configuration for a pin group */
  499. void pinmux_config_pingroup(struct pingroup_config *config);
  500. /* Set a pin group to tristate or normal */
  501. void pinmux_set_tristate(enum pmux_pingrp pin, int enable);
  502. /* Set a pin group as input or output */
  503. void pinmux_set_io(enum pmux_pingrp pin, enum pmux_pin_io io);
  504. /**
  505. * Configure a list of pin groups
  506. *
  507. * @param config List of config items
  508. * @param len Number of config items in list
  509. */
  510. void pinmux_config_table(struct pingroup_config *config, int len);
  511. /* Set a group of pins from a table */
  512. void pinmux_init(void);
  513. #endif /* _TEGRA114_PINMUX_H_ */