mtgpio.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. /*
  2. * Copyright (c) 2024, 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, GPIO185, GPIO186, GPIO187, GPIO188, GPIO189, GPIO190,
  36. GPIO191, GPIO192, GPIO193, GPIO194, GPIO195, GPIO196, GPIO197, GPIO198,
  37. GPIO199, GPIO200, GPIO201, GPIO202, GPIO203, GPIO204, GPIO205, GPIO206,
  38. GPIO207, GPIO208, GPIO209, GPIO210, GPIO211, GPIO212, GPIO213, GPIO214,
  39. GPIO215, GPIO216, GPIO217, GPIO218, GPIO219, GPIO220, GPIO221, GPIO222,
  40. GPIO223, GPIO224, GPIO225, GPIO226, GPIO227, GPIO228, GPIO229, GPIO230,
  41. GPIO231, GPIO232, GPIO233, GPIO234, GPIO235, GPIO236, GPIO237, GPIO238,
  42. GPIO239, GPIO240, GPIO241, GPIO242, GPIO243, GPIO244, GPIO245, GPIO246,
  43. GPIO247, GPIO248, GPIO249, GPIO250, GPIO251, GPIO252, GPIO253, GPIO254,
  44. GPIO255, GPIO256, GPIO257, GPIO258, GPIO259, GPIO260, GPIO261, GPIO262,
  45. GPIO263, GPIO264, GPIO265, GPIO266, GPIO267, GPIO268, GPIO269, GPIO270,
  46. MT_GPIO_BASE_MAX
  47. } GPIO_PIN;
  48. static const struct mt_pin_info mt_pin_infos[] = {
  49. PIN(0, 0, 0, 0x18, 0x90),
  50. PIN(1, 0, 1, 0x18, 0x90),
  51. PIN(2, 0, 1, 0x1b, 0x70),
  52. PIN(3, 0, 2, 0x1b, 0x70),
  53. PIN(4, 0, 3, 0x1b, 0x70),
  54. PIN(5, 0, 4, 0x1b, 0x70),
  55. PIN(6, 0, 5, 0x1b, 0x70),
  56. PIN(7, 0, 6, 0x1b, 0x70),
  57. PIN(8, 0, 7, 0x1b, 0x70),
  58. PIN(9, 0, 14, 0x29, 0xa0),
  59. PIN(10, 0, 12, 0x29, 0xa0),
  60. PIN(11, 0, 2, 0x18, 0x90),
  61. PIN(12, 0, 13, 0x29, 0xa0),
  62. PIN(13, 0, 1, 0x26, 0x90),
  63. PIN(14, 0, 0, 0x13, 0x80),
  64. PIN(15, 0, 2, 0x26, 0x90),
  65. PIN(16, 0, 3, 0x26, 0x90),
  66. PIN(17, 0, 4, 0x26, 0x90),
  67. PIN(18, 0, 5, 0x26, 0x90),
  68. PIN(19, 0, 6, 0x26, 0x90),
  69. PIN(20, 0, 1, 0x13, 0x80),
  70. PIN(21, 0, 3, 0x12, 0x80),
  71. PIN(22, 0, 4, 0x12, 0x80),
  72. PIN(23, 0, 5, 0x12, 0x80),
  73. PIN(24, 0, 6, 0x12, 0x80),
  74. PIN(25, 0, 7, 0x12, 0x80),
  75. PIN(26, 0, 8, 0x12, 0x80),
  76. PIN(27, 0, 9, 0x12, 0x80),
  77. PIN(28, 0, 10, 0x12, 0x80),
  78. PIN(29, 0, 11, 0x12, 0x80),
  79. PIN(30, 0, 12, 0x12, 0x80),
  80. PIN(31, 0, 13, 0x12, 0x80),
  81. PIN(32, 0, 8, 0x11, 0x80),
  82. PIN(33, 0, 9, 0x11, 0x80),
  83. PIN(34, 0, 10, 0x11, 0x80),
  84. PIN(35, 0, 11, 0x11, 0x80),
  85. PIN(36, 0, 12, 0x11, 0x80),
  86. PIN(37, 0, 13, 0x11, 0x80),
  87. PIN(38, 0, 14, 0x11, 0x80),
  88. PIN(39, 0, 6, 0x18, 0x90),
  89. PIN(40, 0, 3, 0x18, 0x90),
  90. PIN(41, 0, 5, 0x18, 0x90),
  91. PIN(42, 0, 4, 0x18, 0x90),
  92. PIN(43, 0, 7, 0x18, 0x90),
  93. PIN(44, 0, 8, 0x18, 0x90),
  94. PIN(45, 0, 9, 0x18, 0x90),
  95. PIN(46, 0, 10, 0x18, 0x90),
  96. PIN(47, 0, 13, 0x18, 0x90),
  97. PIN(48, 0, 11, 0x18, 0x90),
  98. PIN(49, 0, 14, 0x18, 0x90),
  99. PIN(50, 0, 12, 0x18, 0x90),
  100. PIN(51, 0, 15, 0x18, 0x90),
  101. PIN(52, 0, 7, 0x29, 0xa0),
  102. PIN(53, 0, 8, 0x29, 0xa0),
  103. PIN(54, 0, 2, 0x29, 0xa0),
  104. PIN(55, 0, 1, 0x29, 0xa0),
  105. PIN(56, 0, 5, 0x29, 0xa0),
  106. PIN(57, 0, 6, 0x29, 0xa0),
  107. PIN(58, 0, 3, 0x29, 0xa0),
  108. PIN(59, 0, 4, 0x29, 0xa0),
  109. PIN(60, 1, 0, 0x29, 0xb0),
  110. PIN(61, 0, 10, 0x29, 0xa0),
  111. PIN(62, 0, 9, 0x29, 0xa0),
  112. PIN(63, 0, 18, 0x29, 0xa0),
  113. PIN(64, 0, 0, 0x29, 0xa0),
  114. PIN(65, 0, 11, 0x29, 0xa0),
  115. PIN(66, 0, 24, 0x29, 0xa0),
  116. PIN(67, 0, 21, 0x29, 0xa0),
  117. PIN(68, 0, 20, 0x29, 0xa0),
  118. PIN(69, 0, 25, 0x29, 0xa0),
  119. PIN(70, 0, 16, 0x29, 0xa0),
  120. PIN(71, 0, 15, 0x29, 0xa0),
  121. PIN(72, 0, 23, 0x29, 0xa0),
  122. PIN(73, 0, 19, 0x29, 0xa0),
  123. PIN(74, 0, 17, 0x29, 0xa0),
  124. PIN(75, 0, 2, 0x1a, 0x80),
  125. PIN(76, 0, 3, 0x1a, 0x80),
  126. PIN(77, 0, 4, 0x1a, 0x80),
  127. PIN(78, 0, 5, 0x1a, 0x80),
  128. PIN(79, 0, 0, 0x1a, 0x80),
  129. PIN(80, 0, 1, 0x1a, 0x80),
  130. PIN(81, 0, 9, 0x1b, 0x70),
  131. PIN(82, 0, 10, 0x1b, 0x70),
  132. PIN(83, 0, 12, 0x1b, 0x70),
  133. PIN(84, 0, 11, 0x1b, 0x70),
  134. PIN(85, 0, 13, 0x1b, 0x70),
  135. PIN(86, 0, 14, 0x1b, 0x70),
  136. PIN(87, 0, 16, 0x1b, 0x70),
  137. PIN(88, 0, 15, 0x1b, 0x70),
  138. PIN(89, 0, 0, 0x1b, 0x70),
  139. PIN(90, 0, 8, 0x1b, 0x70),
  140. PIN(91, 0, 6, 0x1c, 0x80),
  141. PIN(92, 0, 7, 0x1c, 0x80),
  142. PIN(93, 0, 8, 0x1c, 0x80),
  143. PIN(94, 0, 4, 0x1c, 0x80),
  144. PIN(95, 0, 1, 0x1c, 0x80),
  145. PIN(96, 0, 3, 0x1c, 0x80),
  146. PIN(97, 0, 2, 0x1c, 0x80),
  147. PIN(98, 0, 5, 0x1c, 0x80),
  148. PIN(99, 0, 9, 0x1c, 0x80),
  149. PIN(100, 0, 12, 0x1c, 0x80),
  150. PIN(101, 0, 10, 0x1c, 0x80),
  151. PIN(102, 0, 13, 0x1c, 0x80),
  152. PIN(103, 0, 0, 0x1c, 0x80),
  153. PIN(104, 0, 11, 0x1c, 0x80),
  154. PIN(105, 0, 14, 0x1c, 0x80),
  155. PIN(106, 0, 0, 0x15, 0x80),
  156. PIN(107, 0, 1, 0x15, 0x80),
  157. PIN(108, 0, 3, 0x15, 0x80),
  158. PIN(109, 0, 2, 0x15, 0x80),
  159. PIN(110, 0, 4, 0x15, 0x80),
  160. PIN(111, 0, 5, 0x15, 0x80),
  161. PIN(112, 0, 7, 0x15, 0x80),
  162. PIN(113, 0, 6, 0x15, 0x80),
  163. PIN(114, 0, 8, 0x15, 0x80),
  164. PIN(115, 0, 9, 0x15, 0x80),
  165. PIN(116, 0, 11, 0x15, 0x80),
  166. PIN(117, 0, 10, 0x15, 0x80),
  167. PIN(118, 0, 9, 0x26, 0x90),
  168. PIN(119, 0, 10, 0x26, 0x90),
  169. PIN(120, 0, 12, 0x26, 0x90),
  170. PIN(121, 0, 11, 0x26, 0x90),
  171. PIN(122, 0, 0, 0x26, 0x90),
  172. PIN(123, 0, 7, 0x26, 0x90),
  173. PIN(124, 0, 8, 0x26, 0x90),
  174. PIN(125, 1, 0, 0x17, 0x80),
  175. PIN(126, 1, 1, 0x17, 0x80),
  176. PIN(127, 1, 2, 0x17, 0x80),
  177. PIN(128, 1, 3, 0x17, 0x80),
  178. PIN(129, 1, 4, 0x17, 0x80),
  179. PIN(130, 1, 5, 0x17, 0x80),
  180. PIN(131, 1, 9, 0x17, 0x80),
  181. PIN(132, 1, 11, 0x17, 0x80),
  182. PIN(133, 1, 10, 0x17, 0x80),
  183. PIN(134, 1, 6, 0x17, 0x80),
  184. PIN(135, 1, 8, 0x17, 0x80),
  185. PIN(136, 1, 7, 0x17, 0x80),
  186. PIN(137, 1, 10, 0x14, 0x70),
  187. PIN(138, 1, 11, 0x14, 0x70),
  188. PIN(139, 1, 12, 0x14, 0x70),
  189. PIN(140, 1, 13, 0x14, 0x70),
  190. PIN(141, 1, 14, 0x14, 0x70),
  191. PIN(142, 1, 15, 0x14, 0x70),
  192. PIN(143, 1, 16, 0x14, 0x70),
  193. PIN(144, 1, 17, 0x14, 0x70),
  194. PIN(145, 1, 0, 0x14, 0x70),
  195. PIN(146, 1, 1, 0x14, 0x70),
  196. PIN(147, 1, 2, 0x14, 0x70),
  197. PIN(148, 1, 3, 0x14, 0x70),
  198. PIN(149, 1, 4, 0x14, 0x70),
  199. PIN(150, 1, 5, 0x14, 0x70),
  200. PIN(151, 1, 6, 0x14, 0x70),
  201. PIN(152, 1, 7, 0x14, 0x70),
  202. PIN(153, 1, 9, 0x14, 0x70),
  203. PIN(154, 1, 8, 0x14, 0x70),
  204. PIN(155, 1, 18, 0x14, 0x70),
  205. PIN(156, 1, 19, 0x14, 0x70),
  206. PIN(157, 0, 1, 0x12, 0x80),
  207. PIN(158, 0, 2, 0x12, 0x80),
  208. PIN(159, 0, 0, 0x12, 0x80),
  209. PIN(160, 0, 22, 0x13, 0x80),
  210. PIN(161, 0, 20, 0x13, 0x80),
  211. PIN(162, 0, 23, 0x13, 0x80),
  212. PIN(163, 0, 21, 0x13, 0x80),
  213. PIN(164, 0, 12, 0x13, 0x80),
  214. PIN(165, 0, 14, 0x13, 0x80),
  215. PIN(166, 0, 13, 0x13, 0x80),
  216. PIN(167, 0, 15, 0x13, 0x80),
  217. PIN(168, 0, 16, 0x13, 0x80),
  218. PIN(169, 0, 17, 0x13, 0x80),
  219. PIN(170, 0, 19, 0x13, 0x80),
  220. PIN(171, 0, 18, 0x13, 0x80),
  221. PIN(172, 0, 10, 0x13, 0x80),
  222. PIN(173, 0, 11, 0x13, 0x80),
  223. PIN(174, 0, 15, 0x11, 0x80),
  224. PIN(175, 0, 16, 0x11, 0x80),
  225. PIN(176, 0, 17, 0x11, 0x80),
  226. PIN(177, 0, 18, 0x11, 0x80),
  227. PIN(178, 0, 6, 0x11, 0x80),
  228. PIN(179, 0, 7, 0x11, 0x80),
  229. PIN(180, 0, 0, 0x11, 0x80),
  230. PIN(181, 0, 1, 0x11, 0x80),
  231. PIN(182, 0, 2, 0x11, 0x80),
  232. PIN(183, 0, 3, 0x11, 0x80),
  233. PIN(184, 0, 4, 0x11, 0x80),
  234. PIN(185, 0, 5, 0x11, 0x80),
  235. PIN(186, 0, 4, 0x1d, 0xc0),
  236. PIN(187, 0, 5, 0x1d, 0xc0),
  237. PIN(188, 0, 12, 0x1d, 0xc0),
  238. PIN(189, 0, 17, 0x1d, 0xc0),
  239. PIN(190, 0, 13, 0x1d, 0xc0),
  240. PIN(191, 0, 18, 0x1d, 0xc0),
  241. PIN(192, 0, 0, 0x1d, 0xc0),
  242. PIN(193, 0, 6, 0x1d, 0xc0),
  243. PIN(194, 0, 14, 0x1d, 0xc0),
  244. PIN(195, 0, 19, 0x1d, 0xc0),
  245. PIN(196, 0, 1, 0x1d, 0xc0),
  246. PIN(197, 0, 7, 0x1d, 0xc0),
  247. PIN(198, 0, 15, 0x1d, 0xc0),
  248. PIN(199, 0, 20, 0x1d, 0xc0),
  249. PIN(200, 0, 22, 0x1d, 0xc0),
  250. PIN(201, 0, 25, 0x1d, 0xc0),
  251. PIN(202, 0, 16, 0x1d, 0xc0),
  252. PIN(203, 0, 21, 0x1d, 0xc0),
  253. PIN(204, 0, 2, 0x1d, 0xc0),
  254. PIN(205, 0, 3, 0x1d, 0xc0),
  255. PIN(206, 0, 8, 0x1d, 0xc0),
  256. PIN(207, 0, 9, 0x1d, 0xc0),
  257. PIN(208, 0, 10, 0x1d, 0xc0),
  258. PIN(209, 0, 11, 0x1d, 0xc0),
  259. PIN(210, 0, 0, 0x2e, 0x90),
  260. PIN(211, 0, 1, 0x2e, 0x90),
  261. PIN(212, 0, 2, 0x2e, 0x90),
  262. PIN(213, 0, 3, 0x2e, 0x90),
  263. PIN(214, 0, 23, 0x1d, 0xc0),
  264. PIN(215, 0, 24, 0x1d, 0xc0),
  265. PIN(216, 0, 4, 0x2e, 0x90),
  266. PIN(217, 1, 1, 0x2e, 0xa0),
  267. PIN(218, 1, 2, 0x2e, 0xa0),
  268. PIN(219, 1, 0, 0x2e, 0xa0),
  269. PIN(220, 0, 5, 0x2e, 0x90),
  270. PIN(221, 0, 6, 0x2e, 0x90),
  271. PIN(222, 0, 8, 0x2e, 0x90),
  272. PIN(223, 0, 7, 0x2e, 0x90),
  273. PIN(224, 1, 3, 0x2e, 0xa0),
  274. PIN(225, 1, 4, 0x2e, 0xa0),
  275. PIN(226, 1, 5, 0x2e, 0xa0),
  276. PIN(227, 1, 6, 0x2e, 0xa0),
  277. PIN(228, 1, 7, 0x2e, 0xa0),
  278. PIN(229, 1, 8, 0x2e, 0xa0),
  279. PIN(230, 0, 13, 0x2f, 0x70),
  280. PIN(231, 0, 14, 0x2f, 0x70),
  281. PIN(232, 0, 10, 0x2f, 0x70),
  282. PIN(233, 0, 0, 0x2f, 0x70),
  283. PIN(234, 0, 3, 0x2f, 0x70),
  284. PIN(235, 0, 1, 0x2f, 0x70),
  285. PIN(236, 0, 2, 0x2f, 0x70),
  286. PIN(237, 0, 6, 0x2f, 0x70),
  287. PIN(238, 0, 5, 0x2f, 0x70),
  288. PIN(239, 0, 19, 0x2f, 0x70),
  289. PIN(240, 0, 18, 0x2f, 0x70),
  290. PIN(241, 0, 16, 0x2f, 0x70),
  291. PIN(242, 0, 17, 0x2f, 0x70),
  292. PIN(243, 0, 15, 0x2f, 0x70),
  293. PIN(244, 0, 12, 0x2f, 0x70),
  294. PIN(245, 0, 9, 0x2f, 0x70),
  295. PIN(246, 0, 8, 0x2f, 0x70),
  296. PIN(247, 0, 7, 0x2f, 0x70),
  297. PIN(248, 0, 4, 0x2f, 0x70),
  298. PIN(249, 0, 20, 0x2f, 0x70),
  299. PIN(250, 0, 11, 0x2f, 0x70),
  300. PIN(251, 0, 2, 0x13, 0x80),
  301. PIN(252, 0, 3, 0x13, 0x80),
  302. PIN(253, 0, 4, 0x13, 0x80),
  303. PIN(254, 0, 5, 0x13, 0x80),
  304. PIN(255, 0, 6, 0x13, 0x80),
  305. PIN(256, 0, 7, 0x13, 0x80),
  306. PIN(257, 0, 8, 0x13, 0x80),
  307. PIN(258, 0, 9, 0x13, 0x80),
  308. PIN(259, 1, 9, 0x2e, 0xa0),
  309. PIN(260, 1, 10, 0x2e, 0xa0),
  310. PIN(261, 1, 11, 0x2e, 0xa0),
  311. PIN(262, 1, 12, 0x2e, 0xa0),
  312. PIN(263, 1, 13, 0x2e, 0xa0),
  313. PIN(264, 1, 14, 0x2e, 0xa0),
  314. PIN(265, 1, 15, 0x2e, 0xa0),
  315. PIN(266, 1, 16, 0x2e, 0xa0),
  316. PIN(267, 1, 2, 0x2f, 0x80),
  317. PIN(268, 1, 3, 0x2f, 0x80),
  318. PIN(269, 1, 0, 0x2f, 0x80),
  319. PIN(270, 1, 1, 0x2f, 0x80),
  320. };
  321. #endif /* MT_GPIO_H */