mtgpio.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. /*
  2. * Copyright (c) 2022, MediaTek Inc. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef MT_GPIO_H
  7. #define MT_GPIO_H
  8. #include <mtgpio_common.h>
  9. /* Enumeration for GPIO pin */
  10. typedef enum GPIO_PIN {
  11. GPIO_UNSUPPORTED = -1,
  12. GPIO0, GPIO1, GPIO2, GPIO3, GPIO4, GPIO5, GPIO6,
  13. GPIO7, GPIO8, GPIO9, GPIO10, GPIO11, GPIO12, GPIO13, GPIO14,
  14. GPIO15, GPIO16, GPIO17, GPIO18, GPIO19, GPIO20, GPIO21, GPIO22,
  15. GPIO23, GPIO24, GPIO25, GPIO26, GPIO27, GPIO28, GPIO29, GPIO30,
  16. GPIO31, GPIO32, GPIO33, GPIO34, GPIO35, GPIO36, GPIO37, GPIO38,
  17. GPIO39, GPIO40, GPIO41, GPIO42, GPIO43, GPIO44, GPIO45, GPIO46,
  18. GPIO47, GPIO48, GPIO49, GPIO50, GPIO51, GPIO52, GPIO53, GPIO54,
  19. GPIO55, GPIO56, GPIO57, GPIO58, GPIO59, GPIO60, GPIO61, GPIO62,
  20. GPIO63, GPIO64, GPIO65, GPIO66, GPIO67, GPIO68, GPIO69, GPIO70,
  21. GPIO71, GPIO72, GPIO73, GPIO74, GPIO75, GPIO76, GPIO77, GPIO78,
  22. GPIO79, GPIO80, GPIO81, GPIO82, GPIO83, GPIO84, GPIO85, GPIO86,
  23. GPIO87, GPIO88, GPIO89, GPIO90, GPIO91, GPIO92, GPIO93, GPIO94,
  24. GPIO95, GPIO96, GPIO97, GPIO98, GPIO99, GPIO100, GPIO101, GPIO102,
  25. GPIO103, GPIO104, GPIO105, GPIO106, GPIO107, GPIO108, GPIO109, GPIO110,
  26. GPIO111, GPIO112, GPIO113, GPIO114, GPIO115, GPIO116, GPIO117, GPIO118,
  27. GPIO119, GPIO120, GPIO121, GPIO122, GPIO123, GPIO124, GPIO125, GPIO126,
  28. GPIO127, GPIO128, GPIO129, GPIO130, GPIO131, GPIO132, GPIO133, GPIO134,
  29. GPIO135, GPIO136, GPIO137, GPIO138, GPIO139, GPIO140, GPIO141, GPIO142,
  30. GPIO143, GPIO144, GPIO145, GPIO146, GPIO147, GPIO148, GPIO149, GPIO150,
  31. GPIO151, GPIO152, GPIO153, GPIO154, GPIO155, GPIO156, GPIO157, GPIO158,
  32. GPIO159, GPIO160, GPIO161, GPIO162, GPIO163, GPIO164, GPIO165, GPIO166,
  33. GPIO167, GPIO168, GPIO169, GPIO170, GPIO171, GPIO172, GPIO173, GPIO174,
  34. GPIO175, GPIO176,
  35. MT_GPIO_BASE_MAX
  36. } GPIO_PIN;
  37. static const struct mt_pin_info mt_pin_infos[] = {
  38. PIN(0, 0, 6, 0x30, 0xb0),
  39. PIN(1, 0, 7, 0x30, 0xb0),
  40. PIN(2, 0, 8, 0x30, 0xb0),
  41. PIN(3, 0, 9, 0x30, 0xb0),
  42. PIN(4, 0, 10, 0x30, 0xb0),
  43. PIN(5, 0, 11, 0x30, 0xb0),
  44. PIN(6, 0, 12, 0x30, 0xb0),
  45. PIN(7, 0, 13, 0x30, 0xb0),
  46. PIN(8, 0, 14, 0x30, 0xb0),
  47. PIN(9, 0, 15, 0x30, 0xb0),
  48. PIN(10, 0, 16, 0x30, 0xb0),
  49. PIN(11, 0, 17, 0x30, 0xb0),
  50. PIN(12, 0, 12, 0x31, 0xa0),
  51. PIN(13, 0, 13, 0x31, 0xa0),
  52. PIN(14, 0, 14, 0x31, 0xa0),
  53. PIN(15, 0, 15, 0x31, 0xa0),
  54. PIN(16, 0, 1, 0x22, 0x50),
  55. PIN(17, 0, 2, 0x22, 0x50),
  56. PIN(18, 0, 3, 0x23, 0x60),
  57. PIN(19, 0, 4, 0x23, 0x60),
  58. PIN(20, 0, 5, 0x23, 0x60),
  59. PIN(21, 0, 6, 0x23, 0x60),
  60. PIN(22, 0, 0, 0x23, 0x60),
  61. PIN(23, 0, 1, 0x23, 0x60),
  62. PIN(24, 0, 2, 0x23, 0x60),
  63. PIN(25, 0, 3, 0x30, 0xb0),
  64. PIN(26, 0, 2, 0x30, 0xb0),
  65. PIN(27, 0, 5, 0x30, 0xb0),
  66. PIN(28, 0, 4, 0x30, 0xb0),
  67. PIN(29, 0, 0, 0x30, 0xb0),
  68. PIN(30, 0, 1, 0x30, 0xb0),
  69. PIN(31, 0, 11, 0x30, 0xc0),
  70. PIN(32, 0, 10, 0x30, 0xc0),
  71. PIN(33, 0, 13, 0x30, 0xc0),
  72. PIN(34, 0, 12, 0x30, 0xc0),
  73. PIN(35, 0, 15, 0x30, 0xc0),
  74. PIN(36, 0, 14, 0x30, 0xc0),
  75. PIN(37, 0, 21, 0x30, 0xb0),
  76. PIN(38, 0, 18, 0x30, 0xb0),
  77. PIN(39, 0, 19, 0x30, 0xb0),
  78. PIN(40, 0, 20, 0x30, 0xb0),
  79. PIN(41, 0, 22, 0x30, 0xb0),
  80. PIN(42, 1, 12, 0x31, 0xc0),
  81. PIN(43, 1, 13, 0x31, 0xc0),
  82. PIN(44, 1, 14, 0x31, 0xc0),
  83. PIN(45, 1, 15, 0x31, 0xc0),
  84. PIN(46, 0, 0, 0x22, 0x50),
  85. PIN(47, 0, 25, 0x30, 0xb0),
  86. PIN(48, 0, 24, 0x30, 0xb0),
  87. PIN(49, 0, 23, 0x30, 0xb0),
  88. PIN(50, 0, 5, 0x22, 0x50),
  89. PIN(51, 0, 4, 0x22, 0x50),
  90. PIN(52, 0, 3, 0x22, 0x50),
  91. PIN(53, 0, 6, 0x22, 0x50),
  92. PIN(54, 0, 7, 0x22, 0x50),
  93. PIN(55, 0, 26, 0x30, 0xb0),
  94. PIN(56, 0, 29, 0x30, 0xb0),
  95. PIN(57, 0, 6, 0x31, 0xb0),
  96. PIN(58, 0, 9, 0x31, 0xb0),
  97. PIN(59, 0, 27, 0x30, 0xb0),
  98. PIN(60, 0, 30, 0x30, 0xb0),
  99. PIN(61, 0, 28, 0x30, 0xb0),
  100. PIN(62, 0, 31, 0x30, 0xb0),
  101. PIN(63, 0, 7, 0x31, 0xb0),
  102. PIN(64, 0, 10, 0x31, 0xb0),
  103. PIN(65, 0, 7, 0x23, 0x60),
  104. PIN(66, 0, 9, 0x23, 0x60),
  105. PIN(67, 0, 8, 0x23, 0x60),
  106. PIN(68, 0, 10, 0x23, 0x60),
  107. PIN(69, 0, 1, 0x30, 0xc0),
  108. PIN(70, 0, 0, 0x30, 0xc0),
  109. PIN(71, 0, 5, 0x30, 0xc0),
  110. PIN(72, 0, 4, 0x30, 0xc0),
  111. PIN(73, 0, 2, 0x30, 0xc0),
  112. PIN(74, 0, 3, 0x30, 0xc0),
  113. PIN(75, 0, 7, 0x30, 0xc0),
  114. PIN(76, 0, 6, 0x30, 0xc0),
  115. PIN(77, 0, 9, 0x30, 0xc0),
  116. PIN(78, 0, 8, 0x30, 0xc0),
  117. PIN(79, 0, 12, 0x23, 0x60),
  118. PIN(80, 0, 11, 0x23, 0x60),
  119. PIN(81, 0, 14, 0x23, 0x60),
  120. PIN(82, 0, 13, 0x23, 0x60),
  121. PIN(83, 0, 16, 0x31, 0xb0),
  122. PIN(84, 0, 15, 0x31, 0xb0),
  123. PIN(85, 0, 17, 0x31, 0xb0),
  124. PIN(86, 0, 19, 0x31, 0xb0),
  125. PIN(87, 0, 18, 0x31, 0xb0),
  126. PIN(88, 0, 20, 0x31, 0xb0),
  127. PIN(89, 0, 22, 0x31, 0xb0),
  128. PIN(90, 0, 21, 0x31, 0xb0),
  129. PIN(91, 0, 23, 0x31, 0xb0),
  130. PIN(92, 0, 3, 0x31, 0xb0),
  131. PIN(93, 0, 2, 0x31, 0xb0),
  132. PIN(94, 0, 5, 0x31, 0xb0),
  133. PIN(95, 0, 4, 0x31, 0xb0),
  134. PIN(96, 0, 31, 0x31, 0xa0),
  135. PIN(97, 0, 0, 0x31, 0xb0),
  136. PIN(98, 0, 8, 0x31, 0xb0),
  137. PIN(99, 0, 30, 0x31, 0xa0),
  138. PIN(100, 0, 1, 0x31, 0xb0),
  139. PIN(101, 0, 0, 0x31, 0xa0),
  140. PIN(102, 0, 5, 0x31, 0xa0),
  141. PIN(103, 0, 3, 0x31, 0xa0),
  142. PIN(104, 0, 4, 0x31, 0xa0),
  143. PIN(105, 0, 1, 0x31, 0xa0),
  144. PIN(106, 0, 2, 0x31, 0xa0),
  145. PIN(107, 0, 21, 0x31, 0xa0),
  146. PIN(108, 0, 16, 0x31, 0xa0),
  147. PIN(109, 0, 22, 0x31, 0xa0),
  148. PIN(110, 0, 17, 0x31, 0xa0),
  149. PIN(111, 0, 18, 0x31, 0xa0),
  150. PIN(112, 0, 19, 0x31, 0xa0),
  151. PIN(113, 0, 20, 0x31, 0xa0),
  152. PIN(114, 0, 28, 0x31, 0xa0),
  153. PIN(115, 0, 23, 0x31, 0xa0),
  154. PIN(116, 0, 29, 0x31, 0xa0),
  155. PIN(117, 0, 24, 0x31, 0xa0),
  156. PIN(118, 0, 25, 0x31, 0xa0),
  157. PIN(119, 0, 26, 0x31, 0xa0),
  158. PIN(120, 0, 27, 0x31, 0xa0),
  159. PIN(121, 0, 8, 0x22, 0x50),
  160. PIN(122, 0, 11, 0x22, 0x50),
  161. PIN(123, 0, 10, 0x22, 0x50),
  162. PIN(124, 0, 9, 0x22, 0x50),
  163. PIN(125, 0, 6, 0x31, 0xa0),
  164. PIN(126, 0, 7, 0x31, 0xa0),
  165. PIN(127, 0, 8, 0x31, 0xa0),
  166. PIN(128, 0, 9, 0x31, 0xa0),
  167. PIN(129, 0, 10, 0x31, 0xa0),
  168. PIN(130, 0, 11, 0x31, 0xa0),
  169. PIN(131, 1, 1, 0x30, 0xd0),
  170. PIN(132, 1, 2, 0x30, 0xd0),
  171. PIN(133, 1, 9, 0x30, 0xd0),
  172. PIN(134, 1, 10, 0x30, 0xd0),
  173. PIN(135, 1, 11, 0x30, 0xd0),
  174. PIN(136, 1, 12, 0x30, 0xd0),
  175. PIN(137, 1, 13, 0x30, 0xd0),
  176. PIN(138, 1, 14, 0x30, 0xd0),
  177. PIN(139, 1, 15, 0x30, 0xd0),
  178. PIN(140, 1, 16, 0x30, 0xd0),
  179. PIN(141, 1, 3, 0x30, 0xd0),
  180. PIN(142, 1, 4, 0x30, 0xd0),
  181. PIN(143, 1, 5, 0x30, 0xd0),
  182. PIN(144, 1, 6, 0x30, 0xd0),
  183. PIN(145, 1, 7, 0x30, 0xd0),
  184. PIN(146, 1, 8, 0x30, 0xd0),
  185. PIN(147, 1, 18, 0x30, 0xd0),
  186. PIN(148, 1, 19, 0x30, 0xd0),
  187. PIN(149, 1, 17, 0x30, 0xd0),
  188. PIN(150, 1, 0, 0x30, 0xd0),
  189. PIN(151, 1, 9, 0x31, 0xc0),
  190. PIN(152, 1, 8, 0x31, 0xc0),
  191. PIN(153, 1, 7, 0x31, 0xc0),
  192. PIN(154, 1, 6, 0x31, 0xc0),
  193. PIN(155, 1, 11, 0x31, 0xc0),
  194. PIN(156, 1, 1, 0x31, 0xc0),
  195. PIN(157, 1, 0, 0x31, 0xc0),
  196. PIN(158, 1, 5, 0x31, 0xc0),
  197. PIN(159, 1, 4, 0x31, 0xc0),
  198. PIN(160, 1, 3, 0x31, 0xc0),
  199. PIN(161, 1, 2, 0x31, 0xc0),
  200. PIN(162, 1, 10, 0x31, 0xc0),
  201. PIN(163, 1, 1, 0x23, 0x70),
  202. PIN(164, 1, 0, 0x23, 0x70),
  203. PIN(165, 1, 2, 0x23, 0x70),
  204. PIN(166, 1, 3, 0x23, 0x70),
  205. PIN(167, 1, 4, 0x23, 0x70),
  206. PIN(168, 1, 5, 0x23, 0x70),
  207. PIN(169, 1, 1, 0x22, 0x60),
  208. PIN(170, 1, 0, 0x22, 0x60),
  209. PIN(171, 1, 2, 0x22, 0x60),
  210. PIN(172, 1, 3, 0x22, 0x60),
  211. PIN(173, 1, 4, 0x22, 0x60),
  212. PIN(174, 1, 5, 0x22, 0x60),
  213. PIN(175, 0, 11, 0x31, 0xb0),
  214. PIN(176, 0, 12, 0x31, 0xb0),
  215. };
  216. #endif /* MT_GPIO_H */