xref: /OK3568_Linux_fs/kernel/drivers/pinctrl/mvebu/pinctrl-armada-xp.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0-or-later
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Marvell Armada XP 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  * This file supports the three variants of Armada XP SoCs that are
10*4882a593Smuzhiyun  * available: mv78230, mv78260 and mv78460. From a pin muxing
11*4882a593Smuzhiyun  * perspective, the mv78230 has 49 MPP pins. The mv78260 and mv78460
12*4882a593Smuzhiyun  * both have 67 MPP pins (more GPIOs and address lines for the memory
13*4882a593Smuzhiyun  * bus mainly).
14*4882a593Smuzhiyun  */
15*4882a593Smuzhiyun 
16*4882a593Smuzhiyun #include <linux/err.h>
17*4882a593Smuzhiyun #include <linux/init.h>
18*4882a593Smuzhiyun #include <linux/io.h>
19*4882a593Smuzhiyun #include <linux/platform_device.h>
20*4882a593Smuzhiyun #include <linux/clk.h>
21*4882a593Smuzhiyun #include <linux/of.h>
22*4882a593Smuzhiyun #include <linux/of_device.h>
23*4882a593Smuzhiyun #include <linux/pinctrl/pinctrl.h>
24*4882a593Smuzhiyun #include <linux/bitops.h>
25*4882a593Smuzhiyun 
26*4882a593Smuzhiyun #include "pinctrl-mvebu.h"
27*4882a593Smuzhiyun 
28*4882a593Smuzhiyun static u32 *mpp_saved_regs;
29*4882a593Smuzhiyun 
30*4882a593Smuzhiyun enum armada_xp_variant {
31*4882a593Smuzhiyun 	V_MV78230	= BIT(0),
32*4882a593Smuzhiyun 	V_MV78260	= BIT(1),
33*4882a593Smuzhiyun 	V_MV78460	= BIT(2),
34*4882a593Smuzhiyun 	V_MV78230_PLUS	= (V_MV78230 | V_MV78260 | V_MV78460),
35*4882a593Smuzhiyun 	V_MV78260_PLUS	= (V_MV78260 | V_MV78460),
36*4882a593Smuzhiyun 	V_98DX3236	= BIT(3),
37*4882a593Smuzhiyun 	V_98DX3336	= BIT(4),
38*4882a593Smuzhiyun 	V_98DX4251	= BIT(5),
39*4882a593Smuzhiyun 	V_98DX3236_PLUS	= (V_98DX3236 | V_98DX3336 | V_98DX4251),
40*4882a593Smuzhiyun };
41*4882a593Smuzhiyun 
42*4882a593Smuzhiyun static struct mvebu_mpp_mode armada_xp_mpp_modes[] = {
43*4882a593Smuzhiyun 	MPP_MODE(0,
44*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
45*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "ge0", "txclkout",   V_MV78230_PLUS),
46*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "d0",         V_MV78230_PLUS)),
47*4882a593Smuzhiyun 	MPP_MODE(1,
48*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
49*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "ge0", "txd0",       V_MV78230_PLUS),
50*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "d1",         V_MV78230_PLUS)),
51*4882a593Smuzhiyun 	MPP_MODE(2,
52*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
53*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "ge0", "txd1",       V_MV78230_PLUS),
54*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "d2",         V_MV78230_PLUS)),
55*4882a593Smuzhiyun 	MPP_MODE(3,
56*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
57*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "ge0", "txd2",       V_MV78230_PLUS),
58*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "d3",         V_MV78230_PLUS)),
59*4882a593Smuzhiyun 	MPP_MODE(4,
60*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
61*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "ge0", "txd3",       V_MV78230_PLUS),
62*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "d4",         V_MV78230_PLUS)),
63*4882a593Smuzhiyun 	MPP_MODE(5,
64*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
65*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "ge0", "txctl",      V_MV78230_PLUS),
66*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "d5",         V_MV78230_PLUS)),
67*4882a593Smuzhiyun 	MPP_MODE(6,
68*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
69*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "ge0", "rxd0",       V_MV78230_PLUS),
70*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "d6",         V_MV78230_PLUS)),
71*4882a593Smuzhiyun 	MPP_MODE(7,
72*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
73*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "ge0", "rxd1",       V_MV78230_PLUS),
74*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "d7",         V_MV78230_PLUS)),
75*4882a593Smuzhiyun 	MPP_MODE(8,
76*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
77*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "ge0", "rxd2",       V_MV78230_PLUS),
78*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "d8",         V_MV78230_PLUS)),
79*4882a593Smuzhiyun 	MPP_MODE(9,
80*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
81*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "ge0", "rxd3",       V_MV78230_PLUS),
82*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "d9",         V_MV78230_PLUS)),
83*4882a593Smuzhiyun 	MPP_MODE(10,
84*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
85*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "ge0", "rxctl",      V_MV78230_PLUS),
86*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "d10",        V_MV78230_PLUS)),
87*4882a593Smuzhiyun 	MPP_MODE(11,
88*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
89*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "ge0", "rxclk",      V_MV78230_PLUS),
90*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "d11",        V_MV78230_PLUS)),
91*4882a593Smuzhiyun 	MPP_MODE(12,
92*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
93*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "ge0", "txd4",       V_MV78230_PLUS),
94*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "ge1", "txclkout",   V_MV78230_PLUS),
95*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "d12",        V_MV78230_PLUS)),
96*4882a593Smuzhiyun 	MPP_MODE(13,
97*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
98*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "ge0", "txd5",       V_MV78230_PLUS),
99*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "ge1", "txd0",       V_MV78230_PLUS),
100*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "spi1", "mosi",      V_MV78230_PLUS),
101*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "d13",        V_MV78230_PLUS)),
102*4882a593Smuzhiyun 	MPP_MODE(14,
103*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
104*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "ge0", "txd6",       V_MV78230_PLUS),
105*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "ge1", "txd1",       V_MV78230_PLUS),
106*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "spi1", "sck",       V_MV78230_PLUS),
107*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "d14",        V_MV78230_PLUS)),
108*4882a593Smuzhiyun 	MPP_MODE(15,
109*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
110*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "ge0", "txd7",       V_MV78230_PLUS),
111*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "ge1", "txd2",       V_MV78230_PLUS),
112*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "d15",        V_MV78230_PLUS)),
113*4882a593Smuzhiyun 	MPP_MODE(16,
114*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
115*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "ge0", "txclk",      V_MV78230_PLUS),
116*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "ge1", "txd3",       V_MV78230_PLUS),
117*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "spi1", "cs0",       V_MV78230_PLUS),
118*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "d16",        V_MV78230_PLUS)),
119*4882a593Smuzhiyun 	MPP_MODE(17,
120*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
121*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "ge0", "col",        V_MV78230_PLUS),
122*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "ge1", "txctl",      V_MV78230_PLUS),
123*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "spi1", "miso",      V_MV78230_PLUS),
124*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "d17",        V_MV78230_PLUS)),
125*4882a593Smuzhiyun 	MPP_MODE(18,
126*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
127*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "ge0", "rxerr",      V_MV78230_PLUS),
128*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "ge1", "rxd0",       V_MV78230_PLUS),
129*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "ptp", "trig",       V_MV78230_PLUS),
130*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "d18",        V_MV78230_PLUS)),
131*4882a593Smuzhiyun 	MPP_MODE(19,
132*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
133*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "ge0", "crs",        V_MV78230_PLUS),
134*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "ge1", "rxd1",       V_MV78230_PLUS),
135*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "ptp", "evreq",      V_MV78230_PLUS),
136*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "d19",        V_MV78230_PLUS)),
137*4882a593Smuzhiyun 	MPP_MODE(20,
138*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
139*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "ge0", "rxd4",       V_MV78230_PLUS),
140*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "ge1", "rxd2",       V_MV78230_PLUS),
141*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "ptp", "clk",        V_MV78230_PLUS),
142*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "d20",        V_MV78230_PLUS)),
143*4882a593Smuzhiyun 	MPP_MODE(21,
144*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
145*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "ge0", "rxd5",       V_MV78230_PLUS),
146*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "ge1", "rxd3",       V_MV78230_PLUS),
147*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "dram", "bat",       V_MV78230_PLUS),
148*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "d21",        V_MV78230_PLUS)),
149*4882a593Smuzhiyun 	MPP_MODE(22,
150*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
151*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "ge0", "rxd6",       V_MV78230_PLUS),
152*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "ge1", "rxctl",      V_MV78230_PLUS),
153*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "sata0", "prsnt",    V_MV78230_PLUS),
154*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "d22",        V_MV78230_PLUS)),
155*4882a593Smuzhiyun 	MPP_MODE(23,
156*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
157*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "ge0", "rxd7",       V_MV78230_PLUS),
158*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "ge1", "rxclk",      V_MV78230_PLUS),
159*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "sata1", "prsnt",    V_MV78230_PLUS),
160*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "d23",        V_MV78230_PLUS)),
161*4882a593Smuzhiyun 	MPP_MODE(24,
162*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
163*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "sata1", "prsnt",    V_MV78230_PLUS),
164*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "tdm", "rst",        V_MV78230_PLUS),
165*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "hsync",      V_MV78230_PLUS)),
166*4882a593Smuzhiyun 	MPP_MODE(25,
167*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
168*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "sata0", "prsnt",    V_MV78230_PLUS),
169*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "tdm", "pclk",       V_MV78230_PLUS),
170*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "vsync",      V_MV78230_PLUS)),
171*4882a593Smuzhiyun 	MPP_MODE(26,
172*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
173*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "tdm", "fsync",      V_MV78230_PLUS),
174*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "clk",        V_MV78230_PLUS)),
175*4882a593Smuzhiyun 	MPP_MODE(27,
176*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
177*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "ptp", "trig",       V_MV78230_PLUS),
178*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "tdm", "dtx",        V_MV78230_PLUS),
179*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "e",          V_MV78230_PLUS)),
180*4882a593Smuzhiyun 	MPP_MODE(28,
181*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
182*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "ptp", "evreq",      V_MV78230_PLUS),
183*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "tdm", "drx",        V_MV78230_PLUS),
184*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "pwm",        V_MV78230_PLUS)),
185*4882a593Smuzhiyun 	MPP_MODE(29,
186*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
187*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "ptp", "clk",        V_MV78230_PLUS),
188*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "tdm", "int0",       V_MV78230_PLUS),
189*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "ref-clk",    V_MV78230_PLUS)),
190*4882a593Smuzhiyun 	MPP_MODE(30,
191*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
192*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "sd0", "clk",        V_MV78230_PLUS),
193*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "tdm", "int1",       V_MV78230_PLUS)),
194*4882a593Smuzhiyun 	MPP_MODE(31,
195*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
196*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "sd0", "cmd",        V_MV78230_PLUS),
197*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "tdm", "int2",       V_MV78230_PLUS)),
198*4882a593Smuzhiyun 	MPP_MODE(32,
199*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
200*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "sd0", "d0",         V_MV78230_PLUS),
201*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "tdm", "int3",       V_MV78230_PLUS)),
202*4882a593Smuzhiyun 	MPP_MODE(33,
203*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
204*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "sd0", "d1",         V_MV78230_PLUS),
205*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "tdm", "int4",       V_MV78230_PLUS),
206*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dram", "bat",       V_MV78230_PLUS),
207*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x5, "dram", "vttctrl",   V_MV78230_PLUS)),
208*4882a593Smuzhiyun 	MPP_MODE(34,
209*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
210*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "sd0", "d2",         V_MV78230_PLUS),
211*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "sata0", "prsnt",    V_MV78230_PLUS),
212*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "tdm", "int5",       V_MV78230_PLUS),
213*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dram", "deccerr",   V_MV78230_PLUS)),
214*4882a593Smuzhiyun 	MPP_MODE(35,
215*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
216*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "sd0", "d3",         V_MV78230_PLUS),
217*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "sata1", "prsnt",    V_MV78230_PLUS),
218*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "tdm", "int6",       V_MV78230_PLUS)),
219*4882a593Smuzhiyun 	MPP_MODE(36,
220*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
221*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "spi0", "mosi",      V_MV78230_PLUS)),
222*4882a593Smuzhiyun 	MPP_MODE(37,
223*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
224*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "spi0", "miso",      V_MV78230_PLUS)),
225*4882a593Smuzhiyun 	MPP_MODE(38,
226*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
227*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "spi0", "sck",       V_MV78230_PLUS)),
228*4882a593Smuzhiyun 	MPP_MODE(39,
229*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
230*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "spi0", "cs0",       V_MV78230_PLUS)),
231*4882a593Smuzhiyun 	MPP_MODE(40,
232*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
233*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "spi0", "cs1",       V_MV78230_PLUS),
234*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "uart2", "cts",      V_MV78230_PLUS),
235*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "vga-hsync",  V_MV78230_PLUS),
236*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x5, "pcie", "clkreq0",   V_MV78230_PLUS),
237*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x6, "spi1", "cs1",       V_MV78230_PLUS)),
238*4882a593Smuzhiyun 	MPP_MODE(41,
239*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
240*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "spi0", "cs2",       V_MV78230_PLUS),
241*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "uart2", "rts",      V_MV78230_PLUS),
242*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "sata1", "prsnt",    V_MV78230_PLUS),
243*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "lcd", "vga-vsync",  V_MV78230_PLUS),
244*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x5, "pcie", "clkreq1",   V_MV78230_PLUS),
245*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x6, "spi1", "cs2",       V_MV78230_PLUS)),
246*4882a593Smuzhiyun 	MPP_MODE(42,
247*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
248*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "uart2", "rxd",      V_MV78230_PLUS),
249*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "uart0", "cts",      V_MV78230_PLUS),
250*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "tdm", "int7",       V_MV78230_PLUS),
251*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "tdm", "timer",      V_MV78230_PLUS)),
252*4882a593Smuzhiyun 	MPP_MODE(43,
253*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
254*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "uart2", "txd",      V_MV78230_PLUS),
255*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "uart0", "rts",      V_MV78230_PLUS),
256*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "spi0", "cs3",       V_MV78230_PLUS),
257*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "pcie", "rstout",    V_MV78230_PLUS),
258*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x6, "spi1", "cs3",       V_MV78230_PLUS)),
259*4882a593Smuzhiyun 	MPP_MODE(44,
260*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
261*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "uart2", "cts",      V_MV78230_PLUS),
262*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "uart3", "rxd",      V_MV78230_PLUS),
263*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "spi0", "cs4",       V_MV78230_PLUS),
264*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dram", "bat",       V_MV78230_PLUS),
265*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x5, "pcie", "clkreq2",   V_MV78230_PLUS),
266*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x6, "spi1", "cs4",       V_MV78230_PLUS)),
267*4882a593Smuzhiyun 	MPP_MODE(45,
268*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
269*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "uart2", "rts",      V_MV78230_PLUS),
270*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "uart3", "txd",      V_MV78230_PLUS),
271*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "spi0", "cs5",       V_MV78230_PLUS),
272*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "sata1", "prsnt",    V_MV78230_PLUS),
273*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x5, "dram", "vttctrl",   V_MV78230_PLUS),
274*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x6, "spi1", "cs5",       V_MV78230_PLUS)),
275*4882a593Smuzhiyun 	MPP_MODE(46,
276*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
277*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "uart3", "rts",      V_MV78230_PLUS),
278*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "uart1", "rts",      V_MV78230_PLUS),
279*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "spi0", "cs6",       V_MV78230_PLUS),
280*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "sata0", "prsnt",    V_MV78230_PLUS),
281*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x6, "spi1", "cs6",       V_MV78230_PLUS)),
282*4882a593Smuzhiyun 	MPP_MODE(47,
283*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
284*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "uart3", "cts",      V_MV78230_PLUS),
285*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "uart1", "cts",      V_MV78230_PLUS),
286*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "spi0", "cs7",       V_MV78230_PLUS),
287*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "ref", "clkout",     V_MV78230_PLUS),
288*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x5, "pcie", "clkreq3",   V_MV78230_PLUS),
289*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x6, "spi1", "cs7",       V_MV78230_PLUS)),
290*4882a593Smuzhiyun 	MPP_MODE(48,
291*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
292*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "dev", "clkout",     V_MV78230_PLUS),
293*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "dev", "burst/last", V_MV78230_PLUS),
294*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "nand", "rb",        V_MV78230_PLUS)),
295*4882a593Smuzhiyun 	MPP_MODE(49,
296*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
297*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "dev", "we3",        V_MV78260_PLUS)),
298*4882a593Smuzhiyun 	MPP_MODE(50,
299*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
300*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "dev", "we2",        V_MV78260_PLUS)),
301*4882a593Smuzhiyun 	MPP_MODE(51,
302*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
303*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "dev", "ad16",       V_MV78260_PLUS)),
304*4882a593Smuzhiyun 	MPP_MODE(52,
305*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
306*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "dev", "ad17",       V_MV78260_PLUS)),
307*4882a593Smuzhiyun 	MPP_MODE(53,
308*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
309*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "dev", "ad18",       V_MV78260_PLUS)),
310*4882a593Smuzhiyun 	MPP_MODE(54,
311*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
312*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "dev", "ad19",       V_MV78260_PLUS)),
313*4882a593Smuzhiyun 	MPP_MODE(55,
314*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
315*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "dev", "ad20",       V_MV78260_PLUS)),
316*4882a593Smuzhiyun 	MPP_MODE(56,
317*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
318*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "dev", "ad21",       V_MV78260_PLUS)),
319*4882a593Smuzhiyun 	MPP_MODE(57,
320*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
321*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "dev", "ad22",       V_MV78260_PLUS)),
322*4882a593Smuzhiyun 	MPP_MODE(58,
323*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
324*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "dev", "ad23",       V_MV78260_PLUS)),
325*4882a593Smuzhiyun 	MPP_MODE(59,
326*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
327*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "dev", "ad24",       V_MV78260_PLUS)),
328*4882a593Smuzhiyun 	MPP_MODE(60,
329*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
330*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "dev", "ad25",       V_MV78260_PLUS)),
331*4882a593Smuzhiyun 	MPP_MODE(61,
332*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
333*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "dev", "ad26",       V_MV78260_PLUS)),
334*4882a593Smuzhiyun 	MPP_MODE(62,
335*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
336*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "dev", "ad27",       V_MV78260_PLUS)),
337*4882a593Smuzhiyun 	MPP_MODE(63,
338*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
339*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "dev", "ad28",       V_MV78260_PLUS)),
340*4882a593Smuzhiyun 	MPP_MODE(64,
341*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
342*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "dev", "ad29",       V_MV78260_PLUS)),
343*4882a593Smuzhiyun 	MPP_MODE(65,
344*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
345*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "dev", "ad30",       V_MV78260_PLUS)),
346*4882a593Smuzhiyun 	MPP_MODE(66,
347*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
348*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "dev", "ad31",       V_MV78260_PLUS)),
349*4882a593Smuzhiyun };
350*4882a593Smuzhiyun 
351*4882a593Smuzhiyun static struct mvebu_mpp_mode mv98dx3236_mpp_modes[] = {
352*4882a593Smuzhiyun 	MPP_MODE(0,
353*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
354*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "spi0", "mosi",       V_98DX3236_PLUS),
355*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "ad8",         V_98DX3236_PLUS)),
356*4882a593Smuzhiyun 	MPP_MODE(1,
357*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
358*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "spi0", "miso",       V_98DX3236_PLUS),
359*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "ad9",         V_98DX3236_PLUS)),
360*4882a593Smuzhiyun 	MPP_MODE(2,
361*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
362*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "spi0", "sck",        V_98DX3236_PLUS),
363*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "ad10",        V_98DX3236_PLUS)),
364*4882a593Smuzhiyun 	MPP_MODE(3,
365*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
366*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "spi0", "cs0",        V_98DX3236_PLUS),
367*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "ad11",        V_98DX3236_PLUS)),
368*4882a593Smuzhiyun 	MPP_MODE(4,
369*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
370*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "spi0", "cs1",        V_98DX3236_PLUS),
371*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "smi", "mdc",         V_98DX3236_PLUS),
372*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "cs0",         V_98DX3236_PLUS)),
373*4882a593Smuzhiyun 	MPP_MODE(5,
374*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
375*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "pex", "rsto",        V_98DX3236_PLUS),
376*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "sd0", "cmd",         V_98DX4251),
377*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "bootcs",      V_98DX3236_PLUS)),
378*4882a593Smuzhiyun 	MPP_MODE(6,
379*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
380*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "sd0", "clk",         V_98DX4251),
381*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "a2",          V_98DX3236_PLUS)),
382*4882a593Smuzhiyun 	MPP_MODE(7,
383*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
384*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "sd0", "d0",          V_98DX4251),
385*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "ale0",        V_98DX3236_PLUS)),
386*4882a593Smuzhiyun 	MPP_MODE(8,
387*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
388*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "sd0", "d1",          V_98DX4251),
389*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "ale1",        V_98DX3236_PLUS)),
390*4882a593Smuzhiyun 	MPP_MODE(9,
391*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
392*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "sd0", "d2",          V_98DX4251),
393*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "ready0",      V_98DX3236_PLUS)),
394*4882a593Smuzhiyun 	MPP_MODE(10,
395*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
396*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "sd0", "d3",          V_98DX4251),
397*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "ad12",        V_98DX3236_PLUS)),
398*4882a593Smuzhiyun 	MPP_MODE(11,
399*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
400*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "uart1", "rxd",       V_98DX3236_PLUS),
401*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "uart0", "cts",       V_98DX3236_PLUS),
402*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "ad13",        V_98DX3236_PLUS)),
403*4882a593Smuzhiyun 	MPP_MODE(12,
404*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
405*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x2, "uart1", "txd",       V_98DX3236_PLUS),
406*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "uart0", "rts",       V_98DX3236_PLUS),
407*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "ad14",        V_98DX3236_PLUS)),
408*4882a593Smuzhiyun 	MPP_MODE(13,
409*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
410*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "intr", "out",        V_98DX3236_PLUS),
411*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "ad15",        V_98DX3236_PLUS)),
412*4882a593Smuzhiyun 	MPP_MODE(14,
413*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
414*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "i2c0", "sck",        V_98DX3236_PLUS)),
415*4882a593Smuzhiyun 	MPP_MODE(15,
416*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
417*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "i2c0", "sda",        V_98DX3236_PLUS)),
418*4882a593Smuzhiyun 	MPP_MODE(16,
419*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
420*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "oe",          V_98DX3236_PLUS)),
421*4882a593Smuzhiyun 	MPP_MODE(17,
422*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
423*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "clkout",      V_98DX3236_PLUS)),
424*4882a593Smuzhiyun 	MPP_MODE(18,
425*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
426*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "uart1", "txd",       V_98DX3236_PLUS)),
427*4882a593Smuzhiyun 	MPP_MODE(19,
428*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
429*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "uart1", "rxd",       V_98DX3236_PLUS),
430*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "nand", "rb",         V_98DX3236_PLUS)),
431*4882a593Smuzhiyun 	MPP_MODE(20,
432*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
433*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "we0",         V_98DX3236_PLUS)),
434*4882a593Smuzhiyun 	MPP_MODE(21,
435*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
436*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "ad0",         V_98DX3236_PLUS)),
437*4882a593Smuzhiyun 	MPP_MODE(22,
438*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
439*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "ad1",         V_98DX3236_PLUS)),
440*4882a593Smuzhiyun 	MPP_MODE(23,
441*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
442*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "ad2",         V_98DX3236_PLUS)),
443*4882a593Smuzhiyun 	MPP_MODE(24,
444*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
445*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "ad3",         V_98DX3236_PLUS)),
446*4882a593Smuzhiyun 	MPP_MODE(25,
447*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
448*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "ad4",         V_98DX3236_PLUS)),
449*4882a593Smuzhiyun 	MPP_MODE(26,
450*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
451*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "ad5",         V_98DX3236_PLUS)),
452*4882a593Smuzhiyun 	MPP_MODE(27,
453*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
454*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "ad6",         V_98DX3236_PLUS)),
455*4882a593Smuzhiyun 	MPP_MODE(28,
456*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
457*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "ad7",         V_98DX3236_PLUS)),
458*4882a593Smuzhiyun 	MPP_MODE(29,
459*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
460*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "a0",          V_98DX3236_PLUS)),
461*4882a593Smuzhiyun 	MPP_MODE(30,
462*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
463*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "a1",          V_98DX3236_PLUS)),
464*4882a593Smuzhiyun 	MPP_MODE(31,
465*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
466*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "slv_smi", "mdc",     V_98DX3236_PLUS),
467*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "smi", "mdc",         V_98DX3236_PLUS),
468*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "we1",         V_98DX3236_PLUS)),
469*4882a593Smuzhiyun 	MPP_MODE(32,
470*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
471*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x1, "slv_smi", "mdio",    V_98DX3236_PLUS),
472*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x3, "smi", "mdio",        V_98DX3236_PLUS),
473*4882a593Smuzhiyun 		 MPP_VAR_FUNCTION(0x4, "dev", "cs1",         V_98DX3236_PLUS)),
474*4882a593Smuzhiyun };
475*4882a593Smuzhiyun 
476*4882a593Smuzhiyun static struct mvebu_pinctrl_soc_info armada_xp_pinctrl_info;
477*4882a593Smuzhiyun 
478*4882a593Smuzhiyun static const struct of_device_id armada_xp_pinctrl_of_match[] = {
479*4882a593Smuzhiyun 	{
480*4882a593Smuzhiyun 		.compatible = "marvell,mv78230-pinctrl",
481*4882a593Smuzhiyun 		.data       = (void *) V_MV78230,
482*4882a593Smuzhiyun 	},
483*4882a593Smuzhiyun 	{
484*4882a593Smuzhiyun 		.compatible = "marvell,mv78260-pinctrl",
485*4882a593Smuzhiyun 		.data       = (void *) V_MV78260,
486*4882a593Smuzhiyun 	},
487*4882a593Smuzhiyun 	{
488*4882a593Smuzhiyun 		.compatible = "marvell,mv78460-pinctrl",
489*4882a593Smuzhiyun 		.data       = (void *) V_MV78460,
490*4882a593Smuzhiyun 	},
491*4882a593Smuzhiyun 	{
492*4882a593Smuzhiyun 		.compatible = "marvell,98dx3236-pinctrl",
493*4882a593Smuzhiyun 		.data       = (void *) V_98DX3236,
494*4882a593Smuzhiyun 	},
495*4882a593Smuzhiyun 	{
496*4882a593Smuzhiyun 		.compatible = "marvell,98dx4251-pinctrl",
497*4882a593Smuzhiyun 		.data       = (void *) V_98DX4251,
498*4882a593Smuzhiyun 	},
499*4882a593Smuzhiyun 	{ },
500*4882a593Smuzhiyun };
501*4882a593Smuzhiyun 
502*4882a593Smuzhiyun static const struct mvebu_mpp_ctrl mv78230_mpp_controls[] = {
503*4882a593Smuzhiyun 	MPP_FUNC_CTRL(0, 48, NULL, mvebu_mmio_mpp_ctrl),
504*4882a593Smuzhiyun };
505*4882a593Smuzhiyun 
506*4882a593Smuzhiyun static struct pinctrl_gpio_range mv78230_mpp_gpio_ranges[] = {
507*4882a593Smuzhiyun 	MPP_GPIO_RANGE(0,   0,  0, 32),
508*4882a593Smuzhiyun 	MPP_GPIO_RANGE(1,  32, 32, 17),
509*4882a593Smuzhiyun };
510*4882a593Smuzhiyun 
511*4882a593Smuzhiyun static const struct mvebu_mpp_ctrl mv78260_mpp_controls[] = {
512*4882a593Smuzhiyun 	MPP_FUNC_CTRL(0, 66, NULL, mvebu_mmio_mpp_ctrl),
513*4882a593Smuzhiyun };
514*4882a593Smuzhiyun 
515*4882a593Smuzhiyun static struct pinctrl_gpio_range mv78260_mpp_gpio_ranges[] = {
516*4882a593Smuzhiyun 	MPP_GPIO_RANGE(0,   0,  0, 32),
517*4882a593Smuzhiyun 	MPP_GPIO_RANGE(1,  32, 32, 32),
518*4882a593Smuzhiyun 	MPP_GPIO_RANGE(2,  64, 64,  3),
519*4882a593Smuzhiyun };
520*4882a593Smuzhiyun 
521*4882a593Smuzhiyun static const struct mvebu_mpp_ctrl mv78460_mpp_controls[] = {
522*4882a593Smuzhiyun 	MPP_FUNC_CTRL(0, 66, NULL, mvebu_mmio_mpp_ctrl),
523*4882a593Smuzhiyun };
524*4882a593Smuzhiyun 
525*4882a593Smuzhiyun static struct pinctrl_gpio_range mv78460_mpp_gpio_ranges[] = {
526*4882a593Smuzhiyun 	MPP_GPIO_RANGE(0,   0,  0, 32),
527*4882a593Smuzhiyun 	MPP_GPIO_RANGE(1,  32, 32, 32),
528*4882a593Smuzhiyun 	MPP_GPIO_RANGE(2,  64, 64,  3),
529*4882a593Smuzhiyun };
530*4882a593Smuzhiyun 
531*4882a593Smuzhiyun static struct mvebu_mpp_ctrl mv98dx3236_mpp_controls[] = {
532*4882a593Smuzhiyun 	MPP_FUNC_CTRL(0, 32, NULL, mvebu_mmio_mpp_ctrl),
533*4882a593Smuzhiyun };
534*4882a593Smuzhiyun 
535*4882a593Smuzhiyun static struct pinctrl_gpio_range mv98dx3236_mpp_gpio_ranges[] = {
536*4882a593Smuzhiyun 	MPP_GPIO_RANGE(0, 0, 0, 32),
537*4882a593Smuzhiyun };
538*4882a593Smuzhiyun 
armada_xp_pinctrl_suspend(struct platform_device * pdev,pm_message_t state)539*4882a593Smuzhiyun static int armada_xp_pinctrl_suspend(struct platform_device *pdev,
540*4882a593Smuzhiyun 				     pm_message_t state)
541*4882a593Smuzhiyun {
542*4882a593Smuzhiyun 	struct mvebu_pinctrl_soc_info *soc =
543*4882a593Smuzhiyun 		platform_get_drvdata(pdev);
544*4882a593Smuzhiyun 	int i, nregs;
545*4882a593Smuzhiyun 
546*4882a593Smuzhiyun 	nregs = DIV_ROUND_UP(soc->nmodes, MVEBU_MPPS_PER_REG);
547*4882a593Smuzhiyun 
548*4882a593Smuzhiyun 	for (i = 0; i < nregs; i++)
549*4882a593Smuzhiyun 		mpp_saved_regs[i] = readl(soc->control_data[0].base + i * 4);
550*4882a593Smuzhiyun 
551*4882a593Smuzhiyun 	return 0;
552*4882a593Smuzhiyun }
553*4882a593Smuzhiyun 
armada_xp_pinctrl_resume(struct platform_device * pdev)554*4882a593Smuzhiyun static int armada_xp_pinctrl_resume(struct platform_device *pdev)
555*4882a593Smuzhiyun {
556*4882a593Smuzhiyun 	struct mvebu_pinctrl_soc_info *soc =
557*4882a593Smuzhiyun 		platform_get_drvdata(pdev);
558*4882a593Smuzhiyun 	int i, nregs;
559*4882a593Smuzhiyun 
560*4882a593Smuzhiyun 	nregs = DIV_ROUND_UP(soc->nmodes, MVEBU_MPPS_PER_REG);
561*4882a593Smuzhiyun 
562*4882a593Smuzhiyun 	for (i = 0; i < nregs; i++)
563*4882a593Smuzhiyun 		writel(mpp_saved_regs[i], soc->control_data[0].base + i * 4);
564*4882a593Smuzhiyun 
565*4882a593Smuzhiyun 	return 0;
566*4882a593Smuzhiyun }
567*4882a593Smuzhiyun 
armada_xp_pinctrl_probe(struct platform_device * pdev)568*4882a593Smuzhiyun static int armada_xp_pinctrl_probe(struct platform_device *pdev)
569*4882a593Smuzhiyun {
570*4882a593Smuzhiyun 	struct mvebu_pinctrl_soc_info *soc = &armada_xp_pinctrl_info;
571*4882a593Smuzhiyun 	const struct of_device_id *match =
572*4882a593Smuzhiyun 		of_match_device(armada_xp_pinctrl_of_match, &pdev->dev);
573*4882a593Smuzhiyun 	int nregs;
574*4882a593Smuzhiyun 
575*4882a593Smuzhiyun 	if (!match)
576*4882a593Smuzhiyun 		return -ENODEV;
577*4882a593Smuzhiyun 
578*4882a593Smuzhiyun 	soc->variant = (unsigned) match->data & 0xff;
579*4882a593Smuzhiyun 
580*4882a593Smuzhiyun 	switch (soc->variant) {
581*4882a593Smuzhiyun 	case V_MV78230:
582*4882a593Smuzhiyun 		soc->controls = mv78230_mpp_controls;
583*4882a593Smuzhiyun 		soc->ncontrols = ARRAY_SIZE(mv78230_mpp_controls);
584*4882a593Smuzhiyun 		soc->modes = armada_xp_mpp_modes;
585*4882a593Smuzhiyun 		/* We don't necessarily want the full list of the
586*4882a593Smuzhiyun 		 * armada_xp_mpp_modes, but only the first 'n' ones
587*4882a593Smuzhiyun 		 * that are available on this SoC */
588*4882a593Smuzhiyun 		soc->nmodes = mv78230_mpp_controls[0].npins;
589*4882a593Smuzhiyun 		soc->gpioranges = mv78230_mpp_gpio_ranges;
590*4882a593Smuzhiyun 		soc->ngpioranges = ARRAY_SIZE(mv78230_mpp_gpio_ranges);
591*4882a593Smuzhiyun 		break;
592*4882a593Smuzhiyun 	case V_MV78260:
593*4882a593Smuzhiyun 		soc->controls = mv78260_mpp_controls;
594*4882a593Smuzhiyun 		soc->ncontrols = ARRAY_SIZE(mv78260_mpp_controls);
595*4882a593Smuzhiyun 		soc->modes = armada_xp_mpp_modes;
596*4882a593Smuzhiyun 		/* We don't necessarily want the full list of the
597*4882a593Smuzhiyun 		 * armada_xp_mpp_modes, but only the first 'n' ones
598*4882a593Smuzhiyun 		 * that are available on this SoC */
599*4882a593Smuzhiyun 		soc->nmodes = mv78260_mpp_controls[0].npins;
600*4882a593Smuzhiyun 		soc->gpioranges = mv78260_mpp_gpio_ranges;
601*4882a593Smuzhiyun 		soc->ngpioranges = ARRAY_SIZE(mv78260_mpp_gpio_ranges);
602*4882a593Smuzhiyun 		break;
603*4882a593Smuzhiyun 	case V_MV78460:
604*4882a593Smuzhiyun 		soc->controls = mv78460_mpp_controls;
605*4882a593Smuzhiyun 		soc->ncontrols = ARRAY_SIZE(mv78460_mpp_controls);
606*4882a593Smuzhiyun 		soc->modes = armada_xp_mpp_modes;
607*4882a593Smuzhiyun 		/* We don't necessarily want the full list of the
608*4882a593Smuzhiyun 		 * armada_xp_mpp_modes, but only the first 'n' ones
609*4882a593Smuzhiyun 		 * that are available on this SoC */
610*4882a593Smuzhiyun 		soc->nmodes = mv78460_mpp_controls[0].npins;
611*4882a593Smuzhiyun 		soc->gpioranges = mv78460_mpp_gpio_ranges;
612*4882a593Smuzhiyun 		soc->ngpioranges = ARRAY_SIZE(mv78460_mpp_gpio_ranges);
613*4882a593Smuzhiyun 		break;
614*4882a593Smuzhiyun 	case V_98DX3236:
615*4882a593Smuzhiyun 	case V_98DX3336:
616*4882a593Smuzhiyun 	case V_98DX4251:
617*4882a593Smuzhiyun 		/* fall-through */
618*4882a593Smuzhiyun 		soc->controls = mv98dx3236_mpp_controls;
619*4882a593Smuzhiyun 		soc->ncontrols = ARRAY_SIZE(mv98dx3236_mpp_controls);
620*4882a593Smuzhiyun 		soc->modes = mv98dx3236_mpp_modes;
621*4882a593Smuzhiyun 		soc->nmodes = mv98dx3236_mpp_controls[0].npins;
622*4882a593Smuzhiyun 		soc->gpioranges = mv98dx3236_mpp_gpio_ranges;
623*4882a593Smuzhiyun 		soc->ngpioranges = ARRAY_SIZE(mv98dx3236_mpp_gpio_ranges);
624*4882a593Smuzhiyun 		break;
625*4882a593Smuzhiyun 	}
626*4882a593Smuzhiyun 
627*4882a593Smuzhiyun 	nregs = DIV_ROUND_UP(soc->nmodes, MVEBU_MPPS_PER_REG);
628*4882a593Smuzhiyun 
629*4882a593Smuzhiyun 	mpp_saved_regs = devm_kmalloc_array(&pdev->dev, nregs, sizeof(u32),
630*4882a593Smuzhiyun 					    GFP_KERNEL);
631*4882a593Smuzhiyun 	if (!mpp_saved_regs)
632*4882a593Smuzhiyun 		return -ENOMEM;
633*4882a593Smuzhiyun 
634*4882a593Smuzhiyun 	pdev->dev.platform_data = soc;
635*4882a593Smuzhiyun 
636*4882a593Smuzhiyun 	return mvebu_pinctrl_simple_mmio_probe(pdev);
637*4882a593Smuzhiyun }
638*4882a593Smuzhiyun 
639*4882a593Smuzhiyun static struct platform_driver armada_xp_pinctrl_driver = {
640*4882a593Smuzhiyun 	.driver = {
641*4882a593Smuzhiyun 		.name = "armada-xp-pinctrl",
642*4882a593Smuzhiyun 		.of_match_table = armada_xp_pinctrl_of_match,
643*4882a593Smuzhiyun 	},
644*4882a593Smuzhiyun 	.probe = armada_xp_pinctrl_probe,
645*4882a593Smuzhiyun 	.suspend = armada_xp_pinctrl_suspend,
646*4882a593Smuzhiyun 	.resume = armada_xp_pinctrl_resume,
647*4882a593Smuzhiyun };
648*4882a593Smuzhiyun builtin_platform_driver(armada_xp_pinctrl_driver);
649