pinctrl-ingenic.c 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853
  1. /*
  2. * Ingenic SoCs pinctrl driver
  3. *
  4. * Copyright (c) 2017 Paul Cercueil <paul@crapouillou.net>
  5. *
  6. * License terms: GNU General Public License (GPL) version 2
  7. */
  8. #include <linux/compiler.h>
  9. #include <linux/gpio.h>
  10. #include <linux/interrupt.h>
  11. #include <linux/io.h>
  12. #include <linux/of_device.h>
  13. #include <linux/of_platform.h>
  14. #include <linux/pinctrl/pinctrl.h>
  15. #include <linux/pinctrl/pinmux.h>
  16. #include <linux/pinctrl/pinconf.h>
  17. #include <linux/pinctrl/pinconf-generic.h>
  18. #include <linux/platform_device.h>
  19. #include <linux/regmap.h>
  20. #include <linux/slab.h>
  21. #include "core.h"
  22. #include "pinconf.h"
  23. #include "pinmux.h"
  24. #define JZ4740_GPIO_DATA 0x10
  25. #define JZ4740_GPIO_PULL_DIS 0x30
  26. #define JZ4740_GPIO_FUNC 0x40
  27. #define JZ4740_GPIO_SELECT 0x50
  28. #define JZ4740_GPIO_DIR 0x60
  29. #define JZ4740_GPIO_TRIG 0x70
  30. #define JZ4740_GPIO_FLAG 0x80
  31. #define JZ4770_GPIO_INT 0x10
  32. #define JZ4770_GPIO_MSK 0x20
  33. #define JZ4770_GPIO_PAT1 0x30
  34. #define JZ4770_GPIO_PAT0 0x40
  35. #define JZ4770_GPIO_FLAG 0x50
  36. #define JZ4770_GPIO_PEN 0x70
  37. #define REG_SET(x) ((x) + 0x4)
  38. #define REG_CLEAR(x) ((x) + 0x8)
  39. #define PINS_PER_GPIO_CHIP 32
  40. enum jz_version {
  41. ID_JZ4740,
  42. ID_JZ4770,
  43. ID_JZ4780,
  44. };
  45. struct ingenic_chip_info {
  46. unsigned int num_chips;
  47. const struct group_desc *groups;
  48. unsigned int num_groups;
  49. const struct function_desc *functions;
  50. unsigned int num_functions;
  51. const u32 *pull_ups, *pull_downs;
  52. };
  53. struct ingenic_pinctrl {
  54. struct device *dev;
  55. struct regmap *map;
  56. struct pinctrl_dev *pctl;
  57. struct pinctrl_pin_desc *pdesc;
  58. enum jz_version version;
  59. const struct ingenic_chip_info *info;
  60. };
  61. static const u32 jz4740_pull_ups[4] = {
  62. 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
  63. };
  64. static const u32 jz4740_pull_downs[4] = {
  65. 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  66. };
  67. static int jz4740_mmc_1bit_pins[] = { 0x69, 0x68, 0x6a, };
  68. static int jz4740_mmc_4bit_pins[] = { 0x6b, 0x6c, 0x6d, };
  69. static int jz4740_uart0_data_pins[] = { 0x7a, 0x79, };
  70. static int jz4740_uart0_hwflow_pins[] = { 0x7e, 0x7f, };
  71. static int jz4740_uart1_data_pins[] = { 0x7e, 0x7f, };
  72. static int jz4740_lcd_8bit_pins[] = {
  73. 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x52, 0x53, 0x54,
  74. };
  75. static int jz4740_lcd_16bit_pins[] = {
  76. 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x55,
  77. };
  78. static int jz4740_lcd_18bit_pins[] = { 0x50, 0x51, };
  79. static int jz4740_lcd_18bit_tft_pins[] = { 0x56, 0x57, 0x31, 0x32, };
  80. static int jz4740_nand_cs1_pins[] = { 0x39, };
  81. static int jz4740_nand_cs2_pins[] = { 0x3a, };
  82. static int jz4740_nand_cs3_pins[] = { 0x3b, };
  83. static int jz4740_nand_cs4_pins[] = { 0x3c, };
  84. static int jz4740_pwm_pwm0_pins[] = { 0x77, };
  85. static int jz4740_pwm_pwm1_pins[] = { 0x78, };
  86. static int jz4740_pwm_pwm2_pins[] = { 0x79, };
  87. static int jz4740_pwm_pwm3_pins[] = { 0x7a, };
  88. static int jz4740_pwm_pwm4_pins[] = { 0x7b, };
  89. static int jz4740_pwm_pwm5_pins[] = { 0x7c, };
  90. static int jz4740_pwm_pwm6_pins[] = { 0x7e, };
  91. static int jz4740_pwm_pwm7_pins[] = { 0x7f, };
  92. static int jz4740_mmc_1bit_funcs[] = { 0, 0, 0, };
  93. static int jz4740_mmc_4bit_funcs[] = { 0, 0, 0, };
  94. static int jz4740_uart0_data_funcs[] = { 1, 1, };
  95. static int jz4740_uart0_hwflow_funcs[] = { 1, 1, };
  96. static int jz4740_uart1_data_funcs[] = { 2, 2, };
  97. static int jz4740_lcd_8bit_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };
  98. static int jz4740_lcd_16bit_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, };
  99. static int jz4740_lcd_18bit_funcs[] = { 0, 0, };
  100. static int jz4740_lcd_18bit_tft_funcs[] = { 0, 0, 0, 0, };
  101. static int jz4740_nand_cs1_funcs[] = { 0, };
  102. static int jz4740_nand_cs2_funcs[] = { 0, };
  103. static int jz4740_nand_cs3_funcs[] = { 0, };
  104. static int jz4740_nand_cs4_funcs[] = { 0, };
  105. static int jz4740_pwm_pwm0_funcs[] = { 0, };
  106. static int jz4740_pwm_pwm1_funcs[] = { 0, };
  107. static int jz4740_pwm_pwm2_funcs[] = { 0, };
  108. static int jz4740_pwm_pwm3_funcs[] = { 0, };
  109. static int jz4740_pwm_pwm4_funcs[] = { 0, };
  110. static int jz4740_pwm_pwm5_funcs[] = { 0, };
  111. static int jz4740_pwm_pwm6_funcs[] = { 0, };
  112. static int jz4740_pwm_pwm7_funcs[] = { 0, };
  113. #define INGENIC_PIN_GROUP(name, id) \
  114. { \
  115. name, \
  116. id##_pins, \
  117. ARRAY_SIZE(id##_pins), \
  118. id##_funcs, \
  119. }
  120. static const struct group_desc jz4740_groups[] = {
  121. INGENIC_PIN_GROUP("mmc-1bit", jz4740_mmc_1bit),
  122. INGENIC_PIN_GROUP("mmc-4bit", jz4740_mmc_4bit),
  123. INGENIC_PIN_GROUP("uart0-data", jz4740_uart0_data),
  124. INGENIC_PIN_GROUP("uart0-hwflow", jz4740_uart0_hwflow),
  125. INGENIC_PIN_GROUP("uart1-data", jz4740_uart1_data),
  126. INGENIC_PIN_GROUP("lcd-8bit", jz4740_lcd_8bit),
  127. INGENIC_PIN_GROUP("lcd-16bit", jz4740_lcd_16bit),
  128. INGENIC_PIN_GROUP("lcd-18bit", jz4740_lcd_18bit),
  129. INGENIC_PIN_GROUP("lcd-18bit-tft", jz4740_lcd_18bit_tft),
  130. { "lcd-no-pins", },
  131. INGENIC_PIN_GROUP("nand-cs1", jz4740_nand_cs1),
  132. INGENIC_PIN_GROUP("nand-cs2", jz4740_nand_cs2),
  133. INGENIC_PIN_GROUP("nand-cs3", jz4740_nand_cs3),
  134. INGENIC_PIN_GROUP("nand-cs4", jz4740_nand_cs4),
  135. INGENIC_PIN_GROUP("pwm0", jz4740_pwm_pwm0),
  136. INGENIC_PIN_GROUP("pwm1", jz4740_pwm_pwm1),
  137. INGENIC_PIN_GROUP("pwm2", jz4740_pwm_pwm2),
  138. INGENIC_PIN_GROUP("pwm3", jz4740_pwm_pwm3),
  139. INGENIC_PIN_GROUP("pwm4", jz4740_pwm_pwm4),
  140. INGENIC_PIN_GROUP("pwm5", jz4740_pwm_pwm5),
  141. INGENIC_PIN_GROUP("pwm6", jz4740_pwm_pwm6),
  142. INGENIC_PIN_GROUP("pwm7", jz4740_pwm_pwm7),
  143. };
  144. static const char *jz4740_mmc_groups[] = { "mmc-1bit", "mmc-4bit", };
  145. static const char *jz4740_uart0_groups[] = { "uart0-data", "uart0-hwflow", };
  146. static const char *jz4740_uart1_groups[] = { "uart1-data", };
  147. static const char *jz4740_lcd_groups[] = {
  148. "lcd-8bit", "lcd-16bit", "lcd-18bit", "lcd-18bit-tft", "lcd-no-pins",
  149. };
  150. static const char *jz4740_nand_groups[] = {
  151. "nand-cs1", "nand-cs2", "nand-cs3", "nand-cs4",
  152. };
  153. static const char *jz4740_pwm0_groups[] = { "pwm0", };
  154. static const char *jz4740_pwm1_groups[] = { "pwm1", };
  155. static const char *jz4740_pwm2_groups[] = { "pwm2", };
  156. static const char *jz4740_pwm3_groups[] = { "pwm3", };
  157. static const char *jz4740_pwm4_groups[] = { "pwm4", };
  158. static const char *jz4740_pwm5_groups[] = { "pwm5", };
  159. static const char *jz4740_pwm6_groups[] = { "pwm6", };
  160. static const char *jz4740_pwm7_groups[] = { "pwm7", };
  161. static const struct function_desc jz4740_functions[] = {
  162. { "mmc", jz4740_mmc_groups, ARRAY_SIZE(jz4740_mmc_groups), },
  163. { "uart0", jz4740_uart0_groups, ARRAY_SIZE(jz4740_uart0_groups), },
  164. { "uart1", jz4740_uart1_groups, ARRAY_SIZE(jz4740_uart1_groups), },
  165. { "lcd", jz4740_lcd_groups, ARRAY_SIZE(jz4740_lcd_groups), },
  166. { "nand", jz4740_nand_groups, ARRAY_SIZE(jz4740_nand_groups), },
  167. { "pwm0", jz4740_pwm0_groups, ARRAY_SIZE(jz4740_pwm0_groups), },
  168. { "pwm1", jz4740_pwm1_groups, ARRAY_SIZE(jz4740_pwm1_groups), },
  169. { "pwm2", jz4740_pwm2_groups, ARRAY_SIZE(jz4740_pwm2_groups), },
  170. { "pwm3", jz4740_pwm3_groups, ARRAY_SIZE(jz4740_pwm3_groups), },
  171. { "pwm4", jz4740_pwm4_groups, ARRAY_SIZE(jz4740_pwm4_groups), },
  172. { "pwm5", jz4740_pwm5_groups, ARRAY_SIZE(jz4740_pwm5_groups), },
  173. { "pwm6", jz4740_pwm6_groups, ARRAY_SIZE(jz4740_pwm6_groups), },
  174. { "pwm7", jz4740_pwm7_groups, ARRAY_SIZE(jz4740_pwm7_groups), },
  175. };
  176. static const struct ingenic_chip_info jz4740_chip_info = {
  177. .num_chips = 4,
  178. .groups = jz4740_groups,
  179. .num_groups = ARRAY_SIZE(jz4740_groups),
  180. .functions = jz4740_functions,
  181. .num_functions = ARRAY_SIZE(jz4740_functions),
  182. .pull_ups = jz4740_pull_ups,
  183. .pull_downs = jz4740_pull_downs,
  184. };
  185. static const u32 jz4770_pull_ups[6] = {
  186. 0x3fffffff, 0xfff0030c, 0xffffffff, 0xffff4fff, 0xfffffb7c, 0xffa7f00f,
  187. };
  188. static const u32 jz4770_pull_downs[6] = {
  189. 0x00000000, 0x000f0c03, 0x00000000, 0x0000b000, 0x00000483, 0x00580ff0,
  190. };
  191. static int jz4770_uart0_data_pins[] = { 0xa0, 0xa3, };
  192. static int jz4770_uart0_hwflow_pins[] = { 0xa1, 0xa2, };
  193. static int jz4770_uart1_data_pins[] = { 0x7a, 0x7c, };
  194. static int jz4770_uart1_hwflow_pins[] = { 0x7b, 0x7d, };
  195. static int jz4770_uart2_data_pins[] = { 0x66, 0x67, };
  196. static int jz4770_uart2_hwflow_pins[] = { 0x65, 0x64, };
  197. static int jz4770_uart3_data_pins[] = { 0x6c, 0x85, };
  198. static int jz4770_uart3_hwflow_pins[] = { 0x88, 0x89, };
  199. static int jz4770_uart4_data_pins[] = { 0x54, 0x4a, };
  200. static int jz4770_mmc0_8bit_a_pins[] = { 0x04, 0x05, 0x06, 0x07, 0x18, };
  201. static int jz4770_mmc0_4bit_a_pins[] = { 0x15, 0x16, 0x17, };
  202. static int jz4770_mmc0_1bit_a_pins[] = { 0x12, 0x13, 0x14, };
  203. static int jz4770_mmc0_4bit_e_pins[] = { 0x95, 0x96, 0x97, };
  204. static int jz4770_mmc0_1bit_e_pins[] = { 0x9c, 0x9d, 0x94, };
  205. static int jz4770_mmc1_4bit_d_pins[] = { 0x75, 0x76, 0x77, };
  206. static int jz4770_mmc1_1bit_d_pins[] = { 0x78, 0x79, 0x74, };
  207. static int jz4770_mmc1_4bit_e_pins[] = { 0x95, 0x96, 0x97, };
  208. static int jz4770_mmc1_1bit_e_pins[] = { 0x9c, 0x9d, 0x94, };
  209. static int jz4770_nemc_data_pins[] = {
  210. 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
  211. };
  212. static int jz4770_nemc_cle_ale_pins[] = { 0x20, 0x21, };
  213. static int jz4770_nemc_addr_pins[] = { 0x22, 0x23, 0x24, 0x25, };
  214. static int jz4770_nemc_rd_we_pins[] = { 0x10, 0x11, };
  215. static int jz4770_nemc_frd_fwe_pins[] = { 0x12, 0x13, };
  216. static int jz4770_nemc_cs1_pins[] = { 0x15, };
  217. static int jz4770_nemc_cs2_pins[] = { 0x16, };
  218. static int jz4770_nemc_cs3_pins[] = { 0x17, };
  219. static int jz4770_nemc_cs4_pins[] = { 0x18, };
  220. static int jz4770_nemc_cs5_pins[] = { 0x19, };
  221. static int jz4770_nemc_cs6_pins[] = { 0x1a, };
  222. static int jz4770_i2c0_pins[] = { 0x6e, 0x6f, };
  223. static int jz4770_i2c1_pins[] = { 0x8e, 0x8f, };
  224. static int jz4770_i2c2_pins[] = { 0xb0, 0xb1, };
  225. static int jz4770_i2c3_pins[] = { 0x6a, 0x6b, };
  226. static int jz4770_i2c4_e_pins[] = { 0x8c, 0x8d, };
  227. static int jz4770_i2c4_f_pins[] = { 0xb9, 0xb8, };
  228. static int jz4770_cim_pins[] = {
  229. 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31,
  230. };
  231. static int jz4770_lcd_32bit_pins[] = {
  232. 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
  233. 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
  234. 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
  235. 0x58, 0x59, 0x51,
  236. };
  237. static int jz4770_pwm_pwm0_pins[] = { 0x80, };
  238. static int jz4770_pwm_pwm1_pins[] = { 0x81, };
  239. static int jz4770_pwm_pwm2_pins[] = { 0x82, };
  240. static int jz4770_pwm_pwm3_pins[] = { 0x83, };
  241. static int jz4770_pwm_pwm4_pins[] = { 0x84, };
  242. static int jz4770_pwm_pwm5_pins[] = { 0x85, };
  243. static int jz4770_pwm_pwm6_pins[] = { 0x6a, };
  244. static int jz4770_pwm_pwm7_pins[] = { 0x6b, };
  245. static int jz4770_uart0_data_funcs[] = { 0, 0, };
  246. static int jz4770_uart0_hwflow_funcs[] = { 0, 0, };
  247. static int jz4770_uart1_data_funcs[] = { 0, 0, };
  248. static int jz4770_uart1_hwflow_funcs[] = { 0, 0, };
  249. static int jz4770_uart2_data_funcs[] = { 1, 1, };
  250. static int jz4770_uart2_hwflow_funcs[] = { 1, 1, };
  251. static int jz4770_uart3_data_funcs[] = { 0, 1, };
  252. static int jz4770_uart3_hwflow_funcs[] = { 0, 0, };
  253. static int jz4770_uart4_data_funcs[] = { 2, 2, };
  254. static int jz4770_mmc0_8bit_a_funcs[] = { 1, 1, 1, 1, 1, };
  255. static int jz4770_mmc0_4bit_a_funcs[] = { 1, 1, 1, };
  256. static int jz4770_mmc0_1bit_a_funcs[] = { 1, 1, 0, };
  257. static int jz4770_mmc0_4bit_e_funcs[] = { 0, 0, 0, };
  258. static int jz4770_mmc0_1bit_e_funcs[] = { 0, 0, 0, };
  259. static int jz4770_mmc1_4bit_d_funcs[] = { 0, 0, 0, };
  260. static int jz4770_mmc1_1bit_d_funcs[] = { 0, 0, 0, };
  261. static int jz4770_mmc1_4bit_e_funcs[] = { 1, 1, 1, };
  262. static int jz4770_mmc1_1bit_e_funcs[] = { 1, 1, 1, };
  263. static int jz4770_nemc_data_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, };
  264. static int jz4770_nemc_cle_ale_funcs[] = { 0, 0, };
  265. static int jz4770_nemc_addr_funcs[] = { 0, 0, 0, 0, };
  266. static int jz4770_nemc_rd_we_funcs[] = { 0, 0, };
  267. static int jz4770_nemc_frd_fwe_funcs[] = { 0, 0, };
  268. static int jz4770_nemc_cs1_funcs[] = { 0, };
  269. static int jz4770_nemc_cs2_funcs[] = { 0, };
  270. static int jz4770_nemc_cs3_funcs[] = { 0, };
  271. static int jz4770_nemc_cs4_funcs[] = { 0, };
  272. static int jz4770_nemc_cs5_funcs[] = { 0, };
  273. static int jz4770_nemc_cs6_funcs[] = { 0, };
  274. static int jz4770_i2c0_funcs[] = { 0, 0, };
  275. static int jz4770_i2c1_funcs[] = { 0, 0, };
  276. static int jz4770_i2c2_funcs[] = { 2, 2, };
  277. static int jz4770_i2c3_funcs[] = { 1, 1, };
  278. static int jz4770_i2c4_e_funcs[] = { 1, 1, };
  279. static int jz4770_i2c4_f_funcs[] = { 1, 1, };
  280. static int jz4770_cim_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };
  281. static int jz4770_lcd_32bit_funcs[] = {
  282. 0, 0, 0, 0, 0, 0, 0, 0,
  283. 0, 0, 0, 0, 0, 0, 0, 0,
  284. 0, 0, 0,
  285. };
  286. static int jz4770_pwm_pwm0_funcs[] = { 0, };
  287. static int jz4770_pwm_pwm1_funcs[] = { 0, };
  288. static int jz4770_pwm_pwm2_funcs[] = { 0, };
  289. static int jz4770_pwm_pwm3_funcs[] = { 0, };
  290. static int jz4770_pwm_pwm4_funcs[] = { 0, };
  291. static int jz4770_pwm_pwm5_funcs[] = { 0, };
  292. static int jz4770_pwm_pwm6_funcs[] = { 0, };
  293. static int jz4770_pwm_pwm7_funcs[] = { 0, };
  294. static const struct group_desc jz4770_groups[] = {
  295. INGENIC_PIN_GROUP("uart0-data", jz4770_uart0_data),
  296. INGENIC_PIN_GROUP("uart0-hwflow", jz4770_uart0_hwflow),
  297. INGENIC_PIN_GROUP("uart1-data", jz4770_uart1_data),
  298. INGENIC_PIN_GROUP("uart1-hwflow", jz4770_uart1_hwflow),
  299. INGENIC_PIN_GROUP("uart2-data", jz4770_uart2_data),
  300. INGENIC_PIN_GROUP("uart2-hwflow", jz4770_uart2_hwflow),
  301. INGENIC_PIN_GROUP("uart3-data", jz4770_uart3_data),
  302. INGENIC_PIN_GROUP("uart3-hwflow", jz4770_uart3_hwflow),
  303. INGENIC_PIN_GROUP("uart4-data", jz4770_uart4_data),
  304. INGENIC_PIN_GROUP("mmc0-8bit-a", jz4770_mmc0_8bit_a),
  305. INGENIC_PIN_GROUP("mmc0-4bit-a", jz4770_mmc0_4bit_a),
  306. INGENIC_PIN_GROUP("mmc0-1bit-a", jz4770_mmc0_1bit_a),
  307. INGENIC_PIN_GROUP("mmc0-4bit-e", jz4770_mmc0_4bit_e),
  308. INGENIC_PIN_GROUP("mmc0-1bit-e", jz4770_mmc0_1bit_e),
  309. INGENIC_PIN_GROUP("mmc1-4bit-d", jz4770_mmc1_4bit_d),
  310. INGENIC_PIN_GROUP("mmc1-1bit-d", jz4770_mmc1_1bit_d),
  311. INGENIC_PIN_GROUP("mmc1-4bit-e", jz4770_mmc1_4bit_e),
  312. INGENIC_PIN_GROUP("mmc1-1bit-e", jz4770_mmc1_1bit_e),
  313. INGENIC_PIN_GROUP("nemc-data", jz4770_nemc_data),
  314. INGENIC_PIN_GROUP("nemc-cle-ale", jz4770_nemc_cle_ale),
  315. INGENIC_PIN_GROUP("nemc-addr", jz4770_nemc_addr),
  316. INGENIC_PIN_GROUP("nemc-rd-we", jz4770_nemc_rd_we),
  317. INGENIC_PIN_GROUP("nemc-frd-fwe", jz4770_nemc_frd_fwe),
  318. INGENIC_PIN_GROUP("nemc-cs1", jz4770_nemc_cs1),
  319. INGENIC_PIN_GROUP("nemc-cs2", jz4770_nemc_cs2),
  320. INGENIC_PIN_GROUP("nemc-cs3", jz4770_nemc_cs3),
  321. INGENIC_PIN_GROUP("nemc-cs4", jz4770_nemc_cs4),
  322. INGENIC_PIN_GROUP("nemc-cs5", jz4770_nemc_cs5),
  323. INGENIC_PIN_GROUP("nemc-cs6", jz4770_nemc_cs6),
  324. INGENIC_PIN_GROUP("i2c0-data", jz4770_i2c0),
  325. INGENIC_PIN_GROUP("i2c1-data", jz4770_i2c1),
  326. INGENIC_PIN_GROUP("i2c2-data", jz4770_i2c2),
  327. INGENIC_PIN_GROUP("i2c3-data", jz4770_i2c3),
  328. INGENIC_PIN_GROUP("i2c4-data-e", jz4770_i2c4_e),
  329. INGENIC_PIN_GROUP("i2c4-data-f", jz4770_i2c4_f),
  330. INGENIC_PIN_GROUP("cim-data", jz4770_cim),
  331. INGENIC_PIN_GROUP("lcd-32bit", jz4770_lcd_32bit),
  332. { "lcd-no-pins", },
  333. INGENIC_PIN_GROUP("pwm0", jz4770_pwm_pwm0),
  334. INGENIC_PIN_GROUP("pwm1", jz4770_pwm_pwm1),
  335. INGENIC_PIN_GROUP("pwm2", jz4770_pwm_pwm2),
  336. INGENIC_PIN_GROUP("pwm3", jz4770_pwm_pwm3),
  337. INGENIC_PIN_GROUP("pwm4", jz4770_pwm_pwm4),
  338. INGENIC_PIN_GROUP("pwm5", jz4770_pwm_pwm5),
  339. INGENIC_PIN_GROUP("pwm6", jz4770_pwm_pwm6),
  340. INGENIC_PIN_GROUP("pwm7", jz4770_pwm_pwm7),
  341. };
  342. static const char *jz4770_uart0_groups[] = { "uart0-data", "uart0-hwflow", };
  343. static const char *jz4770_uart1_groups[] = { "uart1-data", "uart1-hwflow", };
  344. static const char *jz4770_uart2_groups[] = { "uart2-data", "uart2-hwflow", };
  345. static const char *jz4770_uart3_groups[] = { "uart3-data", "uart3-hwflow", };
  346. static const char *jz4770_uart4_groups[] = { "uart4-data", };
  347. static const char *jz4770_mmc0_groups[] = {
  348. "mmc0-8bit-a", "mmc0-4bit-a", "mmc0-1bit-a",
  349. "mmc0-1bit-e", "mmc0-4bit-e",
  350. };
  351. static const char *jz4770_mmc1_groups[] = {
  352. "mmc1-1bit-d", "mmc1-4bit-d", "mmc1-1bit-e", "mmc1-4bit-e",
  353. };
  354. static const char *jz4770_nemc_groups[] = {
  355. "nemc-data", "nemc-cle-ale", "nemc-addr", "nemc-rd-we", "nemc-frd-fwe",
  356. };
  357. static const char *jz4770_cs1_groups[] = { "nemc-cs1", };
  358. static const char *jz4770_cs6_groups[] = { "nemc-cs6", };
  359. static const char *jz4770_i2c0_groups[] = { "i2c0-data", };
  360. static const char *jz4770_i2c1_groups[] = { "i2c1-data", };
  361. static const char *jz4770_i2c2_groups[] = { "i2c2-data", };
  362. static const char *jz4770_i2c3_groups[] = { "i2c3-data", };
  363. static const char *jz4770_i2c4_groups[] = { "i2c4-data-e", "i2c4-data-f", };
  364. static const char *jz4770_cim_groups[] = { "cim-data", };
  365. static const char *jz4770_lcd_groups[] = { "lcd-32bit", "lcd-no-pins", };
  366. static const char *jz4770_pwm0_groups[] = { "pwm0", };
  367. static const char *jz4770_pwm1_groups[] = { "pwm1", };
  368. static const char *jz4770_pwm2_groups[] = { "pwm2", };
  369. static const char *jz4770_pwm3_groups[] = { "pwm3", };
  370. static const char *jz4770_pwm4_groups[] = { "pwm4", };
  371. static const char *jz4770_pwm5_groups[] = { "pwm5", };
  372. static const char *jz4770_pwm6_groups[] = { "pwm6", };
  373. static const char *jz4770_pwm7_groups[] = { "pwm7", };
  374. static const struct function_desc jz4770_functions[] = {
  375. { "uart0", jz4770_uart0_groups, ARRAY_SIZE(jz4770_uart0_groups), },
  376. { "uart1", jz4770_uart1_groups, ARRAY_SIZE(jz4770_uart1_groups), },
  377. { "uart2", jz4770_uart2_groups, ARRAY_SIZE(jz4770_uart2_groups), },
  378. { "uart3", jz4770_uart3_groups, ARRAY_SIZE(jz4770_uart3_groups), },
  379. { "uart4", jz4770_uart4_groups, ARRAY_SIZE(jz4770_uart4_groups), },
  380. { "mmc0", jz4770_mmc0_groups, ARRAY_SIZE(jz4770_mmc0_groups), },
  381. { "mmc1", jz4770_mmc1_groups, ARRAY_SIZE(jz4770_mmc1_groups), },
  382. { "nemc", jz4770_nemc_groups, ARRAY_SIZE(jz4770_nemc_groups), },
  383. { "nemc-cs1", jz4770_cs1_groups, ARRAY_SIZE(jz4770_cs1_groups), },
  384. { "nemc-cs6", jz4770_cs6_groups, ARRAY_SIZE(jz4770_cs6_groups), },
  385. { "i2c0", jz4770_i2c0_groups, ARRAY_SIZE(jz4770_i2c0_groups), },
  386. { "i2c1", jz4770_i2c1_groups, ARRAY_SIZE(jz4770_i2c1_groups), },
  387. { "i2c2", jz4770_i2c2_groups, ARRAY_SIZE(jz4770_i2c2_groups), },
  388. { "i2c3", jz4770_i2c3_groups, ARRAY_SIZE(jz4770_i2c3_groups), },
  389. { "i2c4", jz4770_i2c4_groups, ARRAY_SIZE(jz4770_i2c4_groups), },
  390. { "cim", jz4770_cim_groups, ARRAY_SIZE(jz4770_cim_groups), },
  391. { "lcd", jz4770_lcd_groups, ARRAY_SIZE(jz4770_lcd_groups), },
  392. { "pwm0", jz4770_pwm0_groups, ARRAY_SIZE(jz4770_pwm0_groups), },
  393. { "pwm1", jz4770_pwm1_groups, ARRAY_SIZE(jz4770_pwm1_groups), },
  394. { "pwm2", jz4770_pwm2_groups, ARRAY_SIZE(jz4770_pwm2_groups), },
  395. { "pwm3", jz4770_pwm3_groups, ARRAY_SIZE(jz4770_pwm3_groups), },
  396. { "pwm4", jz4770_pwm4_groups, ARRAY_SIZE(jz4770_pwm4_groups), },
  397. { "pwm5", jz4770_pwm5_groups, ARRAY_SIZE(jz4770_pwm5_groups), },
  398. { "pwm6", jz4770_pwm6_groups, ARRAY_SIZE(jz4770_pwm6_groups), },
  399. { "pwm7", jz4770_pwm7_groups, ARRAY_SIZE(jz4770_pwm7_groups), },
  400. };
  401. static const struct ingenic_chip_info jz4770_chip_info = {
  402. .num_chips = 6,
  403. .groups = jz4770_groups,
  404. .num_groups = ARRAY_SIZE(jz4770_groups),
  405. .functions = jz4770_functions,
  406. .num_functions = ARRAY_SIZE(jz4770_functions),
  407. .pull_ups = jz4770_pull_ups,
  408. .pull_downs = jz4770_pull_downs,
  409. };
  410. static inline void ingenic_config_pin(struct ingenic_pinctrl *jzpc,
  411. unsigned int pin, u8 reg, bool set)
  412. {
  413. unsigned int idx = pin % PINS_PER_GPIO_CHIP;
  414. unsigned int offt = pin / PINS_PER_GPIO_CHIP;
  415. regmap_write(jzpc->map, offt * 0x100 +
  416. (set ? REG_SET(reg) : REG_CLEAR(reg)), BIT(idx));
  417. }
  418. static inline bool ingenic_get_pin_config(struct ingenic_pinctrl *jzpc,
  419. unsigned int pin, u8 reg)
  420. {
  421. unsigned int idx = pin % PINS_PER_GPIO_CHIP;
  422. unsigned int offt = pin / PINS_PER_GPIO_CHIP;
  423. unsigned int val;
  424. regmap_read(jzpc->map, offt * 0x100 + reg, &val);
  425. return val & BIT(idx);
  426. }
  427. static const struct pinctrl_ops ingenic_pctlops = {
  428. .get_groups_count = pinctrl_generic_get_group_count,
  429. .get_group_name = pinctrl_generic_get_group_name,
  430. .get_group_pins = pinctrl_generic_get_group_pins,
  431. .dt_node_to_map = pinconf_generic_dt_node_to_map_all,
  432. .dt_free_map = pinconf_generic_dt_free_map,
  433. };
  434. static int ingenic_pinmux_set_pin_fn(struct ingenic_pinctrl *jzpc,
  435. int pin, int func)
  436. {
  437. unsigned int idx = pin % PINS_PER_GPIO_CHIP;
  438. unsigned int offt = pin / PINS_PER_GPIO_CHIP;
  439. dev_dbg(jzpc->dev, "set pin P%c%u to function %u\n",
  440. 'A' + offt, idx, func);
  441. if (jzpc->version >= ID_JZ4770) {
  442. ingenic_config_pin(jzpc, pin, JZ4770_GPIO_INT, false);
  443. ingenic_config_pin(jzpc, pin, JZ4770_GPIO_MSK, false);
  444. ingenic_config_pin(jzpc, pin, JZ4770_GPIO_PAT1, func & 0x2);
  445. ingenic_config_pin(jzpc, pin, JZ4770_GPIO_PAT0, func & 0x1);
  446. } else {
  447. ingenic_config_pin(jzpc, pin, JZ4740_GPIO_FUNC, true);
  448. ingenic_config_pin(jzpc, pin, JZ4740_GPIO_TRIG, func & 0x2);
  449. ingenic_config_pin(jzpc, pin, JZ4740_GPIO_SELECT, func > 0);
  450. }
  451. return 0;
  452. }
  453. static int ingenic_pinmux_set_mux(struct pinctrl_dev *pctldev,
  454. unsigned int selector, unsigned int group)
  455. {
  456. struct ingenic_pinctrl *jzpc = pinctrl_dev_get_drvdata(pctldev);
  457. struct function_desc *func;
  458. struct group_desc *grp;
  459. unsigned int i;
  460. func = pinmux_generic_get_function(pctldev, selector);
  461. if (!func)
  462. return -EINVAL;
  463. grp = pinctrl_generic_get_group(pctldev, group);
  464. if (!grp)
  465. return -EINVAL;
  466. dev_dbg(pctldev->dev, "enable function %s group %s\n",
  467. func->name, grp->name);
  468. for (i = 0; i < grp->num_pins; i++) {
  469. int *pin_modes = grp->data;
  470. ingenic_pinmux_set_pin_fn(jzpc, grp->pins[i], pin_modes[i]);
  471. }
  472. return 0;
  473. }
  474. static int ingenic_pinmux_gpio_set_direction(struct pinctrl_dev *pctldev,
  475. struct pinctrl_gpio_range *range,
  476. unsigned int pin, bool input)
  477. {
  478. struct ingenic_pinctrl *jzpc = pinctrl_dev_get_drvdata(pctldev);
  479. unsigned int idx = pin % PINS_PER_GPIO_CHIP;
  480. unsigned int offt = pin / PINS_PER_GPIO_CHIP;
  481. dev_dbg(pctldev->dev, "set pin P%c%u to %sput\n",
  482. 'A' + offt, idx, input ? "in" : "out");
  483. if (jzpc->version >= ID_JZ4770) {
  484. ingenic_config_pin(jzpc, pin, JZ4770_GPIO_INT, false);
  485. ingenic_config_pin(jzpc, pin, JZ4770_GPIO_MSK, true);
  486. ingenic_config_pin(jzpc, pin, JZ4770_GPIO_PAT1, input);
  487. } else {
  488. ingenic_config_pin(jzpc, pin, JZ4740_GPIO_SELECT, false);
  489. ingenic_config_pin(jzpc, pin, JZ4740_GPIO_DIR, !input);
  490. ingenic_config_pin(jzpc, pin, JZ4740_GPIO_FUNC, false);
  491. }
  492. return 0;
  493. }
  494. static const struct pinmux_ops ingenic_pmxops = {
  495. .get_functions_count = pinmux_generic_get_function_count,
  496. .get_function_name = pinmux_generic_get_function_name,
  497. .get_function_groups = pinmux_generic_get_function_groups,
  498. .set_mux = ingenic_pinmux_set_mux,
  499. .gpio_set_direction = ingenic_pinmux_gpio_set_direction,
  500. };
  501. static int ingenic_pinconf_get(struct pinctrl_dev *pctldev,
  502. unsigned int pin, unsigned long *config)
  503. {
  504. struct ingenic_pinctrl *jzpc = pinctrl_dev_get_drvdata(pctldev);
  505. enum pin_config_param param = pinconf_to_config_param(*config);
  506. unsigned int idx = pin % PINS_PER_GPIO_CHIP;
  507. unsigned int offt = pin / PINS_PER_GPIO_CHIP;
  508. bool pull;
  509. if (jzpc->version >= ID_JZ4770)
  510. pull = !ingenic_get_pin_config(jzpc, pin, JZ4770_GPIO_PEN);
  511. else
  512. pull = !ingenic_get_pin_config(jzpc, pin, JZ4740_GPIO_PULL_DIS);
  513. switch (param) {
  514. case PIN_CONFIG_BIAS_DISABLE:
  515. if (pull)
  516. return -EINVAL;
  517. break;
  518. case PIN_CONFIG_BIAS_PULL_UP:
  519. if (!pull || !(jzpc->info->pull_ups[offt] & BIT(idx)))
  520. return -EINVAL;
  521. break;
  522. case PIN_CONFIG_BIAS_PULL_DOWN:
  523. if (!pull || !(jzpc->info->pull_downs[offt] & BIT(idx)))
  524. return -EINVAL;
  525. break;
  526. default:
  527. return -ENOTSUPP;
  528. }
  529. *config = pinconf_to_config_packed(param, 1);
  530. return 0;
  531. }
  532. static void ingenic_set_bias(struct ingenic_pinctrl *jzpc,
  533. unsigned int pin, bool enabled)
  534. {
  535. if (jzpc->version >= ID_JZ4770)
  536. ingenic_config_pin(jzpc, pin, JZ4770_GPIO_PEN, !enabled);
  537. else
  538. ingenic_config_pin(jzpc, pin, JZ4740_GPIO_PULL_DIS, !enabled);
  539. }
  540. static int ingenic_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin,
  541. unsigned long *configs, unsigned int num_configs)
  542. {
  543. struct ingenic_pinctrl *jzpc = pinctrl_dev_get_drvdata(pctldev);
  544. unsigned int idx = pin % PINS_PER_GPIO_CHIP;
  545. unsigned int offt = pin / PINS_PER_GPIO_CHIP;
  546. unsigned int cfg;
  547. for (cfg = 0; cfg < num_configs; cfg++) {
  548. switch (pinconf_to_config_param(configs[cfg])) {
  549. case PIN_CONFIG_BIAS_DISABLE:
  550. case PIN_CONFIG_BIAS_PULL_UP:
  551. case PIN_CONFIG_BIAS_PULL_DOWN:
  552. continue;
  553. default:
  554. return -ENOTSUPP;
  555. }
  556. }
  557. for (cfg = 0; cfg < num_configs; cfg++) {
  558. switch (pinconf_to_config_param(configs[cfg])) {
  559. case PIN_CONFIG_BIAS_DISABLE:
  560. dev_dbg(jzpc->dev, "disable pull-over for pin P%c%u\n",
  561. 'A' + offt, idx);
  562. ingenic_set_bias(jzpc, pin, false);
  563. break;
  564. case PIN_CONFIG_BIAS_PULL_UP:
  565. if (!(jzpc->info->pull_ups[offt] & BIT(idx)))
  566. return -EINVAL;
  567. dev_dbg(jzpc->dev, "set pull-up for pin P%c%u\n",
  568. 'A' + offt, idx);
  569. ingenic_set_bias(jzpc, pin, true);
  570. break;
  571. case PIN_CONFIG_BIAS_PULL_DOWN:
  572. if (!(jzpc->info->pull_downs[offt] & BIT(idx)))
  573. return -EINVAL;
  574. dev_dbg(jzpc->dev, "set pull-down for pin P%c%u\n",
  575. 'A' + offt, idx);
  576. ingenic_set_bias(jzpc, pin, true);
  577. break;
  578. default:
  579. unreachable();
  580. }
  581. }
  582. return 0;
  583. }
  584. static int ingenic_pinconf_group_get(struct pinctrl_dev *pctldev,
  585. unsigned int group, unsigned long *config)
  586. {
  587. const unsigned int *pins;
  588. unsigned int i, npins, old = 0;
  589. int ret;
  590. ret = pinctrl_generic_get_group_pins(pctldev, group, &pins, &npins);
  591. if (ret)
  592. return ret;
  593. for (i = 0; i < npins; i++) {
  594. if (ingenic_pinconf_get(pctldev, pins[i], config))
  595. return -ENOTSUPP;
  596. /* configs do not match between two pins */
  597. if (i && (old != *config))
  598. return -ENOTSUPP;
  599. old = *config;
  600. }
  601. return 0;
  602. }
  603. static int ingenic_pinconf_group_set(struct pinctrl_dev *pctldev,
  604. unsigned int group, unsigned long *configs,
  605. unsigned int num_configs)
  606. {
  607. const unsigned int *pins;
  608. unsigned int i, npins;
  609. int ret;
  610. ret = pinctrl_generic_get_group_pins(pctldev, group, &pins, &npins);
  611. if (ret)
  612. return ret;
  613. for (i = 0; i < npins; i++) {
  614. ret = ingenic_pinconf_set(pctldev,
  615. pins[i], configs, num_configs);
  616. if (ret)
  617. return ret;
  618. }
  619. return 0;
  620. }
  621. static const struct pinconf_ops ingenic_confops = {
  622. .is_generic = true,
  623. .pin_config_get = ingenic_pinconf_get,
  624. .pin_config_set = ingenic_pinconf_set,
  625. .pin_config_group_get = ingenic_pinconf_group_get,
  626. .pin_config_group_set = ingenic_pinconf_group_set,
  627. };
  628. static const struct regmap_config ingenic_pinctrl_regmap_config = {
  629. .reg_bits = 32,
  630. .val_bits = 32,
  631. .reg_stride = 4,
  632. };
  633. static const struct of_device_id ingenic_pinctrl_of_match[] = {
  634. { .compatible = "ingenic,jz4740-pinctrl", .data = (void *) ID_JZ4740 },
  635. { .compatible = "ingenic,jz4770-pinctrl", .data = (void *) ID_JZ4770 },
  636. { .compatible = "ingenic,jz4780-pinctrl", .data = (void *) ID_JZ4780 },
  637. {},
  638. };
  639. int ingenic_pinctrl_probe(struct platform_device *pdev)
  640. {
  641. struct device *dev = &pdev->dev;
  642. struct ingenic_pinctrl *jzpc;
  643. struct pinctrl_desc *pctl_desc;
  644. void __iomem *base;
  645. const struct platform_device_id *id = platform_get_device_id(pdev);
  646. const struct of_device_id *of_id = of_match_device(
  647. ingenic_pinctrl_of_match, dev);
  648. const struct ingenic_chip_info *chip_info;
  649. unsigned int i;
  650. int err;
  651. jzpc = devm_kzalloc(dev, sizeof(*jzpc), GFP_KERNEL);
  652. if (!jzpc)
  653. return -ENOMEM;
  654. base = devm_ioremap_resource(dev,
  655. platform_get_resource(pdev, IORESOURCE_MEM, 0));
  656. if (IS_ERR(base)) {
  657. dev_err(dev, "Failed to ioremap registers\n");
  658. return PTR_ERR(base);
  659. }
  660. jzpc->map = devm_regmap_init_mmio(dev, base,
  661. &ingenic_pinctrl_regmap_config);
  662. if (IS_ERR(jzpc->map)) {
  663. dev_err(dev, "Failed to create regmap\n");
  664. return PTR_ERR(jzpc->map);
  665. }
  666. jzpc->dev = dev;
  667. if (of_id)
  668. jzpc->version = (enum jz_version)of_id->data;
  669. else
  670. jzpc->version = (enum jz_version)id->driver_data;
  671. if (jzpc->version >= ID_JZ4770)
  672. chip_info = &jz4770_chip_info;
  673. else
  674. chip_info = &jz4740_chip_info;
  675. jzpc->info = chip_info;
  676. pctl_desc = devm_kzalloc(&pdev->dev, sizeof(*pctl_desc), GFP_KERNEL);
  677. if (!pctl_desc)
  678. return -ENOMEM;
  679. /* fill in pinctrl_desc structure */
  680. pctl_desc->name = dev_name(dev);
  681. pctl_desc->owner = THIS_MODULE;
  682. pctl_desc->pctlops = &ingenic_pctlops;
  683. pctl_desc->pmxops = &ingenic_pmxops;
  684. pctl_desc->confops = &ingenic_confops;
  685. pctl_desc->npins = chip_info->num_chips * PINS_PER_GPIO_CHIP;
  686. pctl_desc->pins = jzpc->pdesc = devm_kzalloc(&pdev->dev,
  687. sizeof(*jzpc->pdesc) * pctl_desc->npins, GFP_KERNEL);
  688. if (!jzpc->pdesc)
  689. return -ENOMEM;
  690. for (i = 0; i < pctl_desc->npins; i++) {
  691. jzpc->pdesc[i].number = i;
  692. jzpc->pdesc[i].name = kasprintf(GFP_KERNEL, "P%c%d",
  693. 'A' + (i / PINS_PER_GPIO_CHIP),
  694. i % PINS_PER_GPIO_CHIP);
  695. }
  696. jzpc->pctl = devm_pinctrl_register(dev, pctl_desc, jzpc);
  697. if (IS_ERR(jzpc->pctl)) {
  698. dev_err(dev, "Failed to register pinctrl\n");
  699. return PTR_ERR(jzpc->pctl);
  700. }
  701. for (i = 0; i < chip_info->num_groups; i++) {
  702. const struct group_desc *group = &chip_info->groups[i];
  703. err = pinctrl_generic_add_group(jzpc->pctl, group->name,
  704. group->pins, group->num_pins, group->data);
  705. if (err) {
  706. dev_err(dev, "Failed to register group %s\n",
  707. group->name);
  708. return err;
  709. }
  710. }
  711. for (i = 0; i < chip_info->num_functions; i++) {
  712. const struct function_desc *func = &chip_info->functions[i];
  713. err = pinmux_generic_add_function(jzpc->pctl, func->name,
  714. func->group_names, func->num_group_names,
  715. func->data);
  716. if (err) {
  717. dev_err(dev, "Failed to register function %s\n",
  718. func->name);
  719. return err;
  720. }
  721. }
  722. dev_set_drvdata(dev, jzpc->map);
  723. if (dev->of_node) {
  724. err = of_platform_populate(dev->of_node, NULL, NULL, dev);
  725. if (err) {
  726. dev_err(dev, "Failed to probe GPIO devices\n");
  727. return err;
  728. }
  729. }
  730. return 0;
  731. }
  732. static const struct platform_device_id ingenic_pinctrl_ids[] = {
  733. { "jz4740-pinctrl", ID_JZ4740 },
  734. { "jz4770-pinctrl", ID_JZ4770 },
  735. { "jz4780-pinctrl", ID_JZ4780 },
  736. {},
  737. };
  738. static struct platform_driver ingenic_pinctrl_driver = {
  739. .driver = {
  740. .name = "pinctrl-ingenic",
  741. .of_match_table = of_match_ptr(ingenic_pinctrl_of_match),
  742. .suppress_bind_attrs = true,
  743. },
  744. .probe = ingenic_pinctrl_probe,
  745. .id_table = ingenic_pinctrl_ids,
  746. };
  747. static int __init ingenic_pinctrl_drv_register(void)
  748. {
  749. return platform_driver_register(&ingenic_pinctrl_driver);
  750. }
  751. subsys_initcall(ingenic_pinctrl_drv_register);