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