1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Copyright (C) 2022
4 * Author(s): Jesse Taube <Mr.Bossman075@gmail.com>
5 */
6
7 #include <linux/err.h>
8 #include <linux/init.h>
9 #include <linux/of_device.h>
10 #include <linux/pinctrl/pinctrl.h>
11 #include <linux/platform_device.h>
12
13 #include "pinctrl-imx.h"
14
15 enum imxrt1170_pads {
16 IMXRT1170_PAD_RESERVE0,
17 IMXRT1170_PAD_RESERVE1,
18 IMXRT1170_PAD_RESERVE2,
19 IMXRT1170_PAD_RESERVE3,
20 IMXRT1170_PAD_EMC_B1_00,
21 IMXRT1170_PAD_EMC_B1_01,
22 IMXRT1170_PAD_EMC_B1_02,
23 IMXRT1170_PAD_EMC_B1_03,
24 IMXRT1170_PAD_EMC_B1_04,
25 IMXRT1170_PAD_EMC_B1_05,
26 IMXRT1170_PAD_EMC_B1_06,
27 IMXRT1170_PAD_EMC_B1_07,
28 IMXRT1170_PAD_EMC_B1_08,
29 IMXRT1170_PAD_EMC_B1_09,
30 IMXRT1170_PAD_EMC_B1_10,
31 IMXRT1170_PAD_EMC_B1_11,
32 IMXRT1170_PAD_EMC_B1_12,
33 IMXRT1170_PAD_EMC_B1_13,
34 IMXRT1170_PAD_EMC_B1_14,
35 IMXRT1170_PAD_EMC_B1_15,
36 IMXRT1170_PAD_EMC_B1_16,
37 IMXRT1170_PAD_EMC_B1_17,
38 IMXRT1170_PAD_EMC_B1_18,
39 IMXRT1170_PAD_EMC_B1_19,
40 IMXRT1170_PAD_EMC_B1_20,
41 IMXRT1170_PAD_EMC_B1_21,
42 IMXRT1170_PAD_EMC_B1_22,
43 IMXRT1170_PAD_EMC_B1_23,
44 IMXRT1170_PAD_EMC_B1_24,
45 IMXRT1170_PAD_EMC_B1_25,
46 IMXRT1170_PAD_EMC_B1_26,
47 IMXRT1170_PAD_EMC_B1_27,
48 IMXRT1170_PAD_EMC_B1_28,
49 IMXRT1170_PAD_EMC_B1_29,
50 IMXRT1170_PAD_EMC_B1_30,
51 IMXRT1170_PAD_EMC_B1_31,
52 IMXRT1170_PAD_EMC_B1_32,
53 IMXRT1170_PAD_EMC_B1_33,
54 IMXRT1170_PAD_EMC_B1_34,
55 IMXRT1170_PAD_EMC_B1_35,
56 IMXRT1170_PAD_EMC_B1_36,
57 IMXRT1170_PAD_EMC_B1_37,
58 IMXRT1170_PAD_EMC_B1_38,
59 IMXRT1170_PAD_EMC_B1_39,
60 IMXRT1170_PAD_EMC_B1_40,
61 IMXRT1170_PAD_EMC_B1_41,
62 IMXRT1170_PAD_EMC_B2_00,
63 IMXRT1170_PAD_EMC_B2_01,
64 IMXRT1170_PAD_EMC_B2_02,
65 IMXRT1170_PAD_EMC_B2_03,
66 IMXRT1170_PAD_EMC_B2_04,
67 IMXRT1170_PAD_EMC_B2_05,
68 IMXRT1170_PAD_EMC_B2_06,
69 IMXRT1170_PAD_EMC_B2_07,
70 IMXRT1170_PAD_EMC_B2_08,
71 IMXRT1170_PAD_EMC_B2_09,
72 IMXRT1170_PAD_EMC_B2_10,
73 IMXRT1170_PAD_EMC_B2_11,
74 IMXRT1170_PAD_EMC_B2_12,
75 IMXRT1170_PAD_EMC_B2_13,
76 IMXRT1170_PAD_EMC_B2_14,
77 IMXRT1170_PAD_EMC_B2_15,
78 IMXRT1170_PAD_EMC_B2_16,
79 IMXRT1170_PAD_EMC_B2_17,
80 IMXRT1170_PAD_EMC_B2_18,
81 IMXRT1170_PAD_EMC_B2_19,
82 IMXRT1170_PAD_EMC_B2_20,
83 IMXRT1170_PAD_AD_00,
84 IMXRT1170_PAD_AD_01,
85 IMXRT1170_PAD_AD_02,
86 IMXRT1170_PAD_AD_03,
87 IMXRT1170_PAD_AD_04,
88 IMXRT1170_PAD_AD_05,
89 IMXRT1170_PAD_AD_06,
90 IMXRT1170_PAD_AD_07,
91 IMXRT1170_PAD_AD_08,
92 IMXRT1170_PAD_AD_09,
93 IMXRT1170_PAD_AD_10,
94 IMXRT1170_PAD_AD_11,
95 IMXRT1170_PAD_AD_12,
96 IMXRT1170_PAD_AD_13,
97 IMXRT1170_PAD_AD_14,
98 IMXRT1170_PAD_AD_15,
99 IMXRT1170_PAD_AD_16,
100 IMXRT1170_PAD_AD_17,
101 IMXRT1170_PAD_AD_18,
102 IMXRT1170_PAD_AD_19,
103 IMXRT1170_PAD_AD_20,
104 IMXRT1170_PAD_AD_21,
105 IMXRT1170_PAD_AD_22,
106 IMXRT1170_PAD_AD_23,
107 IMXRT1170_PAD_AD_24,
108 IMXRT1170_PAD_AD_25,
109 IMXRT1170_PAD_AD_26,
110 IMXRT1170_PAD_AD_27,
111 IMXRT1170_PAD_AD_28,
112 IMXRT1170_PAD_AD_29,
113 IMXRT1170_PAD_AD_30,
114 IMXRT1170_PAD_AD_31,
115 IMXRT1170_PAD_AD_32,
116 IMXRT1170_PAD_AD_33,
117 IMXRT1170_PAD_AD_34,
118 IMXRT1170_PAD_AD_35,
119 IMXRT1170_PAD_SD_B1_00,
120 IMXRT1170_PAD_SD_B1_01,
121 IMXRT1170_PAD_SD_B1_02,
122 IMXRT1170_PAD_SD_B1_03,
123 IMXRT1170_PAD_SD_B1_04,
124 IMXRT1170_PAD_SD_B1_05,
125 IMXRT1170_PAD_SD_B2_00,
126 IMXRT1170_PAD_SD_B2_01,
127 IMXRT1170_PAD_SD_B2_02,
128 IMXRT1170_PAD_SD_B2_03,
129 IMXRT1170_PAD_SD_B2_04,
130 IMXRT1170_PAD_SD_B2_05,
131 IMXRT1170_PAD_SD_B2_06,
132 IMXRT1170_PAD_SD_B2_07,
133 IMXRT1170_PAD_SD_B2_08,
134 IMXRT1170_PAD_SD_B2_09,
135 IMXRT1170_PAD_SD_B2_10,
136 IMXRT1170_PAD_SD_B2_11,
137 IMXRT1170_PAD_DISP_B1_00,
138 IMXRT1170_PAD_DISP_B1_01,
139 IMXRT1170_PAD_DISP_B1_02,
140 IMXRT1170_PAD_DISP_B1_03,
141 IMXRT1170_PAD_DISP_B1_04,
142 IMXRT1170_PAD_DISP_B1_05,
143 IMXRT1170_PAD_DISP_B1_06,
144 IMXRT1170_PAD_DISP_B1_07,
145 IMXRT1170_PAD_DISP_B1_08,
146 IMXRT1170_PAD_DISP_B1_09,
147 IMXRT1170_PAD_DISP_B1_10,
148 IMXRT1170_PAD_DISP_B1_11,
149 IMXRT1170_PAD_DISP_B2_00,
150 IMXRT1170_PAD_DISP_B2_01,
151 IMXRT1170_PAD_DISP_B2_02,
152 IMXRT1170_PAD_DISP_B2_03,
153 IMXRT1170_PAD_DISP_B2_04,
154 IMXRT1170_PAD_DISP_B2_05,
155 IMXRT1170_PAD_DISP_B2_06,
156 IMXRT1170_PAD_DISP_B2_07,
157 IMXRT1170_PAD_DISP_B2_08,
158 IMXRT1170_PAD_DISP_B2_09,
159 IMXRT1170_PAD_DISP_B2_10,
160 IMXRT1170_PAD_DISP_B2_11,
161 IMXRT1170_PAD_DISP_B2_12,
162 IMXRT1170_PAD_DISP_B2_13,
163 IMXRT1170_PAD_DISP_B2_14,
164 IMXRT1170_PAD_DISP_B2_15,
165 };
166
167 /* Pad names for the pinmux subsystem */
168 static const struct pinctrl_pin_desc imxrt1170_pinctrl_pads[] = {
169 IMX_PINCTRL_PIN(IMXRT1170_PAD_RESERVE0),
170 IMX_PINCTRL_PIN(IMXRT1170_PAD_RESERVE1),
171 IMX_PINCTRL_PIN(IMXRT1170_PAD_RESERVE2),
172 IMX_PINCTRL_PIN(IMXRT1170_PAD_RESERVE3),
173 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_00),
174 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_01),
175 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_02),
176 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_03),
177 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_04),
178 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_05),
179 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_06),
180 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_07),
181 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_08),
182 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_09),
183 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_10),
184 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_11),
185 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_12),
186 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_13),
187 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_14),
188 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_15),
189 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_16),
190 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_17),
191 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_18),
192 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_19),
193 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_20),
194 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_21),
195 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_22),
196 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_23),
197 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_24),
198 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_25),
199 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_26),
200 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_27),
201 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_28),
202 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_29),
203 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_30),
204 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_31),
205 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_32),
206 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_33),
207 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_34),
208 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_35),
209 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_36),
210 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_37),
211 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_38),
212 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_39),
213 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_40),
214 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B1_41),
215 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B2_00),
216 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B2_01),
217 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B2_02),
218 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B2_03),
219 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B2_04),
220 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B2_05),
221 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B2_06),
222 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B2_07),
223 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B2_08),
224 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B2_09),
225 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B2_10),
226 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B2_11),
227 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B2_12),
228 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B2_13),
229 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B2_14),
230 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B2_15),
231 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B2_16),
232 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B2_17),
233 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B2_18),
234 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B2_19),
235 IMX_PINCTRL_PIN(IMXRT1170_PAD_EMC_B2_20),
236 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_00),
237 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_01),
238 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_02),
239 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_03),
240 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_04),
241 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_05),
242 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_06),
243 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_07),
244 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_08),
245 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_09),
246 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_10),
247 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_11),
248 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_12),
249 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_13),
250 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_14),
251 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_15),
252 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_16),
253 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_17),
254 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_18),
255 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_19),
256 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_20),
257 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_21),
258 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_22),
259 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_23),
260 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_24),
261 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_25),
262 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_26),
263 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_27),
264 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_28),
265 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_29),
266 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_30),
267 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_31),
268 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_32),
269 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_33),
270 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_34),
271 IMX_PINCTRL_PIN(IMXRT1170_PAD_AD_35),
272 IMX_PINCTRL_PIN(IMXRT1170_PAD_SD_B1_00),
273 IMX_PINCTRL_PIN(IMXRT1170_PAD_SD_B1_01),
274 IMX_PINCTRL_PIN(IMXRT1170_PAD_SD_B1_02),
275 IMX_PINCTRL_PIN(IMXRT1170_PAD_SD_B1_03),
276 IMX_PINCTRL_PIN(IMXRT1170_PAD_SD_B1_04),
277 IMX_PINCTRL_PIN(IMXRT1170_PAD_SD_B1_05),
278 IMX_PINCTRL_PIN(IMXRT1170_PAD_SD_B2_00),
279 IMX_PINCTRL_PIN(IMXRT1170_PAD_SD_B2_01),
280 IMX_PINCTRL_PIN(IMXRT1170_PAD_SD_B2_02),
281 IMX_PINCTRL_PIN(IMXRT1170_PAD_SD_B2_03),
282 IMX_PINCTRL_PIN(IMXRT1170_PAD_SD_B2_04),
283 IMX_PINCTRL_PIN(IMXRT1170_PAD_SD_B2_05),
284 IMX_PINCTRL_PIN(IMXRT1170_PAD_SD_B2_06),
285 IMX_PINCTRL_PIN(IMXRT1170_PAD_SD_B2_07),
286 IMX_PINCTRL_PIN(IMXRT1170_PAD_SD_B2_08),
287 IMX_PINCTRL_PIN(IMXRT1170_PAD_SD_B2_09),
288 IMX_PINCTRL_PIN(IMXRT1170_PAD_SD_B2_10),
289 IMX_PINCTRL_PIN(IMXRT1170_PAD_SD_B2_11),
290 IMX_PINCTRL_PIN(IMXRT1170_PAD_DISP_B1_00),
291 IMX_PINCTRL_PIN(IMXRT1170_PAD_DISP_B1_01),
292 IMX_PINCTRL_PIN(IMXRT1170_PAD_DISP_B1_02),
293 IMX_PINCTRL_PIN(IMXRT1170_PAD_DISP_B1_03),
294 IMX_PINCTRL_PIN(IMXRT1170_PAD_DISP_B1_04),
295 IMX_PINCTRL_PIN(IMXRT1170_PAD_DISP_B1_05),
296 IMX_PINCTRL_PIN(IMXRT1170_PAD_DISP_B1_06),
297 IMX_PINCTRL_PIN(IMXRT1170_PAD_DISP_B1_07),
298 IMX_PINCTRL_PIN(IMXRT1170_PAD_DISP_B1_08),
299 IMX_PINCTRL_PIN(IMXRT1170_PAD_DISP_B1_09),
300 IMX_PINCTRL_PIN(IMXRT1170_PAD_DISP_B1_10),
301 IMX_PINCTRL_PIN(IMXRT1170_PAD_DISP_B1_11),
302 IMX_PINCTRL_PIN(IMXRT1170_PAD_DISP_B2_00),
303 IMX_PINCTRL_PIN(IMXRT1170_PAD_DISP_B2_01),
304 IMX_PINCTRL_PIN(IMXRT1170_PAD_DISP_B2_02),
305 IMX_PINCTRL_PIN(IMXRT1170_PAD_DISP_B2_03),
306 IMX_PINCTRL_PIN(IMXRT1170_PAD_DISP_B2_04),
307 IMX_PINCTRL_PIN(IMXRT1170_PAD_DISP_B2_05),
308 IMX_PINCTRL_PIN(IMXRT1170_PAD_DISP_B2_06),
309 IMX_PINCTRL_PIN(IMXRT1170_PAD_DISP_B2_07),
310 IMX_PINCTRL_PIN(IMXRT1170_PAD_DISP_B2_08),
311 IMX_PINCTRL_PIN(IMXRT1170_PAD_DISP_B2_09),
312 IMX_PINCTRL_PIN(IMXRT1170_PAD_DISP_B2_10),
313 IMX_PINCTRL_PIN(IMXRT1170_PAD_DISP_B2_11),
314 IMX_PINCTRL_PIN(IMXRT1170_PAD_DISP_B2_12),
315 IMX_PINCTRL_PIN(IMXRT1170_PAD_DISP_B2_13),
316 IMX_PINCTRL_PIN(IMXRT1170_PAD_DISP_B2_14),
317 IMX_PINCTRL_PIN(IMXRT1170_PAD_DISP_B2_15),
318 };
319
320 static const struct imx_pinctrl_soc_info imxrt1170_pinctrl_info = {
321 .pins = imxrt1170_pinctrl_pads,
322 .npins = ARRAY_SIZE(imxrt1170_pinctrl_pads),
323 .gpr_compatible = "fsl,imxrt1170-iomuxc-gpr",
324 };
325
326 static const struct of_device_id imxrt1170_pinctrl_of_match[] = {
327 { .compatible = "fsl,imxrt1170-iomuxc", .data = &imxrt1170_pinctrl_info, },
328 { /* sentinel */ }
329 };
330
imxrt1170_pinctrl_probe(struct platform_device * pdev)331 static int imxrt1170_pinctrl_probe(struct platform_device *pdev)
332 {
333 return imx_pinctrl_probe(pdev, &imxrt1170_pinctrl_info);
334 }
335
336 static struct platform_driver imxrt1170_pinctrl_driver = {
337 .driver = {
338 .name = "imxrt1170-pinctrl",
339 .of_match_table = of_match_ptr(imxrt1170_pinctrl_of_match),
340 .suppress_bind_attrs = true,
341 },
342 .probe = imxrt1170_pinctrl_probe,
343 };
344
imxrt1170_pinctrl_init(void)345 static int __init imxrt1170_pinctrl_init(void)
346 {
347 return platform_driver_register(&imxrt1170_pinctrl_driver);
348 }
349 arch_initcall(imxrt1170_pinctrl_init);
350