12874c5fdSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later
2ce3ed59dSThomas Petazzoni /*
3ce3ed59dSThomas Petazzoni  * Marvell Armada 375 pinctrl driver based on mvebu pinctrl core
4ce3ed59dSThomas Petazzoni  *
5ce3ed59dSThomas Petazzoni  * Copyright (C) 2012 Marvell
6ce3ed59dSThomas Petazzoni  *
7ce3ed59dSThomas Petazzoni  * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
8ce3ed59dSThomas Petazzoni  */
9ce3ed59dSThomas Petazzoni 
10ce3ed59dSThomas Petazzoni #include <linux/err.h>
11ce3ed59dSThomas Petazzoni #include <linux/init.h>
12ce3ed59dSThomas Petazzoni #include <linux/io.h>
13ce3ed59dSThomas Petazzoni #include <linux/platform_device.h>
14ce3ed59dSThomas Petazzoni #include <linux/clk.h>
15ce3ed59dSThomas Petazzoni #include <linux/of.h>
16ce3ed59dSThomas Petazzoni #include <linux/pinctrl/pinctrl.h>
17ce3ed59dSThomas Petazzoni 
18ce3ed59dSThomas Petazzoni #include "pinctrl-mvebu.h"
19ce3ed59dSThomas Petazzoni 
20ce3ed59dSThomas Petazzoni static struct mvebu_mpp_mode mv88f6720_mpp_modes[] = {
21ce3ed59dSThomas Petazzoni 	MPP_MODE(0,
22ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
23ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "dev", "ad2"),
24ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "spi0", "cs1"),
25ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "spi1", "cs1"),
26ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "nand", "io2")),
27ce3ed59dSThomas Petazzoni 	MPP_MODE(1,
28ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
29ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "dev", "ad3"),
30ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "spi0", "mosi"),
31ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "spi1", "mosi"),
32ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "nand", "io3")),
33ce3ed59dSThomas Petazzoni 	MPP_MODE(2,
34ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
35ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "dev", "ad4"),
369540cf53SThomas Petazzoni 		 MPP_FUNCTION(0x2, "ptp", "evreq"),
37ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "led", "c0"),
38ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x4, "audio", "sdi"),
39ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "nand", "io4"),
40ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x6, "spi1", "mosi")),
41ce3ed59dSThomas Petazzoni 	MPP_MODE(3,
42ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
43ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "dev", "ad5"),
449540cf53SThomas Petazzoni 		 MPP_FUNCTION(0x2, "ptp", "trig"),
45ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "led", "p3"),
46ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x4, "audio", "mclk"),
47ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "nand", "io5"),
48ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x6, "spi1", "miso")),
49ce3ed59dSThomas Petazzoni 	MPP_MODE(4,
50ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
51ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "dev", "ad6"),
52ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "spi0", "miso"),
53ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "spi1", "miso"),
54ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "nand", "io6")),
55ce3ed59dSThomas Petazzoni 	MPP_MODE(5,
56ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
57ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "dev", "ad7"),
58ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "spi0", "cs2"),
59ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "spi1", "cs2"),
60ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "nand", "io7"),
61ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x6, "spi1", "miso")),
62ce3ed59dSThomas Petazzoni 	MPP_MODE(6,
63ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
64ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "dev", "ad0"),
65ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "led", "p1"),
66f32f01e1SThomas Petazzoni 		 MPP_FUNCTION(0x4, "audio", "lrclk"),
67ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "nand", "io0")),
68ce3ed59dSThomas Petazzoni 	MPP_MODE(7,
69ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
70ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "dev", "ad1"),
71ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "ptp", "clk"),
72ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "led", "p2"),
73ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x4, "audio", "extclk"),
74ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "nand", "io1")),
75ce3ed59dSThomas Petazzoni 	MPP_MODE(8,
76ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
77ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "dev", "bootcs"),
78ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "spi0", "cs0"),
79ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "spi1", "cs0"),
80ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "nand", "ce")),
81ce3ed59dSThomas Petazzoni 	MPP_MODE(9,
82ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
83ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "spi0", "sck"),
84ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "spi1", "sck"),
85ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "nand", "we")),
86ce3ed59dSThomas Petazzoni 	MPP_MODE(10,
87ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
88ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "dram", "vttctrl"),
89ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "led", "c1"),
90ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "nand", "re"),
91ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x6, "spi1", "sck")),
92ce3ed59dSThomas Petazzoni 	MPP_MODE(11,
93ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
94ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "dev", "a0"),
95ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "led", "c2"),
96ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x4, "audio", "sdo"),
97ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "nand", "cle")),
98ce3ed59dSThomas Petazzoni 	MPP_MODE(12,
99ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
100ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "dev", "a1"),
101ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x4, "audio", "bclk"),
102ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "nand", "ale")),
103ce3ed59dSThomas Petazzoni 	MPP_MODE(13,
104ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
1057bd6a26dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "dev", "ready"),
106d4974c16SThomas Petazzoni 		 MPP_FUNCTION(0x2, "pcie0", "rstout"),
107d4974c16SThomas Petazzoni 		 MPP_FUNCTION(0x3, "pcie1", "rstout"),
108ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "nand", "rb"),
109ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x6, "spi1", "mosi")),
110ce3ed59dSThomas Petazzoni 	MPP_MODE(14,
111ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
112ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "i2c0", "sda"),
113ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "uart1", "txd")),
114ce3ed59dSThomas Petazzoni 	MPP_MODE(15,
115ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
116ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "i2c0", "sck"),
117ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "uart1", "rxd")),
118ce3ed59dSThomas Petazzoni 	MPP_MODE(16,
119ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
120ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "uart0", "txd")),
121ce3ed59dSThomas Petazzoni 	MPP_MODE(17,
122ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
123ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "uart0", "rxd")),
124ce3ed59dSThomas Petazzoni 	MPP_MODE(18,
125ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
126dae5597fSThomas Petazzoni 		 MPP_FUNCTION(0x2, "tdm", "int")),
127ce3ed59dSThomas Petazzoni 	MPP_MODE(19,
128ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
129dae5597fSThomas Petazzoni 		 MPP_FUNCTION(0x2, "tdm", "rst")),
130ce3ed59dSThomas Petazzoni 	MPP_MODE(20,
131ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
132ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "tdm", "pclk")),
133ce3ed59dSThomas Petazzoni 	MPP_MODE(21,
134ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
135ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "tdm", "fsync")),
136ce3ed59dSThomas Petazzoni 	MPP_MODE(22,
137ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
138ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "tdm", "drx")),
139ce3ed59dSThomas Petazzoni 	MPP_MODE(23,
140ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
141ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "tdm", "dtx")),
142ce3ed59dSThomas Petazzoni 	MPP_MODE(24,
143ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
144ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "led", "p0"),
145ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "ge1", "rxd0"),
146ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "sd", "cmd"),
147ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x4, "uart0", "rts"),
148ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "spi0", "cs0"),
149ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x6, "dev", "cs1")),
150ce3ed59dSThomas Petazzoni 	MPP_MODE(25,
151ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
152ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "led", "p2"),
153ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "ge1", "rxd1"),
154ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "sd", "d0"),
155ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x4, "uart0", "cts"),
156ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "spi0", "mosi"),
157ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x6, "dev", "cs2")),
158ce3ed59dSThomas Petazzoni 	MPP_MODE(26,
159ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
160ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "pcie0", "clkreq"),
161ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "ge1", "rxd2"),
162ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "sd", "d2"),
163ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x4, "uart1", "rts"),
164ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "spi0", "cs1"),
165ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x6, "led", "c1")),
166ce3ed59dSThomas Petazzoni 	MPP_MODE(27,
167ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
168ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "pcie1", "clkreq"),
169ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "ge1", "rxd3"),
170ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "sd", "d1"),
171ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x4, "uart1", "cts"),
172ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "spi0", "miso"),
173ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x6, "led", "c2")),
174ce3ed59dSThomas Petazzoni 	MPP_MODE(28,
175ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
176ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "led", "p3"),
177ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "ge1", "txctl"),
178ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "sd", "clk"),
179ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "dram", "vttctrl")),
180ce3ed59dSThomas Petazzoni 	MPP_MODE(29,
181ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
182ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "pcie1", "clkreq"),
183ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "ge1", "rxclk"),
184ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "sd", "d3"),
185ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "spi0", "sck"),
186d4974c16SThomas Petazzoni 		 MPP_FUNCTION(0x6, "pcie0", "rstout")),
187ce3ed59dSThomas Petazzoni 	MPP_MODE(30,
188ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
189ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "ge1", "txd0"),
190ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "spi1", "cs0"),
191ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "led", "p3"),
1929540cf53SThomas Petazzoni 		 MPP_FUNCTION(0x6, "ptp", "evreq")),
193ce3ed59dSThomas Petazzoni 	MPP_MODE(31,
194ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
195ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "ge1", "txd1"),
196ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "spi1", "mosi"),
197ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "led", "p0")),
198ce3ed59dSThomas Petazzoni 	MPP_MODE(32,
199ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
200ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "ge1", "txd2"),
201ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "spi1", "sck"),
2029540cf53SThomas Petazzoni 		 MPP_FUNCTION(0x4, "ptp", "trig"),
203ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "led", "c0")),
204ce3ed59dSThomas Petazzoni 	MPP_MODE(33,
205ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
206ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "ge1", "txd3"),
207ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "spi1", "miso"),
208ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "led", "p2")),
209ce3ed59dSThomas Petazzoni 	MPP_MODE(34,
210ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
211ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "ge1", "txclkout"),
212ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "spi1", "sck"),
213ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "led", "c1")),
214ce3ed59dSThomas Petazzoni 	MPP_MODE(35,
215ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
216ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "ge1", "rxctl"),
217ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "spi1", "cs1"),
218ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x4, "spi0", "cs2"),
219ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "led", "p1")),
220ce3ed59dSThomas Petazzoni 	MPP_MODE(36,
221ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
222ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "pcie0", "clkreq"),
223ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "led", "c2")),
224ce3ed59dSThomas Petazzoni 	MPP_MODE(37,
225ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
226ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "pcie0", "clkreq"),
227dae5597fSThomas Petazzoni 		 MPP_FUNCTION(0x2, "tdm", "int"),
228ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x4, "ge", "mdc")),
229ce3ed59dSThomas Petazzoni 	MPP_MODE(38,
230ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
231ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "pcie1", "clkreq"),
232ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x4, "ge", "mdio")),
233ce3ed59dSThomas Petazzoni 	MPP_MODE(39,
234ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
235ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x4, "ref", "clkout"),
236ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "led", "p3")),
237ce3ed59dSThomas Petazzoni 	MPP_MODE(40,
238ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
239ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x4, "uart1", "txd"),
240ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "led", "p0")),
241ce3ed59dSThomas Petazzoni 	MPP_MODE(41,
242ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
243ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x4, "uart1", "rxd"),
244ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "led", "p1")),
245ce3ed59dSThomas Petazzoni 	MPP_MODE(42,
246ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
247ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "spi1", "cs2"),
248ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x4, "led", "c0"),
249ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x6, "ptp", "clk")),
250ce3ed59dSThomas Petazzoni 	MPP_MODE(43,
251ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
252ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "sata0", "prsnt"),
253ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x4, "dram", "vttctrl"),
254ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "led", "c1")),
255ce3ed59dSThomas Petazzoni 	MPP_MODE(44,
256ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
257ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x4, "sata0", "prsnt")),
258ce3ed59dSThomas Petazzoni 	MPP_MODE(45,
259ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
260ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "spi0", "cs2"),
261d4974c16SThomas Petazzoni 		 MPP_FUNCTION(0x4, "pcie0", "rstout"),
262ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "led", "c2"),
263ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x6, "spi1", "cs2")),
264ce3ed59dSThomas Petazzoni 	MPP_MODE(46,
265ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
266ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "led", "p0"),
267ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "ge0", "txd0"),
268ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "ge1", "txd0"),
2697bd6a26dSThomas Petazzoni 		 MPP_FUNCTION(0x6, "dev", "we1")),
270ce3ed59dSThomas Petazzoni 	MPP_MODE(47,
271ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
272ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "led", "p1"),
273ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "ge0", "txd1"),
274ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "ge1", "txd1"),
2759540cf53SThomas Petazzoni 		 MPP_FUNCTION(0x5, "ptp", "trig"),
276ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x6, "dev", "ale0")),
277ce3ed59dSThomas Petazzoni 	MPP_MODE(48,
278ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
279ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "led", "p2"),
280ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "ge0", "txd2"),
281ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "ge1", "txd2"),
282ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x6, "dev", "ale1")),
283ce3ed59dSThomas Petazzoni 	MPP_MODE(49,
284ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
285ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "led", "p3"),
286ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "ge0", "txd3"),
287ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "ge1", "txd3"),
288ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x6, "dev", "a2")),
289ce3ed59dSThomas Petazzoni 	MPP_MODE(50,
290ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
291ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "led", "c0"),
292ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "ge0", "rxd0"),
293ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "ge1", "rxd0"),
2949540cf53SThomas Petazzoni 		 MPP_FUNCTION(0x5, "ptp", "evreq"),
295ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x6, "dev", "ad12")),
296ce3ed59dSThomas Petazzoni 	MPP_MODE(51,
297ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
298ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "led", "c1"),
299ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "ge0", "rxd1"),
300ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "ge1", "rxd1"),
301ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x6, "dev", "ad8")),
302ce3ed59dSThomas Petazzoni 	MPP_MODE(52,
303ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
304ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "led", "c2"),
305ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "ge0", "rxd2"),
306ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "ge1", "rxd2"),
307ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "i2c0", "sda"),
308ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x6, "dev", "ad9")),
309ce3ed59dSThomas Petazzoni 	MPP_MODE(53,
310ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
311d4974c16SThomas Petazzoni 		 MPP_FUNCTION(0x1, "pcie1", "rstout"),
312ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "ge0", "rxd3"),
313ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "ge1", "rxd3"),
314ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x5, "i2c0", "sck"),
315ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x6, "dev", "ad10")),
316ce3ed59dSThomas Petazzoni 	MPP_MODE(54,
317ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
318d4974c16SThomas Petazzoni 		 MPP_FUNCTION(0x1, "pcie0", "rstout"),
319ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "ge0", "rxctl"),
320ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "ge1", "rxctl"),
321ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x6, "dev", "ad11")),
322ce3ed59dSThomas Petazzoni 	MPP_MODE(55,
323ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
324ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "ge0", "rxclk"),
325ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "ge1", "rxclk"),
326ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x6, "dev", "cs0")),
327ce3ed59dSThomas Petazzoni 	MPP_MODE(56,
328ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
329ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "ge0", "txclkout"),
330ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "ge1", "txclkout"),
331ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x6, "dev", "oe")),
332ce3ed59dSThomas Petazzoni 	MPP_MODE(57,
333ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
334ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "ge0", "txctl"),
335ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "ge1", "txctl"),
3367bd6a26dSThomas Petazzoni 		 MPP_FUNCTION(0x6, "dev", "we0")),
337ce3ed59dSThomas Petazzoni 	MPP_MODE(58,
338ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
339ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x4, "led", "c0")),
340ce3ed59dSThomas Petazzoni 	MPP_MODE(59,
341ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
342ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x4, "led", "c1")),
343ce3ed59dSThomas Petazzoni 	MPP_MODE(60,
344ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
345ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "uart1", "txd"),
346ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x4, "led", "c2"),
347ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x6, "dev", "ad13")),
348ce3ed59dSThomas Petazzoni 	MPP_MODE(61,
349ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
350ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "i2c1", "sda"),
351ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "uart1", "rxd"),
352ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x3, "spi1", "cs2"),
353ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x4, "led", "p0"),
354ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x6, "dev", "ad14")),
355ce3ed59dSThomas Petazzoni 	MPP_MODE(62,
356ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
357ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "i2c1", "sck"),
358ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x4, "led", "p1"),
359ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x6, "dev", "ad15")),
360ce3ed59dSThomas Petazzoni 	MPP_MODE(63,
361ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
3629540cf53SThomas Petazzoni 		 MPP_FUNCTION(0x2, "ptp", "trig"),
363ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x4, "led", "p2"),
3647bd6a26dSThomas Petazzoni 		 MPP_FUNCTION(0x6, "dev", "burst/last")),
365ce3ed59dSThomas Petazzoni 	MPP_MODE(64,
366ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
367ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x2, "dram", "vttctrl"),
368ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x4, "led", "p3")),
369ce3ed59dSThomas Petazzoni 	MPP_MODE(65,
370ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
371ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x1, "sata1", "prsnt")),
372ce3ed59dSThomas Petazzoni 	MPP_MODE(66,
373ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x0, "gpio", NULL),
3749540cf53SThomas Petazzoni 		 MPP_FUNCTION(0x2, "ptp", "evreq"),
375ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x4, "spi1", "cs3"),
376d4974c16SThomas Petazzoni 		 MPP_FUNCTION(0x5, "pcie0", "rstout"),
377ce3ed59dSThomas Petazzoni 		 MPP_FUNCTION(0x6, "dev", "cs3")),
378ce3ed59dSThomas Petazzoni };
379ce3ed59dSThomas Petazzoni 
380ce3ed59dSThomas Petazzoni static struct mvebu_pinctrl_soc_info armada_375_pinctrl_info;
381ce3ed59dSThomas Petazzoni 
382baa9946eSFabian Frederick static const struct of_device_id armada_375_pinctrl_of_match[] = {
383ce3ed59dSThomas Petazzoni 	{ .compatible = "marvell,mv88f6720-pinctrl" },
384ce3ed59dSThomas Petazzoni 	{ },
385ce3ed59dSThomas Petazzoni };
386ce3ed59dSThomas Petazzoni 
38730be3fb9SRussell King static const struct mvebu_mpp_ctrl mv88f6720_mpp_controls[] = {
388ad9ec4ecSRussell King 	MPP_FUNC_CTRL(0, 69, NULL, mvebu_mmio_mpp_ctrl),
389ce3ed59dSThomas Petazzoni };
390ce3ed59dSThomas Petazzoni 
391ce3ed59dSThomas Petazzoni static struct pinctrl_gpio_range mv88f6720_mpp_gpio_ranges[] = {
392ce3ed59dSThomas Petazzoni 	MPP_GPIO_RANGE(0,   0,  0, 32),
393ce3ed59dSThomas Petazzoni 	MPP_GPIO_RANGE(1,  32, 32, 32),
394ce3ed59dSThomas Petazzoni 	MPP_GPIO_RANGE(2,  64, 64,  3),
395ce3ed59dSThomas Petazzoni };
396ce3ed59dSThomas Petazzoni 
armada_375_pinctrl_probe(struct platform_device * pdev)397ce3ed59dSThomas Petazzoni static int armada_375_pinctrl_probe(struct platform_device *pdev)
398ce3ed59dSThomas Petazzoni {
399ce3ed59dSThomas Petazzoni 	struct mvebu_pinctrl_soc_info *soc = &armada_375_pinctrl_info;
400ce3ed59dSThomas Petazzoni 
401ce3ed59dSThomas Petazzoni 	soc->variant = 0; /* no variants for Armada 375 */
402ce3ed59dSThomas Petazzoni 	soc->controls = mv88f6720_mpp_controls;
403ce3ed59dSThomas Petazzoni 	soc->ncontrols = ARRAY_SIZE(mv88f6720_mpp_controls);
404ce3ed59dSThomas Petazzoni 	soc->modes = mv88f6720_mpp_modes;
405ce3ed59dSThomas Petazzoni 	soc->nmodes = ARRAY_SIZE(mv88f6720_mpp_modes);
406ce3ed59dSThomas Petazzoni 	soc->gpioranges = mv88f6720_mpp_gpio_ranges;
407ce3ed59dSThomas Petazzoni 	soc->ngpioranges = ARRAY_SIZE(mv88f6720_mpp_gpio_ranges);
408ce3ed59dSThomas Petazzoni 
409ce3ed59dSThomas Petazzoni 	pdev->dev.platform_data = soc;
410ce3ed59dSThomas Petazzoni 
411ad9ec4ecSRussell King 	return mvebu_pinctrl_simple_mmio_probe(pdev);
412ce3ed59dSThomas Petazzoni }
413ce3ed59dSThomas Petazzoni 
414ce3ed59dSThomas Petazzoni static struct platform_driver armada_375_pinctrl_driver = {
415ce3ed59dSThomas Petazzoni 	.driver = {
416ce3ed59dSThomas Petazzoni 		.name = "armada-375-pinctrl",
417ce3ed59dSThomas Petazzoni 		.of_match_table = of_match_ptr(armada_375_pinctrl_of_match),
418ce3ed59dSThomas Petazzoni 	},
419ce3ed59dSThomas Petazzoni 	.probe = armada_375_pinctrl_probe,
420ce3ed59dSThomas Petazzoni };
421fdbde81bSPaul Gortmaker builtin_platform_driver(armada_375_pinctrl_driver);
422