pinmux.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /*
  2. * (C) Copyright 2010,2011
  3. * NVIDIA Corporation <www.nvidia.com>
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #ifndef _PINMUX_H_
  24. #define _PINMUX_H_
  25. /* Pin groups which we can set to tristate or normal */
  26. enum pmux_pingrp {
  27. /* APB_MISC_PP_TRISTATE_REG_A_0 */
  28. PINGRP_ATA,
  29. PINGRP_ATB,
  30. PINGRP_ATC,
  31. PINGRP_ATD,
  32. PINGRP_CDEV1,
  33. PINGRP_CDEV2,
  34. PINGRP_CSUS,
  35. PINGRP_DAP1,
  36. PINGRP_DAP2,
  37. PINGRP_DAP3,
  38. PINGRP_DAP4,
  39. PINGRP_DTA,
  40. PINGRP_DTB,
  41. PINGRP_DTC,
  42. PINGRP_DTD,
  43. PINGRP_DTE,
  44. PINGRP_GPU,
  45. PINGRP_GPV,
  46. PINGRP_I2CP,
  47. PINGRP_IRTX,
  48. PINGRP_IRRX,
  49. PINGRP_KBCB,
  50. PINGRP_KBCA,
  51. PINGRP_PMC,
  52. PINGRP_PTA,
  53. PINGRP_RM,
  54. PINGRP_KBCE,
  55. PINGRP_KBCF,
  56. PINGRP_GMA,
  57. PINGRP_GMC,
  58. PINGRP_SDMMC1,
  59. PINGRP_OWC,
  60. /* 32: APB_MISC_PP_TRISTATE_REG_B_0 */
  61. PINGRP_GME,
  62. PINGRP_SDC,
  63. PINGRP_SDD,
  64. PINGRP_RESERVED0,
  65. PINGRP_SLXA,
  66. PINGRP_SLXC,
  67. PINGRP_SLXD,
  68. PINGRP_SLXK,
  69. PINGRP_SPDI,
  70. PINGRP_SPDO,
  71. PINGRP_SPIA,
  72. PINGRP_SPIB,
  73. PINGRP_SPIC,
  74. PINGRP_SPID,
  75. PINGRP_SPIE,
  76. PINGRP_SPIF,
  77. PINGRP_SPIG,
  78. PINGRP_SPIH,
  79. PINGRP_UAA,
  80. PINGRP_UAB,
  81. PINGRP_UAC,
  82. PINGRP_UAD,
  83. PINGRP_UCA,
  84. PINGRP_UCB,
  85. PINGRP_RESERVED1,
  86. PINGRP_ATE,
  87. PINGRP_KBCC,
  88. PINGRP_RESERVED2,
  89. PINGRP_RESERVED3,
  90. PINGRP_GMB,
  91. PINGRP_GMD,
  92. PINGRP_DDC,
  93. /* 64: APB_MISC_PP_TRISTATE_REG_C_0 */
  94. PINGRP_LD0,
  95. PINGRP_LD1,
  96. PINGRP_LD2,
  97. PINGRP_LD3,
  98. PINGRP_LD4,
  99. PINGRP_LD5,
  100. PINGRP_LD6,
  101. PINGRP_LD7,
  102. PINGRP_LD8,
  103. PINGRP_LD9,
  104. PINGRP_LD10,
  105. PINGRP_LD11,
  106. PINGRP_LD12,
  107. PINGRP_LD13,
  108. PINGRP_LD14,
  109. PINGRP_LD15,
  110. PINGRP_LD16,
  111. PINGRP_LD17,
  112. PINGRP_LHP0,
  113. PINGRP_LHP1,
  114. PINGRP_LHP2,
  115. PINGRP_LVP0,
  116. PINGRP_LVP1,
  117. PINGRP_HDINT,
  118. PINGRP_LM0,
  119. PINGRP_LM1,
  120. PINGRP_LVS,
  121. PINGRP_LSC0,
  122. PINGRP_LSC1,
  123. PINGRP_LSCK,
  124. PINGRP_LDC,
  125. PINGRP_LCSN,
  126. /* 96: APB_MISC_PP_TRISTATE_REG_D_0 */
  127. PINGRP_LSPI,
  128. PINGRP_LSDA,
  129. PINGRP_LSDI,
  130. PINGRP_LPW0,
  131. PINGRP_LPW1,
  132. PINGRP_LPW2,
  133. PINGRP_LDI,
  134. PINGRP_LHS,
  135. PINGRP_LPP,
  136. PINGRP_RESERVED4,
  137. PINGRP_KBCD,
  138. PINGRP_GPU7,
  139. PINGRP_DTF,
  140. PINGRP_UDA,
  141. PINGRP_CRTP,
  142. PINGRP_SDB,
  143. };
  144. #define TEGRA_TRISTATE_REGS 4
  145. /* APB MISC Pin Mux and Tristate (APB_MISC_PP_) registers */
  146. struct pmux_tri_ctlr {
  147. uint pmt_reserved0; /* ABP_MISC_PP_ reserved offset 00 */
  148. uint pmt_reserved1; /* ABP_MISC_PP_ reserved offset 04 */
  149. uint pmt_strap_opt_a; /* _STRAPPING_OPT_A_0, offset 08 */
  150. uint pmt_reserved2; /* ABP_MISC_PP_ reserved offset 0C */
  151. uint pmt_reserved3; /* ABP_MISC_PP_ reserved offset 10 */
  152. uint pmt_tri[TEGRA_TRISTATE_REGS]; /* _TRI_STATE_REG_A/B/C/D_0 14-20 */
  153. uint pmt_cfg_ctl; /* _CONFIG_CTL_0, offset 24 */
  154. uint pmt_reserved[22]; /* ABP_MISC_PP_ reserved offs 28-7C */
  155. uint pmt_ctl_a; /* _PINGRP_MUX_CTL_A_0, offset 80 */
  156. uint pmt_ctl_b; /* _PINGRP_MUX_CTL_B_0, offset 84 */
  157. uint pmt_ctl_c; /* _PINGRP_MUX_CTL_C_0, offset 88 */
  158. uint pmt_ctl_d; /* _PINGRP_MUX_CTL_D_0, offset 8C */
  159. uint pmt_ctl_e; /* _PINGRP_MUX_CTL_E_0, offset 90 */
  160. uint pmt_ctl_f; /* _PINGRP_MUX_CTL_F_0, offset 94 */
  161. uint pmt_ctl_g; /* _PINGRP_MUX_CTL_G_0, offset 98 */
  162. };
  163. /* Converts a pin group to a tristate register: 0=A, 1=B, 2=C, 3=D */
  164. #define TRISTATE_REG(id) ((id) >> 5)
  165. /* Mask value for a tristate (within TRISTATE_REG(id)) */
  166. #define TRISTATE_MASK(id) (1 << ((id) & 0x1f))
  167. /* Set a pin group to tristate */
  168. void pinmux_tristate_enable(enum pmux_pingrp pin);
  169. /* Set a pin group to normal (non tristate) */
  170. void pinmux_tristate_disable(enum pmux_pingrp pin);
  171. #endif /* PINMUX_H */