1 // SPDX-License-Identifier: GPL-2.0+
3 // VF610 pinctrl driver based on imx pinmux and pinconf core
5 // Copyright 2013 Freescale Semiconductor, Inc.
8 #include <linux/init.h>
11 #include <linux/of_device.h>
12 #include <linux/pinctrl/pinctrl.h>
14 #include "pinctrl-imx.h"
106 VF610_PAD_PTD10
= 89,
107 VF610_PAD_PTD11
= 90,
108 VF610_PAD_PTD12
= 91,
109 VF610_PAD_PTD13
= 92,
110 VF610_PAD_PTB23
= 93,
111 VF610_PAD_PTB24
= 94,
112 VF610_PAD_PTB25
= 95,
113 VF610_PAD_PTB26
= 96,
114 VF610_PAD_PTB27
= 97,
115 VF610_PAD_PTB28
= 98,
116 VF610_PAD_PTC26
= 99,
117 VF610_PAD_PTC27
= 100,
118 VF610_PAD_PTC28
= 101,
119 VF610_PAD_PTC29
= 102,
120 VF610_PAD_PTC30
= 103,
121 VF610_PAD_PTC31
= 104,
122 VF610_PAD_PTE0
= 105,
123 VF610_PAD_PTE1
= 106,
124 VF610_PAD_PTE2
= 107,
125 VF610_PAD_PTE3
= 108,
126 VF610_PAD_PTE4
= 109,
127 VF610_PAD_PTE5
= 110,
128 VF610_PAD_PTE6
= 111,
129 VF610_PAD_PTE7
= 112,
130 VF610_PAD_PTE8
= 113,
131 VF610_PAD_PTE9
= 114,
132 VF610_PAD_PTE10
= 115,
133 VF610_PAD_PTE11
= 116,
134 VF610_PAD_PTE12
= 117,
135 VF610_PAD_PTE13
= 118,
136 VF610_PAD_PTE14
= 119,
137 VF610_PAD_PTE15
= 120,
138 VF610_PAD_PTE16
= 121,
139 VF610_PAD_PTE17
= 122,
140 VF610_PAD_PTE18
= 123,
141 VF610_PAD_PTE19
= 124,
142 VF610_PAD_PTE20
= 125,
143 VF610_PAD_PTE21
= 126,
144 VF610_PAD_PTE22
= 127,
145 VF610_PAD_PTE23
= 128,
146 VF610_PAD_PTE24
= 129,
147 VF610_PAD_PTE25
= 130,
148 VF610_PAD_PTE26
= 131,
149 VF610_PAD_PTE27
= 132,
150 VF610_PAD_PTE28
= 133,
151 VF610_PAD_PTA7
= 134,
154 /* Pad names for the pinmux subsystem */
155 static const struct pinctrl_pin_desc vf610_pinctrl_pads
[] = {
156 IMX_PINCTRL_PIN(VF610_PAD_PTA6
),
157 IMX_PINCTRL_PIN(VF610_PAD_PTA8
),
158 IMX_PINCTRL_PIN(VF610_PAD_PTA9
),
159 IMX_PINCTRL_PIN(VF610_PAD_PTA10
),
160 IMX_PINCTRL_PIN(VF610_PAD_PTA11
),
161 IMX_PINCTRL_PIN(VF610_PAD_PTA12
),
162 IMX_PINCTRL_PIN(VF610_PAD_PTA16
),
163 IMX_PINCTRL_PIN(VF610_PAD_PTA17
),
164 IMX_PINCTRL_PIN(VF610_PAD_PTA18
),
165 IMX_PINCTRL_PIN(VF610_PAD_PTA19
),
166 IMX_PINCTRL_PIN(VF610_PAD_PTA20
),
167 IMX_PINCTRL_PIN(VF610_PAD_PTA21
),
168 IMX_PINCTRL_PIN(VF610_PAD_PTA22
),
169 IMX_PINCTRL_PIN(VF610_PAD_PTA23
),
170 IMX_PINCTRL_PIN(VF610_PAD_PTA24
),
171 IMX_PINCTRL_PIN(VF610_PAD_PTA25
),
172 IMX_PINCTRL_PIN(VF610_PAD_PTA26
),
173 IMX_PINCTRL_PIN(VF610_PAD_PTA27
),
174 IMX_PINCTRL_PIN(VF610_PAD_PTA28
),
175 IMX_PINCTRL_PIN(VF610_PAD_PTA29
),
176 IMX_PINCTRL_PIN(VF610_PAD_PTA30
),
177 IMX_PINCTRL_PIN(VF610_PAD_PTA31
),
178 IMX_PINCTRL_PIN(VF610_PAD_PTB0
),
179 IMX_PINCTRL_PIN(VF610_PAD_PTB1
),
180 IMX_PINCTRL_PIN(VF610_PAD_PTB2
),
181 IMX_PINCTRL_PIN(VF610_PAD_PTB3
),
182 IMX_PINCTRL_PIN(VF610_PAD_PTB4
),
183 IMX_PINCTRL_PIN(VF610_PAD_PTB5
),
184 IMX_PINCTRL_PIN(VF610_PAD_PTB6
),
185 IMX_PINCTRL_PIN(VF610_PAD_PTB7
),
186 IMX_PINCTRL_PIN(VF610_PAD_PTB8
),
187 IMX_PINCTRL_PIN(VF610_PAD_PTB9
),
188 IMX_PINCTRL_PIN(VF610_PAD_PTB10
),
189 IMX_PINCTRL_PIN(VF610_PAD_PTB11
),
190 IMX_PINCTRL_PIN(VF610_PAD_PTB12
),
191 IMX_PINCTRL_PIN(VF610_PAD_PTB13
),
192 IMX_PINCTRL_PIN(VF610_PAD_PTB14
),
193 IMX_PINCTRL_PIN(VF610_PAD_PTB15
),
194 IMX_PINCTRL_PIN(VF610_PAD_PTB16
),
195 IMX_PINCTRL_PIN(VF610_PAD_PTB17
),
196 IMX_PINCTRL_PIN(VF610_PAD_PTB18
),
197 IMX_PINCTRL_PIN(VF610_PAD_PTB19
),
198 IMX_PINCTRL_PIN(VF610_PAD_PTB20
),
199 IMX_PINCTRL_PIN(VF610_PAD_PTB21
),
200 IMX_PINCTRL_PIN(VF610_PAD_PTB22
),
201 IMX_PINCTRL_PIN(VF610_PAD_PTC0
),
202 IMX_PINCTRL_PIN(VF610_PAD_PTC1
),
203 IMX_PINCTRL_PIN(VF610_PAD_PTC2
),
204 IMX_PINCTRL_PIN(VF610_PAD_PTC3
),
205 IMX_PINCTRL_PIN(VF610_PAD_PTC4
),
206 IMX_PINCTRL_PIN(VF610_PAD_PTC5
),
207 IMX_PINCTRL_PIN(VF610_PAD_PTC6
),
208 IMX_PINCTRL_PIN(VF610_PAD_PTC7
),
209 IMX_PINCTRL_PIN(VF610_PAD_PTC8
),
210 IMX_PINCTRL_PIN(VF610_PAD_PTC9
),
211 IMX_PINCTRL_PIN(VF610_PAD_PTC10
),
212 IMX_PINCTRL_PIN(VF610_PAD_PTC11
),
213 IMX_PINCTRL_PIN(VF610_PAD_PTC12
),
214 IMX_PINCTRL_PIN(VF610_PAD_PTC13
),
215 IMX_PINCTRL_PIN(VF610_PAD_PTC14
),
216 IMX_PINCTRL_PIN(VF610_PAD_PTC15
),
217 IMX_PINCTRL_PIN(VF610_PAD_PTC16
),
218 IMX_PINCTRL_PIN(VF610_PAD_PTC17
),
219 IMX_PINCTRL_PIN(VF610_PAD_PTD31
),
220 IMX_PINCTRL_PIN(VF610_PAD_PTD30
),
221 IMX_PINCTRL_PIN(VF610_PAD_PTD29
),
222 IMX_PINCTRL_PIN(VF610_PAD_PTD28
),
223 IMX_PINCTRL_PIN(VF610_PAD_PTD27
),
224 IMX_PINCTRL_PIN(VF610_PAD_PTD26
),
225 IMX_PINCTRL_PIN(VF610_PAD_PTD25
),
226 IMX_PINCTRL_PIN(VF610_PAD_PTD24
),
227 IMX_PINCTRL_PIN(VF610_PAD_PTD23
),
228 IMX_PINCTRL_PIN(VF610_PAD_PTD22
),
229 IMX_PINCTRL_PIN(VF610_PAD_PTD21
),
230 IMX_PINCTRL_PIN(VF610_PAD_PTD20
),
231 IMX_PINCTRL_PIN(VF610_PAD_PTD19
),
232 IMX_PINCTRL_PIN(VF610_PAD_PTD18
),
233 IMX_PINCTRL_PIN(VF610_PAD_PTD17
),
234 IMX_PINCTRL_PIN(VF610_PAD_PTD16
),
235 IMX_PINCTRL_PIN(VF610_PAD_PTD0
),
236 IMX_PINCTRL_PIN(VF610_PAD_PTD1
),
237 IMX_PINCTRL_PIN(VF610_PAD_PTD2
),
238 IMX_PINCTRL_PIN(VF610_PAD_PTD3
),
239 IMX_PINCTRL_PIN(VF610_PAD_PTD4
),
240 IMX_PINCTRL_PIN(VF610_PAD_PTD5
),
241 IMX_PINCTRL_PIN(VF610_PAD_PTD6
),
242 IMX_PINCTRL_PIN(VF610_PAD_PTD7
),
243 IMX_PINCTRL_PIN(VF610_PAD_PTD8
),
244 IMX_PINCTRL_PIN(VF610_PAD_PTD9
),
245 IMX_PINCTRL_PIN(VF610_PAD_PTD10
),
246 IMX_PINCTRL_PIN(VF610_PAD_PTD11
),
247 IMX_PINCTRL_PIN(VF610_PAD_PTD12
),
248 IMX_PINCTRL_PIN(VF610_PAD_PTD13
),
249 IMX_PINCTRL_PIN(VF610_PAD_PTB23
),
250 IMX_PINCTRL_PIN(VF610_PAD_PTB24
),
251 IMX_PINCTRL_PIN(VF610_PAD_PTB25
),
252 IMX_PINCTRL_PIN(VF610_PAD_PTB26
),
253 IMX_PINCTRL_PIN(VF610_PAD_PTB27
),
254 IMX_PINCTRL_PIN(VF610_PAD_PTB28
),
255 IMX_PINCTRL_PIN(VF610_PAD_PTC26
),
256 IMX_PINCTRL_PIN(VF610_PAD_PTC27
),
257 IMX_PINCTRL_PIN(VF610_PAD_PTC28
),
258 IMX_PINCTRL_PIN(VF610_PAD_PTC29
),
259 IMX_PINCTRL_PIN(VF610_PAD_PTC30
),
260 IMX_PINCTRL_PIN(VF610_PAD_PTC31
),
261 IMX_PINCTRL_PIN(VF610_PAD_PTE0
),
262 IMX_PINCTRL_PIN(VF610_PAD_PTE1
),
263 IMX_PINCTRL_PIN(VF610_PAD_PTE2
),
264 IMX_PINCTRL_PIN(VF610_PAD_PTE3
),
265 IMX_PINCTRL_PIN(VF610_PAD_PTE4
),
266 IMX_PINCTRL_PIN(VF610_PAD_PTE5
),
267 IMX_PINCTRL_PIN(VF610_PAD_PTE6
),
268 IMX_PINCTRL_PIN(VF610_PAD_PTE7
),
269 IMX_PINCTRL_PIN(VF610_PAD_PTE8
),
270 IMX_PINCTRL_PIN(VF610_PAD_PTE9
),
271 IMX_PINCTRL_PIN(VF610_PAD_PTE10
),
272 IMX_PINCTRL_PIN(VF610_PAD_PTE11
),
273 IMX_PINCTRL_PIN(VF610_PAD_PTE12
),
274 IMX_PINCTRL_PIN(VF610_PAD_PTE13
),
275 IMX_PINCTRL_PIN(VF610_PAD_PTE14
),
276 IMX_PINCTRL_PIN(VF610_PAD_PTE15
),
277 IMX_PINCTRL_PIN(VF610_PAD_PTE16
),
278 IMX_PINCTRL_PIN(VF610_PAD_PTE17
),
279 IMX_PINCTRL_PIN(VF610_PAD_PTE18
),
280 IMX_PINCTRL_PIN(VF610_PAD_PTE19
),
281 IMX_PINCTRL_PIN(VF610_PAD_PTE20
),
282 IMX_PINCTRL_PIN(VF610_PAD_PTE21
),
283 IMX_PINCTRL_PIN(VF610_PAD_PTE22
),
284 IMX_PINCTRL_PIN(VF610_PAD_PTE23
),
285 IMX_PINCTRL_PIN(VF610_PAD_PTE24
),
286 IMX_PINCTRL_PIN(VF610_PAD_PTE25
),
287 IMX_PINCTRL_PIN(VF610_PAD_PTE26
),
288 IMX_PINCTRL_PIN(VF610_PAD_PTE27
),
289 IMX_PINCTRL_PIN(VF610_PAD_PTE28
),
290 IMX_PINCTRL_PIN(VF610_PAD_PTA7
),
293 static int vf610_pmx_gpio_set_direction(struct pinctrl_dev
*pctldev
,
294 struct pinctrl_gpio_range
*range
,
295 unsigned offset
, bool input
)
297 struct imx_pinctrl
*ipctl
= pinctrl_dev_get_drvdata(pctldev
);
298 const struct imx_pin_reg
*pin_reg
;
301 pin_reg
= &ipctl
->pin_regs
[offset
];
302 if (pin_reg
->mux_reg
== -1)
305 /* IBE always enabled allows us to read the value "on the wire" */
306 reg
= readl(ipctl
->base
+ pin_reg
->mux_reg
);
311 writel(reg
, ipctl
->base
+ pin_reg
->mux_reg
);
316 static const struct imx_pinctrl_soc_info vf610_pinctrl_info
= {
317 .pins
= vf610_pinctrl_pads
,
318 .npins
= ARRAY_SIZE(vf610_pinctrl_pads
),
319 .flags
= SHARE_MUX_CONF_REG
| ZERO_OFFSET_VALID
,
320 .gpio_set_direction
= vf610_pmx_gpio_set_direction
,
321 .mux_mask
= 0x700000,
325 static const struct of_device_id vf610_pinctrl_of_match
[] = {
326 { .compatible
= "fsl,vf610-iomuxc", },
330 static int vf610_pinctrl_probe(struct platform_device
*pdev
)
332 return imx_pinctrl_probe(pdev
, &vf610_pinctrl_info
);
335 static struct platform_driver vf610_pinctrl_driver
= {
337 .name
= "vf610-pinctrl",
338 .of_match_table
= vf610_pinctrl_of_match
,
340 .probe
= vf610_pinctrl_probe
,
343 static int __init
vf610_pinctrl_init(void)
345 return platform_driver_register(&vf610_pinctrl_driver
);
347 arch_initcall(vf610_pinctrl_init
);