mtgpio.h 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. /*
  2. * Copyright (c) 2020, 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, GPIO7,
  13. GPIO8, GPIO9, GPIO10, GPIO11, GPIO12, GPIO13, GPIO14, GPIO15,
  14. GPIO16, GPIO17, GPIO18, GPIO19, GPIO20, GPIO21, GPIO22, GPIO23,
  15. GPIO24, GPIO25, GPIO26, GPIO27, GPIO28, GPIO29, GPIO30, GPIO31,
  16. GPIO32, GPIO33, GPIO34, GPIO35, GPIO36, GPIO37, GPIO38, GPIO39,
  17. GPIO40, GPIO41, GPIO42, GPIO43, GPIO44, GPIO45, GPIO46, GPIO47,
  18. GPIO48, GPIO49, GPIO50, GPIO51, GPIO52, GPIO53, GPIO54, GPIO55,
  19. GPIO56, GPIO57, GPIO58, GPIO59, GPIO60, GPIO61, GPIO62, GPIO63,
  20. GPIO64, GPIO65, GPIO66, GPIO67, GPIO68, GPIO69, GPIO70, GPIO71,
  21. GPIO72, GPIO73, GPIO74, GPIO75, GPIO76, GPIO77, GPIO78, GPIO79,
  22. GPIO80, GPIO81, GPIO82, GPIO83, GPIO84, GPIO85, GPIO86, GPIO87,
  23. GPIO88, GPIO89, GPIO90, GPIO91, GPIO92, GPIO93, GPIO94, GPIO95,
  24. GPIO96, GPIO97, GPIO98, GPIO99, GPIO100, GPIO101, GPIO102, GPIO103,
  25. GPIO104, GPIO105, GPIO106, GPIO107, GPIO108, GPIO109, GPIO110, GPIO111,
  26. GPIO112, GPIO113, GPIO114, GPIO115, GPIO116, GPIO117, GPIO118, GPIO119,
  27. GPIO120, GPIO121, GPIO122, GPIO123, GPIO124, GPIO125, GPIO126, GPIO127,
  28. GPIO128, GPIO129, GPIO130, GPIO131, GPIO132, GPIO133, GPIO134, GPIO135,
  29. GPIO136, GPIO137, GPIO138, GPIO139, GPIO140, GPIO141, GPIO142, GPIO143,
  30. GPIO144, GPIO145, GPIO146, GPIO147, GPIO148, GPIO149, GPIO150, GPIO151,
  31. GPIO152, GPIO153, GPIO154, GPIO155, GPIO156, GPIO157, GPIO158, GPIO159,
  32. GPIO160, GPIO161, GPIO162, GPIO163, GPIO164, GPIO165, GPIO166, GPIO167,
  33. GPIO168, GPIO169, GPIO170, GPIO171, GPIO172, GPIO173, GPIO174, GPIO175,
  34. GPIO176, GPIO177, GPIO178, GPIO179, GPIO180, GPIO181, GPIO182, GPIO183,
  35. GPIO184, GPIO185, GPIO186, GPIO187, GPIO188, GPIO189, GPIO190, GPIO191,
  36. GPIO192, GPIO193, GPIO194, GPIO195, GPIO196, GPIO197, GPIO198, GPIO199,
  37. GPIO200, GPIO201, GPIO202, GPIO203, GPIO204, GPIO205, GPIO206, GPIO207,
  38. GPIO208, GPIO209, GPIO210, GPIO211, GPIO212, GPIO213, GPIO214, GPIO215,
  39. GPIO216, GPIO217, GPIO218, GPIO219,
  40. MT_GPIO_BASE_MAX
  41. } GPIO_PIN;
  42. static const struct mt_pin_info mt_pin_infos[] = {
  43. PIN(0, 0, 9, 0x23, 0xb0),
  44. PIN(1, 0, 10, 0x23, 0xb0),
  45. PIN(2, 0, 11, 0x23, 0xb0),
  46. PIN(3, 0, 12, 0x23, 0xb0),
  47. PIN(4, 0, 13, 0x23, 0xb0),
  48. PIN(5, 0, 14, 0x23, 0xb0),
  49. PIN(6, 0, 15, 0x23, 0xb0),
  50. PIN(7, 0, 16, 0x23, 0xb0),
  51. PIN(8, 0, 17, 0x23, 0xb0),
  52. PIN(9, 0, 18, 0x23, 0xb0),
  53. PIN(10, 1, 0, 0x15, 0x20),
  54. PIN(11, 1, 1, 0x15, 0x20),
  55. PIN(12, 1, 2, 0x15, 0x20),
  56. PIN(13, 1, 3, 0x15, 0x20),
  57. PIN(14, 1, 4, 0x15, 0x20),
  58. PIN(15, 1, 5, 0x15, 0x20),
  59. PIN(16, 0, 2, 0x17, 0x50),
  60. PIN(17, 0, 3, 0x17, 0x50),
  61. PIN(18, 0, 21, 0x36, 0xa0),
  62. PIN(19, 0, 22, 0x36, 0xa0),
  63. PIN(20, 0, 23, 0x36, 0xa0),
  64. PIN(21, 0, 24, 0x36, 0xa0),
  65. PIN(22, 0, 3, 0x21, 0x90),
  66. PIN(23, 0, 4, 0x21, 0x90),
  67. PIN(24, 0, 5, 0x21, 0x90),
  68. PIN(25, 0, 6, 0x21, 0x90),
  69. PIN(26, 0, 5, 0x22, 0x80),
  70. PIN(27, 0, 6, 0x22, 0x80),
  71. PIN(28, 0, 7, 0x22, 0x80),
  72. PIN(29, 0, 8, 0x22, 0x80),
  73. PIN(30, 0, 9, 0x22, 0x80),
  74. PIN(31, 0, 27, 0x22, 0x70),
  75. PIN(32, 0, 24, 0x22, 0x70),
  76. PIN(33, 0, 26, 0x22, 0x70),
  77. PIN(34, 0, 23, 0x22, 0x70),
  78. PIN(35, 0, 25, 0x22, 0x70),
  79. PIN(36, 0, 20, 0x21, 0x90),
  80. PIN(37, 0, 21, 0x21, 0x90),
  81. PIN(38, 0, 22, 0x21, 0x90),
  82. PIN(39, 0, 23, 0x21, 0x90),
  83. PIN(40, 0, 0, 0x17, 0x50),
  84. PIN(41, 0, 1, 0x17, 0x50),
  85. PIN(42, 0, 4, 0x17, 0x50),
  86. PIN(43, 0, 25, 0x36, 0xa0),
  87. PIN(44, 0, 26, 0x36, 0xa0),
  88. PIN(45, 1, 9, 0x20, 0x60),
  89. PIN(46, 1, 11, 0x20, 0x60),
  90. PIN(47, 1, 10, 0x20, 0x60),
  91. PIN(48, 1, 7, 0x20, 0x60),
  92. PIN(49, 1, 8, 0x20, 0x60),
  93. PIN(50, 1, 6, 0x20, 0x60),
  94. PIN(51, 1, 0, 0x20, 0x60),
  95. PIN(52, 1, 1, 0x20, 0x60),
  96. PIN(53, 1, 5, 0x20, 0x60),
  97. PIN(54, 1, 2, 0x20, 0x60),
  98. PIN(55, 1, 4, 0x20, 0x60),
  99. PIN(56, 1, 3, 0x20, 0x60),
  100. PIN(57, 0, 1, 0x22, 0x80),
  101. PIN(58, 0, 2, 0x22, 0x80),
  102. PIN(59, 0, 3, 0x22, 0x80),
  103. PIN(60, 0, 4, 0x22, 0x80),
  104. PIN(61, 0, 28, 0x22, 0x70),
  105. PIN(62, 0, 22, 0x22, 0x70),
  106. PIN(63, 0, 0, 0x22, 0x70),
  107. PIN(64, 0, 1, 0x22, 0x70),
  108. PIN(65, 0, 12, 0x22, 0x70),
  109. PIN(66, 0, 15, 0x22, 0x70),
  110. PIN(67, 0, 16, 0x22, 0x70),
  111. PIN(68, 0, 17, 0x22, 0x70),
  112. PIN(69, 0, 18, 0x22, 0x70),
  113. PIN(70, 0, 19, 0x22, 0x70),
  114. PIN(71, 0, 20, 0x22, 0x70),
  115. PIN(72, 0, 21, 0x22, 0x70),
  116. PIN(73, 0, 2, 0x22, 0x70),
  117. PIN(74, 0, 3, 0x22, 0x70),
  118. PIN(75, 0, 4, 0x22, 0x70),
  119. PIN(76, 0, 5, 0x22, 0x70),
  120. PIN(77, 0, 6, 0x22, 0x70),
  121. PIN(78, 0, 7, 0x22, 0x70),
  122. PIN(79, 0, 8, 0x22, 0x70),
  123. PIN(80, 0, 9, 0x22, 0x70),
  124. PIN(81, 0, 10, 0x22, 0x70),
  125. PIN(82, 0, 11, 0x22, 0x70),
  126. PIN(83, 0, 13, 0x22, 0x70),
  127. PIN(84, 0, 14, 0x22, 0x70),
  128. PIN(85, 0, 31, 0x22, 0x70),
  129. PIN(86, 0, 0, 0x22, 0x80),
  130. PIN(87, 0, 29, 0x22, 0x70),
  131. PIN(88, 0, 30, 0x22, 0x70),
  132. PIN(89, 0, 24, 0x21, 0x90),
  133. PIN(90, 0, 25, 0x21, 0x90),
  134. PIN(91, 0, 0, 0x21, 0x90),
  135. PIN(92, 0, 2, 0x21, 0xa0),
  136. PIN(93, 0, 4, 0x21, 0xa0),
  137. PIN(94, 0, 3, 0x21, 0xa0),
  138. PIN(95, 0, 5, 0x21, 0xa0),
  139. PIN(96, 0, 31, 0x21, 0x90),
  140. PIN(97, 0, 26, 0x21, 0x90),
  141. PIN(98, 0, 0, 0x21, 0xa0),
  142. PIN(99, 0, 27, 0x21, 0x90),
  143. PIN(100, 0, 28, 0x21, 0x90),
  144. PIN(101, 0, 29, 0x21, 0x90),
  145. PIN(102, 0, 30, 0x21, 0x90),
  146. PIN(103, 0, 18, 0x21, 0x90),
  147. PIN(104, 0, 17, 0x21, 0x90),
  148. PIN(105, 0, 19, 0x21, 0x90),
  149. PIN(106, 0, 16, 0x21, 0x90),
  150. PIN(107, 0, 1, 0x21, 0x90),
  151. PIN(108, 0, 2, 0x21, 0x90),
  152. PIN(109, 0, 10, 0x21, 0x90),
  153. PIN(110, 0, 7, 0x21, 0x90),
  154. PIN(111, 0, 9, 0x21, 0x90),
  155. PIN(112, 0, 11, 0x21, 0x90),
  156. PIN(113, 0, 8, 0x21, 0x90),
  157. PIN(114, 0, 14, 0x21, 0x90),
  158. PIN(115, 0, 13, 0x21, 0x90),
  159. PIN(116, 0, 15, 0x21, 0x90),
  160. PIN(117, 0, 12, 0x21, 0x90),
  161. PIN(118, 0, 23, 0x23, 0xb0),
  162. PIN(119, 0, 29, 0x23, 0xb0),
  163. PIN(120, 0, 28, 0x23, 0xb0),
  164. PIN(121, 0, 2, 0x23, 0xc0),
  165. PIN(122, 0, 27, 0x23, 0xb0),
  166. PIN(123, 0, 1, 0x23, 0xc0),
  167. PIN(124, 0, 26, 0x23, 0xb0),
  168. PIN(125, 0, 0, 0x23, 0xc0),
  169. PIN(126, 0, 19, 0x23, 0xb0),
  170. PIN(127, 0, 20, 0x23, 0xb0),
  171. PIN(128, 0, 21, 0x23, 0xb0),
  172. PIN(129, 0, 22, 0x23, 0xb0),
  173. PIN(130, 0, 6, 0x23, 0xb0),
  174. PIN(131, 0, 7, 0x23, 0xb0),
  175. PIN(132, 0, 8, 0x23, 0xb0),
  176. PIN(133, 0, 3, 0x23, 0xb0),
  177. PIN(134, 0, 4, 0x23, 0xb0),
  178. PIN(135, 0, 5, 0x23, 0xb0),
  179. PIN(136, 0, 0, 0x23, 0xb0),
  180. PIN(137, 0, 1, 0x23, 0xb0),
  181. PIN(138, 0, 2, 0x23, 0xb0),
  182. PIN(139, 0, 25, 0x23, 0xb0),
  183. PIN(140, 0, 31, 0x23, 0xb0),
  184. PIN(141, 0, 24, 0x23, 0xb0),
  185. PIN(142, 0, 30, 0x23, 0xb0),
  186. PIN(143, 0, 6, 0x20, 0x70),
  187. PIN(144, 0, 7, 0x20, 0x70),
  188. PIN(145, 0, 8, 0x20, 0x70),
  189. PIN(146, 0, 3, 0x20, 0x70),
  190. PIN(147, 0, 4, 0x20, 0x70),
  191. PIN(148, 0, 5, 0x20, 0x70),
  192. PIN(149, 0, 0, 0x20, 0x70),
  193. PIN(150, 0, 1, 0x20, 0x70),
  194. PIN(151, 0, 2, 0x20, 0x70),
  195. PIN(152, 1, 3, 0x36, 0x90),
  196. PIN(153, 1, 2, 0x36, 0x90),
  197. PIN(154, 1, 0, 0x36, 0x906),
  198. PIN(155, 1, 1, 0x36, 0x90),
  199. PIN(156, 0, 29, 0x36, 0xa0),
  200. PIN(157, 0, 30, 0x36, 0xa0),
  201. PIN(158, 0, 31, 0x36, 0xa0),
  202. PIN(159, 0, 0, 0x36, 0xb0),
  203. PIN(160, 0, 27, 0x36, 0xa04),
  204. PIN(161, 0, 28, 0x36, 0xa0),
  205. PIN(162, 0, 0, 0x36, 0xa0),
  206. PIN(163, 0, 1, 0x36, 0xa0),
  207. PIN(164, 0, 2, 0x36, 0xa0),
  208. PIN(165, 0, 3, 0x36, 0xa0),
  209. PIN(166, 0, 4, 0x36, 0xa0),
  210. PIN(167, 0, 5, 0x36, 0xa0),
  211. PIN(168, 0, 6, 0x36, 0xa0),
  212. PIN(169, 0, 7, 0x36, 0xa0),
  213. PIN(170, 0, 8, 0x36, 0xa0),
  214. PIN(171, 0, 9, 0x36, 0xa0),
  215. PIN(172, 0, 13, 0x36, 0xa0),
  216. PIN(173, 0, 14, 0x36, 0xa0),
  217. PIN(174, 0, 12, 0x36, 0xa0),
  218. PIN(175, 0, 15, 0x36, 0xa0),
  219. PIN(176, 0, 10, 0x36, 0xa0),
  220. PIN(177, 0, 11, 0x36, 0xa0),
  221. PIN(178, 0, 16, 0x36, 0xa0),
  222. PIN(179, 0, 17, 0x36, 0xa0),
  223. PIN(180, 0, 18, 0x36, 0xa0),
  224. PIN(181, 0, 19, 0x36, 0xa0),
  225. PIN(182, 0, 20, 0x36, 0xa0),
  226. PIN(183, 1, 1, 0x18, 0x30),
  227. PIN(184, 1, 2, 0x18, 0x30),
  228. PIN(185, 1, 4, 0x18, 0x30),
  229. PIN(186, 1, 6, 0x18, 0x30),
  230. PIN(187, 1, 8, 0x18, 0x30),
  231. PIN(188, 1, 3, 0x18, 0x30),
  232. PIN(189, 1, 7, 0x18, 0x30),
  233. PIN(190, 1, 9, 0x18, 0x30),
  234. PIN(191, 1, 10, 0x18, 0x30),
  235. PIN(192, 1, 0, 0x18, 0x30),
  236. PIN(193, 1, 5, 0x18, 0x30),
  237. PIN(194, 1, 11, 0x18, 0x30),
  238. PIN(195, 0, 16, 0x14, 0x50),
  239. PIN(196, 0, 6, 0x14, 0x50),
  240. PIN(197, 0, 8, 0x14, 0x50),
  241. PIN(198, 0, 7, 0x14, 0x50),
  242. PIN(199, 0, 3, 0x14, 0x50),
  243. PIN(200, 0, 6, 0x17, 0x50),
  244. PIN(201, 0, 8, 0x17, 0x50),
  245. PIN(202, 0, 15, 0x14, 0x50),
  246. PIN(203, 0, 17, 0x14, 0x50),
  247. PIN(204, 0, 5, 0x17, 0x50),
  248. PIN(205, 0, 7, 0x17, 0x50),
  249. PIN(206, 0, 18, 0x14, 0x50),
  250. PIN(207, 0, 19, 0x14, 0x50),
  251. PIN(208, 0, 20, 0x14, 0x50),
  252. PIN(209, 0, 12, 0x14, 0x50),
  253. PIN(210, 0, 11, 0x14, 0x50),
  254. PIN(211, 0, 13, 0x14, 0x50),
  255. PIN(212, 0, 10, 0x14, 0x50),
  256. PIN(213, 0, 14, 0x14, 0x50),
  257. PIN(214, 0, 0, 0x14, 0x50),
  258. PIN(215, 0, 9, 0x14, 0x50),
  259. PIN(216, 0, 4, 0x14, 0x50),
  260. PIN(217, 0, 5, 0x14, 0x50),
  261. PIN(218, 0, 1, 0x14, 0x50),
  262. PIN(219, 0, 2, 0x14, 0x50),
  263. };
  264. #endif /* MT_GPIO_H */