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