xref: /linux/drivers/pinctrl/mvebu/pinctrl-armada-xp.c (revision ad2a4f2b80da74c206dfb1e299475bb1feb5aa03)
106763c74SThomas Petazzoni /*
206763c74SThomas Petazzoni  * Marvell Armada XP pinctrl driver based on mvebu pinctrl core
306763c74SThomas Petazzoni  *
406763c74SThomas Petazzoni  * Copyright (C) 2012 Marvell
506763c74SThomas Petazzoni  *
606763c74SThomas Petazzoni  * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
706763c74SThomas Petazzoni  *
806763c74SThomas Petazzoni  * This program is free software; you can redistribute it and/or modify
906763c74SThomas Petazzoni  * it under the terms of the GNU General Public License as published by
1006763c74SThomas Petazzoni  * the Free Software Foundation; either version 2 of the License, or
1106763c74SThomas Petazzoni  * (at your option) any later version.
1206763c74SThomas Petazzoni  *
1306763c74SThomas Petazzoni  * This file supports the three variants of Armada XP SoCs that are
1406763c74SThomas Petazzoni  * available: mv78230, mv78260 and mv78460. From a pin muxing
1506763c74SThomas Petazzoni  * perspective, the mv78230 has 49 MPP pins. The mv78260 and mv78460
1606763c74SThomas Petazzoni  * both have 67 MPP pins (more GPIOs and address lines for the memory
1706763c74SThomas Petazzoni  * bus mainly). The only difference between the mv78260 and the
1806763c74SThomas Petazzoni  * mv78460 in terms of pin muxing is the addition of two functions on
1906763c74SThomas Petazzoni  * pins 43 and 56 to access the VDD of the CPU2 and 3 (mv78260 has two
2006763c74SThomas Petazzoni  * cores, mv78460 has four cores).
2106763c74SThomas Petazzoni  */
2206763c74SThomas Petazzoni 
2306763c74SThomas Petazzoni #include <linux/err.h>
2406763c74SThomas Petazzoni #include <linux/init.h>
2506763c74SThomas Petazzoni #include <linux/io.h>
2606763c74SThomas Petazzoni #include <linux/module.h>
2706763c74SThomas Petazzoni #include <linux/platform_device.h>
2806763c74SThomas Petazzoni #include <linux/clk.h>
2906763c74SThomas Petazzoni #include <linux/of.h>
3006763c74SThomas Petazzoni #include <linux/of_device.h>
3106763c74SThomas Petazzoni #include <linux/pinctrl/pinctrl.h>
3206763c74SThomas Petazzoni #include <linux/bitops.h>
3306763c74SThomas Petazzoni 
3406763c74SThomas Petazzoni #include "pinctrl-mvebu.h"
3506763c74SThomas Petazzoni 
36*ad2a4f2bSSebastian Hesselbarth static void __iomem *mpp_base;
37*ad2a4f2bSSebastian Hesselbarth 
38*ad2a4f2bSSebastian Hesselbarth static int armada_xp_mpp_ctrl_get(unsigned pid, unsigned long *config)
39*ad2a4f2bSSebastian Hesselbarth {
40*ad2a4f2bSSebastian Hesselbarth 	return default_mpp_ctrl_get(mpp_base, pid, config);
41*ad2a4f2bSSebastian Hesselbarth }
42*ad2a4f2bSSebastian Hesselbarth 
43*ad2a4f2bSSebastian Hesselbarth static int armada_xp_mpp_ctrl_set(unsigned pid, unsigned long config)
44*ad2a4f2bSSebastian Hesselbarth {
45*ad2a4f2bSSebastian Hesselbarth 	return default_mpp_ctrl_set(mpp_base, pid, config);
46*ad2a4f2bSSebastian Hesselbarth }
47*ad2a4f2bSSebastian Hesselbarth 
4806763c74SThomas Petazzoni enum armada_xp_variant {
4906763c74SThomas Petazzoni 	V_MV78230	= BIT(0),
5006763c74SThomas Petazzoni 	V_MV78260	= BIT(1),
5106763c74SThomas Petazzoni 	V_MV78460	= BIT(2),
5206763c74SThomas Petazzoni 	V_MV78230_PLUS	= (V_MV78230 | V_MV78260 | V_MV78460),
5306763c74SThomas Petazzoni 	V_MV78260_PLUS	= (V_MV78260 | V_MV78460),
5406763c74SThomas Petazzoni };
5506763c74SThomas Petazzoni 
5606763c74SThomas Petazzoni static struct mvebu_mpp_mode armada_xp_mpp_modes[] = {
5706763c74SThomas Petazzoni 	MPP_MODE(0,
5806763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
5906763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "ge0", "txclko",     V_MV78230_PLUS),
6006763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "d0",         V_MV78230_PLUS)),
6106763c74SThomas Petazzoni 	MPP_MODE(1,
6206763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
6306763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "ge0", "txd0",       V_MV78230_PLUS),
6406763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "d1",         V_MV78230_PLUS)),
6506763c74SThomas Petazzoni 	MPP_MODE(2,
6606763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
6706763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "ge0", "txd1",       V_MV78230_PLUS),
6806763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "d2",         V_MV78230_PLUS)),
6906763c74SThomas Petazzoni 	MPP_MODE(3,
7006763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
7106763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "ge0", "txd2",       V_MV78230_PLUS),
7206763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "d3",         V_MV78230_PLUS)),
7306763c74SThomas Petazzoni 	MPP_MODE(4,
7406763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
7506763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "ge0", "txd3",       V_MV78230_PLUS),
7606763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "d4",         V_MV78230_PLUS)),
7706763c74SThomas Petazzoni 	MPP_MODE(5,
7806763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
7906763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "ge0", "txctl",      V_MV78230_PLUS),
8006763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "d5",         V_MV78230_PLUS)),
8106763c74SThomas Petazzoni 	MPP_MODE(6,
8206763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
8306763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "ge0", "rxd0",       V_MV78230_PLUS),
8406763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "d6",         V_MV78230_PLUS)),
8506763c74SThomas Petazzoni 	MPP_MODE(7,
8606763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
8706763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "ge0", "rxd1",       V_MV78230_PLUS),
8806763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "d7",         V_MV78230_PLUS)),
8906763c74SThomas Petazzoni 	MPP_MODE(8,
9006763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
9106763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "ge0", "rxd2",       V_MV78230_PLUS),
9206763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "d8",         V_MV78230_PLUS)),
9306763c74SThomas Petazzoni 	MPP_MODE(9,
9406763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
9506763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "ge0", "rxd3",       V_MV78230_PLUS),
9606763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "d9",         V_MV78230_PLUS)),
9706763c74SThomas Petazzoni 	MPP_MODE(10,
9806763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
9906763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "ge0", "rxctl",      V_MV78230_PLUS),
10006763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "d10",        V_MV78230_PLUS)),
10106763c74SThomas Petazzoni 	MPP_MODE(11,
10206763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
10306763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "ge0", "rxclk",      V_MV78230_PLUS),
10406763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "d11",        V_MV78230_PLUS)),
10506763c74SThomas Petazzoni 	MPP_MODE(12,
10606763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
10706763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "ge0", "txd4",       V_MV78230_PLUS),
10806763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x2, "ge1", "clkout",     V_MV78230_PLUS),
10906763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "d12",        V_MV78230_PLUS)),
11006763c74SThomas Petazzoni 	MPP_MODE(13,
11106763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
11206763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "ge0", "txd5",       V_MV78230_PLUS),
11306763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x2, "ge1", "txd0",       V_MV78230_PLUS),
11406763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "d13",        V_MV78230_PLUS)),
11506763c74SThomas Petazzoni 	MPP_MODE(14,
11606763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
11706763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "ge0", "txd6",       V_MV78230_PLUS),
11806763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x2, "ge1", "txd1",       V_MV78230_PLUS),
11906763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "d14",        V_MV78230_PLUS)),
12006763c74SThomas Petazzoni 	MPP_MODE(15,
12106763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
12206763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "ge0", "txd7",       V_MV78230_PLUS),
12306763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x2, "ge1", "txd2",       V_MV78230_PLUS),
12406763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "d15",        V_MV78230_PLUS)),
12506763c74SThomas Petazzoni 	MPP_MODE(16,
12606763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
12706763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "ge0", "txclk",      V_MV78230_PLUS),
12806763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x2, "ge1", "txd3",       V_MV78230_PLUS),
12906763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "d16",        V_MV78230_PLUS)),
13006763c74SThomas Petazzoni 	MPP_MODE(17,
13106763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
13206763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "ge0", "col",        V_MV78230_PLUS),
13306763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x2, "ge1", "txctl",      V_MV78230_PLUS),
13406763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "d17",        V_MV78230_PLUS)),
13506763c74SThomas Petazzoni 	MPP_MODE(18,
13606763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
13706763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "ge0", "rxerr",      V_MV78230_PLUS),
13806763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x2, "ge1", "rxd0",       V_MV78230_PLUS),
13906763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x3, "ptp", "trig",       V_MV78230_PLUS),
14006763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "d18",        V_MV78230_PLUS)),
14106763c74SThomas Petazzoni 	MPP_MODE(19,
14206763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
14306763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "ge0", "crs",        V_MV78230_PLUS),
14406763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x2, "ge1", "rxd1",       V_MV78230_PLUS),
14506763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x3, "ptp", "evreq",      V_MV78230_PLUS),
14606763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "d19",        V_MV78230_PLUS)),
14706763c74SThomas Petazzoni 	MPP_MODE(20,
14806763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
14906763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "ge0", "rxd4",       V_MV78230_PLUS),
15006763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x2, "ge1", "rxd2",       V_MV78230_PLUS),
15106763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x3, "ptp", "clk",        V_MV78230_PLUS),
15206763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "d20",        V_MV78230_PLUS)),
15306763c74SThomas Petazzoni 	MPP_MODE(21,
15406763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
15506763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "ge0", "rxd5",       V_MV78230_PLUS),
15606763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x2, "ge1", "rxd3",       V_MV78230_PLUS),
15706763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x3, "mem", "bat",        V_MV78230_PLUS),
15806763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "d21",        V_MV78230_PLUS)),
15906763c74SThomas Petazzoni 	MPP_MODE(22,
16006763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
16106763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "ge0", "rxd6",       V_MV78230_PLUS),
16206763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x2, "ge1", "rxctl",      V_MV78230_PLUS),
16306763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x3, "sata0", "prsnt",    V_MV78230_PLUS),
16406763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "d22",        V_MV78230_PLUS)),
16506763c74SThomas Petazzoni 	MPP_MODE(23,
16606763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
16706763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "ge0", "rxd7",       V_MV78230_PLUS),
16806763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x2, "ge1", "rxclk",      V_MV78230_PLUS),
16906763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x3, "sata1", "prsnt",    V_MV78230_PLUS),
17006763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "d23",        V_MV78230_PLUS)),
17106763c74SThomas Petazzoni 	MPP_MODE(24,
17206763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
17306763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "sata1", "prsnt",    V_MV78230_PLUS),
17406763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x2, "nf", "bootcs-re",   V_MV78230_PLUS),
17506763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x3, "tdm", "rst",        V_MV78230_PLUS),
17606763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "hsync",      V_MV78230_PLUS)),
17706763c74SThomas Petazzoni 	MPP_MODE(25,
17806763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
17906763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "sata0", "prsnt",    V_MV78230_PLUS),
18006763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x2, "nf", "bootcs-we",   V_MV78230_PLUS),
18106763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x3, "tdm", "pclk",       V_MV78230_PLUS),
18206763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "vsync",      V_MV78230_PLUS)),
18306763c74SThomas Petazzoni 	MPP_MODE(26,
18406763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
18506763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x3, "tdm", "fsync",      V_MV78230_PLUS),
18606763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "clk",        V_MV78230_PLUS),
18706763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x5, "vdd", "cpu1-pd",    V_MV78230_PLUS)),
18806763c74SThomas Petazzoni 	MPP_MODE(27,
18906763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
19006763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "ptp", "trig",       V_MV78230_PLUS),
19106763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x3, "tdm", "dtx",        V_MV78230_PLUS),
19206763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "e",          V_MV78230_PLUS)),
19306763c74SThomas Petazzoni 	MPP_MODE(28,
19406763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
19506763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "ptp", "evreq",      V_MV78230_PLUS),
19606763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x3, "tdm", "drx",        V_MV78230_PLUS),
19706763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "pwm",        V_MV78230_PLUS)),
19806763c74SThomas Petazzoni 	MPP_MODE(29,
19906763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
20006763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "ptp", "clk",        V_MV78230_PLUS),
20106763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x3, "tdm", "int0",       V_MV78230_PLUS),
20206763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "ref-clk",    V_MV78230_PLUS),
20306763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x5, "vdd", "cpu0-pd",    V_MV78230_PLUS)),
20406763c74SThomas Petazzoni 	MPP_MODE(30,
20506763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
20606763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "sd0", "clk",        V_MV78230_PLUS),
20706763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x3, "tdm", "int1",       V_MV78230_PLUS)),
20806763c74SThomas Petazzoni 	MPP_MODE(31,
20906763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
21006763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "sd0", "cmd",        V_MV78230_PLUS),
21106763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x3, "tdm", "int2",       V_MV78230_PLUS),
21206763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x5, "vdd", "cpu0-pd",    V_MV78230_PLUS)),
21306763c74SThomas Petazzoni 	MPP_MODE(32,
21406763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
21506763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "sd0", "d0",         V_MV78230_PLUS),
21606763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x3, "tdm", "int3",       V_MV78230_PLUS),
21706763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x5, "vdd", "cpu1-pd",    V_MV78230_PLUS)),
21806763c74SThomas Petazzoni 	MPP_MODE(33,
21906763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
22006763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "sd0", "d1",         V_MV78230_PLUS),
22106763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x3, "tdm", "int4",       V_MV78230_PLUS),
22206763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "mem", "bat",        V_MV78230_PLUS)),
22306763c74SThomas Petazzoni 	MPP_MODE(34,
22406763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
22506763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "sd0", "d2",         V_MV78230_PLUS),
22606763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x2, "sata0", "prsnt",    V_MV78230_PLUS),
22706763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x3, "tdm", "int5",       V_MV78230_PLUS)),
22806763c74SThomas Petazzoni 	MPP_MODE(35,
22906763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
23006763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "sd0", "d3",         V_MV78230_PLUS),
23106763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x2, "sata1", "prsnt",    V_MV78230_PLUS),
23206763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x3, "tdm", "int6",       V_MV78230_PLUS)),
23306763c74SThomas Petazzoni 	MPP_MODE(36,
23406763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
23506763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "spi", "mosi",       V_MV78230_PLUS)),
23606763c74SThomas Petazzoni 	MPP_MODE(37,
23706763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
23806763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "spi", "miso",       V_MV78230_PLUS)),
23906763c74SThomas Petazzoni 	MPP_MODE(38,
24006763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
24106763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "spi", "sck",        V_MV78230_PLUS)),
24206763c74SThomas Petazzoni 	MPP_MODE(39,
24306763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
24406763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "spi", "cs0",        V_MV78230_PLUS)),
24506763c74SThomas Petazzoni 	MPP_MODE(40,
24606763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
24706763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "spi", "cs1",        V_MV78230_PLUS),
24806763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x2, "uart2", "cts",      V_MV78230_PLUS),
24906763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x3, "vdd", "cpu1-pd",    V_MV78230_PLUS),
25006763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "vga-hsync",  V_MV78230_PLUS),
25106763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x5, "pcie", "clkreq0",   V_MV78230_PLUS)),
25206763c74SThomas Petazzoni 	MPP_MODE(41,
25306763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
25406763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "spi", "cs2",        V_MV78230_PLUS),
25506763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x2, "uart2", "rts",      V_MV78230_PLUS),
25606763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x3, "sata1", "prsnt",    V_MV78230_PLUS),
25706763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "lcd", "vga-vsync",  V_MV78230_PLUS),
25806763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x5, "pcie", "clkreq1",   V_MV78230_PLUS)),
25906763c74SThomas Petazzoni 	MPP_MODE(42,
26006763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
26106763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "uart2", "rxd",      V_MV78230_PLUS),
26206763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x2, "uart0", "cts",      V_MV78230_PLUS),
26306763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x3, "tdm", "int7",       V_MV78230_PLUS),
26406763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "tdm-1", "timer",    V_MV78230_PLUS),
26506763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x5, "vdd", "cpu0-pd",    V_MV78230_PLUS)),
26606763c74SThomas Petazzoni 	MPP_MODE(43,
26706763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
26806763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "uart2", "txd",      V_MV78230_PLUS),
26906763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x2, "uart0", "rts",      V_MV78230_PLUS),
27006763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x3, "spi", "cs3",        V_MV78230_PLUS),
27106763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "pcie", "rstout",    V_MV78230_PLUS),
27206763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x5, "vdd", "cpu2-3-pd",  V_MV78460)),
27306763c74SThomas Petazzoni 	MPP_MODE(44,
27406763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
27506763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "uart2", "cts",      V_MV78230_PLUS),
27606763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x2, "uart3", "rxd",      V_MV78230_PLUS),
27706763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x3, "spi", "cs4",        V_MV78230_PLUS),
27806763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "mem", "bat",        V_MV78230_PLUS),
27906763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x5, "pcie", "clkreq2",   V_MV78230_PLUS)),
28006763c74SThomas Petazzoni 	MPP_MODE(45,
28106763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
28206763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "uart2", "rts",      V_MV78230_PLUS),
28306763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x2, "uart3", "txd",      V_MV78230_PLUS),
28406763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x3, "spi", "cs5",        V_MV78230_PLUS),
28506763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "sata1", "prsnt",    V_MV78230_PLUS)),
28606763c74SThomas Petazzoni 	MPP_MODE(46,
28706763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
28806763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "uart3", "rts",      V_MV78230_PLUS),
28906763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x2, "uart1", "rts",      V_MV78230_PLUS),
29006763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x3, "spi", "cs6",        V_MV78230_PLUS),
29106763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "sata0", "prsnt",    V_MV78230_PLUS)),
29206763c74SThomas Petazzoni 	MPP_MODE(47,
29306763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
29406763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "uart3", "cts",      V_MV78230_PLUS),
29506763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x2, "uart1", "cts",      V_MV78230_PLUS),
29606763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x3, "spi", "cs7",        V_MV78230_PLUS),
29706763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x4, "ref", "clkout",     V_MV78230_PLUS),
29806763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x5, "pcie", "clkreq3",   V_MV78230_PLUS)),
29906763c74SThomas Petazzoni 	MPP_MODE(48,
30006763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
30106763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "tclk", NULL,        V_MV78230_PLUS),
30206763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x2, "dev", "burst/last", V_MV78230_PLUS)),
30306763c74SThomas Petazzoni 	MPP_MODE(49,
30406763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
30506763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "dev", "we3",        V_MV78260_PLUS)),
30606763c74SThomas Petazzoni 	MPP_MODE(50,
30706763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
30806763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "dev", "we2",        V_MV78260_PLUS)),
30906763c74SThomas Petazzoni 	MPP_MODE(51,
31006763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
31106763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "dev", "ad16",       V_MV78260_PLUS)),
31206763c74SThomas Petazzoni 	MPP_MODE(52,
31306763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
31406763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "dev", "ad17",       V_MV78260_PLUS)),
31506763c74SThomas Petazzoni 	MPP_MODE(53,
31606763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
31706763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "dev", "ad18",       V_MV78260_PLUS)),
31806763c74SThomas Petazzoni 	MPP_MODE(54,
31906763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
32006763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "dev", "ad19",       V_MV78260_PLUS)),
32106763c74SThomas Petazzoni 	MPP_MODE(55,
32206763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
32306763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "dev", "ad20",       V_MV78260_PLUS),
32406763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x2, "vdd", "cpu0-pd",    V_MV78260_PLUS)),
32506763c74SThomas Petazzoni 	MPP_MODE(56,
32606763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
32706763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "dev", "ad21",       V_MV78260_PLUS),
32806763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x2, "vdd", "cpu1-pd",    V_MV78260_PLUS)),
32906763c74SThomas Petazzoni 	MPP_MODE(57,
33006763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
33106763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "dev", "ad22",       V_MV78260_PLUS),
33206763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x2, "vdd", "cpu2-3-pd",  V_MV78460)),
33306763c74SThomas Petazzoni 	MPP_MODE(58,
33406763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
33506763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "dev", "ad23",       V_MV78260_PLUS)),
33606763c74SThomas Petazzoni 	MPP_MODE(59,
33706763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
33806763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "dev", "ad24",       V_MV78260_PLUS)),
33906763c74SThomas Petazzoni 	MPP_MODE(60,
34006763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
34106763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "dev", "ad25",       V_MV78260_PLUS)),
34206763c74SThomas Petazzoni 	MPP_MODE(61,
34306763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
34406763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "dev", "ad26",       V_MV78260_PLUS)),
34506763c74SThomas Petazzoni 	MPP_MODE(62,
34606763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
34706763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "dev", "ad27",       V_MV78260_PLUS)),
34806763c74SThomas Petazzoni 	MPP_MODE(63,
34906763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
35006763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "dev", "ad28",       V_MV78260_PLUS)),
35106763c74SThomas Petazzoni 	MPP_MODE(64,
35206763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
35306763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "dev", "ad29",       V_MV78260_PLUS)),
35406763c74SThomas Petazzoni 	MPP_MODE(65,
35506763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
35606763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "dev", "ad30",       V_MV78260_PLUS)),
35706763c74SThomas Petazzoni 	MPP_MODE(66,
35806763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
35906763c74SThomas Petazzoni 		 MPP_VAR_FUNCTION(0x1, "dev", "ad31",       V_MV78260_PLUS)),
36006763c74SThomas Petazzoni };
36106763c74SThomas Petazzoni 
36206763c74SThomas Petazzoni static struct mvebu_pinctrl_soc_info armada_xp_pinctrl_info;
36306763c74SThomas Petazzoni 
364150632b0SGreg Kroah-Hartman static struct of_device_id armada_xp_pinctrl_of_match[] = {
36506763c74SThomas Petazzoni 	{
36606763c74SThomas Petazzoni 		.compatible = "marvell,mv78230-pinctrl",
36706763c74SThomas Petazzoni 		.data       = (void *) V_MV78230,
36806763c74SThomas Petazzoni 	},
36906763c74SThomas Petazzoni 	{
37006763c74SThomas Petazzoni 		.compatible = "marvell,mv78260-pinctrl",
37106763c74SThomas Petazzoni 		.data       = (void *) V_MV78260,
37206763c74SThomas Petazzoni 	},
37306763c74SThomas Petazzoni 	{
37406763c74SThomas Petazzoni 		.compatible = "marvell,mv78460-pinctrl",
37506763c74SThomas Petazzoni 		.data       = (void *) V_MV78460,
37606763c74SThomas Petazzoni 	},
37706763c74SThomas Petazzoni 	{ },
37806763c74SThomas Petazzoni };
37906763c74SThomas Petazzoni 
38006763c74SThomas Petazzoni static struct mvebu_mpp_ctrl mv78230_mpp_controls[] = {
38106763c74SThomas Petazzoni 	MPP_REG_CTRL(0, 48),
38206763c74SThomas Petazzoni };
38306763c74SThomas Petazzoni 
38406763c74SThomas Petazzoni static struct pinctrl_gpio_range mv78230_mpp_gpio_ranges[] = {
38506763c74SThomas Petazzoni 	MPP_GPIO_RANGE(0,   0,  0, 32),
38606763c74SThomas Petazzoni 	MPP_GPIO_RANGE(1,  32, 32, 17),
38706763c74SThomas Petazzoni };
38806763c74SThomas Petazzoni 
38906763c74SThomas Petazzoni static struct mvebu_mpp_ctrl mv78260_mpp_controls[] = {
39006763c74SThomas Petazzoni 	MPP_REG_CTRL(0, 66),
39106763c74SThomas Petazzoni };
39206763c74SThomas Petazzoni 
39306763c74SThomas Petazzoni static struct pinctrl_gpio_range mv78260_mpp_gpio_ranges[] = {
39406763c74SThomas Petazzoni 	MPP_GPIO_RANGE(0,   0,  0, 32),
39506763c74SThomas Petazzoni 	MPP_GPIO_RANGE(1,  32, 32, 32),
39606763c74SThomas Petazzoni 	MPP_GPIO_RANGE(2,  64, 64,  3),
39706763c74SThomas Petazzoni };
39806763c74SThomas Petazzoni 
39906763c74SThomas Petazzoni static struct mvebu_mpp_ctrl mv78460_mpp_controls[] = {
40006763c74SThomas Petazzoni 	MPP_REG_CTRL(0, 66),
40106763c74SThomas Petazzoni };
40206763c74SThomas Petazzoni 
40306763c74SThomas Petazzoni static struct pinctrl_gpio_range mv78460_mpp_gpio_ranges[] = {
40406763c74SThomas Petazzoni 	MPP_GPIO_RANGE(0,   0,  0, 32),
40506763c74SThomas Petazzoni 	MPP_GPIO_RANGE(1,  32, 32, 32),
40606763c74SThomas Petazzoni 	MPP_GPIO_RANGE(2,  64, 64,  3),
40706763c74SThomas Petazzoni };
40806763c74SThomas Petazzoni 
409150632b0SGreg Kroah-Hartman static int armada_xp_pinctrl_probe(struct platform_device *pdev)
41006763c74SThomas Petazzoni {
41106763c74SThomas Petazzoni 	struct mvebu_pinctrl_soc_info *soc = &armada_xp_pinctrl_info;
41206763c74SThomas Petazzoni 	const struct of_device_id *match =
41306763c74SThomas Petazzoni 		of_match_device(armada_xp_pinctrl_of_match, &pdev->dev);
41406763c74SThomas Petazzoni 
41506763c74SThomas Petazzoni 	if (!match)
41606763c74SThomas Petazzoni 		return -ENODEV;
41706763c74SThomas Petazzoni 
41806763c74SThomas Petazzoni 	soc->variant = (unsigned) match->data & 0xff;
41906763c74SThomas Petazzoni 
42006763c74SThomas Petazzoni 	switch (soc->variant) {
42106763c74SThomas Petazzoni 	case V_MV78230:
42206763c74SThomas Petazzoni 		soc->controls = mv78230_mpp_controls;
42306763c74SThomas Petazzoni 		soc->ncontrols = ARRAY_SIZE(mv78230_mpp_controls);
42406763c74SThomas Petazzoni 		soc->modes = armada_xp_mpp_modes;
42506763c74SThomas Petazzoni 		/* We don't necessarily want the full list of the
42606763c74SThomas Petazzoni 		 * armada_xp_mpp_modes, but only the first 'n' ones
42706763c74SThomas Petazzoni 		 * that are available on this SoC */
42806763c74SThomas Petazzoni 		soc->nmodes = mv78230_mpp_controls[0].npins;
42906763c74SThomas Petazzoni 		soc->gpioranges = mv78230_mpp_gpio_ranges;
43006763c74SThomas Petazzoni 		soc->ngpioranges = ARRAY_SIZE(mv78230_mpp_gpio_ranges);
43106763c74SThomas Petazzoni 		break;
43206763c74SThomas Petazzoni 	case V_MV78260:
43306763c74SThomas Petazzoni 		soc->controls = mv78260_mpp_controls;
43406763c74SThomas Petazzoni 		soc->ncontrols = ARRAY_SIZE(mv78260_mpp_controls);
43506763c74SThomas Petazzoni 		soc->modes = armada_xp_mpp_modes;
43606763c74SThomas Petazzoni 		/* We don't necessarily want the full list of the
43706763c74SThomas Petazzoni 		 * armada_xp_mpp_modes, but only the first 'n' ones
43806763c74SThomas Petazzoni 		 * that are available on this SoC */
43906763c74SThomas Petazzoni 		soc->nmodes = mv78260_mpp_controls[0].npins;
44006763c74SThomas Petazzoni 		soc->gpioranges = mv78260_mpp_gpio_ranges;
44106763c74SThomas Petazzoni 		soc->ngpioranges = ARRAY_SIZE(mv78260_mpp_gpio_ranges);
44206763c74SThomas Petazzoni 		break;
44306763c74SThomas Petazzoni 	case V_MV78460:
44406763c74SThomas Petazzoni 		soc->controls = mv78460_mpp_controls;
44506763c74SThomas Petazzoni 		soc->ncontrols = ARRAY_SIZE(mv78460_mpp_controls);
44606763c74SThomas Petazzoni 		soc->modes = armada_xp_mpp_modes;
44706763c74SThomas Petazzoni 		/* We don't necessarily want the full list of the
44806763c74SThomas Petazzoni 		 * armada_xp_mpp_modes, but only the first 'n' ones
44906763c74SThomas Petazzoni 		 * that are available on this SoC */
45006763c74SThomas Petazzoni 		soc->nmodes = mv78460_mpp_controls[0].npins;
45106763c74SThomas Petazzoni 		soc->gpioranges = mv78460_mpp_gpio_ranges;
45206763c74SThomas Petazzoni 		soc->ngpioranges = ARRAY_SIZE(mv78460_mpp_gpio_ranges);
45306763c74SThomas Petazzoni 		break;
45406763c74SThomas Petazzoni 	}
45506763c74SThomas Petazzoni 
45606763c74SThomas Petazzoni 	pdev->dev.platform_data = soc;
45706763c74SThomas Petazzoni 
45806763c74SThomas Petazzoni 	return mvebu_pinctrl_probe(pdev);
45906763c74SThomas Petazzoni }
46006763c74SThomas Petazzoni 
461150632b0SGreg Kroah-Hartman static int armada_xp_pinctrl_remove(struct platform_device *pdev)
46206763c74SThomas Petazzoni {
46306763c74SThomas Petazzoni 	return mvebu_pinctrl_remove(pdev);
46406763c74SThomas Petazzoni }
46506763c74SThomas Petazzoni 
46606763c74SThomas Petazzoni static struct platform_driver armada_xp_pinctrl_driver = {
46706763c74SThomas Petazzoni 	.driver = {
46806763c74SThomas Petazzoni 		.name = "armada-xp-pinctrl",
46906763c74SThomas Petazzoni 		.owner = THIS_MODULE,
470f2e9394dSSachin Kamat 		.of_match_table = armada_xp_pinctrl_of_match,
47106763c74SThomas Petazzoni 	},
47206763c74SThomas Petazzoni 	.probe = armada_xp_pinctrl_probe,
473150632b0SGreg Kroah-Hartman 	.remove = armada_xp_pinctrl_remove,
47406763c74SThomas Petazzoni };
47506763c74SThomas Petazzoni 
47606763c74SThomas Petazzoni module_platform_driver(armada_xp_pinctrl_driver);
47706763c74SThomas Petazzoni 
47806763c74SThomas Petazzoni MODULE_AUTHOR("Thomas Petazzoni <thomas.petazzoni@free-electrons.com>");
47906763c74SThomas Petazzoni MODULE_DESCRIPTION("Marvell Armada XP pinctrl driver");
48006763c74SThomas Petazzoni MODULE_LICENSE("GPL v2");
481