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