pinctrl_leopard.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. /*
  2. * Copyright (c) 2020 Linaro Limited
  3. * SPDX-License-Identifier: Apache-2.0
  4. */
  5. #ifndef PINCTRL_LEOPARD_H_
  6. #define PINCTRL_LEOPARD_H_
  7. #define PIN_MFP_SET(pin, val) \
  8. {.pin_num = pin, \
  9. .mode = val}
  10. #define GPIO_CTL_MFP_SHIFT (0)
  11. #define GPIO_CTL_MFP_MASK (0x1f << GPIO_CTL_MFP_SHIFT)
  12. #define GPIO_CTL_MFP_GPIO (0x0 << GPIO_CTL_MFP_SHIFT)
  13. #define GPIO_CTL_MFP(x) (x << GPIO_CTL_MFP_SHIFT)
  14. #define GPIO_CTL_SMIT (0x1 << 5)
  15. #define GPIO_CTL_GPIO_OUTEN (0x1 << 6)
  16. #define GPIO_CTL_GPIO_INEN (0x1 << 7)
  17. #define GPIO_CTL_PULL_MASK (0xf << 8)
  18. #define GPIO_CTL_PULLUP_STRONG (0x1 << 8)
  19. #define GPIO_CTL_PULLDOWN (0x1 << 9)
  20. #define GPIO_CTL_PULLUP (0x1 << 11)
  21. #define GPIO_CTL_PULLUP_4K7 (0x1 << 10)
  22. #define GPIO_CTL_PADDRV_SHIFT (12)
  23. #define GPIO_CTL_PADDRV_LEVEL(x) ((x) << GPIO_CTL_PADDRV_SHIFT)
  24. #define GPIO_CTL_PADDRV_MASK GPIO_CTL_PADDRV_LEVEL(0x7)
  25. #define GPIO_CTL_SR (0x1 << 15)
  26. #define GPIO_CTL_INTC_EN (0x1 << 20)
  27. #define GPIO_CTL_INC_TRIGGER_SHIFT (21)
  28. #define GPIO_CTL_INC_TRIGGER(x) ((x) << GPIO_CTL_INC_TRIGGER_SHIFT)
  29. #define GPIO_CTL_INC_TRIGGER_MASK GPIO_CTL_INC_TRIGGER(0x7)
  30. #define GPIO_CTL_INC_TRIGGER_RISING_EDGE GPIO_CTL_INC_TRIGGER(0x0)
  31. #define GPIO_CTL_INC_TRIGGER_FALLING_EDGE GPIO_CTL_INC_TRIGGER(0x1)
  32. #define GPIO_CTL_INC_TRIGGER_DUAL_EDGE GPIO_CTL_INC_TRIGGER(0x2)
  33. #define GPIO_CTL_INC_TRIGGER_HIGH_LEVEL GPIO_CTL_INC_TRIGGER(0x3)
  34. #define GPIO_CTL_INC_TRIGGER_LOW_LEVEL GPIO_CTL_INC_TRIGGER(0x4)
  35. #define GPIO_CTL_INTC_MASK (0x1 << 25)
  36. /*********I2C mfp config*****************/
  37. #define MFP0_I2C 8
  38. #define MFP1_I2C 9
  39. #define MFP2_I2C 14
  40. #define MFP3_I2C 15
  41. #define I2C_MFP_CFG(x) (GPIO_CTL_MFP(x)|GPIO_CTL_PULLUP_4K7|GPIO_CTL_PADDRV_LEVEL(3))
  42. #define gpio74_i2c0_clk_node PIN_MFP_SET(74, I2C_MFP_CFG(MFP0_I2C))
  43. #define gpio22_i2c0_data_node PIN_MFP_SET(22, I2C_MFP_CFG(MFP0_I2C))
  44. #define gpio24_i2c0_clk_node PIN_MFP_SET(24, I2C_MFP_CFG(MFP0_I2C))
  45. #define gpio25_i2c0_data_node PIN_MFP_SET(25, I2C_MFP_CFG(MFP0_I2C))
  46. #define gpio28_i2c0_clk_node PIN_MFP_SET(28, I2C_MFP_CFG(MFP0_I2C))
  47. #define gpio29_i2c0_data_node PIN_MFP_SET(29, I2C_MFP_CFG(MFP0_I2C))
  48. #define gpio20_i2c1_clk_node PIN_MFP_SET(20, I2C_MFP_CFG(MFP1_I2C))
  49. #define gpio21_i2c1_data_node PIN_MFP_SET(21, I2C_MFP_CFG(MFP1_I2C))
  50. #define gpio18_i2c1_clk_node PIN_MFP_SET(18, I2C_MFP_CFG(MFP1_I2C))
  51. #define gpio19_i2c1_data_node PIN_MFP_SET(19, I2C_MFP_CFG(MFP1_I2C))
  52. #define gpio28_i2c1_clk_node PIN_MFP_SET(28, I2C_MFP_CFG(MFP1_I2C))
  53. #define gpio29_i2c1_data_node PIN_MFP_SET(29, I2C_MFP_CFG(MFP1_I2C))
  54. #define gpio57_i2c0_clk_node PIN_MFP_SET(57, I2C_MFP_CFG(MFP0_I2C))
  55. #define gpio58_i2c0_data_node PIN_MFP_SET(58, I2C_MFP_CFG(MFP0_I2C))
  56. #define gpio59_i2c1_clk_node PIN_MFP_SET(59, I2C_MFP_CFG(MFP1_I2C))
  57. #define gpio60_i2c1_data_node PIN_MFP_SET(60, I2C_MFP_CFG(MFP1_I2C))
  58. /*********I2CMT mfp config*****************/
  59. #define MFP0_I2CMT 26
  60. #define MFP1_I2CMT 27
  61. #define I2CMT_MFP_CFG(x) (GPIO_CTL_MFP(x)|GPIO_CTL_PULLUP_4K7|GPIO_CTL_PADDRV_LEVEL(3))
  62. #define gpio22_i2cmt0_clk_node PIN_MFP_SET(22, I2CMT_MFP_CFG(MFP0_I2CMT))
  63. #define gpio23_i2cmt0_data_node PIN_MFP_SET(23, I2CMT_MFP_CFG(MFP0_I2CMT))
  64. #define gpio24_i2cmt0_clk_node PIN_MFP_SET(24, I2CMT_MFP_CFG(MFP0_I2CMT))
  65. #define gpio25_i2cmt0_data_node PIN_MFP_SET(25, I2CMT_MFP_CFG(MFP0_I2CMT))
  66. #define gpio49_i2cmt0_clk_node PIN_MFP_SET(49, I2CMT_MFP_CFG(MFP0_I2CMT))
  67. #define gpio50_i2cmt0_data_node PIN_MFP_SET(50, I2CMT_MFP_CFG(MFP0_I2CMT))
  68. #define gpio51_i2cmt1_clk_node PIN_MFP_SET(51, I2CMT_MFP_CFG(MFP1_I2CMT))
  69. #define gpio52_i2cmt1_data_node PIN_MFP_SET(52, I2CMT_MFP_CFG(MFP1_I2CMT))
  70. #define gpio59_i2cmt1_clk_node PIN_MFP_SET(59, I2CMT_MFP_CFG(MFP1_I2CMT))
  71. #define gpio60_i2cmt1_data_node PIN_MFP_SET(60, I2CMT_MFP_CFG(MFP1_I2CMT))
  72. /*********SPI mfp config*****************/
  73. #define MFP_SPI0 6
  74. #define MFP_SPI0_1 7
  75. #define MFP_SPI1 2
  76. #define MFP_SPI2 3
  77. #define MFP_SPI3 4
  78. #define SPI_MFP_CFG(x) (GPIO_CTL_MFP(x)|GPIO_CTL_PULLUP_STRONG|GPIO_CTL_PADDRV_LEVEL(3))
  79. #define SPI2_MFP_CFG(x) (GPIO_CTL_MFP(x)|GPIO_CTL_PULLUP_STRONG|GPIO_CTL_PADDRV_LEVEL(5))
  80. #define gpio24_spi1_ss_node PIN_MFP_SET(24, SPI_MFP_CFG(MFP_SPI1))
  81. #define gpio25_spi1_clk_node PIN_MFP_SET(25, SPI_MFP_CFG(MFP_SPI1))
  82. #define gpio26_spi1_miso_node PIN_MFP_SET(26, SPI_MFP_CFG(MFP_SPI1))
  83. #define gpio27_spi1_mosi_node PIN_MFP_SET(27, SPI_MFP_CFG(MFP_SPI1))
  84. #define gpio30_spi2_ss_node PIN_MFP_SET(30, SPI2_MFP_CFG(MFP_SPI2))
  85. #define gpio31_spi2_clk_node PIN_MFP_SET(31, SPI2_MFP_CFG(MFP_SPI2))
  86. #define gpio32_spi2_miso_node PIN_MFP_SET(32, SPI2_MFP_CFG(MFP_SPI2))
  87. #define gpio33_spi2_mosi_node PIN_MFP_SET(33, SPI2_MFP_CFG(MFP_SPI2))
  88. #define gpio20_spi3_ss_node PIN_MFP_SET(20, SPI2_MFP_CFG(MFP_SPI3))
  89. #define gpio21_spi3_clk_node PIN_MFP_SET(21, SPI2_MFP_CFG(MFP_SPI3))
  90. #define gpio22_spi3_miso_node PIN_MFP_SET(22, SPI2_MFP_CFG(MFP_SPI3))
  91. #define gpio23_spi3_mosi_node PIN_MFP_SET(23, SPI2_MFP_CFG(MFP_SPI3))
  92. /*********SPIMT mfp config*****************/
  93. #define MFP0_SPIMT 24
  94. #define MFP1_SPIMT 25
  95. #define SPIMT_MFP_CFG(x) (GPIO_CTL_MFP(x)|GPIO_CTL_PULLUP_STRONG|GPIO_CTL_PADDRV_LEVEL(3))
  96. #define gpio49_spimt0_ss_node PIN_MFP_SET(49, SPIMT_MFP_CFG(MFP0_SPIMT))
  97. #define gpio50_spimt0_clk_node PIN_MFP_SET(50, SPIMT_MFP_CFG(MFP0_SPIMT))
  98. #define gpio51_spimt0_miso_node PIN_MFP_SET(51, SPIMT_MFP_CFG(MFP0_SPIMT))
  99. #define gpio52_spimt0_mosi_node PIN_MFP_SET(52, SPIMT_MFP_CFG(MFP0_SPIMT))
  100. #define gpio61_spimt0_ss1_node PIN_MFP_SET(61, SPIMT_MFP_CFG(MFP0_SPIMT))
  101. #define gpio53_spimt1_ss_node PIN_MFP_SET(53, SPIMT_MFP_CFG(MFP1_SPIMT))
  102. #define gpio54_spimt1_clk_node PIN_MFP_SET(54, SPIMT_MFP_CFG(MFP1_SPIMT))
  103. #define gpio55_spimt1_miso_node PIN_MFP_SET(55, SPIMT_MFP_CFG(MFP1_SPIMT))
  104. #define gpio56_spimt1_mosi_node PIN_MFP_SET(56, SPIMT_MFP_CFG(MFP1_SPIMT))
  105. /* lcdc */
  106. #ifndef LCD_PADDRV_LEVEL
  107. # define LCD_PADDRV_LEVEL (1)
  108. #endif
  109. #ifndef LCD_CLK_PADDRV_LEVEL
  110. # define LCD_CLK_PADDRV_LEVEL (1)
  111. #endif
  112. #define LCD_MFP_SEL (19 | GPIO_CTL_PADDRV_LEVEL(LCD_PADDRV_LEVEL))
  113. #define LCD_MFP_CLK_SEL (19 | GPIO_CTL_PADDRV_LEVEL(LCD_CLK_PADDRV_LEVEL))
  114. #define gpio30_lcd_ce0_hsync_node PIN_MFP_SET(30, (GPIO_CTL_MFP(LCD_MFP_SEL)|GPIO_CTL_PULLUP))
  115. #define gpio31_lcd_ce1_node PIN_MFP_SET(31, (GPIO_CTL_MFP(LCD_MFP_SEL)|GPIO_CTL_PULLUP))
  116. #define gpio32_lcd_rs_vsync_sda_node PIN_MFP_SET(32, LCD_MFP_SEL)
  117. #define gpio33_lcd_rde_lde_cdx_node PIN_MFP_SET(33, LCD_MFP_SEL)
  118. #define gpio34_lcd_wr_dclk_scl_node PIN_MFP_SET(34, LCD_MFP_SEL)
  119. #define gpio35_lcd_te_sdo_node PIN_MFP_SET(35, LCD_MFP_SEL)
  120. #define gpio14_lcd_d0_node PIN_MFP_SET(14, LCD_MFP_SEL)
  121. #define gpio15_lcd_d1_node PIN_MFP_SET(15, LCD_MFP_SEL)
  122. #define gpio16_lcd_d2_node PIN_MFP_SET(16, LCD_MFP_SEL)
  123. #define gpio17_lcd_d3_node PIN_MFP_SET(17, LCD_MFP_SEL)
  124. #define gpio18_lcd_d4_node PIN_MFP_SET(18, LCD_MFP_SEL)
  125. #define gpio19_lcd_d5_node PIN_MFP_SET(19, LCD_MFP_SEL)
  126. #define gpio20_lcd_d6_node PIN_MFP_SET(20, LCD_MFP_SEL)
  127. #define gpio21_lcd_d7_node PIN_MFP_SET(21, LCD_MFP_SEL)
  128. #define gpio14_lcd_ce0_hsync_node PIN_MFP_SET(14, (GPIO_CTL_MFP(LCD_MFP_SEL)|GPIO_CTL_PULLUP))
  129. #define gpio15_lcd_ce1_node PIN_MFP_SET(15, LCD_MFP_SEL)
  130. #define gpio16_lcd_d8_node PIN_MFP_SET(16, LCD_MFP_SEL)
  131. #define gpio17_lcd_d9_node PIN_MFP_SET(17, LCD_MFP_SEL)
  132. #define gpio18_lcd_d10_node PIN_MFP_SET(18, LCD_MFP_SEL)
  133. #define gpio19_lcd_d11_node PIN_MFP_SET(19, LCD_MFP_SEL)
  134. #define gpio20_lcd_d12_node PIN_MFP_SET(20, LCD_MFP_SEL)
  135. #define gpio21_lcd_d13_node PIN_MFP_SET(21, LCD_MFP_SEL)
  136. #define gpio22_lcd_d14_node PIN_MFP_SET(22, LCD_MFP_SEL)
  137. #define gpio23_lcd_d15_node PIN_MFP_SET(23, LCD_MFP_SEL)
  138. #define gpio24_lcd_d0_node PIN_MFP_SET(24, LCD_MFP_SEL)
  139. #define gpio25_lcd_d1_node PIN_MFP_SET(25, LCD_MFP_SEL)
  140. #define gpio26_lcd_d2_node PIN_MFP_SET(26, LCD_MFP_SEL)
  141. #define gpio27_lcd_d3_node PIN_MFP_SET(27, LCD_MFP_SEL)
  142. #define gpio28_lcd_d4_node PIN_MFP_SET(28, LCD_MFP_SEL)
  143. #define gpio29_lcd_d5_node PIN_MFP_SET(29, LCD_MFP_SEL)
  144. #define gpio30_lcd_d6_node PIN_MFP_SET(30, LCD_MFP_SEL)
  145. #define gpio31_lcd_d7_node PIN_MFP_SET(31, LCD_MFP_SEL)
  146. #define gpio32_lcd_rs_vsync_sda_node PIN_MFP_SET(32, LCD_MFP_SEL)
  147. #define gpio33_lcd_rde_lde_cdx_node PIN_MFP_SET(33, LCD_MFP_SEL)
  148. #define gpio34_lcd_wr_dclk_scl_node PIN_MFP_SET(34, LCD_MFP_SEL)
  149. #define gpio35_lcd_te_sdo_node PIN_MFP_SET(35, LCD_MFP_SEL)
  150. /* lcdc fpga 1.8v*/
  151. #define gpio30_lcd_ce0_hsync_node PIN_MFP_SET(30, (GPIO_CTL_MFP(LCD_MFP_SEL)|GPIO_CTL_PULLUP))
  152. #define gpio34_lcd_wr_dclk_scl_node PIN_MFP_SET(34, LCD_MFP_SEL)
  153. #define gpio14_lcd_d0_node PIN_MFP_SET(14, LCD_MFP_SEL)
  154. #define gpio15_lcd_d1_node PIN_MFP_SET(15, LCD_MFP_SEL)
  155. #define gpio16_lcd_d2_node PIN_MFP_SET(16, LCD_MFP_SEL)
  156. #define gpio17_lcd_d3_node PIN_MFP_SET(17, LCD_MFP_SEL)
  157. #define gpio18_lcd_d4_node PIN_MFP_SET(18, LCD_MFP_SEL)
  158. #define gpio19_lcd_d5_node PIN_MFP_SET(19, LCD_MFP_SEL)
  159. #define gpio20_lcd_d6_node PIN_MFP_SET(20, LCD_MFP_SEL)
  160. #define gpio21_lcd_d7_node PIN_MFP_SET(21, LCD_MFP_SEL)
  161. //#define gpio24_lcd_d10_node PIN_MFP_SET(24, LCD_MFP_SEL)
  162. //#define gpio25_lcd_d11_node PIN_MFP_SET(25, LCD_MFP_SEL)
  163. //#define gpio26_lcd_d12_node PIN_MFP_SET(26, LCD_MFP_SEL)
  164. //#define gpio27_lcd_d13_node PIN_MFP_SET(27, LCD_MFP_SEL)
  165. //#define gpio28_lcd_d14_node PIN_MFP_SET(28, LCD_MFP_SEL)
  166. //#define gpio29_lcd_d15_node PIN_MFP_SET(29, LCD_MFP_SEL)
  167. /* sd0 */
  168. #define SDC0_MFP_SEL 10
  169. #define SDC0_MFP_CFG_VAL (GPIO_CTL_MFP(SDC0_MFP_SEL)|GPIO_CTL_PULLUP|GPIO_CTL_PADDRV_LEVEL(5))
  170. //#define gpio0_sdc0_cmd_node PIN_MFP_SET(0, sdc0, cmd, SDC0_MFP_CFG_VAL)
  171. //#define gpio1_sdc0_clk_node PIN_MFP_SET(1, sdc0, clk, (GPIO_CTL_MFP(SDC0_MFP_SEL)|GPIO_CTL_PADDRV_LEVEL(3)))
  172. //#define gpio2_sdc0_d0_node PIN_MFP_SET(2, sdc0, d0, SDC0_MFP_CFG_VAL)
  173. //#define gpio3_sdc0_d1_node PIN_MFP_SET(3, sdc0, d1, SDC0_MFP_CFG_VAL)
  174. //#define gpio4_sdc0_d2_node PIN_MFP_SET(4, sdc0, d2, SDC0_MFP_CFG_VAL)
  175. //#define gpio5_sdc0_d3_node PIN_MFP_SET(5, sdc0, d3, SDC0_MFP_CFG_VAL)
  176. //#define gpio6_sdc0_d4_node PIN_MFP_SET(6, sdc0, d4, SDC0_MFP_CFG_VAL)
  177. //#define gpio7_sdc0_d5_node PIN_MFP_SET(7, sdc0, d5, SDC0_MFP_CFG_VAL)
  178. //#define gpio8_sdc0_d6_node PIN_MFP_SET(8, sdc0, d6, SDC0_MFP_CFG_VAL)
  179. //#define gpio9_sdc0_d7_node PIN_MFP_SET(9, sdc0, d7, SDC0_MFP_CFG_VAL)
  180. #define gpio11_sdc0_cmd_node PIN_MFP_SET(11, SDC0_MFP_CFG_VAL)
  181. #define gpio10_sdc0_clk_node PIN_MFP_SET(10, (GPIO_CTL_MFP(SDC0_MFP_SEL)|GPIO_CTL_PADDRV_LEVEL(3)))
  182. #define gpio12_sdc0_d0_node PIN_MFP_SET(12, SDC0_MFP_CFG_VAL)
  183. #define gpio13_sdc0_d1_node PIN_MFP_SET(13, SDC0_MFP_CFG_VAL)
  184. #define gpio8_sdc0_d2_node PIN_MFP_SET(8, SDC0_MFP_CFG_VAL)
  185. #define gpio9_sdc0_d3_node PIN_MFP_SET(9, SDC0_MFP_CFG_VAL)
  186. /* sd1 */
  187. #define SDC1_MFP_SEL 20
  188. #define SDC1_MFP_CFG_VAL (GPIO_CTL_MFP(SDC1_MFP_SEL)|GPIO_CTL_PULLUP|GPIO_CTL_PADDRV_LEVEL(5))
  189. #define gpio44_sdc1_cmd_node PIN_MFP_SET(44, SDC1_MFP_SEL)
  190. #define gpio43_sdc1_clk_node PIN_MFP_SET(43, (GPIO_CTL_MFP(SDC1_MFP_SEL)|GPIO_CTL_PADDRV_LEVEL(3)))
  191. #define gpio45_sdc1_d0_node PIN_MFP_SET(45, SDC1_MFP_CFG_VAL)
  192. #define gpio46_sdc1_d1_node PIN_MFP_SET(46, SDC1_MFP_CFG_VAL)
  193. #define gpio41_sdc1_d2_node PIN_MFP_SET(41, SDC1_MFP_CFG_VAL)
  194. #define gpio42_sdc1_d3_node PIN_MFP_SET(42, SDC1_MFP_CFG_VAL)
  195. /* uart0 */
  196. #define UART0_MFP_SEL 5
  197. #define UART0_MFP_CFG (GPIO_CTL_MFP(UART0_MFP_SEL)|GPIO_CTL_SMIT|GPIO_CTL_PULLUP_STRONG|GPIO_CTL_PADDRV_LEVEL(4))
  198. #define gpio10_uart0_tx_node PIN_MFP_SET(10, UART0_MFP_CFG)
  199. #define gpio11_uart0_rx_node PIN_MFP_SET(11, UART0_MFP_CFG)
  200. #define gpio28_uart0_tx_node PIN_MFP_SET(28, UART0_MFP_CFG)
  201. #define gpio29_uart0_rx_node PIN_MFP_SET(29, UART0_MFP_CFG)
  202. #define gpio37_uart0_tx_node PIN_MFP_SET(37, UART0_MFP_CFG)
  203. #define gpio38_uart0_rx_node PIN_MFP_SET(38, UART0_MFP_CFG)
  204. #define gpio63_uart0_tx_node PIN_MFP_SET(63, UART0_MFP_CFG)
  205. #define gpio62_uart0_rx_node PIN_MFP_SET(62, UART0_MFP_CFG)
  206. /* uart1 */
  207. #define UART1_MFP_SEL 6
  208. #define UART1_MFP_CFG (GPIO_CTL_MFP(UART1_MFP_SEL) | GPIO_CTL_SMIT | GPIO_CTL_PULLUP_STRONG | GPIO_CTL_PADDRV_LEVEL(4))
  209. #define gpio16_uart1_tx_node PIN_MFP_SET(16, UART1_MFP_CFG)
  210. #define gpio17_uart1_rx_node PIN_MFP_SET(17, UART1_MFP_CFG)
  211. /* uart2 */
  212. #define UART2_MFP_SEL 7
  213. #define UART2_MFP_CFG (GPIO_CTL_MFP(UART2_MFP_SEL) | GPIO_CTL_SMIT | GPIO_CTL_PULLUP_STRONG | GPIO_CTL_PADDRV_LEVEL(4))
  214. #define gpio53_uart2_tx_node PIN_MFP_SET(53, UART2_MFP_CFG)
  215. #define gpio54_uart2_rx_node PIN_MFP_SET(54, UART2_MFP_CFG)
  216. #define gpio26_uart2_tx_node PIN_MFP_SET(26, UART2_MFP_CFG)
  217. #define gpio27_uart2_rx_node PIN_MFP_SET(27, UART2_MFP_CFG)
  218. /* SPDIFTX */
  219. #define SPDIFTX_MFP_SEL 14
  220. #define SPDIFTX_MFP_CFG (GPIO_CTL_MFP(SPDIFTX_MFP_SEL)| GPIO_CTL_SMIT | GPIO_CTL_PADDRV_LEVEL(3))
  221. #define gpio9_spdiftx0_d0_node PIN_MFP_SET(9, SPDIFTX_MFP_CFG)
  222. #define gpio62_spdiftx0_d0_node PIN_MFP_SET(62, SPDIFTX_MFP_CFG)
  223. /* SPDIFRX */
  224. #define SPDIFRX_MFP_SEL 15
  225. #define SPDIFRX_MFP_CFG (GPIO_CTL_MFP(SPDIFRX_MFP_SEL)| GPIO_CTL_SMIT | GPIO_CTL_PADDRV_LEVEL(3))
  226. #define gpio13_spdifrx0_d0_node PIN_MFP_SET(13, SPDIFRX_MFP_CFG)
  227. #define gpio63_spdifrx0_d0_node PIN_MFP_SET(63, SPDIFRX_MFP_CFG)
  228. /* I2STX */
  229. #define I2STX_MFP_SEL 12
  230. #define I2STX_MFP_CFG (GPIO_CTL_MFP(I2STX_MFP_SEL)| GPIO_CTL_SMIT | GPIO_CTL_PADDRV_LEVEL(3))
  231. #define gpio39_i2stx0_d0_node PIN_MFP_SET(39, I2STX_MFP_CFG)
  232. #define gpio16_i2stx0_mclk_node PIN_MFP_SET(16, I2STX_MFP_CFG)
  233. #define gpio17_i2stx0_bclk_node PIN_MFP_SET(17, I2STX_MFP_CFG)
  234. #define gpio18_i2stx0_lrclk_node PIN_MFP_SET(18, I2STX_MFP_CFG)
  235. #define gpio9_i2stx0_d0_node PIN_MFP_SET(9, I2STX_MFP_CFG)
  236. #define gpio6_i2stx0_mclk_node PIN_MFP_SET(6, I2STX_MFP_CFG)
  237. #define gpio7_i2stx0_bclk_node PIN_MFP_SET(7, I2STX_MFP_CFG)
  238. #define gpio8_i2stx0_lrclk_node PIN_MFP_SET(8, I2STX_MFP_CFG)
  239. #define gpio49_i2stx0_mclk_node PIN_MFP_SET(49, I2STX_MFP_CFG)
  240. #define gpio50_i2stx0_bclk_node PIN_MFP_SET(50, I2STX_MFP_CFG)
  241. #define gpio51_i2stx0_lrclk_node PIN_MFP_SET(51, I2STX_MFP_CFG)
  242. #define gpio52_i2stx0_d0_node PIN_MFP_SET(52, I2STX_MFP_CFG)
  243. /* I2SRX */
  244. #define I2SRX_MFP_SEL 13
  245. #define I2SRX_MFP_CFG (GPIO_CTL_MFP(I2SRX_MFP_SEL)| GPIO_CTL_SMIT | GPIO_CTL_PADDRV_LEVEL(3))
  246. #define gpio43_i2srx0_d0_node PIN_MFP_SET(43, I2SRX_MFP_CFG)
  247. #define gpio19_i2srx0_mclk_node PIN_MFP_SET(19, I2SRX_MFP_CFG)
  248. #define gpio20_i2srx0_bclk_node PIN_MFP_SET(20, I2SRX_MFP_CFG)
  249. #define gpio21_i2srx0_lrclk_node PIN_MFP_SET(21, I2SRX_MFP_CFG)
  250. #define gpio9_i2srx0_d0_node PIN_MFP_SET(9, I2SRX_MFP_CFG)
  251. #define gpio40_i2srx0_mclk_node PIN_MFP_SET(40, I2SRX_MFP_CFG)
  252. #define gpio6_i2srx0_bclk_node PIN_MFP_SET(6, I2SRX_MFP_CFG)
  253. #define gpio7_i2srx0_lrclk_node PIN_MFP_SET(7, I2SRX_MFP_CFG)
  254. #define gpio53_i2srx0_mclk_node PIN_MFP_SET(53, I2SRX_MFP_CFG)
  255. #define gpio54_i2srx0_bclk_node PIN_MFP_SET(54, I2SRX_MFP_CFG)
  256. #define gpio55_i2srx0_lrclk_node PIN_MFP_SET(55, I2SRX_MFP_CFG)
  257. #define gpio56_i2srx0_d0_node PIN_MFP_SET(56, I2SRX_MFP_CFG)
  258. /* TP KEY */
  259. #define gpio12_tp_rst_node PIN_MFP_SET(12, GPIO_CTL_GPIO_OUTEN)
  260. #define gpio30_tp_rst_node PIN_MFP_SET(30, GPIO_CTL_GPIO_OUTEN)
  261. #define gpio13_tp_isr_node PIN_MFP_SET(13, GPIO_CTL_GPIO_OUTEN)
  262. #define gpio31_tp_isr_node PIN_MFP_SET(31, GPIO_CTL_GPIO_OUTEN)
  263. /* GPIO KEY */
  264. #define GPIOKEY_MFP_PU_CFG (GPIO_CTL_SMIT | GPIO_CTL_PULLUP | GPIO_CTL_GPIO_INEN | GPIO_CTL_INTC_EN | GPIO_CTL_INC_TRIGGER_DUAL_EDGE)
  265. #define GPIOKEY_MFP_CFG (GPIO_CTL_SMIT | GPIO_CTL_GPIO_INEN | GPIO_CTL_INTC_EN | GPIO_CTL_INC_TRIGGER_DUAL_EDGE)
  266. #define gpio17_keygpio_key0_node PIN_MFP_SET(17, GPIOKEY_MFP_CFG)
  267. #define gpio18_keygpio_key1_node PIN_MFP_SET(18, GPIOKEY_MFP_CFG)
  268. #define gpio19_keygpio_key2_node PIN_MFP_SET(19, GPIOKEY_MFP_CFG)
  269. #define gpio20_keygpio_key3_node PIN_MFP_SET(20, GPIOKEY_MFP_CFG)
  270. #define gpio21_keygpio_key4_node PIN_MFP_SET(21, GPIOKEY_MFP_CFG)
  271. #define gpio22_keygpio_key5_node PIN_MFP_SET(22, GPIOKEY_MFP_CFG)
  272. #define gpio23_keygpio_key6_node PIN_MFP_SET(23, GPIOKEY_MFP_CFG)
  273. #define gpio24_keygpio_key7_node PIN_MFP_SET(24, GPIOKEY_MFP_CFG)
  274. #define gpio25_keygpio_key8_node PIN_MFP_SET(25, GPIOKEY_MFP_CFG)
  275. #define gpio26_keygpio_key9_node PIN_MFP_SET(26, GPIOKEY_MFP_CFG)
  276. /* knob gpio */
  277. #define GPIOKNOB_MFP_INT_CFG (GPIO_CTL_SMIT | GPIO_CTL_PULLUP | GPIO_CTL_GPIO_INEN | GPIO_CTL_INTC_EN | GPIO_CTL_INC_TRIGGER_DUAL_EDGE)
  278. #define GPIOKNOB_MFP_CFG (GPIO_CTL_SMIT | GPIO_CTL_PULLUP | GPIO_CTL_GPIO_INEN )
  279. /* PWM */
  280. #define PWM_MFP_CFG (0x12 | GPIO_CTL_SMIT | GPIO_CTL_PADDRV_LEVEL(3))
  281. #define PWM_PIN_MFP_SET(pin, chan, val) \
  282. {.pin_num = pin, \
  283. .pin_chan = chan, \
  284. .mode = val}
  285. #define gpio03_pwm_chan0_node PWM_PIN_MFP_SET(03, 0, PWM_MFP_CFG)
  286. #define gpio04_pwm_chan0_node PWM_PIN_MFP_SET(04, 0, PWM_MFP_CFG)
  287. #define gpio14_pwm_chan0_node PWM_PIN_MFP_SET(14, 0, PWM_MFP_CFG)
  288. #define gpio36_pwm_chan0_node PWM_PIN_MFP_SET(36, 0, PWM_MFP_CFG)
  289. #define gpio49_pwm_chan0_node PWM_PIN_MFP_SET(49, 0, PWM_MFP_CFG)
  290. #define gpio05_pwm_chan1_node PWM_PIN_MFP_SET(05, 1, PWM_MFP_CFG)
  291. #define gpio15_pwm_chan1_node PWM_PIN_MFP_SET(15, 1, PWM_MFP_CFG)
  292. #define gpio37_pwm_chan1_node PWM_PIN_MFP_SET(37, 1, PWM_MFP_CFG)
  293. #define gpio50_pwm_chan1_node PWM_PIN_MFP_SET(50, 1, PWM_MFP_CFG)
  294. #define gpio06_pwm_chan2_node PWM_PIN_MFP_SET(06, 2, PWM_MFP_CFG)
  295. #define gpio21_pwm_chan2_node PWM_PIN_MFP_SET(21, 2, PWM_MFP_CFG)
  296. #define gpio38_pwm_chan2_node PWM_PIN_MFP_SET(38, 2, PWM_MFP_CFG)
  297. #define gpio51_pwm_chan2_node PWM_PIN_MFP_SET(51, 2, PWM_MFP_CFG)
  298. #define gpio07_pwm_chan3_node PWM_PIN_MFP_SET(07, 3, PWM_MFP_CFG)
  299. #define gpio17_pwm_chan3_node PWM_PIN_MFP_SET(17, 3, PWM_MFP_CFG)
  300. #define gpio39_pwm_chan3_node PWM_PIN_MFP_SET(39, 3, PWM_MFP_CFG)
  301. #define gpio52_pwm_chan3_node PWM_PIN_MFP_SET(52, 3, PWM_MFP_CFG)
  302. #define gpio08_pwm_chan4_node PWM_PIN_MFP_SET(08, 4, PWM_MFP_CFG)
  303. #define gpio18_pwm_chan4_node PWM_PIN_MFP_SET(18, 4, PWM_MFP_CFG)
  304. #define gpio40_pwm_chan4_node PWM_PIN_MFP_SET(40, 4, PWM_MFP_CFG)
  305. #define gpio53_pwm_chan4_node PWM_PIN_MFP_SET(53, 4, PWM_MFP_CFG)
  306. #define gpio09_pwm_chan5_node PWM_PIN_MFP_SET(09, 5, PWM_MFP_CFG)
  307. #define gpio19_pwm_chan5_node PWM_PIN_MFP_SET(19, 5, PWM_MFP_CFG)
  308. #define gpio41_pwm_chan5_node PWM_PIN_MFP_SET(41, 5, PWM_MFP_CFG)
  309. #define gpio54_pwm_chan5_node PWM_PIN_MFP_SET(54, 5, PWM_MFP_CFG)
  310. #define gpio10_pwm_chan6_node PWM_PIN_MFP_SET(10, 6, PWM_MFP_CFG)
  311. #define gpio20_pwm_chan6_node PWM_PIN_MFP_SET(20, 6, PWM_MFP_CFG)
  312. #define gpio42_pwm_chan6_node PWM_PIN_MFP_SET(42, 6, PWM_MFP_CFG)
  313. #define gpio55_pwm_chan6_node PWM_PIN_MFP_SET(55, 6, PWM_MFP_CFG)
  314. #define gpio11_pwm_chan7_node PWM_PIN_MFP_SET(11, 7, PWM_MFP_CFG)
  315. #define gpio21_pwm_chan7_node PWM_PIN_MFP_SET(21, 7, PWM_MFP_CFG)
  316. #define gpio43_pwm_chan7_node PWM_PIN_MFP_SET(43, 7, PWM_MFP_CFG)
  317. #define gpio45_pwm_chan7_node PWM_PIN_MFP_SET(45, 7, PWM_MFP_CFG)
  318. #define gpio56_pwm_chan7_node PWM_PIN_MFP_SET(56, 7, PWM_MFP_CFG)
  319. #define gpio12_pwm_chan7_node PWM_PIN_MFP_SET(12, 8, PWM_MFP_CFG)
  320. #define gpio22_pwm_chan7_node PWM_PIN_MFP_SET(22, 8, PWM_MFP_CFG)
  321. #define gpio44_pwm_chan7_node PWM_PIN_MFP_SET(44, 8, PWM_MFP_CFG)
  322. #define gpio46_pwm_chan7_node PWM_PIN_MFP_SET(46, 8, PWM_MFP_CFG)
  323. #define gpio57_pwm_chan7_node PWM_PIN_MFP_SET(57, 8, PWM_MFP_CFG)
  324. /* SPI NOR */
  325. #define SPINOR_MFP_SEL 1
  326. #define SPINOR_MFP_CFG (GPIO_CTL_MFP(SPINOR_MFP_SEL)| GPIO_CTL_SMIT | GPIO_CTL_PADDRV_LEVEL(3) | GPIO_CTL_SR)
  327. #define SPINOR_MFP_PU_CFG (GPIO_CTL_MFP(SPINOR_MFP_SEL)| GPIO_CTL_SMIT | GPIO_CTL_PADDRV_LEVEL(3) | GPIO_CTL_PULLUP | GPIO_CTL_SR)
  328. #define SPINOR2_MFP_SEL 3
  329. #define SPINOR2_MFP_CFG (GPIO_CTL_MFP(SPINOR2_MFP_SEL)| GPIO_CTL_SMIT | GPIO_CTL_PADDRV_LEVEL(3))
  330. #define SPI3_MFP_SEL 4
  331. #define SPI3_MFP_CFG (GPIO_CTL_MFP(SPI3_MFP_SEL)| GPIO_CTL_SMIT | GPIO_CTL_PADDRV_LEVEL(3))
  332. #define SPINOR_22_MFP_SEL 22
  333. #define SPINOR_22_MFP_CFG (GPIO_CTL_MFP(SPINOR_22_MFP_SEL)| GPIO_CTL_SMIT | GPIO_CTL_PADDRV_LEVEL(3))
  334. #define SPINOR_22_MFP_PU_CFG (GPIO_CTL_MFP(SPINOR_22_MFP_SEL)| GPIO_CTL_SMIT | GPIO_CTL_PADDRV_LEVEL(3) | GPIO_CTL_PULLUP)
  335. #define gpio0_spinor0_cs_node PIN_MFP_SET(0, SPINOR_MFP_CFG)
  336. #define gpio1_spinor0_miso_node PIN_MFP_SET(1, SPINOR_MFP_CFG)
  337. #define gpio2_spinor0_clk_node PIN_MFP_SET(2, SPINOR_MFP_CFG)
  338. #define gpio3_spinor0_mosi_node PIN_MFP_SET(3, SPINOR_MFP_CFG)
  339. #define gpio6_spinor0_io2_node PIN_MFP_SET(6, SPINOR_MFP_PU_CFG)
  340. #define gpio7_spinor0_io3_node PIN_MFP_SET(7, SPINOR_MFP_PU_CFG)
  341. /* HDMI CEC */
  342. #define CEC_MFP_SEL 21
  343. #define CEC_MFP_CFG (GPIO_CTL_MFP(CEC_MFP_SEL)| GPIO_CTL_SMIT | GPIO_CTL_PADDRV_LEVEL(3) | GPIO_CTL_PULLUP)
  344. #define gpio12_cec0_d0_node PIN_MFP_SET(12, CEC_MFP_CFG)
  345. /* ADC KEY */
  346. #define ADCKEY_MFP_SEL 28
  347. #define ADCKEY_MFP_CFG (GPIO_CTL_MFP(ADCKEY_MFP_SEL) | GPIO_CTL_SMIT | GPIO_CTL_PADDRV_LEVEL(3))
  348. #define gpio21_adckey_lradc3_node PIN_MFP_SET(21, ADCKEY_MFP_CFG)
  349. /* SPI NAND */
  350. #define SPINAND_MFP_SEL 4
  351. #define SPINAND_MFP_CFG (GPIO_CTL_MFP(SPINAND_MFP_SEL) | GPIO_CTL_SMIT | GPIO_CTL_PADDRV_LEVEL(3))
  352. #define SPINAND_MFP_PU_CFG (GPIO_CTL_MFP(SPINAND_MFP_SEL)| GPIO_CTL_SMIT | GPIO_CTL_PADDRV_LEVEL(3) | GPIO_CTL_PULLUP)
  353. #define gpio8_spinand3_io2_node PIN_MFP_SET(8, SPINAND_MFP_PU_CFG)
  354. #define gpio9_spinand3_io3_node PIN_MFP_SET(9, SPINAND_MFP_PU_CFG)
  355. #define gpio10_spinand3_ss_node PIN_MFP_SET(10, SPINAND_MFP_CFG)
  356. #define gpio11_spinand3_clk_node PIN_MFP_SET(11, SPINAND_MFP_CFG)
  357. #define gpio12_spinand3_io1_node PIN_MFP_SET(12, SPINAND_MFP_CFG)
  358. #define gpio13_spinand3_io0_node PIN_MFP_SET(13, SPINAND_MFP_CFG)
  359. #define gpio61_spinand3_io2_node PIN_MFP_SET(61, SPINAND_MFP_PU_CFG)
  360. #define gpio62_spinand3_io3_node PIN_MFP_SET(62, SPINAND_MFP_PU_CFG)
  361. #define gpio53_spinand3_ss_node PIN_MFP_SET(53, SPINAND_MFP_CFG)
  362. #define gpio54_spinand3_clk_node PIN_MFP_SET(54, SPINAND_MFP_CFG)
  363. #define gpio55_spinand3_io1_node PIN_MFP_SET(55, SPINAND_MFP_CFG)
  364. #define gpio56_spinand3_io0_node PIN_MFP_SET(56, SPINAND_MFP_CFG)
  365. /* BATTERY NTC */
  366. #define BATNTC_MFP_SEL 28
  367. #define BATNTC_MFP_CFG (GPIO_CTL_MFP(BATNTC_MFP_SEL) | GPIO_CTL_SMIT | GPIO_CTL_PADDRV_LEVEL(3))
  368. #define BATNTC_REF_MFP_SEL 28
  369. /* NTC ref config should pull up to vcc 3.4v */
  370. #define BATNTC_REF_MFP_CFG (GPIO_CTL_MFP(BATNTC_REF_MFP_SEL) | GPIO_CTL_SMIT | GPIO_CTL_PADDRV_LEVEL(3) | GPIO_CTL_PULLUP_STRONG)
  371. #endif /* PINCTRL_LEOPARD_H_ */