mtgpio.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. /*
  2. * Copyright (c) 2021, 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, GPIO177, GPIO178, GPIO179, GPIO180, GPIO181, GPIO182,
  35. GPIO183, GPIO184,
  36. MT_GPIO_BASE_MAX
  37. } GPIO_PIN;
  38. static const struct mt_pin_info mt_pin_infos[] = {
  39. PIN(0, 0, 13, 0x16, 0x40),
  40. PIN(1, 0, 14, 0x16, 0x40),
  41. PIN(2, 0, 17, 0x16, 0x40),
  42. PIN(3, 0, 18, 0x16, 0x40),
  43. PIN(4, 0, 19, 0x16, 0x40),
  44. PIN(5, 0, 20, 0x16, 0x40),
  45. PIN(6, 0, 19, 0x24, 0x40),
  46. PIN(7, 0, 20, 0x24, 0x40),
  47. PIN(8, 0, 21, 0x24, 0x40),
  48. PIN(9, 0, 22, 0x24, 0x40),
  49. PIN(10, 0, 16, 0x24, 0x40),
  50. PIN(11, 0, 17, 0x24, 0x40),
  51. PIN(12, 0, 18, 0x24, 0x40),
  52. PIN(13, 0, 0, 0x23, 0x60),
  53. PIN(14, 0, 1, 0x23, 0x60),
  54. PIN(15, 0, 15, 0x16, 0x40),
  55. PIN(16, 0, 16, 0x16, 0x40),
  56. PIN(17, 0, 9, 0x25, 0x70),
  57. PIN(18, 0, 10, 0x25, 0x70),
  58. PIN(19, 0, 3, 0x25, 0x70),
  59. PIN(20, 0, 6, 0x25, 0x70),
  60. PIN(21, 0, 4, 0x25, 0x70),
  61. PIN(22, 0, 7, 0x25, 0x70),
  62. PIN(23, 0, 5, 0x25, 0x70),
  63. PIN(24, 0, 8, 0x25, 0x70),
  64. PIN(25, 0, 18, 0x25, 0x70),
  65. PIN(26, 0, 15, 0x25, 0x70),
  66. PIN(27, 0, 17, 0x25, 0x70),
  67. PIN(28, 0, 16, 0x25, 0x70),
  68. PIN(29, 0, 0, 0x16, 0x40),
  69. PIN(30, 0, 1, 0x16, 0x40),
  70. PIN(31, 0, 2, 0x16, 0x40),
  71. PIN(32, 0, 25, 0x12, 0x50),
  72. PIN(33, 0, 27, 0x12, 0x50),
  73. PIN(34, 0, 26, 0x12, 0x50),
  74. PIN(35, 0, 28, 0x12, 0x50),
  75. PIN(36, 0, 9, 0x12, 0x50),
  76. PIN(37, 0, 10, 0x12, 0x50),
  77. PIN(38, 0, 12, 0x12, 0x50),
  78. PIN(39, 0, 11, 0x12, 0x50),
  79. PIN(40, 0, 13, 0x12, 0x50),
  80. PIN(41, 0, 14, 0x12, 0x50),
  81. PIN(42, 0, 16, 0x12, 0x50),
  82. PIN(43, 0, 15, 0x12, 0x50),
  83. PIN(44, 0, 28, 0x25, 0x70),
  84. PIN(45, 0, 29, 0x25, 0x70),
  85. PIN(46, 0, 31, 0x25, 0x70),
  86. PIN(47, 0, 30, 0x25, 0x70),
  87. PIN(48, 0, 17, 0x12, 0x50),
  88. PIN(49, 0, 18, 0x12, 0x50),
  89. PIN(50, 0, 20, 0x12, 0x50),
  90. PIN(51, 0, 19, 0x12, 0x50),
  91. PIN(52, 0, 12, 0x23, 0x60),
  92. PIN(53, 0, 13, 0x23, 0x60),
  93. PIN(54, 0, 15, 0x23, 0x60),
  94. PIN(55, 0, 14, 0x23, 0x60),
  95. PIN(56, 0, 12, 0x25, 0x70),
  96. PIN(57, 0, 11, 0x25, 0x70),
  97. PIN(58, 0, 13, 0x25, 0x70),
  98. PIN(59, 0, 14, 0x25, 0x70),
  99. PIN(60, 0, 21, 0x23, 0x60),
  100. PIN(61, 0, 16, 0x23, 0x60),
  101. PIN(62, 0, 22, 0x23, 0x60),
  102. PIN(63, 0, 17, 0x23, 0x60),
  103. PIN(64, 0, 18, 0x23, 0x60),
  104. PIN(65, 0, 19, 0x23, 0x60),
  105. PIN(66, 0, 20, 0x23, 0x60),
  106. PIN(67, 1, 10, 0x21, 0x70),
  107. PIN(68, 1, 0, 0x21, 0x70),
  108. PIN(69, 1, 1, 0x21, 0x70),
  109. PIN(70, 1, 11, 0x21, 0x70),
  110. PIN(71, 1, 2, 0x21, 0x70),
  111. PIN(72, 1, 3, 0x21, 0x70),
  112. PIN(73, 1, 4, 0x21, 0x70),
  113. PIN(74, 1, 5, 0x21, 0x70),
  114. PIN(75, 1, 6, 0x21, 0x70),
  115. PIN(76, 1, 7, 0x21, 0x70),
  116. PIN(77, 1, 8, 0x21, 0x70),
  117. PIN(78, 1, 9, 0x21, 0x70),
  118. PIN(79, 1, 0, 0x25, 0x80),
  119. PIN(80, 1, 1, 0x25, 0x80),
  120. PIN(81, 1, 2, 0x25, 0x80),
  121. PIN(82, 1, 3, 0x25, 0x80),
  122. PIN(83, 0, 3, 0x16, 0x40),
  123. PIN(84, 1, 0, 0x23, 0x70),
  124. PIN(85, 1, 1, 0x23, 0x70),
  125. PIN(86, 1, 2, 0x23, 0x70),
  126. PIN(87, 1, 3, 0x23, 0x70),
  127. PIN(88, 1, 4, 0x23, 0x70),
  128. PIN(89, 1, 5, 0x23, 0x70),
  129. PIN(90, 0, 2, 0x23, 0x60),
  130. PIN(91, 0, 23, 0x23, 0x60),
  131. PIN(92, 0, 25, 0x23, 0x60),
  132. PIN(93, 0, 3, 0x23, 0x60),
  133. PIN(94, 0, 24, 0x23, 0x60),
  134. PIN(95, 0, 26, 0x23, 0x60),
  135. PIN(96, 0, 1, 0x12, 0x50),
  136. PIN(97, 0, 0, 0x12, 0x50),
  137. PIN(98, 0, 2, 0x12, 0x50),
  138. PIN(99, 0, 14, 0x24, 0x40),
  139. PIN(100, 0, 15, 0x24, 0x40),
  140. PIN(101, 0, 13, 0x24, 0x40),
  141. PIN(102, 0, 12, 0x24, 0x40),
  142. PIN(103, 0, 0, 0x24, 0x40),
  143. PIN(104, 0, 1, 0x24, 0x40),
  144. PIN(105, 0, 4, 0x24, 0x40),
  145. PIN(106, 0, 5, 0x24, 0x40),
  146. PIN(107, 0, 6, 0x24, 0x40),
  147. PIN(108, 0, 7, 0x24, 0x40),
  148. PIN(109, 0, 8, 0x24, 0x40),
  149. PIN(110, 0, 9, 0x24, 0x40),
  150. PIN(111, 0, 10, 0x24, 0x40),
  151. PIN(112, 0, 11, 0x24, 0x40),
  152. PIN(113, 0, 2, 0x24, 0x40),
  153. PIN(114, 0, 3, 0x24, 0x40),
  154. PIN(115, 0, 4, 0x23, 0x60),
  155. PIN(116, 0, 7, 0x23, 0x60),
  156. PIN(117, 0, 5, 0x23, 0x60),
  157. PIN(118, 0, 6, 0x23, 0x60),
  158. PIN(119, 0, 22, 0x25, 0x70),
  159. PIN(120, 0, 19, 0x25, 0x70),
  160. PIN(121, 0, 20, 0x25, 0x70),
  161. PIN(122, 0, 21, 0x25, 0x70),
  162. PIN(123, 0, 23, 0x25, 0x70),
  163. PIN(124, 0, 0, 0x25, 0x70),
  164. PIN(125, 0, 1, 0x25, 0x70),
  165. PIN(126, 0, 2, 0x25, 0x70),
  166. PIN(127, 0, 8, 0x23, 0x60),
  167. PIN(128, 0, 10, 0x23, 0x60),
  168. PIN(129, 0, 24, 0x25, 0x70),
  169. PIN(130, 0, 26, 0x25, 0x70),
  170. PIN(131, 0, 25, 0x25, 0x70),
  171. PIN(132, 0, 27, 0x25, 0x70),
  172. PIN(133, 0, 9, 0x21, 0x60),
  173. PIN(134, 0, 12, 0x21, 0x60),
  174. PIN(135, 0, 21, 0x16, 0x40),
  175. PIN(136, 0, 24, 0x16, 0x40),
  176. PIN(137, 0, 10, 0x21, 0x60),
  177. PIN(138, 0, 13, 0x21, 0x60),
  178. PIN(139, 0, 7, 0x12, 0x50),
  179. PIN(140, 0, 8, 0x12, 0x50),
  180. PIN(141, 0, 9, 0x23, 0x60),
  181. PIN(142, 0, 11, 0x23, 0x60),
  182. PIN(143, 0, 22, 0x16, 0x40),
  183. PIN(144, 0, 25, 0x16, 0x40),
  184. PIN(145, 0, 23, 0x16, 0x40),
  185. PIN(146, 0, 26, 0x16, 0x40),
  186. PIN(147, 0, 23, 0x24, 0x40),
  187. PIN(148, 0, 24, 0x24, 0x40),
  188. PIN(149, 0, 25, 0x24, 0x40),
  189. PIN(150, 0, 26, 0x24, 0x40),
  190. PIN(151, 0, 27, 0x24, 0x40),
  191. PIN(152, 0, 28, 0x24, 0x40),
  192. PIN(153, 0, 29, 0x24, 0x40),
  193. PIN(154, 0, 30, 0x24, 0x40),
  194. PIN(155, 0, 31, 0x24, 0x40),
  195. PIN(156, 0, 0, 0x24, 0x50),
  196. PIN(157, 0, 4, 0x12, 0x50),
  197. PIN(158, 0, 3, 0x12, 0x50),
  198. PIN(159, 0, 6, 0x12, 0x50),
  199. PIN(160, 0, 5, 0x12, 0x50),
  200. PIN(161, 0, 23, 0x12, 0x50),
  201. PIN(162, 0, 24, 0x12, 0x50),
  202. PIN(163, 0, 11, 0x21, 0x60),
  203. PIN(164, 0, 8, 0x21, 0x60),
  204. PIN(165, 0, 16, 0x21, 0x60),
  205. PIN(166, 0, 1, 0x21, 0x60),
  206. PIN(167, 0, 7, 0x21, 0x60),
  207. PIN(168, 0, 4, 0x21, 0x60),
  208. PIN(169, 0, 5, 0x21, 0x60),
  209. PIN(170, 0, 0, 0x21, 0x60),
  210. PIN(171, 0, 6, 0x21, 0x60),
  211. PIN(172, 0, 2, 0x21, 0x60),
  212. PIN(173, 0, 3, 0x21, 0x60),
  213. PIN(174, 0, 7, 0x16, 0x40),
  214. PIN(175, 0, 8, 0x16, 0x40),
  215. PIN(176, 0, 4, 0x16, 0x40),
  216. PIN(177, 0, 5, 0x16, 0x40),
  217. PIN(178, 0, 6, 0x16, 0x40),
  218. PIN(179, 0, 9, 0x16, 0x40),
  219. PIN(180, 0, 10, 0x16, 0x40),
  220. PIN(181, 0, 11, 0x16, 0x40),
  221. PIN(182, 0, 12, 0x16, 0x40),
  222. PIN(183, 0, 21, 0x12, 0x50),
  223. PIN(184, 0, 22, 0x12, 0x50),
  224. };
  225. #endif /* MT_GPIO_H */