162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Marvell Armada 370 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
1062306a36Sopenharmony_ci#include <linux/err.h>
1162306a36Sopenharmony_ci#include <linux/init.h>
1262306a36Sopenharmony_ci#include <linux/io.h>
1362306a36Sopenharmony_ci#include <linux/platform_device.h>
1462306a36Sopenharmony_ci#include <linux/clk.h>
1562306a36Sopenharmony_ci#include <linux/of.h>
1662306a36Sopenharmony_ci#include <linux/pinctrl/pinctrl.h>
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci#include "pinctrl-mvebu.h"
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_cistatic struct mvebu_mpp_mode mv88f6710_mpp_modes[] = {
2162306a36Sopenharmony_ci	MPP_MODE(0,
2262306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
2362306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "uart0", "rxd")),
2462306a36Sopenharmony_ci	MPP_MODE(1,
2562306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
2662306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "uart0", "txd")),
2762306a36Sopenharmony_ci	MPP_MODE(2,
2862306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
2962306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "i2c0", "sck"),
3062306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart0", "txd")),
3162306a36Sopenharmony_ci	MPP_MODE(3,
3262306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
3362306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "i2c0", "sda"),
3462306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart0", "rxd")),
3562306a36Sopenharmony_ci	MPP_MODE(4,
3662306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
3762306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "vdd", "cpu-pd")),
3862306a36Sopenharmony_ci	MPP_MODE(5,
3962306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
4062306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "txclkout"),
4162306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "txd"),
4262306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "spi1", "sck"),
4362306a36Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "mclk")),
4462306a36Sopenharmony_ci	MPP_MODE(6,
4562306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
4662306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "txd0"),
4762306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "sata0", "prsnt"),
4862306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "tdm", "rst"),
4962306a36Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "sdo")),
5062306a36Sopenharmony_ci	MPP_MODE(7,
5162306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
5262306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "txd1"),
5362306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "tdm", "dtx"),
5462306a36Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "lrclk")),
5562306a36Sopenharmony_ci	MPP_MODE(8,
5662306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
5762306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "txd2"),
5862306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart0", "rts"),
5962306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "tdm", "drx"),
6062306a36Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "bclk")),
6162306a36Sopenharmony_ci	MPP_MODE(9,
6262306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
6362306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "txd3"),
6462306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "txd"),
6562306a36Sopenharmony_ci	   MPP_FUNCTION(0x3, "sd0", "clk"),
6662306a36Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "spdifo")),
6762306a36Sopenharmony_ci	MPP_MODE(10,
6862306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
6962306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "txctl"),
7062306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart0", "cts"),
7162306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "tdm", "fsync"),
7262306a36Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "sdi")),
7362306a36Sopenharmony_ci	MPP_MODE(11,
7462306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
7562306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "rxd0"),
7662306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "rxd"),
7762306a36Sopenharmony_ci	   MPP_FUNCTION(0x3, "sd0", "cmd"),
7862306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "spi0", "cs1"),
7962306a36Sopenharmony_ci	   MPP_FUNCTION(0x5, "sata1", "prsnt"),
8062306a36Sopenharmony_ci	   MPP_FUNCTION(0x6, "spi1", "cs1")),
8162306a36Sopenharmony_ci	MPP_MODE(12,
8262306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
8362306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "rxd1"),
8462306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "i2c1", "sda"),
8562306a36Sopenharmony_ci	   MPP_FUNCTION(0x3, "sd0", "d0"),
8662306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "spi1", "cs0"),
8762306a36Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "spdifi")),
8862306a36Sopenharmony_ci	MPP_MODE(13,
8962306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
9062306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "rxd2"),
9162306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "i2c1", "sck"),
9262306a36Sopenharmony_ci	   MPP_FUNCTION(0x3, "sd0", "d1"),
9362306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "tdm", "pclk"),
9462306a36Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "rmclk")),
9562306a36Sopenharmony_ci	MPP_MODE(14,
9662306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
9762306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "rxd3"),
9862306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "pcie", "clkreq0"),
9962306a36Sopenharmony_ci	   MPP_FUNCTION(0x3, "sd0", "d2"),
10062306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "spi1", "mosi"),
10162306a36Sopenharmony_ci	   MPP_FUNCTION(0x5, "spi0", "cs2")),
10262306a36Sopenharmony_ci	MPP_MODE(15,
10362306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
10462306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "rxctl"),
10562306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "pcie", "clkreq1"),
10662306a36Sopenharmony_ci	   MPP_FUNCTION(0x3, "sd0", "d3"),
10762306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "spi1", "miso"),
10862306a36Sopenharmony_ci	   MPP_FUNCTION(0x5, "spi0", "cs3")),
10962306a36Sopenharmony_ci	MPP_MODE(16,
11062306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
11162306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "rxclk"),
11262306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "rxd"),
11362306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "tdm", "int"),
11462306a36Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "extclk")),
11562306a36Sopenharmony_ci	MPP_MODE(17,
11662306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
11762306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge", "mdc")),
11862306a36Sopenharmony_ci	MPP_MODE(18,
11962306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
12062306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge", "mdio")),
12162306a36Sopenharmony_ci	MPP_MODE(19,
12262306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
12362306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "txclk"),
12462306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "ge1", "txclkout"),
12562306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "tdm", "pclk")),
12662306a36Sopenharmony_ci	MPP_MODE(20,
12762306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
12862306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "txd4"),
12962306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "ge1", "txd0")),
13062306a36Sopenharmony_ci	MPP_MODE(21,
13162306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
13262306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "txd5"),
13362306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "ge1", "txd1"),
13462306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "uart1", "txd")),
13562306a36Sopenharmony_ci	MPP_MODE(22,
13662306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
13762306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "txd6"),
13862306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "ge1", "txd2"),
13962306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "uart0", "rts")),
14062306a36Sopenharmony_ci	MPP_MODE(23,
14162306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
14262306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "txd7"),
14362306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "ge1", "txd3"),
14462306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "spi1", "mosi")),
14562306a36Sopenharmony_ci	MPP_MODE(24,
14662306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
14762306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "col"),
14862306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "ge1", "txctl"),
14962306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "spi1", "cs0")),
15062306a36Sopenharmony_ci	MPP_MODE(25,
15162306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
15262306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "rxerr"),
15362306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "ge1", "rxd0"),
15462306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "uart1", "rxd")),
15562306a36Sopenharmony_ci	MPP_MODE(26,
15662306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
15762306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "crs"),
15862306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "ge1", "rxd1"),
15962306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "spi1", "miso")),
16062306a36Sopenharmony_ci	MPP_MODE(27,
16162306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
16262306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "rxd4"),
16362306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "ge1", "rxd2"),
16462306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "uart0", "cts")),
16562306a36Sopenharmony_ci	MPP_MODE(28,
16662306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
16762306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "rxd5"),
16862306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "ge1", "rxd3")),
16962306a36Sopenharmony_ci	MPP_MODE(29,
17062306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
17162306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "rxd6"),
17262306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "ge1", "rxctl"),
17362306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "i2c1", "sda")),
17462306a36Sopenharmony_ci	MPP_MODE(30,
17562306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
17662306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "rxd7"),
17762306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "ge1", "rxclk"),
17862306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "i2c1", "sck")),
17962306a36Sopenharmony_ci	MPP_MODE(31,
18062306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
18162306a36Sopenharmony_ci	   MPP_FUNCTION(0x3, "tclk", NULL),
18262306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "ge0", "txerr")),
18362306a36Sopenharmony_ci	MPP_MODE(32,
18462306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
18562306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "spi0", "cs0")),
18662306a36Sopenharmony_ci	MPP_MODE(33,
18762306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
18862306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "bootcs"),
18962306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "spi0", "cs0")),
19062306a36Sopenharmony_ci	MPP_MODE(34,
19162306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
19262306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "we0"),
19362306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "spi0", "mosi")),
19462306a36Sopenharmony_ci	MPP_MODE(35,
19562306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
19662306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "oe"),
19762306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "spi0", "sck")),
19862306a36Sopenharmony_ci	MPP_MODE(36,
19962306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
20062306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "a1"),
20162306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "spi0", "miso")),
20262306a36Sopenharmony_ci	MPP_MODE(37,
20362306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
20462306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "a0"),
20562306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "sata0", "prsnt")),
20662306a36Sopenharmony_ci	MPP_MODE(38,
20762306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
20862306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ready"),
20962306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "cts"),
21062306a36Sopenharmony_ci	   MPP_FUNCTION(0x3, "uart0", "cts")),
21162306a36Sopenharmony_ci	MPP_MODE(39,
21262306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
21362306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad0"),
21462306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "audio", "spdifo")),
21562306a36Sopenharmony_ci	MPP_MODE(40,
21662306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
21762306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad1"),
21862306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "rts"),
21962306a36Sopenharmony_ci	   MPP_FUNCTION(0x3, "uart0", "rts")),
22062306a36Sopenharmony_ci	MPP_MODE(41,
22162306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
22262306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad2"),
22362306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "rxd")),
22462306a36Sopenharmony_ci	MPP_MODE(42,
22562306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
22662306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad3"),
22762306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "txd")),
22862306a36Sopenharmony_ci	MPP_MODE(43,
22962306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
23062306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad4"),
23162306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "audio", "bclk")),
23262306a36Sopenharmony_ci	MPP_MODE(44,
23362306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
23462306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad5"),
23562306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "audio", "mclk")),
23662306a36Sopenharmony_ci	MPP_MODE(45,
23762306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
23862306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad6"),
23962306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "audio", "lrclk")),
24062306a36Sopenharmony_ci	MPP_MODE(46,
24162306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
24262306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad7"),
24362306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "audio", "sdo")),
24462306a36Sopenharmony_ci	MPP_MODE(47,
24562306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
24662306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad8"),
24762306a36Sopenharmony_ci	   MPP_FUNCTION(0x3, "sd0", "clk"),
24862306a36Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "spdifo")),
24962306a36Sopenharmony_ci	MPP_MODE(48,
25062306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
25162306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad9"),
25262306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart0", "rts"),
25362306a36Sopenharmony_ci	   MPP_FUNCTION(0x3, "sd0", "cmd"),
25462306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "sata1", "prsnt"),
25562306a36Sopenharmony_ci	   MPP_FUNCTION(0x5, "spi0", "cs1")),
25662306a36Sopenharmony_ci	MPP_MODE(49,
25762306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
25862306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad10"),
25962306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "pcie", "clkreq1"),
26062306a36Sopenharmony_ci	   MPP_FUNCTION(0x3, "sd0", "d0"),
26162306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "spi1", "cs0"),
26262306a36Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "spdifi")),
26362306a36Sopenharmony_ci	MPP_MODE(50,
26462306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
26562306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad11"),
26662306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart0", "cts"),
26762306a36Sopenharmony_ci	   MPP_FUNCTION(0x3, "sd0", "d1"),
26862306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "spi1", "miso"),
26962306a36Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "rmclk")),
27062306a36Sopenharmony_ci	MPP_MODE(51,
27162306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
27262306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad12"),
27362306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "i2c1", "sda"),
27462306a36Sopenharmony_ci	   MPP_FUNCTION(0x3, "sd0", "d2"),
27562306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "spi1", "mosi")),
27662306a36Sopenharmony_ci	MPP_MODE(52,
27762306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
27862306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad13"),
27962306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "i2c1", "sck"),
28062306a36Sopenharmony_ci	   MPP_FUNCTION(0x3, "sd0", "d3"),
28162306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "spi1", "sck")),
28262306a36Sopenharmony_ci	MPP_MODE(53,
28362306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
28462306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad14"),
28562306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "sd0", "clk"),
28662306a36Sopenharmony_ci	   MPP_FUNCTION(0x3, "tdm", "pclk"),
28762306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "spi0", "cs2"),
28862306a36Sopenharmony_ci	   MPP_FUNCTION(0x5, "pcie", "clkreq1")),
28962306a36Sopenharmony_ci	MPP_MODE(54,
29062306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
29162306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad15"),
29262306a36Sopenharmony_ci	   MPP_FUNCTION(0x3, "tdm", "dtx")),
29362306a36Sopenharmony_ci	MPP_MODE(55,
29462306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
29562306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "cs1"),
29662306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "txd"),
29762306a36Sopenharmony_ci	   MPP_FUNCTION(0x3, "tdm", "rst"),
29862306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "sata1", "prsnt"),
29962306a36Sopenharmony_ci	   MPP_FUNCTION(0x5, "sata0", "prsnt")),
30062306a36Sopenharmony_ci	MPP_MODE(56,
30162306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
30262306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "cs2"),
30362306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "cts"),
30462306a36Sopenharmony_ci	   MPP_FUNCTION(0x3, "uart0", "cts"),
30562306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "spi0", "cs3"),
30662306a36Sopenharmony_ci	   MPP_FUNCTION(0x5, "pcie", "clkreq0"),
30762306a36Sopenharmony_ci	   MPP_FUNCTION(0x6, "spi1", "cs1")),
30862306a36Sopenharmony_ci	MPP_MODE(57,
30962306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
31062306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "cs3"),
31162306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "rxd"),
31262306a36Sopenharmony_ci	   MPP_FUNCTION(0x3, "tdm", "fsync"),
31362306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "sata0", "prsnt"),
31462306a36Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "sdo")),
31562306a36Sopenharmony_ci	MPP_MODE(58,
31662306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
31762306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "cs0"),
31862306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "rts"),
31962306a36Sopenharmony_ci	   MPP_FUNCTION(0x3, "tdm", "int"),
32062306a36Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "extclk"),
32162306a36Sopenharmony_ci	   MPP_FUNCTION(0x6, "uart0", "rts")),
32262306a36Sopenharmony_ci	MPP_MODE(59,
32362306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
32462306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ale0"),
32562306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "rts"),
32662306a36Sopenharmony_ci	   MPP_FUNCTION(0x3, "uart0", "rts"),
32762306a36Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "bclk")),
32862306a36Sopenharmony_ci	MPP_MODE(60,
32962306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
33062306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ale1"),
33162306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "rxd"),
33262306a36Sopenharmony_ci	   MPP_FUNCTION(0x3, "sata0", "prsnt"),
33362306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "pcie", "rstout"),
33462306a36Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "sdi")),
33562306a36Sopenharmony_ci	MPP_MODE(61,
33662306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
33762306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "we1"),
33862306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "txd"),
33962306a36Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "lrclk")),
34062306a36Sopenharmony_ci	MPP_MODE(62,
34162306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
34262306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "a2"),
34362306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "cts"),
34462306a36Sopenharmony_ci	   MPP_FUNCTION(0x3, "tdm", "drx"),
34562306a36Sopenharmony_ci	   MPP_FUNCTION(0x4, "pcie", "clkreq0"),
34662306a36Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "mclk"),
34762306a36Sopenharmony_ci	   MPP_FUNCTION(0x6, "uart0", "cts")),
34862306a36Sopenharmony_ci	MPP_MODE(63,
34962306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
35062306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "spi0", "sck"),
35162306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "tclk", NULL)),
35262306a36Sopenharmony_ci	MPP_MODE(64,
35362306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
35462306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "spi0", "miso"),
35562306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "spi0", "cs1")),
35662306a36Sopenharmony_ci	MPP_MODE(65,
35762306a36Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
35862306a36Sopenharmony_ci	   MPP_FUNCTION(0x1, "spi0", "mosi"),
35962306a36Sopenharmony_ci	   MPP_FUNCTION(0x2, "spi0", "cs2")),
36062306a36Sopenharmony_ci};
36162306a36Sopenharmony_ci
36262306a36Sopenharmony_cistatic struct mvebu_pinctrl_soc_info armada_370_pinctrl_info;
36362306a36Sopenharmony_ci
36462306a36Sopenharmony_cistatic const struct of_device_id armada_370_pinctrl_of_match[] = {
36562306a36Sopenharmony_ci	{ .compatible = "marvell,mv88f6710-pinctrl" },
36662306a36Sopenharmony_ci	{ },
36762306a36Sopenharmony_ci};
36862306a36Sopenharmony_ci
36962306a36Sopenharmony_cistatic const struct mvebu_mpp_ctrl mv88f6710_mpp_controls[] = {
37062306a36Sopenharmony_ci	MPP_FUNC_CTRL(0, 65, NULL, mvebu_mmio_mpp_ctrl),
37162306a36Sopenharmony_ci};
37262306a36Sopenharmony_ci
37362306a36Sopenharmony_cistatic struct pinctrl_gpio_range mv88f6710_mpp_gpio_ranges[] = {
37462306a36Sopenharmony_ci	MPP_GPIO_RANGE(0,   0,  0, 32),
37562306a36Sopenharmony_ci	MPP_GPIO_RANGE(1,  32, 32, 32),
37662306a36Sopenharmony_ci	MPP_GPIO_RANGE(2,  64, 64,  2),
37762306a36Sopenharmony_ci};
37862306a36Sopenharmony_ci
37962306a36Sopenharmony_cistatic int armada_370_pinctrl_probe(struct platform_device *pdev)
38062306a36Sopenharmony_ci{
38162306a36Sopenharmony_ci	struct mvebu_pinctrl_soc_info *soc = &armada_370_pinctrl_info;
38262306a36Sopenharmony_ci
38362306a36Sopenharmony_ci	soc->variant = 0; /* no variants for Armada 370 */
38462306a36Sopenharmony_ci	soc->controls = mv88f6710_mpp_controls;
38562306a36Sopenharmony_ci	soc->ncontrols = ARRAY_SIZE(mv88f6710_mpp_controls);
38662306a36Sopenharmony_ci	soc->modes = mv88f6710_mpp_modes;
38762306a36Sopenharmony_ci	soc->nmodes = ARRAY_SIZE(mv88f6710_mpp_modes);
38862306a36Sopenharmony_ci	soc->gpioranges = mv88f6710_mpp_gpio_ranges;
38962306a36Sopenharmony_ci	soc->ngpioranges = ARRAY_SIZE(mv88f6710_mpp_gpio_ranges);
39062306a36Sopenharmony_ci
39162306a36Sopenharmony_ci	pdev->dev.platform_data = soc;
39262306a36Sopenharmony_ci
39362306a36Sopenharmony_ci	return mvebu_pinctrl_simple_mmio_probe(pdev);
39462306a36Sopenharmony_ci}
39562306a36Sopenharmony_ci
39662306a36Sopenharmony_cistatic struct platform_driver armada_370_pinctrl_driver = {
39762306a36Sopenharmony_ci	.driver = {
39862306a36Sopenharmony_ci		.name = "armada-370-pinctrl",
39962306a36Sopenharmony_ci		.of_match_table = armada_370_pinctrl_of_match,
40062306a36Sopenharmony_ci	},
40162306a36Sopenharmony_ci	.probe = armada_370_pinctrl_probe,
40262306a36Sopenharmony_ci};
40362306a36Sopenharmony_cibuiltin_platform_driver(armada_370_pinctrl_driver);
404