1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0-or-later
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun * Marvell Armada 39x pinctrl driver based on mvebu pinctrl core
4*4882a593Smuzhiyun *
5*4882a593Smuzhiyun * Copyright (C) 2015 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/of.h>
15*4882a593Smuzhiyun #include <linux/of_device.h>
16*4882a593Smuzhiyun #include <linux/pinctrl/pinctrl.h>
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun #include "pinctrl-mvebu.h"
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun enum {
21*4882a593Smuzhiyun V_88F6920 = BIT(0),
22*4882a593Smuzhiyun V_88F6925 = BIT(1),
23*4882a593Smuzhiyun V_88F6928 = BIT(2),
24*4882a593Smuzhiyun V_88F6920_PLUS = (V_88F6920 | V_88F6925 | V_88F6928),
25*4882a593Smuzhiyun V_88F6925_PLUS = (V_88F6925 | V_88F6928),
26*4882a593Smuzhiyun };
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun static struct mvebu_mpp_mode armada_39x_mpp_modes[] = {
29*4882a593Smuzhiyun MPP_MODE(0,
30*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
31*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "ua0", "rxd", V_88F6920_PLUS)),
32*4882a593Smuzhiyun MPP_MODE(1,
33*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
34*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "ua0", "txd", V_88F6920_PLUS)),
35*4882a593Smuzhiyun MPP_MODE(2,
36*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
37*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "i2c0", "sck", V_88F6920_PLUS)),
38*4882a593Smuzhiyun MPP_MODE(3,
39*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
40*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "i2c0", "sda", V_88F6920_PLUS)),
41*4882a593Smuzhiyun MPP_MODE(4,
42*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
43*4882a593Smuzhiyun MPP_VAR_FUNCTION(2, "ua1", "txd", V_88F6920_PLUS),
44*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "ua0", "rts", V_88F6920_PLUS),
45*4882a593Smuzhiyun MPP_VAR_FUNCTION(7, "smi", "mdc", V_88F6920_PLUS)),
46*4882a593Smuzhiyun MPP_MODE(5,
47*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
48*4882a593Smuzhiyun MPP_VAR_FUNCTION(2, "ua1", "rxd", V_88F6920_PLUS),
49*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "ua0", "cts", V_88F6920_PLUS),
50*4882a593Smuzhiyun MPP_VAR_FUNCTION(7, "smi", "mdio", V_88F6920_PLUS)),
51*4882a593Smuzhiyun MPP_MODE(6,
52*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
53*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "cs3", V_88F6920_PLUS),
54*4882a593Smuzhiyun MPP_VAR_FUNCTION(7, "xsmi", "mdio", V_88F6920_PLUS)),
55*4882a593Smuzhiyun MPP_MODE(7,
56*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
57*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "ad9", V_88F6920_PLUS),
58*4882a593Smuzhiyun MPP_VAR_FUNCTION(7, "xsmi", "mdc", V_88F6920_PLUS)),
59*4882a593Smuzhiyun MPP_MODE(8,
60*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
61*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "ad10", V_88F6920_PLUS),
62*4882a593Smuzhiyun MPP_VAR_FUNCTION(7, "ptp", "trig", V_88F6920_PLUS)),
63*4882a593Smuzhiyun MPP_MODE(9,
64*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
65*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "ad11", V_88F6920_PLUS),
66*4882a593Smuzhiyun MPP_VAR_FUNCTION(7, "ptp", "clk", V_88F6920_PLUS)),
67*4882a593Smuzhiyun MPP_MODE(10,
68*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
69*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "ad12", V_88F6920_PLUS),
70*4882a593Smuzhiyun MPP_VAR_FUNCTION(7, "ptp", "evreq", V_88F6920_PLUS)),
71*4882a593Smuzhiyun MPP_MODE(11,
72*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
73*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "ad13", V_88F6920_PLUS),
74*4882a593Smuzhiyun MPP_VAR_FUNCTION(7, "led", "clk", V_88F6920_PLUS)),
75*4882a593Smuzhiyun MPP_MODE(12,
76*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
77*4882a593Smuzhiyun MPP_VAR_FUNCTION(2, "pcie0", "rstout", V_88F6920_PLUS),
78*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "ad14", V_88F6920_PLUS),
79*4882a593Smuzhiyun MPP_VAR_FUNCTION(7, "led", "stb", V_88F6920_PLUS)),
80*4882a593Smuzhiyun MPP_MODE(13,
81*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
82*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "ad15", V_88F6920_PLUS),
83*4882a593Smuzhiyun MPP_VAR_FUNCTION(6, "pcie2", "clkreq", V_88F6920_PLUS),
84*4882a593Smuzhiyun MPP_VAR_FUNCTION(7, "led", "data", V_88F6920_PLUS)),
85*4882a593Smuzhiyun MPP_MODE(14,
86*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
87*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "dram", "vttctrl", V_88F6920_PLUS),
88*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "we1", V_88F6920_PLUS),
89*4882a593Smuzhiyun MPP_VAR_FUNCTION(7, "ua1", "txd", V_88F6920_PLUS)),
90*4882a593Smuzhiyun MPP_MODE(15,
91*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
92*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "pcie0", "rstout", V_88F6920_PLUS),
93*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "spi0", "mosi", V_88F6920_PLUS),
94*4882a593Smuzhiyun MPP_VAR_FUNCTION(7, "i2c1", "sck", V_88F6920_PLUS)),
95*4882a593Smuzhiyun MPP_MODE(16,
96*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
97*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "dram", "deccerr", V_88F6920_PLUS),
98*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "spi0", "miso", V_88F6920_PLUS),
99*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "pcie0", "clkreq", V_88F6920_PLUS),
100*4882a593Smuzhiyun MPP_VAR_FUNCTION(7, "i2c1", "sda", V_88F6920_PLUS)),
101*4882a593Smuzhiyun MPP_MODE(17,
102*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
103*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "ua1", "rxd", V_88F6920_PLUS),
104*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "spi0", "sck", V_88F6920_PLUS),
105*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "sata1", "prsnt", V_88F6925_PLUS),
106*4882a593Smuzhiyun MPP_VAR_FUNCTION(6, "sata0", "prsnt", V_88F6925_PLUS),
107*4882a593Smuzhiyun MPP_VAR_FUNCTION(7, "smi", "mdio", V_88F6920_PLUS)),
108*4882a593Smuzhiyun MPP_MODE(18,
109*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
110*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "ua1", "txd", V_88F6920_PLUS),
111*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "spi0", "cs0", V_88F6920_PLUS),
112*4882a593Smuzhiyun MPP_VAR_FUNCTION(7, "i2c2", "sck", V_88F6920_PLUS)),
113*4882a593Smuzhiyun MPP_MODE(19,
114*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
115*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "sata1", "prsnt", V_88F6925_PLUS),
116*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "ua0", "cts", V_88F6920_PLUS),
117*4882a593Smuzhiyun MPP_VAR_FUNCTION(6, "ua1", "rxd", V_88F6920_PLUS),
118*4882a593Smuzhiyun MPP_VAR_FUNCTION(7, "i2c2", "sda", V_88F6920_PLUS)),
119*4882a593Smuzhiyun MPP_MODE(20,
120*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
121*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "sata0", "prsnt", V_88F6925_PLUS),
122*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "ua0", "rts", V_88F6920_PLUS),
123*4882a593Smuzhiyun MPP_VAR_FUNCTION(6, "ua1", "txd", V_88F6920_PLUS),
124*4882a593Smuzhiyun MPP_VAR_FUNCTION(7, "smi", "mdc", V_88F6920_PLUS)),
125*4882a593Smuzhiyun MPP_MODE(21,
126*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
127*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "spi0", "cs1", V_88F6920_PLUS),
128*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "sata0", "prsnt", V_88F6925_PLUS),
129*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "sd0", "cmd", V_88F6920_PLUS),
130*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "bootcs", V_88F6920_PLUS),
131*4882a593Smuzhiyun MPP_VAR_FUNCTION(6, "sata1", "prsnt", V_88F6925_PLUS),
132*4882a593Smuzhiyun MPP_VAR_FUNCTION(8, "ge", "rxd0", V_88F6920_PLUS)),
133*4882a593Smuzhiyun MPP_MODE(22,
134*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
135*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "spi0", "mosi", V_88F6920_PLUS),
136*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "ad0", V_88F6920_PLUS)),
137*4882a593Smuzhiyun MPP_MODE(23,
138*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
139*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "spi0", "sck", V_88F6920_PLUS),
140*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "ad2", V_88F6920_PLUS)),
141*4882a593Smuzhiyun MPP_MODE(24,
142*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
143*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "spi0", "miso", V_88F6920_PLUS),
144*4882a593Smuzhiyun MPP_VAR_FUNCTION(2, "ua0", "cts", V_88F6920_PLUS),
145*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "ua1", "rxd", V_88F6920_PLUS),
146*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "sd0", "d4", V_88F6920_PLUS),
147*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "ready", V_88F6920_PLUS)),
148*4882a593Smuzhiyun MPP_MODE(25,
149*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
150*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "spi0", "cs0", V_88F6920_PLUS),
151*4882a593Smuzhiyun MPP_VAR_FUNCTION(2, "ua0", "rts", V_88F6920_PLUS),
152*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "ua1", "txd", V_88F6920_PLUS),
153*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "sd0", "d5", V_88F6920_PLUS),
154*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "cs0", V_88F6920_PLUS)),
155*4882a593Smuzhiyun MPP_MODE(26,
156*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
157*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "spi0", "cs2", V_88F6920_PLUS),
158*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "i2c1", "sck", V_88F6920_PLUS),
159*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "sd0", "d6", V_88F6920_PLUS),
160*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "cs1", V_88F6920_PLUS)),
161*4882a593Smuzhiyun MPP_MODE(27,
162*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
163*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "spi0", "cs3", V_88F6920_PLUS),
164*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "i2c1", "sda", V_88F6920_PLUS),
165*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "sd0", "d7", V_88F6920_PLUS),
166*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "cs2", V_88F6920_PLUS),
167*4882a593Smuzhiyun MPP_VAR_FUNCTION(8, "ge", "txclkout", V_88F6920_PLUS)),
168*4882a593Smuzhiyun MPP_MODE(28,
169*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
170*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "sd0", "clk", V_88F6920_PLUS),
171*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "ad5", V_88F6920_PLUS),
172*4882a593Smuzhiyun MPP_VAR_FUNCTION(8, "ge", "txd0", V_88F6920_PLUS)),
173*4882a593Smuzhiyun MPP_MODE(29,
174*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
175*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "ale0", V_88F6920_PLUS),
176*4882a593Smuzhiyun MPP_VAR_FUNCTION(8, "ge", "txd1", V_88F6920_PLUS)),
177*4882a593Smuzhiyun MPP_MODE(30,
178*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
179*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "oe", V_88F6920_PLUS),
180*4882a593Smuzhiyun MPP_VAR_FUNCTION(8, "ge", "txd2", V_88F6920_PLUS)),
181*4882a593Smuzhiyun MPP_MODE(31,
182*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
183*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "ale1", V_88F6920_PLUS),
184*4882a593Smuzhiyun MPP_VAR_FUNCTION(8, "ge", "txd3", V_88F6920_PLUS)),
185*4882a593Smuzhiyun MPP_MODE(32,
186*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
187*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "we0", V_88F6920_PLUS),
188*4882a593Smuzhiyun MPP_VAR_FUNCTION(8, "ge", "txctl", V_88F6920_PLUS)),
189*4882a593Smuzhiyun MPP_MODE(33,
190*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
191*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "dram", "deccerr", V_88F6920_PLUS),
192*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "ad3", V_88F6920_PLUS)),
193*4882a593Smuzhiyun MPP_MODE(34,
194*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
195*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "ad1", V_88F6920_PLUS)),
196*4882a593Smuzhiyun MPP_MODE(35,
197*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
198*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "ref", "clk_out1", V_88F6920_PLUS),
199*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "a1", V_88F6920_PLUS)),
200*4882a593Smuzhiyun MPP_MODE(36,
201*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
202*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "a0", V_88F6920_PLUS)),
203*4882a593Smuzhiyun MPP_MODE(37,
204*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
205*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "sd0", "d3", V_88F6920_PLUS),
206*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "ad8", V_88F6920_PLUS),
207*4882a593Smuzhiyun MPP_VAR_FUNCTION(8, "ge", "rxclk", V_88F6920_PLUS)),
208*4882a593Smuzhiyun MPP_MODE(38,
209*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
210*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "ref", "clk_out0", V_88F6920_PLUS),
211*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "sd0", "d0", V_88F6920_PLUS),
212*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "ad4", V_88F6920_PLUS),
213*4882a593Smuzhiyun MPP_VAR_FUNCTION(8, "ge", "rxd1", V_88F6920_PLUS)),
214*4882a593Smuzhiyun MPP_MODE(39,
215*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
216*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "i2c1", "sck", V_88F6920_PLUS),
217*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "ua0", "cts", V_88F6920_PLUS),
218*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "sd0", "d1", V_88F6920_PLUS),
219*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "a2", V_88F6920_PLUS),
220*4882a593Smuzhiyun MPP_VAR_FUNCTION(8, "ge", "rxd2", V_88F6920_PLUS)),
221*4882a593Smuzhiyun MPP_MODE(40,
222*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
223*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "i2c1", "sda", V_88F6920_PLUS),
224*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "ua0", "rts", V_88F6920_PLUS),
225*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "sd0", "d2", V_88F6920_PLUS),
226*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "ad6", V_88F6920_PLUS),
227*4882a593Smuzhiyun MPP_VAR_FUNCTION(8, "ge", "rxd3", V_88F6920_PLUS)),
228*4882a593Smuzhiyun MPP_MODE(41,
229*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
230*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "ua1", "rxd", V_88F6920_PLUS),
231*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "ua0", "cts", V_88F6920_PLUS),
232*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "spi1", "cs3", V_88F6920_PLUS),
233*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "burst/last", V_88F6920_PLUS),
234*4882a593Smuzhiyun MPP_VAR_FUNCTION(6, "nand", "rb0", V_88F6920_PLUS),
235*4882a593Smuzhiyun MPP_VAR_FUNCTION(8, "ge", "rxctl", V_88F6920_PLUS)),
236*4882a593Smuzhiyun MPP_MODE(42,
237*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
238*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "ua1", "txd", V_88F6920_PLUS),
239*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "ua0", "rts", V_88F6920_PLUS),
240*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "ad7", V_88F6920_PLUS)),
241*4882a593Smuzhiyun MPP_MODE(43,
242*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
243*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "pcie0", "clkreq", V_88F6920_PLUS),
244*4882a593Smuzhiyun MPP_VAR_FUNCTION(2, "dram", "vttctrl", V_88F6920_PLUS),
245*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "dram", "deccerr", V_88F6920_PLUS),
246*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "spi1", "cs2", V_88F6920_PLUS),
247*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dev", "clkout", V_88F6920_PLUS),
248*4882a593Smuzhiyun MPP_VAR_FUNCTION(6, "nand", "rb1", V_88F6920_PLUS)),
249*4882a593Smuzhiyun MPP_MODE(44,
250*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
251*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "sata0", "prsnt", V_88F6925_PLUS),
252*4882a593Smuzhiyun MPP_VAR_FUNCTION(2, "sata1", "prsnt", V_88F6925_PLUS),
253*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "sata2", "prsnt", V_88F6928),
254*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "sata3", "prsnt", V_88F6928),
255*4882a593Smuzhiyun MPP_VAR_FUNCTION(7, "led", "clk", V_88F6920_PLUS)),
256*4882a593Smuzhiyun MPP_MODE(45,
257*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
258*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "ref", "clk_out0", V_88F6920_PLUS),
259*4882a593Smuzhiyun MPP_VAR_FUNCTION(2, "pcie0", "rstout", V_88F6920_PLUS),
260*4882a593Smuzhiyun MPP_VAR_FUNCTION(6, "ua1", "rxd", V_88F6920_PLUS)),
261*4882a593Smuzhiyun MPP_MODE(46,
262*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
263*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "ref", "clk_out1", V_88F6920_PLUS),
264*4882a593Smuzhiyun MPP_VAR_FUNCTION(2, "pcie0", "rstout", V_88F6920_PLUS),
265*4882a593Smuzhiyun MPP_VAR_FUNCTION(6, "ua1", "txd", V_88F6920_PLUS),
266*4882a593Smuzhiyun MPP_VAR_FUNCTION(7, "led", "stb", V_88F6920_PLUS)),
267*4882a593Smuzhiyun MPP_MODE(47,
268*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
269*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "sata0", "prsnt", V_88F6925_PLUS),
270*4882a593Smuzhiyun MPP_VAR_FUNCTION(2, "sata1", "prsnt", V_88F6925_PLUS),
271*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "sata2", "prsnt", V_88F6928),
272*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "sata3", "prsnt", V_88F6928),
273*4882a593Smuzhiyun MPP_VAR_FUNCTION(7, "led", "data", V_88F6920_PLUS)),
274*4882a593Smuzhiyun MPP_MODE(48,
275*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
276*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "sata0", "prsnt", V_88F6925_PLUS),
277*4882a593Smuzhiyun MPP_VAR_FUNCTION(2, "dram", "vttctrl", V_88F6920_PLUS),
278*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "tdm", "pclk", V_88F6928),
279*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "audio", "mclk", V_88F6928),
280*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "sd0", "d4", V_88F6920_PLUS),
281*4882a593Smuzhiyun MPP_VAR_FUNCTION(6, "pcie0", "clkreq", V_88F6920_PLUS),
282*4882a593Smuzhiyun MPP_VAR_FUNCTION(7, "ua1", "txd", V_88F6920_PLUS)),
283*4882a593Smuzhiyun MPP_MODE(49,
284*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
285*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "sata2", "prsnt", V_88F6928),
286*4882a593Smuzhiyun MPP_VAR_FUNCTION(2, "sata3", "prsnt", V_88F6928),
287*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "tdm", "fsync", V_88F6928),
288*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "audio", "lrclk", V_88F6928),
289*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "sd0", "d5", V_88F6920_PLUS),
290*4882a593Smuzhiyun MPP_VAR_FUNCTION(7, "ua2", "rxd", V_88F6920_PLUS)),
291*4882a593Smuzhiyun MPP_MODE(50,
292*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
293*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "pcie0", "rstout", V_88F6920_PLUS),
294*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "tdm", "drx", V_88F6928),
295*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "audio", "extclk", V_88F6928),
296*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "sd0", "cmd", V_88F6920_PLUS),
297*4882a593Smuzhiyun MPP_VAR_FUNCTION(7, "ua2", "rxd", V_88F6920_PLUS)),
298*4882a593Smuzhiyun MPP_MODE(51,
299*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
300*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "tdm", "dtx", V_88F6928),
301*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "audio", "sdo", V_88F6928),
302*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "dram", "deccerr", V_88F6920_PLUS),
303*4882a593Smuzhiyun MPP_VAR_FUNCTION(7, "ua2", "txd", V_88F6920_PLUS)),
304*4882a593Smuzhiyun MPP_MODE(52,
305*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
306*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "pcie0", "rstout", V_88F6920_PLUS),
307*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "tdm", "int", V_88F6928),
308*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "audio", "sdi", V_88F6928),
309*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "sd0", "d6", V_88F6920_PLUS),
310*4882a593Smuzhiyun MPP_VAR_FUNCTION(7, "i2c3", "sck", V_88F6920_PLUS)),
311*4882a593Smuzhiyun MPP_MODE(53,
312*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
313*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "sata1", "prsnt", V_88F6925_PLUS),
314*4882a593Smuzhiyun MPP_VAR_FUNCTION(2, "sata0", "prsnt", V_88F6925_PLUS),
315*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "tdm", "rst", V_88F6928),
316*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "audio", "bclk", V_88F6928),
317*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "sd0", "d7", V_88F6920_PLUS),
318*4882a593Smuzhiyun MPP_VAR_FUNCTION(7, "i2c3", "sda", V_88F6920_PLUS)),
319*4882a593Smuzhiyun MPP_MODE(54,
320*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
321*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "sata0", "prsnt", V_88F6925_PLUS),
322*4882a593Smuzhiyun MPP_VAR_FUNCTION(2, "sata1", "prsnt", V_88F6925_PLUS),
323*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "pcie0", "rstout", V_88F6920_PLUS),
324*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "sd0", "d3", V_88F6920_PLUS),
325*4882a593Smuzhiyun MPP_VAR_FUNCTION(7, "ua3", "txd", V_88F6920_PLUS)),
326*4882a593Smuzhiyun MPP_MODE(55,
327*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
328*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "ua1", "cts", V_88F6920_PLUS),
329*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "spi1", "cs1", V_88F6920_PLUS),
330*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "sd0", "d0", V_88F6920_PLUS),
331*4882a593Smuzhiyun MPP_VAR_FUNCTION(6, "ua1", "rxd", V_88F6920_PLUS),
332*4882a593Smuzhiyun MPP_VAR_FUNCTION(7, "ua3", "rxd", V_88F6920_PLUS)),
333*4882a593Smuzhiyun MPP_MODE(56,
334*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
335*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "ua1", "rts", V_88F6920_PLUS),
336*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "dram", "deccerr", V_88F6920_PLUS),
337*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "spi1", "mosi", V_88F6920_PLUS),
338*4882a593Smuzhiyun MPP_VAR_FUNCTION(6, "ua1", "txd", V_88F6920_PLUS)),
339*4882a593Smuzhiyun MPP_MODE(57,
340*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
341*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "spi1", "sck", V_88F6920_PLUS),
342*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "sd0", "clk", V_88F6920_PLUS),
343*4882a593Smuzhiyun MPP_VAR_FUNCTION(6, "ua1", "txd", V_88F6920_PLUS)),
344*4882a593Smuzhiyun MPP_MODE(58,
345*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
346*4882a593Smuzhiyun MPP_VAR_FUNCTION(2, "i2c1", "sck", V_88F6920_PLUS),
347*4882a593Smuzhiyun MPP_VAR_FUNCTION(3, "pcie2", "clkreq", V_88F6920_PLUS),
348*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "spi1", "miso", V_88F6920_PLUS),
349*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "sd0", "d1", V_88F6920_PLUS),
350*4882a593Smuzhiyun MPP_VAR_FUNCTION(6, "ua1", "rxd", V_88F6920_PLUS)),
351*4882a593Smuzhiyun MPP_MODE(59,
352*4882a593Smuzhiyun MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS),
353*4882a593Smuzhiyun MPP_VAR_FUNCTION(1, "pcie0", "rstout", V_88F6920_PLUS),
354*4882a593Smuzhiyun MPP_VAR_FUNCTION(2, "i2c1", "sda", V_88F6920_PLUS),
355*4882a593Smuzhiyun MPP_VAR_FUNCTION(4, "spi1", "cs0", V_88F6920_PLUS),
356*4882a593Smuzhiyun MPP_VAR_FUNCTION(5, "sd0", "d2", V_88F6920_PLUS)),
357*4882a593Smuzhiyun };
358*4882a593Smuzhiyun
359*4882a593Smuzhiyun static struct mvebu_pinctrl_soc_info armada_39x_pinctrl_info;
360*4882a593Smuzhiyun
361*4882a593Smuzhiyun static const struct of_device_id armada_39x_pinctrl_of_match[] = {
362*4882a593Smuzhiyun {
363*4882a593Smuzhiyun .compatible = "marvell,mv88f6920-pinctrl",
364*4882a593Smuzhiyun .data = (void *) V_88F6920,
365*4882a593Smuzhiyun },
366*4882a593Smuzhiyun {
367*4882a593Smuzhiyun .compatible = "marvell,mv88f6925-pinctrl",
368*4882a593Smuzhiyun .data = (void *) V_88F6925,
369*4882a593Smuzhiyun },
370*4882a593Smuzhiyun {
371*4882a593Smuzhiyun .compatible = "marvell,mv88f6928-pinctrl",
372*4882a593Smuzhiyun .data = (void *) V_88F6928,
373*4882a593Smuzhiyun },
374*4882a593Smuzhiyun { },
375*4882a593Smuzhiyun };
376*4882a593Smuzhiyun
377*4882a593Smuzhiyun static const struct mvebu_mpp_ctrl armada_39x_mpp_controls[] = {
378*4882a593Smuzhiyun MPP_FUNC_CTRL(0, 59, NULL, mvebu_mmio_mpp_ctrl),
379*4882a593Smuzhiyun };
380*4882a593Smuzhiyun
381*4882a593Smuzhiyun static struct pinctrl_gpio_range armada_39x_mpp_gpio_ranges[] = {
382*4882a593Smuzhiyun MPP_GPIO_RANGE(0, 0, 0, 32),
383*4882a593Smuzhiyun MPP_GPIO_RANGE(1, 32, 32, 28),
384*4882a593Smuzhiyun };
385*4882a593Smuzhiyun
armada_39x_pinctrl_probe(struct platform_device * pdev)386*4882a593Smuzhiyun static int armada_39x_pinctrl_probe(struct platform_device *pdev)
387*4882a593Smuzhiyun {
388*4882a593Smuzhiyun struct mvebu_pinctrl_soc_info *soc = &armada_39x_pinctrl_info;
389*4882a593Smuzhiyun const struct of_device_id *match =
390*4882a593Smuzhiyun of_match_device(armada_39x_pinctrl_of_match, &pdev->dev);
391*4882a593Smuzhiyun
392*4882a593Smuzhiyun if (!match)
393*4882a593Smuzhiyun return -ENODEV;
394*4882a593Smuzhiyun
395*4882a593Smuzhiyun soc->variant = (unsigned) match->data & 0xff;
396*4882a593Smuzhiyun soc->controls = armada_39x_mpp_controls;
397*4882a593Smuzhiyun soc->ncontrols = ARRAY_SIZE(armada_39x_mpp_controls);
398*4882a593Smuzhiyun soc->gpioranges = armada_39x_mpp_gpio_ranges;
399*4882a593Smuzhiyun soc->ngpioranges = ARRAY_SIZE(armada_39x_mpp_gpio_ranges);
400*4882a593Smuzhiyun soc->modes = armada_39x_mpp_modes;
401*4882a593Smuzhiyun soc->nmodes = armada_39x_mpp_controls[0].npins;
402*4882a593Smuzhiyun
403*4882a593Smuzhiyun pdev->dev.platform_data = soc;
404*4882a593Smuzhiyun
405*4882a593Smuzhiyun return mvebu_pinctrl_simple_mmio_probe(pdev);
406*4882a593Smuzhiyun }
407*4882a593Smuzhiyun
408*4882a593Smuzhiyun static struct platform_driver armada_39x_pinctrl_driver = {
409*4882a593Smuzhiyun .driver = {
410*4882a593Smuzhiyun .name = "armada-39x-pinctrl",
411*4882a593Smuzhiyun .of_match_table = of_match_ptr(armada_39x_pinctrl_of_match),
412*4882a593Smuzhiyun },
413*4882a593Smuzhiyun .probe = armada_39x_pinctrl_probe,
414*4882a593Smuzhiyun };
415*4882a593Smuzhiyun builtin_platform_driver(armada_39x_pinctrl_driver);
416