mpp.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. #ifndef __ARCH_DOVE_MPP_CODED_H
  2. #define __ARCH_DOVE_MPP_CODED_H
  3. #define MPP(_num, _mode, _pmu, _grp, _au1, _nfc) ( \
  4. /* MPP/group number */ ((_num) & 0xff) | \
  5. /* MPP select value */ (((_mode) & 0xf) << 8) | \
  6. /* MPP PMU */ ((!!(_pmu)) << 12) | \
  7. /* group flag */ ((!!(_grp)) << 13) | \
  8. /* AU1 flag */ ((!!(_au1)) << 14) | \
  9. /* NFCE flag */ ((!!(_nfc)) << 15))
  10. #define MPP_MAX 71
  11. #define MPP_NUM(x) ((x) & 0xff)
  12. #define MPP_SEL(x) (((x) >> 8) & 0xf)
  13. #define MPP_PMU_MASK MPP(0, 0x0, 1, 0, 0, 0)
  14. #define MPP_GRP_MASK MPP(0, 0x0, 0, 1, 0, 0)
  15. #define MPP_AU1_MASK MPP(0, 0x0, 0, 0, 1, 0)
  16. #define MPP_NFC_MASK MPP(0, 0x0, 0, 0, 0, 1)
  17. #define MPP_END MPP(0xff, 0xf, 1, 1, 1, 1)
  18. #define MPP_PMU_DRIVE_0 0x1
  19. #define MPP_PMU_DRIVE_1 0x2
  20. #define MPP_PMU_SDI 0x3
  21. #define MPP_PMU_CPU_PWRDWN 0x4
  22. #define MPP_PMU_STBY_PWRDWN 0x5
  23. #define MPP_PMU_CORE_PWR_GOOD 0x8
  24. #define MPP_PMU_BAT_FAULT 0xa
  25. #define MPP_PMU_EXT0_WU 0xb
  26. #define MPP_PMU_EXT1_WU 0xc
  27. #define MPP_PMU_EXT2_WU 0xd
  28. #define MPP_PMU_BLINK 0xe
  29. #define MPP_PMU(_num, _mode) MPP((_num), MPP_PMU_##_mode, 1, 0, 0, 0)
  30. #define MPP_PIN(_num, _mode) MPP((_num), (_mode), 0, 0, 0, 0)
  31. #define MPP_GRP(_grp, _mode) MPP((_grp), (_mode), 0, 1, 0, 0)
  32. #define MPP_GRP_AU1(_mode) MPP(0, (_mode), 0, 0, 1, 0)
  33. #define MPP_GRP_NFC(_mode) MPP(0, (_mode), 0, 0, 0, 1)
  34. #define MPP0_GPIO0 MPP_PIN(0, 0x0)
  35. #define MPP0_UA2_RTSn MPP_PIN(0, 0x2)
  36. #define MPP0_SDIO0_CD MPP_PIN(0, 0x3)
  37. #define MPP0_LCD0_PWM MPP_PIN(0, 0xf)
  38. #define MPP1_GPIO1 MPP_PIN(1, 0x0)
  39. #define MPP1_UA2_CTSn MPP_PIN(1, 0x2)
  40. #define MPP1_SDIO0_WP MPP_PIN(1, 0x3)
  41. #define MPP1_LCD1_PWM MPP_PIN(1, 0xf)
  42. #define MPP2_GPIO2 MPP_PIN(2, 0x0)
  43. #define MPP2_SATA_PRESENT MPP_PIN(2, 0x1)
  44. #define MPP2_UA2_TXD MPP_PIN(2, 0x2)
  45. #define MPP2_SDIO0_BUS_POWER MPP_PIN(2, 0x3)
  46. #define MPP2_UA_RTSn1 MPP_PIN(2, 0x4)
  47. #define MPP3_GPIO3 MPP_PIN(3, 0x0)
  48. #define MPP3_SATA_ACT MPP_PIN(3, 0x1)
  49. #define MPP3_UA2_RXD MPP_PIN(3, 0x2)
  50. #define MPP3_SDIO0_LED_CTRL MPP_PIN(3, 0x3)
  51. #define MPP3_UA_CTSn1 MPP_PIN(3, 0x4)
  52. #define MPP3_SPI_LCD_CS1 MPP_PIN(3, 0xf)
  53. #define MPP4_GPIO4 MPP_PIN(4, 0x0)
  54. #define MPP4_UA3_RTSn MPP_PIN(4, 0x2)
  55. #define MPP4_SDIO1_CD MPP_PIN(4, 0x3)
  56. #define MPP4_SPI_1_MISO MPP_PIN(4, 0x4)
  57. #define MPP5_GPIO5 MPP_PIN(5, 0x0)
  58. #define MPP5_UA3_CTSn MPP_PIN(5, 0x2)
  59. #define MPP5_SDIO1_WP MPP_PIN(5, 0x3)
  60. #define MPP5_SPI_1_CS MPP_PIN(5, 0x4)
  61. #define MPP6_GPIO6 MPP_PIN(6, 0x0)
  62. #define MPP6_UA3_TXD MPP_PIN(6, 0x2)
  63. #define MPP6_SDIO1_BUS_POWER MPP_PIN(6, 0x3)
  64. #define MPP6_SPI_1_MOSI MPP_PIN(6, 0x4)
  65. #define MPP7_GPIO7 MPP_PIN(7, 0x0)
  66. #define MPP7_UA3_RXD MPP_PIN(7, 0x2)
  67. #define MPP7_SDIO1_LED_CTRL MPP_PIN(7, 0x3)
  68. #define MPP7_SPI_1_SCK MPP_PIN(7, 0x4)
  69. #define MPP8_GPIO8 MPP_PIN(8, 0x0)
  70. #define MPP8_WD_RST_OUT MPP_PIN(8, 0x1)
  71. #define MPP9_GPIO9 MPP_PIN(9, 0x0)
  72. #define MPP9_PEX1_CLKREQn MPP_PIN(9, 0x5)
  73. #define MPP10_GPIO10 MPP_PIN(10, 0x0)
  74. #define MPP10_SSP_SCLK MPP_PIN(10, 0x5)
  75. #define MPP11_GPIO11 MPP_PIN(11, 0x0)
  76. #define MPP11_SATA_PRESENT MPP_PIN(11, 0x1)
  77. #define MPP11_SATA_ACT MPP_PIN(11, 0x2)
  78. #define MPP11_SDIO0_LED_CTRL MPP_PIN(11, 0x3)
  79. #define MPP11_SDIO1_LED_CTRL MPP_PIN(11, 0x4)
  80. #define MPP11_PEX0_CLKREQn MPP_PIN(11, 0x5)
  81. #define MPP12_GPIO12 MPP_PIN(12, 0x0)
  82. #define MPP12_SATA_ACT MPP_PIN(12, 0x1)
  83. #define MPP12_UA2_RTSn MPP_PIN(12, 0x2)
  84. #define MPP12_AD0_I2S_EXT_MCLK MPP_PIN(12, 0x3)
  85. #define MPP12_SDIO1_CD MPP_PIN(12, 0x4)
  86. #define MPP13_GPIO13 MPP_PIN(13, 0x0)
  87. #define MPP13_UA2_CTSn MPP_PIN(13, 0x2)
  88. #define MPP13_AD1_I2S_EXT_MCLK MPP_PIN(13, 0x3)
  89. #define MPP13_SDIO1WP MPP_PIN(13, 0x4)
  90. #define MPP13_SSP_EXTCLK MPP_PIN(13, 0x5)
  91. #define MPP14_GPIO14 MPP_PIN(14, 0x0)
  92. #define MPP14_UA2_TXD MPP_PIN(14, 0x2)
  93. #define MPP14_SDIO1_BUS_POWER MPP_PIN(14, 0x4)
  94. #define MPP14_SSP_RXD MPP_PIN(14, 0x5)
  95. #define MPP15_GPIO15 MPP_PIN(15, 0x0)
  96. #define MPP15_UA2_RXD MPP_PIN(15, 0x2)
  97. #define MPP15_SDIO1_LED_CTRL MPP_PIN(15, 0x4)
  98. #define MPP15_SSP_SFRM MPP_PIN(15, 0x5)
  99. #define MPP16_GPIO16 MPP_PIN(16, 0x0)
  100. #define MPP16_UA3_RTSn MPP_PIN(16, 0x2)
  101. #define MPP16_SDIO0_CD MPP_PIN(16, 0x3)
  102. #define MPP16_SPI_LCD_CS1 MPP_PIN(16, 0x4)
  103. #define MPP16_AC97_SDATA_IN1 MPP_PIN(16, 0x5)
  104. #define MPP17_GPIO17 MPP_PIN(17, 0x0)
  105. #define MPP17_AC97_SYSCLK_OUT MPP_PIN(17, 0x1)
  106. #define MPP17_UA3_CTSn MPP_PIN(17, 0x2)
  107. #define MPP17_SDIO0_WP MPP_PIN(17, 0x3)
  108. #define MPP17_TW_SDA2 MPP_PIN(17, 0x4)
  109. #define MPP17_AC97_SDATA_IN2 MPP_PIN(17, 0x5)
  110. #define MPP18_GPIO18 MPP_PIN(18, 0x0)
  111. #define MPP18_UA3_TXD MPP_PIN(18, 0x2)
  112. #define MPP18_SDIO0_BUS_POWER MPP_PIN(18, 0x3)
  113. #define MPP18_LCD0_PWM MPP_PIN(18, 0x4)
  114. #define MPP18_AC_SDATA_IN3 MPP_PIN(18, 0x5)
  115. #define MPP19_GPIO19 MPP_PIN(19, 0x0)
  116. #define MPP19_UA3_RXD MPP_PIN(19, 0x2)
  117. #define MPP19_SDIO0_LED_CTRL MPP_PIN(19, 0x3)
  118. #define MPP19_TW_SCK2 MPP_PIN(19, 0x4)
  119. #define MPP20_GPIO20 MPP_PIN(20, 0x0)
  120. #define MPP20_AC97_SYSCLK_OUT MPP_PIN(20, 0x1)
  121. #define MPP20_SPI_LCD_MISO MPP_PIN(20, 0x2)
  122. #define MPP20_SDIO1_CD MPP_PIN(20, 0x3)
  123. #define MPP20_SDIO0_CD MPP_PIN(20, 0x5)
  124. #define MPP20_SPI_1_MISO MPP_PIN(20, 0x6)
  125. #define MPP21_GPIO21 MPP_PIN(21, 0x0)
  126. #define MPP21_UA1_RTSn MPP_PIN(21, 0x1)
  127. #define MPP21_SPI_LCD_CS0 MPP_PIN(21, 0x2)
  128. #define MPP21_SDIO1_WP MPP_PIN(21, 0x3)
  129. #define MPP21_SSP_SFRM MPP_PIN(21, 0x4)
  130. #define MPP21_SDIO0_WP MPP_PIN(21, 0x5)
  131. #define MPP21_SPI_1_CS MPP_PIN(21, 0x6)
  132. #define MPP22_GPIO22 MPP_PIN(22, 0x0)
  133. #define MPP22_UA1_CTSn MPP_PIN(22, 0x1)
  134. #define MPP22_SPI_LCD_MOSI MPP_PIN(22, 0x2)
  135. #define MPP22_SDIO1_BUS_POWER MPP_PIN(22, 0x3)
  136. #define MPP22_SSP_TXD MPP_PIN(22, 0x4)
  137. #define MPP22_SDIO0_BUS_POWER MPP_PIN(22, 0x5)
  138. #define MPP22_SPI_1_MOSI MPP_PIN(22, 0x6)
  139. #define MPP23_GPIO23 MPP_PIN(23, 0x0)
  140. #define MPP23_SPI_LCD_SCK MPP_PIN(23, 0x2)
  141. #define MPP23_SDIO1_LED_CTRL MPP_PIN(23, 0x3)
  142. #define MPP23_SSP_SCLK MPP_PIN(23, 0x4)
  143. #define MPP23_SDIO0_LED_CTRL MPP_PIN(23, 0x5)
  144. #define MPP23_SPI_1_SCK MPP_PIN(23, 0x6)
  145. /* for MPP groups _num is a group index */
  146. enum dove_mpp_grp_idx {
  147. MPP_24_39 = 2,
  148. MPP_40_45 = 0,
  149. MPP_46_51 = 1,
  150. MPP_58_61 = 5,
  151. MPP_62_63 = 4,
  152. };
  153. #define MPP24_39_GPIO MPP_GRP(MPP_24_39, 0x1)
  154. #define MPP24_39_CAM MPP_GRP(MPP_24_39, 0x0)
  155. #define MPP40_45_GPIO MPP_GRP(MPP_40_45, 0x1)
  156. #define MPP40_45_SD0 MPP_GRP(MPP_40_45, 0x0)
  157. #define MPP46_51_GPIO MPP_GRP(MPP_46_51, 0x1)
  158. #define MPP46_51_SD1 MPP_GRP(MPP_46_51, 0x0)
  159. #define MPP58_61_GPIO MPP_GRP(MPP_58_61, 0x1)
  160. #define MPP58_61_SPI MPP_GRP(MPP_58_61, 0x0)
  161. #define MPP62_63_GPIO MPP_GRP(MPP_62_63, 0x1)
  162. #define MPP62_63_UA1 MPP_GRP(MPP_62_63, 0x0)
  163. /* The MPP[64:71] control differs from other groups */
  164. #define MPP64_71_GPO MPP_GRP_NFC(0x1)
  165. #define MPP64_71_NFC MPP_GRP_NFC(0x0)
  166. /*
  167. * The MPP[52:57] functionality is encoded by 4 bits in different
  168. * registers. The _num field in this case encodes those bits in
  169. * correspodence with Table 135 of 88AP510 Functional specification
  170. */
  171. #define MPP52_57_AU1 MPP_GRP_AU1(0x0)
  172. #define MPP52_57_AU1_GPIO57 MPP_GRP_AU1(0x2)
  173. #define MPP52_57_GPIO MPP_GRP_AU1(0xa)
  174. #define MPP52_57_TW_GPIO MPP_GRP_AU1(0xb)
  175. #define MPP52_57_AU1_SSP MPP_GRP_AU1(0xc)
  176. #define MPP52_57_SSP_GPIO MPP_GRP_AU1(0xe)
  177. #define MPP52_57_SSP_TW MPP_GRP_AU1(0xf)
  178. void dove_mpp_conf(unsigned int *mpp_list);
  179. #endif /* __ARCH_DOVE_MPP_CODED_H */