162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Marvell Armada XP pinctrl driver based on mvebu pinctrl core
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2012 Marvell
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
862306a36Sopenharmony_ci *
962306a36Sopenharmony_ci * This file supports the three variants of Armada XP SoCs that are
1062306a36Sopenharmony_ci * available: mv78230, mv78260 and mv78460. From a pin muxing
1162306a36Sopenharmony_ci * perspective, the mv78230 has 49 MPP pins. The mv78260 and mv78460
1262306a36Sopenharmony_ci * both have 67 MPP pins (more GPIOs and address lines for the memory
1362306a36Sopenharmony_ci * bus mainly).
1462306a36Sopenharmony_ci */
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#include <linux/err.h>
1762306a36Sopenharmony_ci#include <linux/init.h>
1862306a36Sopenharmony_ci#include <linux/io.h>
1962306a36Sopenharmony_ci#include <linux/platform_device.h>
2062306a36Sopenharmony_ci#include <linux/clk.h>
2162306a36Sopenharmony_ci#include <linux/of.h>
2262306a36Sopenharmony_ci#include <linux/of_device.h>
2362306a36Sopenharmony_ci#include <linux/pinctrl/pinctrl.h>
2462306a36Sopenharmony_ci#include <linux/bitops.h>
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci#include "pinctrl-mvebu.h"
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_cistatic u32 *mpp_saved_regs;
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_cienum armada_xp_variant {
3162306a36Sopenharmony_ci	V_MV78230	= BIT(0),
3262306a36Sopenharmony_ci	V_MV78260	= BIT(1),
3362306a36Sopenharmony_ci	V_MV78460	= BIT(2),
3462306a36Sopenharmony_ci	V_MV78230_PLUS	= (V_MV78230 | V_MV78260 | V_MV78460),
3562306a36Sopenharmony_ci	V_MV78260_PLUS	= (V_MV78260 | V_MV78460),
3662306a36Sopenharmony_ci	V_98DX3236	= BIT(3),
3762306a36Sopenharmony_ci	V_98DX3336	= BIT(4),
3862306a36Sopenharmony_ci	V_98DX4251	= BIT(5),
3962306a36Sopenharmony_ci	V_98DX3236_PLUS	= (V_98DX3236 | V_98DX3336 | V_98DX4251),
4062306a36Sopenharmony_ci};
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_cistatic struct mvebu_mpp_mode armada_xp_mpp_modes[] = {
4362306a36Sopenharmony_ci	MPP_MODE(0,
4462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
4562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "ge0", "txclkout",   V_MV78230_PLUS),
4662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "d0",         V_MV78230_PLUS)),
4762306a36Sopenharmony_ci	MPP_MODE(1,
4862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
4962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "ge0", "txd0",       V_MV78230_PLUS),
5062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "d1",         V_MV78230_PLUS)),
5162306a36Sopenharmony_ci	MPP_MODE(2,
5262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
5362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "ge0", "txd1",       V_MV78230_PLUS),
5462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "d2",         V_MV78230_PLUS)),
5562306a36Sopenharmony_ci	MPP_MODE(3,
5662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
5762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "ge0", "txd2",       V_MV78230_PLUS),
5862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "d3",         V_MV78230_PLUS)),
5962306a36Sopenharmony_ci	MPP_MODE(4,
6062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
6162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "ge0", "txd3",       V_MV78230_PLUS),
6262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "d4",         V_MV78230_PLUS)),
6362306a36Sopenharmony_ci	MPP_MODE(5,
6462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
6562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "ge0", "txctl",      V_MV78230_PLUS),
6662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "d5",         V_MV78230_PLUS)),
6762306a36Sopenharmony_ci	MPP_MODE(6,
6862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
6962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "ge0", "rxd0",       V_MV78230_PLUS),
7062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "d6",         V_MV78230_PLUS)),
7162306a36Sopenharmony_ci	MPP_MODE(7,
7262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
7362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "ge0", "rxd1",       V_MV78230_PLUS),
7462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "d7",         V_MV78230_PLUS)),
7562306a36Sopenharmony_ci	MPP_MODE(8,
7662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
7762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "ge0", "rxd2",       V_MV78230_PLUS),
7862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "d8",         V_MV78230_PLUS)),
7962306a36Sopenharmony_ci	MPP_MODE(9,
8062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
8162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "ge0", "rxd3",       V_MV78230_PLUS),
8262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "d9",         V_MV78230_PLUS)),
8362306a36Sopenharmony_ci	MPP_MODE(10,
8462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
8562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "ge0", "rxctl",      V_MV78230_PLUS),
8662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "d10",        V_MV78230_PLUS)),
8762306a36Sopenharmony_ci	MPP_MODE(11,
8862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
8962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "ge0", "rxclk",      V_MV78230_PLUS),
9062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "d11",        V_MV78230_PLUS)),
9162306a36Sopenharmony_ci	MPP_MODE(12,
9262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
9362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "ge0", "txd4",       V_MV78230_PLUS),
9462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "ge1", "txclkout",   V_MV78230_PLUS),
9562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "d12",        V_MV78230_PLUS)),
9662306a36Sopenharmony_ci	MPP_MODE(13,
9762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
9862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "ge0", "txd5",       V_MV78230_PLUS),
9962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "ge1", "txd0",       V_MV78230_PLUS),
10062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "spi1", "mosi",      V_MV78230_PLUS),
10162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "d13",        V_MV78230_PLUS)),
10262306a36Sopenharmony_ci	MPP_MODE(14,
10362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
10462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "ge0", "txd6",       V_MV78230_PLUS),
10562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "ge1", "txd1",       V_MV78230_PLUS),
10662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "spi1", "sck",       V_MV78230_PLUS),
10762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "d14",        V_MV78230_PLUS)),
10862306a36Sopenharmony_ci	MPP_MODE(15,
10962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
11062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "ge0", "txd7",       V_MV78230_PLUS),
11162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "ge1", "txd2",       V_MV78230_PLUS),
11262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "d15",        V_MV78230_PLUS)),
11362306a36Sopenharmony_ci	MPP_MODE(16,
11462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
11562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "ge0", "txclk",      V_MV78230_PLUS),
11662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "ge1", "txd3",       V_MV78230_PLUS),
11762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "spi1", "cs0",       V_MV78230_PLUS),
11862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "d16",        V_MV78230_PLUS)),
11962306a36Sopenharmony_ci	MPP_MODE(17,
12062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
12162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "ge0", "col",        V_MV78230_PLUS),
12262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "ge1", "txctl",      V_MV78230_PLUS),
12362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "spi1", "miso",      V_MV78230_PLUS),
12462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "d17",        V_MV78230_PLUS)),
12562306a36Sopenharmony_ci	MPP_MODE(18,
12662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
12762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "ge0", "rxerr",      V_MV78230_PLUS),
12862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "ge1", "rxd0",       V_MV78230_PLUS),
12962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "ptp", "trig",       V_MV78230_PLUS),
13062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "d18",        V_MV78230_PLUS)),
13162306a36Sopenharmony_ci	MPP_MODE(19,
13262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
13362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "ge0", "crs",        V_MV78230_PLUS),
13462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "ge1", "rxd1",       V_MV78230_PLUS),
13562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "ptp", "evreq",      V_MV78230_PLUS),
13662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "d19",        V_MV78230_PLUS)),
13762306a36Sopenharmony_ci	MPP_MODE(20,
13862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
13962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "ge0", "rxd4",       V_MV78230_PLUS),
14062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "ge1", "rxd2",       V_MV78230_PLUS),
14162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "ptp", "clk",        V_MV78230_PLUS),
14262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "d20",        V_MV78230_PLUS)),
14362306a36Sopenharmony_ci	MPP_MODE(21,
14462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
14562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "ge0", "rxd5",       V_MV78230_PLUS),
14662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "ge1", "rxd3",       V_MV78230_PLUS),
14762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "dram", "bat",       V_MV78230_PLUS),
14862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "d21",        V_MV78230_PLUS)),
14962306a36Sopenharmony_ci	MPP_MODE(22,
15062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
15162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "ge0", "rxd6",       V_MV78230_PLUS),
15262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "ge1", "rxctl",      V_MV78230_PLUS),
15362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "sata0", "prsnt",    V_MV78230_PLUS),
15462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "d22",        V_MV78230_PLUS)),
15562306a36Sopenharmony_ci	MPP_MODE(23,
15662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
15762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "ge0", "rxd7",       V_MV78230_PLUS),
15862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "ge1", "rxclk",      V_MV78230_PLUS),
15962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "sata1", "prsnt",    V_MV78230_PLUS),
16062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "d23",        V_MV78230_PLUS)),
16162306a36Sopenharmony_ci	MPP_MODE(24,
16262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
16362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "sata1", "prsnt",    V_MV78230_PLUS),
16462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "tdm", "rst",        V_MV78230_PLUS),
16562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "hsync",      V_MV78230_PLUS)),
16662306a36Sopenharmony_ci	MPP_MODE(25,
16762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
16862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "sata0", "prsnt",    V_MV78230_PLUS),
16962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "tdm", "pclk",       V_MV78230_PLUS),
17062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "vsync",      V_MV78230_PLUS)),
17162306a36Sopenharmony_ci	MPP_MODE(26,
17262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
17362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "tdm", "fsync",      V_MV78230_PLUS),
17462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "clk",        V_MV78230_PLUS)),
17562306a36Sopenharmony_ci	MPP_MODE(27,
17662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
17762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "ptp", "trig",       V_MV78230_PLUS),
17862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "tdm", "dtx",        V_MV78230_PLUS),
17962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "e",          V_MV78230_PLUS)),
18062306a36Sopenharmony_ci	MPP_MODE(28,
18162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
18262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "ptp", "evreq",      V_MV78230_PLUS),
18362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "tdm", "drx",        V_MV78230_PLUS),
18462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "pwm",        V_MV78230_PLUS)),
18562306a36Sopenharmony_ci	MPP_MODE(29,
18662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
18762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "ptp", "clk",        V_MV78230_PLUS),
18862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "tdm", "int0",       V_MV78230_PLUS),
18962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "ref-clk",    V_MV78230_PLUS)),
19062306a36Sopenharmony_ci	MPP_MODE(30,
19162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
19262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "sd0", "clk",        V_MV78230_PLUS),
19362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "tdm", "int1",       V_MV78230_PLUS)),
19462306a36Sopenharmony_ci	MPP_MODE(31,
19562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
19662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "sd0", "cmd",        V_MV78230_PLUS),
19762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "tdm", "int2",       V_MV78230_PLUS)),
19862306a36Sopenharmony_ci	MPP_MODE(32,
19962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
20062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "sd0", "d0",         V_MV78230_PLUS),
20162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "tdm", "int3",       V_MV78230_PLUS)),
20262306a36Sopenharmony_ci	MPP_MODE(33,
20362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
20462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "sd0", "d1",         V_MV78230_PLUS),
20562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "tdm", "int4",       V_MV78230_PLUS),
20662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dram", "bat",       V_MV78230_PLUS),
20762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x5, "dram", "vttctrl",   V_MV78230_PLUS)),
20862306a36Sopenharmony_ci	MPP_MODE(34,
20962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
21062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "sd0", "d2",         V_MV78230_PLUS),
21162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "sata0", "prsnt",    V_MV78230_PLUS),
21262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "tdm", "int5",       V_MV78230_PLUS),
21362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dram", "deccerr",   V_MV78230_PLUS)),
21462306a36Sopenharmony_ci	MPP_MODE(35,
21562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
21662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "sd0", "d3",         V_MV78230_PLUS),
21762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "sata1", "prsnt",    V_MV78230_PLUS),
21862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "tdm", "int6",       V_MV78230_PLUS)),
21962306a36Sopenharmony_ci	MPP_MODE(36,
22062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
22162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "spi0", "mosi",      V_MV78230_PLUS)),
22262306a36Sopenharmony_ci	MPP_MODE(37,
22362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
22462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "spi0", "miso",      V_MV78230_PLUS)),
22562306a36Sopenharmony_ci	MPP_MODE(38,
22662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
22762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "spi0", "sck",       V_MV78230_PLUS)),
22862306a36Sopenharmony_ci	MPP_MODE(39,
22962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
23062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "spi0", "cs0",       V_MV78230_PLUS)),
23162306a36Sopenharmony_ci	MPP_MODE(40,
23262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
23362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "spi0", "cs1",       V_MV78230_PLUS),
23462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "uart2", "cts",      V_MV78230_PLUS),
23562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "vga-hsync",  V_MV78230_PLUS),
23662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x5, "pcie", "clkreq0",   V_MV78230_PLUS),
23762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x6, "spi1", "cs1",       V_MV78230_PLUS)),
23862306a36Sopenharmony_ci	MPP_MODE(41,
23962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
24062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "spi0", "cs2",       V_MV78230_PLUS),
24162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "uart2", "rts",      V_MV78230_PLUS),
24262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "sata1", "prsnt",    V_MV78230_PLUS),
24362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "lcd", "vga-vsync",  V_MV78230_PLUS),
24462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x5, "pcie", "clkreq1",   V_MV78230_PLUS),
24562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x6, "spi1", "cs2",       V_MV78230_PLUS)),
24662306a36Sopenharmony_ci	MPP_MODE(42,
24762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
24862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "uart2", "rxd",      V_MV78230_PLUS),
24962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "uart0", "cts",      V_MV78230_PLUS),
25062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "tdm", "int7",       V_MV78230_PLUS),
25162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "tdm", "timer",      V_MV78230_PLUS)),
25262306a36Sopenharmony_ci	MPP_MODE(43,
25362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
25462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "uart2", "txd",      V_MV78230_PLUS),
25562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "uart0", "rts",      V_MV78230_PLUS),
25662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "spi0", "cs3",       V_MV78230_PLUS),
25762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "pcie", "rstout",    V_MV78230_PLUS),
25862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x6, "spi1", "cs3",       V_MV78230_PLUS)),
25962306a36Sopenharmony_ci	MPP_MODE(44,
26062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
26162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "uart2", "cts",      V_MV78230_PLUS),
26262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "uart3", "rxd",      V_MV78230_PLUS),
26362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "spi0", "cs4",       V_MV78230_PLUS),
26462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dram", "bat",       V_MV78230_PLUS),
26562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x5, "pcie", "clkreq2",   V_MV78230_PLUS),
26662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x6, "spi1", "cs4",       V_MV78230_PLUS)),
26762306a36Sopenharmony_ci	MPP_MODE(45,
26862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
26962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "uart2", "rts",      V_MV78230_PLUS),
27062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "uart3", "txd",      V_MV78230_PLUS),
27162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "spi0", "cs5",       V_MV78230_PLUS),
27262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "sata1", "prsnt",    V_MV78230_PLUS),
27362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x5, "dram", "vttctrl",   V_MV78230_PLUS),
27462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x6, "spi1", "cs5",       V_MV78230_PLUS)),
27562306a36Sopenharmony_ci	MPP_MODE(46,
27662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
27762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "uart3", "rts",      V_MV78230_PLUS),
27862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "uart1", "rts",      V_MV78230_PLUS),
27962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "spi0", "cs6",       V_MV78230_PLUS),
28062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "sata0", "prsnt",    V_MV78230_PLUS),
28162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x6, "spi1", "cs6",       V_MV78230_PLUS)),
28262306a36Sopenharmony_ci	MPP_MODE(47,
28362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
28462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "uart3", "cts",      V_MV78230_PLUS),
28562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "uart1", "cts",      V_MV78230_PLUS),
28662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "spi0", "cs7",       V_MV78230_PLUS),
28762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "ref", "clkout",     V_MV78230_PLUS),
28862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x5, "pcie", "clkreq3",   V_MV78230_PLUS),
28962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x6, "spi1", "cs7",       V_MV78230_PLUS)),
29062306a36Sopenharmony_ci	MPP_MODE(48,
29162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
29262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "dev", "clkout",     V_MV78230_PLUS),
29362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "dev", "burst/last", V_MV78230_PLUS),
29462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "nand", "rb",        V_MV78230_PLUS)),
29562306a36Sopenharmony_ci	MPP_MODE(49,
29662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
29762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "dev", "we3",        V_MV78260_PLUS)),
29862306a36Sopenharmony_ci	MPP_MODE(50,
29962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
30062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "dev", "we2",        V_MV78260_PLUS)),
30162306a36Sopenharmony_ci	MPP_MODE(51,
30262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
30362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "dev", "ad16",       V_MV78260_PLUS)),
30462306a36Sopenharmony_ci	MPP_MODE(52,
30562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
30662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "dev", "ad17",       V_MV78260_PLUS)),
30762306a36Sopenharmony_ci	MPP_MODE(53,
30862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
30962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "dev", "ad18",       V_MV78260_PLUS)),
31062306a36Sopenharmony_ci	MPP_MODE(54,
31162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
31262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "dev", "ad19",       V_MV78260_PLUS)),
31362306a36Sopenharmony_ci	MPP_MODE(55,
31462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
31562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "dev", "ad20",       V_MV78260_PLUS)),
31662306a36Sopenharmony_ci	MPP_MODE(56,
31762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
31862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "dev", "ad21",       V_MV78260_PLUS)),
31962306a36Sopenharmony_ci	MPP_MODE(57,
32062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
32162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "dev", "ad22",       V_MV78260_PLUS)),
32262306a36Sopenharmony_ci	MPP_MODE(58,
32362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
32462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "dev", "ad23",       V_MV78260_PLUS)),
32562306a36Sopenharmony_ci	MPP_MODE(59,
32662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
32762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "dev", "ad24",       V_MV78260_PLUS)),
32862306a36Sopenharmony_ci	MPP_MODE(60,
32962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
33062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "dev", "ad25",       V_MV78260_PLUS)),
33162306a36Sopenharmony_ci	MPP_MODE(61,
33262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
33362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "dev", "ad26",       V_MV78260_PLUS)),
33462306a36Sopenharmony_ci	MPP_MODE(62,
33562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
33662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "dev", "ad27",       V_MV78260_PLUS)),
33762306a36Sopenharmony_ci	MPP_MODE(63,
33862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
33962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "dev", "ad28",       V_MV78260_PLUS)),
34062306a36Sopenharmony_ci	MPP_MODE(64,
34162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
34262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "dev", "ad29",       V_MV78260_PLUS)),
34362306a36Sopenharmony_ci	MPP_MODE(65,
34462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
34562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "dev", "ad30",       V_MV78260_PLUS)),
34662306a36Sopenharmony_ci	MPP_MODE(66,
34762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
34862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "dev", "ad31",       V_MV78260_PLUS)),
34962306a36Sopenharmony_ci};
35062306a36Sopenharmony_ci
35162306a36Sopenharmony_cistatic struct mvebu_mpp_mode mv98dx3236_mpp_modes[] = {
35262306a36Sopenharmony_ci	MPP_MODE(0,
35362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
35462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "spi0", "mosi",       V_98DX3236_PLUS),
35562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "ad8",         V_98DX3236_PLUS)),
35662306a36Sopenharmony_ci	MPP_MODE(1,
35762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
35862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "spi0", "miso",       V_98DX3236_PLUS),
35962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "ad9",         V_98DX3236_PLUS)),
36062306a36Sopenharmony_ci	MPP_MODE(2,
36162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
36262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "spi0", "sck",        V_98DX3236_PLUS),
36362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "ad10",        V_98DX3236_PLUS)),
36462306a36Sopenharmony_ci	MPP_MODE(3,
36562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
36662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "spi0", "cs0",        V_98DX3236_PLUS),
36762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "ad11",        V_98DX3236_PLUS)),
36862306a36Sopenharmony_ci	MPP_MODE(4,
36962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
37062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "spi0", "cs1",        V_98DX3236_PLUS),
37162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "smi", "mdc",         V_98DX3236_PLUS),
37262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "cs0",         V_98DX3236_PLUS)),
37362306a36Sopenharmony_ci	MPP_MODE(5,
37462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
37562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "pex", "rsto",        V_98DX3236_PLUS),
37662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "sd0", "cmd",         V_98DX4251),
37762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "bootcs",      V_98DX3236_PLUS)),
37862306a36Sopenharmony_ci	MPP_MODE(6,
37962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
38062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "sd0", "clk",         V_98DX4251),
38162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "a2",          V_98DX3236_PLUS)),
38262306a36Sopenharmony_ci	MPP_MODE(7,
38362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
38462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "sd0", "d0",          V_98DX4251),
38562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "ale0",        V_98DX3236_PLUS)),
38662306a36Sopenharmony_ci	MPP_MODE(8,
38762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
38862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "sd0", "d1",          V_98DX4251),
38962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "ale1",        V_98DX3236_PLUS)),
39062306a36Sopenharmony_ci	MPP_MODE(9,
39162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
39262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "sd0", "d2",          V_98DX4251),
39362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "ready0",      V_98DX3236_PLUS)),
39462306a36Sopenharmony_ci	MPP_MODE(10,
39562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
39662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "sd0", "d3",          V_98DX4251),
39762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "ad12",        V_98DX3236_PLUS)),
39862306a36Sopenharmony_ci	MPP_MODE(11,
39962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
40062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "uart1", "rxd",       V_98DX3236_PLUS),
40162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "uart0", "cts",       V_98DX3236_PLUS),
40262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "ad13",        V_98DX3236_PLUS)),
40362306a36Sopenharmony_ci	MPP_MODE(12,
40462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
40562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x2, "uart1", "txd",       V_98DX3236_PLUS),
40662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "uart0", "rts",       V_98DX3236_PLUS),
40762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "ad14",        V_98DX3236_PLUS)),
40862306a36Sopenharmony_ci	MPP_MODE(13,
40962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
41062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "intr", "out",        V_98DX3236_PLUS),
41162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "ad15",        V_98DX3236_PLUS)),
41262306a36Sopenharmony_ci	MPP_MODE(14,
41362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
41462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "i2c0", "sck",        V_98DX3236_PLUS)),
41562306a36Sopenharmony_ci	MPP_MODE(15,
41662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
41762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "i2c0", "sda",        V_98DX3236_PLUS)),
41862306a36Sopenharmony_ci	MPP_MODE(16,
41962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
42062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "oe",          V_98DX3236_PLUS)),
42162306a36Sopenharmony_ci	MPP_MODE(17,
42262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
42362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "clkout",      V_98DX3236_PLUS)),
42462306a36Sopenharmony_ci	MPP_MODE(18,
42562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
42662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "uart1", "txd",       V_98DX3236_PLUS)),
42762306a36Sopenharmony_ci	MPP_MODE(19,
42862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
42962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "uart1", "rxd",       V_98DX3236_PLUS),
43062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "nand", "rb",         V_98DX3236_PLUS)),
43162306a36Sopenharmony_ci	MPP_MODE(20,
43262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
43362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "we0",         V_98DX3236_PLUS)),
43462306a36Sopenharmony_ci	MPP_MODE(21,
43562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
43662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "ad0",         V_98DX3236_PLUS)),
43762306a36Sopenharmony_ci	MPP_MODE(22,
43862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
43962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "ad1",         V_98DX3236_PLUS)),
44062306a36Sopenharmony_ci	MPP_MODE(23,
44162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
44262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "ad2",         V_98DX3236_PLUS)),
44362306a36Sopenharmony_ci	MPP_MODE(24,
44462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
44562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "ad3",         V_98DX3236_PLUS)),
44662306a36Sopenharmony_ci	MPP_MODE(25,
44762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
44862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "ad4",         V_98DX3236_PLUS)),
44962306a36Sopenharmony_ci	MPP_MODE(26,
45062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
45162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "ad5",         V_98DX3236_PLUS)),
45262306a36Sopenharmony_ci	MPP_MODE(27,
45362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
45462306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "ad6",         V_98DX3236_PLUS)),
45562306a36Sopenharmony_ci	MPP_MODE(28,
45662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
45762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "ad7",         V_98DX3236_PLUS)),
45862306a36Sopenharmony_ci	MPP_MODE(29,
45962306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
46062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "a0",          V_98DX3236_PLUS)),
46162306a36Sopenharmony_ci	MPP_MODE(30,
46262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
46362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "a1",          V_98DX3236_PLUS)),
46462306a36Sopenharmony_ci	MPP_MODE(31,
46562306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
46662306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "slv_smi", "mdc",     V_98DX3236_PLUS),
46762306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "smi", "mdc",         V_98DX3236_PLUS),
46862306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "we1",         V_98DX3236_PLUS)),
46962306a36Sopenharmony_ci	MPP_MODE(32,
47062306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
47162306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x1, "slv_smi", "mdio",    V_98DX3236_PLUS),
47262306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x3, "smi", "mdio",        V_98DX3236_PLUS),
47362306a36Sopenharmony_ci		 MPP_VAR_FUNCTION(0x4, "dev", "cs1",         V_98DX3236_PLUS)),
47462306a36Sopenharmony_ci};
47562306a36Sopenharmony_ci
47662306a36Sopenharmony_cistatic struct mvebu_pinctrl_soc_info armada_xp_pinctrl_info;
47762306a36Sopenharmony_ci
47862306a36Sopenharmony_cistatic const struct of_device_id armada_xp_pinctrl_of_match[] = {
47962306a36Sopenharmony_ci	{
48062306a36Sopenharmony_ci		.compatible = "marvell,mv78230-pinctrl",
48162306a36Sopenharmony_ci		.data       = (void *) V_MV78230,
48262306a36Sopenharmony_ci	},
48362306a36Sopenharmony_ci	{
48462306a36Sopenharmony_ci		.compatible = "marvell,mv78260-pinctrl",
48562306a36Sopenharmony_ci		.data       = (void *) V_MV78260,
48662306a36Sopenharmony_ci	},
48762306a36Sopenharmony_ci	{
48862306a36Sopenharmony_ci		.compatible = "marvell,mv78460-pinctrl",
48962306a36Sopenharmony_ci		.data       = (void *) V_MV78460,
49062306a36Sopenharmony_ci	},
49162306a36Sopenharmony_ci	{
49262306a36Sopenharmony_ci		.compatible = "marvell,98dx3236-pinctrl",
49362306a36Sopenharmony_ci		.data       = (void *) V_98DX3236,
49462306a36Sopenharmony_ci	},
49562306a36Sopenharmony_ci	{
49662306a36Sopenharmony_ci		.compatible = "marvell,98dx4251-pinctrl",
49762306a36Sopenharmony_ci		.data       = (void *) V_98DX4251,
49862306a36Sopenharmony_ci	},
49962306a36Sopenharmony_ci	{ },
50062306a36Sopenharmony_ci};
50162306a36Sopenharmony_ci
50262306a36Sopenharmony_cistatic const struct mvebu_mpp_ctrl mv78230_mpp_controls[] = {
50362306a36Sopenharmony_ci	MPP_FUNC_CTRL(0, 48, NULL, mvebu_mmio_mpp_ctrl),
50462306a36Sopenharmony_ci};
50562306a36Sopenharmony_ci
50662306a36Sopenharmony_cistatic struct pinctrl_gpio_range mv78230_mpp_gpio_ranges[] = {
50762306a36Sopenharmony_ci	MPP_GPIO_RANGE(0,   0,  0, 32),
50862306a36Sopenharmony_ci	MPP_GPIO_RANGE(1,  32, 32, 17),
50962306a36Sopenharmony_ci};
51062306a36Sopenharmony_ci
51162306a36Sopenharmony_cistatic const struct mvebu_mpp_ctrl mv78260_mpp_controls[] = {
51262306a36Sopenharmony_ci	MPP_FUNC_CTRL(0, 66, NULL, mvebu_mmio_mpp_ctrl),
51362306a36Sopenharmony_ci};
51462306a36Sopenharmony_ci
51562306a36Sopenharmony_cistatic struct pinctrl_gpio_range mv78260_mpp_gpio_ranges[] = {
51662306a36Sopenharmony_ci	MPP_GPIO_RANGE(0,   0,  0, 32),
51762306a36Sopenharmony_ci	MPP_GPIO_RANGE(1,  32, 32, 32),
51862306a36Sopenharmony_ci	MPP_GPIO_RANGE(2,  64, 64,  3),
51962306a36Sopenharmony_ci};
52062306a36Sopenharmony_ci
52162306a36Sopenharmony_cistatic const struct mvebu_mpp_ctrl mv78460_mpp_controls[] = {
52262306a36Sopenharmony_ci	MPP_FUNC_CTRL(0, 66, NULL, mvebu_mmio_mpp_ctrl),
52362306a36Sopenharmony_ci};
52462306a36Sopenharmony_ci
52562306a36Sopenharmony_cistatic struct pinctrl_gpio_range mv78460_mpp_gpio_ranges[] = {
52662306a36Sopenharmony_ci	MPP_GPIO_RANGE(0,   0,  0, 32),
52762306a36Sopenharmony_ci	MPP_GPIO_RANGE(1,  32, 32, 32),
52862306a36Sopenharmony_ci	MPP_GPIO_RANGE(2,  64, 64,  3),
52962306a36Sopenharmony_ci};
53062306a36Sopenharmony_ci
53162306a36Sopenharmony_cistatic struct mvebu_mpp_ctrl mv98dx3236_mpp_controls[] = {
53262306a36Sopenharmony_ci	MPP_FUNC_CTRL(0, 32, NULL, mvebu_mmio_mpp_ctrl),
53362306a36Sopenharmony_ci};
53462306a36Sopenharmony_ci
53562306a36Sopenharmony_cistatic struct pinctrl_gpio_range mv98dx3236_mpp_gpio_ranges[] = {
53662306a36Sopenharmony_ci	MPP_GPIO_RANGE(0, 0, 0, 32),
53762306a36Sopenharmony_ci};
53862306a36Sopenharmony_ci
53962306a36Sopenharmony_cistatic int armada_xp_pinctrl_suspend(struct platform_device *pdev,
54062306a36Sopenharmony_ci				     pm_message_t state)
54162306a36Sopenharmony_ci{
54262306a36Sopenharmony_ci	struct mvebu_pinctrl_soc_info *soc =
54362306a36Sopenharmony_ci		platform_get_drvdata(pdev);
54462306a36Sopenharmony_ci	int i, nregs;
54562306a36Sopenharmony_ci
54662306a36Sopenharmony_ci	nregs = DIV_ROUND_UP(soc->nmodes, MVEBU_MPPS_PER_REG);
54762306a36Sopenharmony_ci
54862306a36Sopenharmony_ci	for (i = 0; i < nregs; i++)
54962306a36Sopenharmony_ci		mpp_saved_regs[i] = readl(soc->control_data[0].base + i * 4);
55062306a36Sopenharmony_ci
55162306a36Sopenharmony_ci	return 0;
55262306a36Sopenharmony_ci}
55362306a36Sopenharmony_ci
55462306a36Sopenharmony_cistatic int armada_xp_pinctrl_resume(struct platform_device *pdev)
55562306a36Sopenharmony_ci{
55662306a36Sopenharmony_ci	struct mvebu_pinctrl_soc_info *soc =
55762306a36Sopenharmony_ci		platform_get_drvdata(pdev);
55862306a36Sopenharmony_ci	int i, nregs;
55962306a36Sopenharmony_ci
56062306a36Sopenharmony_ci	nregs = DIV_ROUND_UP(soc->nmodes, MVEBU_MPPS_PER_REG);
56162306a36Sopenharmony_ci
56262306a36Sopenharmony_ci	for (i = 0; i < nregs; i++)
56362306a36Sopenharmony_ci		writel(mpp_saved_regs[i], soc->control_data[0].base + i * 4);
56462306a36Sopenharmony_ci
56562306a36Sopenharmony_ci	return 0;
56662306a36Sopenharmony_ci}
56762306a36Sopenharmony_ci
56862306a36Sopenharmony_cistatic int armada_xp_pinctrl_probe(struct platform_device *pdev)
56962306a36Sopenharmony_ci{
57062306a36Sopenharmony_ci	struct mvebu_pinctrl_soc_info *soc = &armada_xp_pinctrl_info;
57162306a36Sopenharmony_ci	const struct of_device_id *match =
57262306a36Sopenharmony_ci		of_match_device(armada_xp_pinctrl_of_match, &pdev->dev);
57362306a36Sopenharmony_ci	int nregs;
57462306a36Sopenharmony_ci
57562306a36Sopenharmony_ci	if (!match)
57662306a36Sopenharmony_ci		return -ENODEV;
57762306a36Sopenharmony_ci
57862306a36Sopenharmony_ci	soc->variant = (unsigned) match->data & 0xff;
57962306a36Sopenharmony_ci
58062306a36Sopenharmony_ci	switch (soc->variant) {
58162306a36Sopenharmony_ci	case V_MV78230:
58262306a36Sopenharmony_ci		soc->controls = mv78230_mpp_controls;
58362306a36Sopenharmony_ci		soc->ncontrols = ARRAY_SIZE(mv78230_mpp_controls);
58462306a36Sopenharmony_ci		soc->modes = armada_xp_mpp_modes;
58562306a36Sopenharmony_ci		/* We don't necessarily want the full list of the
58662306a36Sopenharmony_ci		 * armada_xp_mpp_modes, but only the first 'n' ones
58762306a36Sopenharmony_ci		 * that are available on this SoC */
58862306a36Sopenharmony_ci		soc->nmodes = mv78230_mpp_controls[0].npins;
58962306a36Sopenharmony_ci		soc->gpioranges = mv78230_mpp_gpio_ranges;
59062306a36Sopenharmony_ci		soc->ngpioranges = ARRAY_SIZE(mv78230_mpp_gpio_ranges);
59162306a36Sopenharmony_ci		break;
59262306a36Sopenharmony_ci	case V_MV78260:
59362306a36Sopenharmony_ci		soc->controls = mv78260_mpp_controls;
59462306a36Sopenharmony_ci		soc->ncontrols = ARRAY_SIZE(mv78260_mpp_controls);
59562306a36Sopenharmony_ci		soc->modes = armada_xp_mpp_modes;
59662306a36Sopenharmony_ci		/* We don't necessarily want the full list of the
59762306a36Sopenharmony_ci		 * armada_xp_mpp_modes, but only the first 'n' ones
59862306a36Sopenharmony_ci		 * that are available on this SoC */
59962306a36Sopenharmony_ci		soc->nmodes = mv78260_mpp_controls[0].npins;
60062306a36Sopenharmony_ci		soc->gpioranges = mv78260_mpp_gpio_ranges;
60162306a36Sopenharmony_ci		soc->ngpioranges = ARRAY_SIZE(mv78260_mpp_gpio_ranges);
60262306a36Sopenharmony_ci		break;
60362306a36Sopenharmony_ci	case V_MV78460:
60462306a36Sopenharmony_ci		soc->controls = mv78460_mpp_controls;
60562306a36Sopenharmony_ci		soc->ncontrols = ARRAY_SIZE(mv78460_mpp_controls);
60662306a36Sopenharmony_ci		soc->modes = armada_xp_mpp_modes;
60762306a36Sopenharmony_ci		/* We don't necessarily want the full list of the
60862306a36Sopenharmony_ci		 * armada_xp_mpp_modes, but only the first 'n' ones
60962306a36Sopenharmony_ci		 * that are available on this SoC */
61062306a36Sopenharmony_ci		soc->nmodes = mv78460_mpp_controls[0].npins;
61162306a36Sopenharmony_ci		soc->gpioranges = mv78460_mpp_gpio_ranges;
61262306a36Sopenharmony_ci		soc->ngpioranges = ARRAY_SIZE(mv78460_mpp_gpio_ranges);
61362306a36Sopenharmony_ci		break;
61462306a36Sopenharmony_ci	case V_98DX3236:
61562306a36Sopenharmony_ci	case V_98DX3336:
61662306a36Sopenharmony_ci	case V_98DX4251:
61762306a36Sopenharmony_ci		/* fall-through */
61862306a36Sopenharmony_ci		soc->controls = mv98dx3236_mpp_controls;
61962306a36Sopenharmony_ci		soc->ncontrols = ARRAY_SIZE(mv98dx3236_mpp_controls);
62062306a36Sopenharmony_ci		soc->modes = mv98dx3236_mpp_modes;
62162306a36Sopenharmony_ci		soc->nmodes = mv98dx3236_mpp_controls[0].npins;
62262306a36Sopenharmony_ci		soc->gpioranges = mv98dx3236_mpp_gpio_ranges;
62362306a36Sopenharmony_ci		soc->ngpioranges = ARRAY_SIZE(mv98dx3236_mpp_gpio_ranges);
62462306a36Sopenharmony_ci		break;
62562306a36Sopenharmony_ci	}
62662306a36Sopenharmony_ci
62762306a36Sopenharmony_ci	nregs = DIV_ROUND_UP(soc->nmodes, MVEBU_MPPS_PER_REG);
62862306a36Sopenharmony_ci
62962306a36Sopenharmony_ci	mpp_saved_regs = devm_kmalloc_array(&pdev->dev, nregs, sizeof(u32),
63062306a36Sopenharmony_ci					    GFP_KERNEL);
63162306a36Sopenharmony_ci	if (!mpp_saved_regs)
63262306a36Sopenharmony_ci		return -ENOMEM;
63362306a36Sopenharmony_ci
63462306a36Sopenharmony_ci	pdev->dev.platform_data = soc;
63562306a36Sopenharmony_ci
63662306a36Sopenharmony_ci	return mvebu_pinctrl_simple_mmio_probe(pdev);
63762306a36Sopenharmony_ci}
63862306a36Sopenharmony_ci
63962306a36Sopenharmony_cistatic struct platform_driver armada_xp_pinctrl_driver = {
64062306a36Sopenharmony_ci	.driver = {
64162306a36Sopenharmony_ci		.name = "armada-xp-pinctrl",
64262306a36Sopenharmony_ci		.of_match_table = armada_xp_pinctrl_of_match,
64362306a36Sopenharmony_ci	},
64462306a36Sopenharmony_ci	.probe = armada_xp_pinctrl_probe,
64562306a36Sopenharmony_ci	.suspend = armada_xp_pinctrl_suspend,
64662306a36Sopenharmony_ci	.resume = armada_xp_pinctrl_resume,
64762306a36Sopenharmony_ci};
64862306a36Sopenharmony_cibuiltin_platform_driver(armada_xp_pinctrl_driver);
649