blob: 293ed4381cc0e08c1bb195bbb9f535fba66075ed [file] [log] [blame]
Denis Cariklib4a87c92013-11-06 09:52:15 +01001/*
2 * imx25 pinctrl driver.
3 *
4 * Copyright 2013 Eukréa Electromatique <denis@eukrea.com>
5 *
6 * This driver was mostly copied from the imx51 pinctrl driver which has:
7 *
8 * Copyright (C) 2012 Freescale Semiconductor, Inc.
9 * Copyright (C) 2012 Linaro, Inc.
10 *
11 * Author: Denis Carikli <denis@eukrea.com>
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as published
15 * by the Free Software Foundation.
16 */
17
18#include <linux/err.h>
19#include <linux/init.h>
20#include <linux/io.h>
21#include <linux/module.h>
22#include <linux/of.h>
23#include <linux/of_device.h>
24#include <linux/pinctrl/pinctrl.h>
25
26#include "pinctrl-imx.h"
27
28enum imx25_pads {
Uwe Kleine-König9911a2d2015-09-23 16:35:09 +020029 MX25_PAD_RESERVE0 = 0,
30 MX25_PAD_RESERVE1 = 1,
Uwe Kleine-König34027ca2015-01-28 00:45:56 +010031 MX25_PAD_A10 = 2,
32 MX25_PAD_A13 = 3,
33 MX25_PAD_A14 = 4,
34 MX25_PAD_A15 = 5,
35 MX25_PAD_A16 = 6,
36 MX25_PAD_A17 = 7,
37 MX25_PAD_A18 = 8,
38 MX25_PAD_A19 = 9,
39 MX25_PAD_A20 = 10,
40 MX25_PAD_A21 = 11,
41 MX25_PAD_A22 = 12,
42 MX25_PAD_A23 = 13,
43 MX25_PAD_A24 = 14,
44 MX25_PAD_A25 = 15,
45 MX25_PAD_EB0 = 16,
46 MX25_PAD_EB1 = 17,
47 MX25_PAD_OE = 18,
48 MX25_PAD_CS0 = 19,
49 MX25_PAD_CS1 = 20,
50 MX25_PAD_CS4 = 21,
51 MX25_PAD_CS5 = 22,
52 MX25_PAD_NF_CE0 = 23,
53 MX25_PAD_ECB = 24,
54 MX25_PAD_LBA = 25,
55 MX25_PAD_BCLK = 26,
56 MX25_PAD_RW = 27,
57 MX25_PAD_NFWE_B = 28,
58 MX25_PAD_NFRE_B = 29,
59 MX25_PAD_NFALE = 30,
60 MX25_PAD_NFCLE = 31,
61 MX25_PAD_NFWP_B = 32,
62 MX25_PAD_NFRB = 33,
63 MX25_PAD_D15 = 34,
64 MX25_PAD_D14 = 35,
65 MX25_PAD_D13 = 36,
66 MX25_PAD_D12 = 37,
67 MX25_PAD_D11 = 38,
68 MX25_PAD_D10 = 39,
69 MX25_PAD_D9 = 40,
70 MX25_PAD_D8 = 41,
71 MX25_PAD_D7 = 42,
72 MX25_PAD_D6 = 43,
73 MX25_PAD_D5 = 44,
74 MX25_PAD_D4 = 45,
75 MX25_PAD_D3 = 46,
76 MX25_PAD_D2 = 47,
77 MX25_PAD_D1 = 48,
78 MX25_PAD_D0 = 49,
79 MX25_PAD_LD0 = 50,
80 MX25_PAD_LD1 = 51,
81 MX25_PAD_LD2 = 52,
82 MX25_PAD_LD3 = 53,
83 MX25_PAD_LD4 = 54,
84 MX25_PAD_LD5 = 55,
85 MX25_PAD_LD6 = 56,
86 MX25_PAD_LD7 = 57,
87 MX25_PAD_LD8 = 58,
88 MX25_PAD_LD9 = 59,
89 MX25_PAD_LD10 = 60,
90 MX25_PAD_LD11 = 61,
91 MX25_PAD_LD12 = 62,
92 MX25_PAD_LD13 = 63,
93 MX25_PAD_LD14 = 64,
94 MX25_PAD_LD15 = 65,
95 MX25_PAD_HSYNC = 66,
96 MX25_PAD_VSYNC = 67,
97 MX25_PAD_LSCLK = 68,
98 MX25_PAD_OE_ACD = 69,
99 MX25_PAD_CONTRAST = 70,
100 MX25_PAD_PWM = 71,
101 MX25_PAD_CSI_D2 = 72,
102 MX25_PAD_CSI_D3 = 73,
103 MX25_PAD_CSI_D4 = 74,
104 MX25_PAD_CSI_D5 = 75,
105 MX25_PAD_CSI_D6 = 76,
106 MX25_PAD_CSI_D7 = 77,
107 MX25_PAD_CSI_D8 = 78,
108 MX25_PAD_CSI_D9 = 79,
109 MX25_PAD_CSI_MCLK = 80,
110 MX25_PAD_CSI_VSYNC = 81,
111 MX25_PAD_CSI_HSYNC = 82,
112 MX25_PAD_CSI_PIXCLK = 83,
113 MX25_PAD_I2C1_CLK = 84,
114 MX25_PAD_I2C1_DAT = 85,
115 MX25_PAD_CSPI1_MOSI = 86,
116 MX25_PAD_CSPI1_MISO = 87,
117 MX25_PAD_CSPI1_SS0 = 88,
118 MX25_PAD_CSPI1_SS1 = 89,
119 MX25_PAD_CSPI1_SCLK = 90,
120 MX25_PAD_CSPI1_RDY = 91,
121 MX25_PAD_UART1_RXD = 92,
122 MX25_PAD_UART1_TXD = 93,
123 MX25_PAD_UART1_RTS = 94,
124 MX25_PAD_UART1_CTS = 95,
125 MX25_PAD_UART2_RXD = 96,
126 MX25_PAD_UART2_TXD = 97,
127 MX25_PAD_UART2_RTS = 98,
128 MX25_PAD_UART2_CTS = 99,
129 MX25_PAD_SD1_CMD = 100,
130 MX25_PAD_SD1_CLK = 101,
131 MX25_PAD_SD1_DATA0 = 102,
132 MX25_PAD_SD1_DATA1 = 103,
133 MX25_PAD_SD1_DATA2 = 104,
134 MX25_PAD_SD1_DATA3 = 105,
135 MX25_PAD_KPP_ROW0 = 106,
136 MX25_PAD_KPP_ROW1 = 107,
137 MX25_PAD_KPP_ROW2 = 108,
138 MX25_PAD_KPP_ROW3 = 109,
139 MX25_PAD_KPP_COL0 = 110,
140 MX25_PAD_KPP_COL1 = 111,
141 MX25_PAD_KPP_COL2 = 112,
142 MX25_PAD_KPP_COL3 = 113,
143 MX25_PAD_FEC_MDC = 114,
144 MX25_PAD_FEC_MDIO = 115,
145 MX25_PAD_FEC_TDATA0 = 116,
146 MX25_PAD_FEC_TDATA1 = 117,
147 MX25_PAD_FEC_TX_EN = 118,
148 MX25_PAD_FEC_RDATA0 = 119,
149 MX25_PAD_FEC_RDATA1 = 120,
150 MX25_PAD_FEC_RX_DV = 121,
151 MX25_PAD_FEC_TX_CLK = 122,
152 MX25_PAD_RTCK = 123,
153 MX25_PAD_DE_B = 124,
154 MX25_PAD_GPIO_A = 125,
155 MX25_PAD_GPIO_B = 126,
156 MX25_PAD_GPIO_C = 127,
157 MX25_PAD_GPIO_D = 128,
158 MX25_PAD_GPIO_E = 129,
159 MX25_PAD_GPIO_F = 130,
160 MX25_PAD_EXT_ARMCLK = 131,
161 MX25_PAD_UPLL_BYPCLK = 132,
162 MX25_PAD_VSTBY_REQ = 133,
163 MX25_PAD_VSTBY_ACK = 134,
164 MX25_PAD_POWER_FAIL = 135,
165 MX25_PAD_CLKO = 136,
166 MX25_PAD_BOOT_MODE0 = 137,
167 MX25_PAD_BOOT_MODE1 = 138,
Denis Cariklib4a87c92013-11-06 09:52:15 +0100168};
169
170/* Pad names for the pinmux subsystem */
171static const struct pinctrl_pin_desc imx25_pinctrl_pads[] = {
172 IMX_PINCTRL_PIN(MX25_PAD_RESERVE0),
Uwe Kleine-König9911a2d2015-09-23 16:35:09 +0200173 IMX_PINCTRL_PIN(MX25_PAD_RESERVE1),
Denis Cariklib4a87c92013-11-06 09:52:15 +0100174 IMX_PINCTRL_PIN(MX25_PAD_A10),
175 IMX_PINCTRL_PIN(MX25_PAD_A13),
176 IMX_PINCTRL_PIN(MX25_PAD_A14),
177 IMX_PINCTRL_PIN(MX25_PAD_A15),
178 IMX_PINCTRL_PIN(MX25_PAD_A16),
179 IMX_PINCTRL_PIN(MX25_PAD_A17),
180 IMX_PINCTRL_PIN(MX25_PAD_A18),
181 IMX_PINCTRL_PIN(MX25_PAD_A19),
182 IMX_PINCTRL_PIN(MX25_PAD_A20),
183 IMX_PINCTRL_PIN(MX25_PAD_A21),
184 IMX_PINCTRL_PIN(MX25_PAD_A22),
185 IMX_PINCTRL_PIN(MX25_PAD_A23),
186 IMX_PINCTRL_PIN(MX25_PAD_A24),
187 IMX_PINCTRL_PIN(MX25_PAD_A25),
188 IMX_PINCTRL_PIN(MX25_PAD_EB0),
189 IMX_PINCTRL_PIN(MX25_PAD_EB1),
190 IMX_PINCTRL_PIN(MX25_PAD_OE),
191 IMX_PINCTRL_PIN(MX25_PAD_CS0),
192 IMX_PINCTRL_PIN(MX25_PAD_CS1),
193 IMX_PINCTRL_PIN(MX25_PAD_CS4),
194 IMX_PINCTRL_PIN(MX25_PAD_CS5),
195 IMX_PINCTRL_PIN(MX25_PAD_NF_CE0),
196 IMX_PINCTRL_PIN(MX25_PAD_ECB),
197 IMX_PINCTRL_PIN(MX25_PAD_LBA),
198 IMX_PINCTRL_PIN(MX25_PAD_BCLK),
199 IMX_PINCTRL_PIN(MX25_PAD_RW),
200 IMX_PINCTRL_PIN(MX25_PAD_NFWE_B),
201 IMX_PINCTRL_PIN(MX25_PAD_NFRE_B),
202 IMX_PINCTRL_PIN(MX25_PAD_NFALE),
203 IMX_PINCTRL_PIN(MX25_PAD_NFCLE),
204 IMX_PINCTRL_PIN(MX25_PAD_NFWP_B),
205 IMX_PINCTRL_PIN(MX25_PAD_NFRB),
206 IMX_PINCTRL_PIN(MX25_PAD_D15),
207 IMX_PINCTRL_PIN(MX25_PAD_D14),
208 IMX_PINCTRL_PIN(MX25_PAD_D13),
209 IMX_PINCTRL_PIN(MX25_PAD_D12),
210 IMX_PINCTRL_PIN(MX25_PAD_D11),
211 IMX_PINCTRL_PIN(MX25_PAD_D10),
212 IMX_PINCTRL_PIN(MX25_PAD_D9),
213 IMX_PINCTRL_PIN(MX25_PAD_D8),
214 IMX_PINCTRL_PIN(MX25_PAD_D7),
215 IMX_PINCTRL_PIN(MX25_PAD_D6),
216 IMX_PINCTRL_PIN(MX25_PAD_D5),
217 IMX_PINCTRL_PIN(MX25_PAD_D4),
218 IMX_PINCTRL_PIN(MX25_PAD_D3),
219 IMX_PINCTRL_PIN(MX25_PAD_D2),
220 IMX_PINCTRL_PIN(MX25_PAD_D1),
221 IMX_PINCTRL_PIN(MX25_PAD_D0),
222 IMX_PINCTRL_PIN(MX25_PAD_LD0),
223 IMX_PINCTRL_PIN(MX25_PAD_LD1),
224 IMX_PINCTRL_PIN(MX25_PAD_LD2),
225 IMX_PINCTRL_PIN(MX25_PAD_LD3),
226 IMX_PINCTRL_PIN(MX25_PAD_LD4),
227 IMX_PINCTRL_PIN(MX25_PAD_LD5),
228 IMX_PINCTRL_PIN(MX25_PAD_LD6),
229 IMX_PINCTRL_PIN(MX25_PAD_LD7),
230 IMX_PINCTRL_PIN(MX25_PAD_LD8),
231 IMX_PINCTRL_PIN(MX25_PAD_LD9),
232 IMX_PINCTRL_PIN(MX25_PAD_LD10),
233 IMX_PINCTRL_PIN(MX25_PAD_LD11),
234 IMX_PINCTRL_PIN(MX25_PAD_LD12),
235 IMX_PINCTRL_PIN(MX25_PAD_LD13),
236 IMX_PINCTRL_PIN(MX25_PAD_LD14),
237 IMX_PINCTRL_PIN(MX25_PAD_LD15),
238 IMX_PINCTRL_PIN(MX25_PAD_HSYNC),
239 IMX_PINCTRL_PIN(MX25_PAD_VSYNC),
240 IMX_PINCTRL_PIN(MX25_PAD_LSCLK),
241 IMX_PINCTRL_PIN(MX25_PAD_OE_ACD),
242 IMX_PINCTRL_PIN(MX25_PAD_CONTRAST),
243 IMX_PINCTRL_PIN(MX25_PAD_PWM),
244 IMX_PINCTRL_PIN(MX25_PAD_CSI_D2),
245 IMX_PINCTRL_PIN(MX25_PAD_CSI_D3),
246 IMX_PINCTRL_PIN(MX25_PAD_CSI_D4),
247 IMX_PINCTRL_PIN(MX25_PAD_CSI_D5),
248 IMX_PINCTRL_PIN(MX25_PAD_CSI_D6),
249 IMX_PINCTRL_PIN(MX25_PAD_CSI_D7),
250 IMX_PINCTRL_PIN(MX25_PAD_CSI_D8),
251 IMX_PINCTRL_PIN(MX25_PAD_CSI_D9),
252 IMX_PINCTRL_PIN(MX25_PAD_CSI_MCLK),
253 IMX_PINCTRL_PIN(MX25_PAD_CSI_VSYNC),
254 IMX_PINCTRL_PIN(MX25_PAD_CSI_HSYNC),
255 IMX_PINCTRL_PIN(MX25_PAD_CSI_PIXCLK),
256 IMX_PINCTRL_PIN(MX25_PAD_I2C1_CLK),
257 IMX_PINCTRL_PIN(MX25_PAD_I2C1_DAT),
258 IMX_PINCTRL_PIN(MX25_PAD_CSPI1_MOSI),
259 IMX_PINCTRL_PIN(MX25_PAD_CSPI1_MISO),
260 IMX_PINCTRL_PIN(MX25_PAD_CSPI1_SS0),
261 IMX_PINCTRL_PIN(MX25_PAD_CSPI1_SS1),
262 IMX_PINCTRL_PIN(MX25_PAD_CSPI1_SCLK),
263 IMX_PINCTRL_PIN(MX25_PAD_CSPI1_RDY),
264 IMX_PINCTRL_PIN(MX25_PAD_UART1_RXD),
265 IMX_PINCTRL_PIN(MX25_PAD_UART1_TXD),
266 IMX_PINCTRL_PIN(MX25_PAD_UART1_RTS),
267 IMX_PINCTRL_PIN(MX25_PAD_UART1_CTS),
268 IMX_PINCTRL_PIN(MX25_PAD_UART2_RXD),
269 IMX_PINCTRL_PIN(MX25_PAD_UART2_TXD),
270 IMX_PINCTRL_PIN(MX25_PAD_UART2_RTS),
271 IMX_PINCTRL_PIN(MX25_PAD_UART2_CTS),
272 IMX_PINCTRL_PIN(MX25_PAD_SD1_CMD),
273 IMX_PINCTRL_PIN(MX25_PAD_SD1_CLK),
274 IMX_PINCTRL_PIN(MX25_PAD_SD1_DATA0),
275 IMX_PINCTRL_PIN(MX25_PAD_SD1_DATA1),
276 IMX_PINCTRL_PIN(MX25_PAD_SD1_DATA2),
277 IMX_PINCTRL_PIN(MX25_PAD_SD1_DATA3),
278 IMX_PINCTRL_PIN(MX25_PAD_KPP_ROW0),
279 IMX_PINCTRL_PIN(MX25_PAD_KPP_ROW1),
280 IMX_PINCTRL_PIN(MX25_PAD_KPP_ROW2),
281 IMX_PINCTRL_PIN(MX25_PAD_KPP_ROW3),
282 IMX_PINCTRL_PIN(MX25_PAD_KPP_COL0),
283 IMX_PINCTRL_PIN(MX25_PAD_KPP_COL1),
284 IMX_PINCTRL_PIN(MX25_PAD_KPP_COL2),
285 IMX_PINCTRL_PIN(MX25_PAD_KPP_COL3),
286 IMX_PINCTRL_PIN(MX25_PAD_FEC_MDC),
287 IMX_PINCTRL_PIN(MX25_PAD_FEC_MDIO),
288 IMX_PINCTRL_PIN(MX25_PAD_FEC_TDATA0),
289 IMX_PINCTRL_PIN(MX25_PAD_FEC_TDATA1),
290 IMX_PINCTRL_PIN(MX25_PAD_FEC_TX_EN),
291 IMX_PINCTRL_PIN(MX25_PAD_FEC_RDATA0),
292 IMX_PINCTRL_PIN(MX25_PAD_FEC_RDATA1),
293 IMX_PINCTRL_PIN(MX25_PAD_FEC_RX_DV),
294 IMX_PINCTRL_PIN(MX25_PAD_FEC_TX_CLK),
295 IMX_PINCTRL_PIN(MX25_PAD_RTCK),
296 IMX_PINCTRL_PIN(MX25_PAD_DE_B),
297 IMX_PINCTRL_PIN(MX25_PAD_GPIO_A),
298 IMX_PINCTRL_PIN(MX25_PAD_GPIO_B),
299 IMX_PINCTRL_PIN(MX25_PAD_GPIO_C),
300 IMX_PINCTRL_PIN(MX25_PAD_GPIO_D),
301 IMX_PINCTRL_PIN(MX25_PAD_GPIO_E),
302 IMX_PINCTRL_PIN(MX25_PAD_GPIO_F),
303 IMX_PINCTRL_PIN(MX25_PAD_EXT_ARMCLK),
304 IMX_PINCTRL_PIN(MX25_PAD_UPLL_BYPCLK),
305 IMX_PINCTRL_PIN(MX25_PAD_VSTBY_REQ),
306 IMX_PINCTRL_PIN(MX25_PAD_VSTBY_ACK),
307 IMX_PINCTRL_PIN(MX25_PAD_POWER_FAIL),
308 IMX_PINCTRL_PIN(MX25_PAD_CLKO),
309 IMX_PINCTRL_PIN(MX25_PAD_BOOT_MODE0),
310 IMX_PINCTRL_PIN(MX25_PAD_BOOT_MODE1),
311};
312
313static struct imx_pinctrl_soc_info imx25_pinctrl_info = {
314 .pins = imx25_pinctrl_pads,
315 .npins = ARRAY_SIZE(imx25_pinctrl_pads),
316};
317
Kiran Padwal5dfe10b2014-08-11 16:47:50 +0530318static const struct of_device_id imx25_pinctrl_of_match[] = {
Denis Cariklib4a87c92013-11-06 09:52:15 +0100319 { .compatible = "fsl,imx25-iomuxc", },
320 { /* sentinel */ }
321};
322
323static int imx25_pinctrl_probe(struct platform_device *pdev)
324{
325 return imx_pinctrl_probe(pdev, &imx25_pinctrl_info);
326}
327
328static struct platform_driver imx25_pinctrl_driver = {
329 .driver = {
330 .name = "imx25-pinctrl",
Denis Cariklib4a87c92013-11-06 09:52:15 +0100331 .of_match_table = of_match_ptr(imx25_pinctrl_of_match),
332 },
333 .probe = imx25_pinctrl_probe,
334 .remove = imx_pinctrl_remove,
335};
336
337static int __init imx25_pinctrl_init(void)
338{
339 return platform_driver_register(&imx25_pinctrl_driver);
340}
341arch_initcall(imx25_pinctrl_init);
342
343static void __exit imx25_pinctrl_exit(void)
344{
345 platform_driver_unregister(&imx25_pinctrl_driver);
346}
347module_exit(imx25_pinctrl_exit);
348MODULE_AUTHOR("Denis Carikli <denis@eukrea.com>");
349MODULE_DESCRIPTION("Freescale IMX25 pinctrl driver");
350MODULE_LICENSE("GPL v2");