18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Marvell Armada 370 pinctrl driver based on mvebu pinctrl core
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2012 Marvell
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include <linux/err.h>
118c2ecf20Sopenharmony_ci#include <linux/init.h>
128c2ecf20Sopenharmony_ci#include <linux/io.h>
138c2ecf20Sopenharmony_ci#include <linux/platform_device.h>
148c2ecf20Sopenharmony_ci#include <linux/clk.h>
158c2ecf20Sopenharmony_ci#include <linux/of.h>
168c2ecf20Sopenharmony_ci#include <linux/of_device.h>
178c2ecf20Sopenharmony_ci#include <linux/pinctrl/pinctrl.h>
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#include "pinctrl-mvebu.h"
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_cistatic struct mvebu_mpp_mode mv88f6710_mpp_modes[] = {
228c2ecf20Sopenharmony_ci	MPP_MODE(0,
238c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
248c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "uart0", "rxd")),
258c2ecf20Sopenharmony_ci	MPP_MODE(1,
268c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
278c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "uart0", "txd")),
288c2ecf20Sopenharmony_ci	MPP_MODE(2,
298c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
308c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "i2c0", "sck"),
318c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart0", "txd")),
328c2ecf20Sopenharmony_ci	MPP_MODE(3,
338c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
348c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "i2c0", "sda"),
358c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart0", "rxd")),
368c2ecf20Sopenharmony_ci	MPP_MODE(4,
378c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
388c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "vdd", "cpu-pd")),
398c2ecf20Sopenharmony_ci	MPP_MODE(5,
408c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
418c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "txclkout"),
428c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "txd"),
438c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "spi1", "sck"),
448c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "mclk")),
458c2ecf20Sopenharmony_ci	MPP_MODE(6,
468c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
478c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "txd0"),
488c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "sata0", "prsnt"),
498c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "tdm", "rst"),
508c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "sdo")),
518c2ecf20Sopenharmony_ci	MPP_MODE(7,
528c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
538c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "txd1"),
548c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "tdm", "dtx"),
558c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "lrclk")),
568c2ecf20Sopenharmony_ci	MPP_MODE(8,
578c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
588c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "txd2"),
598c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart0", "rts"),
608c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "tdm", "drx"),
618c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "bclk")),
628c2ecf20Sopenharmony_ci	MPP_MODE(9,
638c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
648c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "txd3"),
658c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "txd"),
668c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x3, "sd0", "clk"),
678c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "spdifo")),
688c2ecf20Sopenharmony_ci	MPP_MODE(10,
698c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
708c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "txctl"),
718c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart0", "cts"),
728c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "tdm", "fsync"),
738c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "sdi")),
748c2ecf20Sopenharmony_ci	MPP_MODE(11,
758c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
768c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "rxd0"),
778c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "rxd"),
788c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x3, "sd0", "cmd"),
798c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "spi0", "cs1"),
808c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x5, "sata1", "prsnt"),
818c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x6, "spi1", "cs1")),
828c2ecf20Sopenharmony_ci	MPP_MODE(12,
838c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
848c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "rxd1"),
858c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "i2c1", "sda"),
868c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x3, "sd0", "d0"),
878c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "spi1", "cs0"),
888c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "spdifi")),
898c2ecf20Sopenharmony_ci	MPP_MODE(13,
908c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
918c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "rxd2"),
928c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "i2c1", "sck"),
938c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x3, "sd0", "d1"),
948c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "tdm", "pclk"),
958c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "rmclk")),
968c2ecf20Sopenharmony_ci	MPP_MODE(14,
978c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
988c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "rxd3"),
998c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "pcie", "clkreq0"),
1008c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x3, "sd0", "d2"),
1018c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "spi1", "mosi"),
1028c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x5, "spi0", "cs2")),
1038c2ecf20Sopenharmony_ci	MPP_MODE(15,
1048c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
1058c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "rxctl"),
1068c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "pcie", "clkreq1"),
1078c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x3, "sd0", "d3"),
1088c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "spi1", "miso"),
1098c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x5, "spi0", "cs3")),
1108c2ecf20Sopenharmony_ci	MPP_MODE(16,
1118c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
1128c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "rxclk"),
1138c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "rxd"),
1148c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "tdm", "int"),
1158c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "extclk")),
1168c2ecf20Sopenharmony_ci	MPP_MODE(17,
1178c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
1188c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge", "mdc")),
1198c2ecf20Sopenharmony_ci	MPP_MODE(18,
1208c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
1218c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge", "mdio")),
1228c2ecf20Sopenharmony_ci	MPP_MODE(19,
1238c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
1248c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "txclk"),
1258c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "ge1", "txclkout"),
1268c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "tdm", "pclk")),
1278c2ecf20Sopenharmony_ci	MPP_MODE(20,
1288c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
1298c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "txd4"),
1308c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "ge1", "txd0")),
1318c2ecf20Sopenharmony_ci	MPP_MODE(21,
1328c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
1338c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "txd5"),
1348c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "ge1", "txd1"),
1358c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "uart1", "txd")),
1368c2ecf20Sopenharmony_ci	MPP_MODE(22,
1378c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
1388c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "txd6"),
1398c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "ge1", "txd2"),
1408c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "uart0", "rts")),
1418c2ecf20Sopenharmony_ci	MPP_MODE(23,
1428c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
1438c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "txd7"),
1448c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "ge1", "txd3"),
1458c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "spi1", "mosi")),
1468c2ecf20Sopenharmony_ci	MPP_MODE(24,
1478c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
1488c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "col"),
1498c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "ge1", "txctl"),
1508c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "spi1", "cs0")),
1518c2ecf20Sopenharmony_ci	MPP_MODE(25,
1528c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
1538c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "rxerr"),
1548c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "ge1", "rxd0"),
1558c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "uart1", "rxd")),
1568c2ecf20Sopenharmony_ci	MPP_MODE(26,
1578c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
1588c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "crs"),
1598c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "ge1", "rxd1"),
1608c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "spi1", "miso")),
1618c2ecf20Sopenharmony_ci	MPP_MODE(27,
1628c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
1638c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "rxd4"),
1648c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "ge1", "rxd2"),
1658c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "uart0", "cts")),
1668c2ecf20Sopenharmony_ci	MPP_MODE(28,
1678c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
1688c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "rxd5"),
1698c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "ge1", "rxd3")),
1708c2ecf20Sopenharmony_ci	MPP_MODE(29,
1718c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
1728c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "rxd6"),
1738c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "ge1", "rxctl"),
1748c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "i2c1", "sda")),
1758c2ecf20Sopenharmony_ci	MPP_MODE(30,
1768c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
1778c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "ge0", "rxd7"),
1788c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "ge1", "rxclk"),
1798c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "i2c1", "sck")),
1808c2ecf20Sopenharmony_ci	MPP_MODE(31,
1818c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
1828c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x3, "tclk", NULL),
1838c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "ge0", "txerr")),
1848c2ecf20Sopenharmony_ci	MPP_MODE(32,
1858c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
1868c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "spi0", "cs0")),
1878c2ecf20Sopenharmony_ci	MPP_MODE(33,
1888c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
1898c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "bootcs"),
1908c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "spi0", "cs0")),
1918c2ecf20Sopenharmony_ci	MPP_MODE(34,
1928c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
1938c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "we0"),
1948c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "spi0", "mosi")),
1958c2ecf20Sopenharmony_ci	MPP_MODE(35,
1968c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
1978c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "oe"),
1988c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "spi0", "sck")),
1998c2ecf20Sopenharmony_ci	MPP_MODE(36,
2008c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
2018c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "a1"),
2028c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "spi0", "miso")),
2038c2ecf20Sopenharmony_ci	MPP_MODE(37,
2048c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
2058c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "a0"),
2068c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "sata0", "prsnt")),
2078c2ecf20Sopenharmony_ci	MPP_MODE(38,
2088c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
2098c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ready"),
2108c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "cts"),
2118c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x3, "uart0", "cts")),
2128c2ecf20Sopenharmony_ci	MPP_MODE(39,
2138c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
2148c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad0"),
2158c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "audio", "spdifo")),
2168c2ecf20Sopenharmony_ci	MPP_MODE(40,
2178c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
2188c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad1"),
2198c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "rts"),
2208c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x3, "uart0", "rts")),
2218c2ecf20Sopenharmony_ci	MPP_MODE(41,
2228c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
2238c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad2"),
2248c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "rxd")),
2258c2ecf20Sopenharmony_ci	MPP_MODE(42,
2268c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
2278c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad3"),
2288c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "txd")),
2298c2ecf20Sopenharmony_ci	MPP_MODE(43,
2308c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
2318c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad4"),
2328c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "audio", "bclk")),
2338c2ecf20Sopenharmony_ci	MPP_MODE(44,
2348c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
2358c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad5"),
2368c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "audio", "mclk")),
2378c2ecf20Sopenharmony_ci	MPP_MODE(45,
2388c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
2398c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad6"),
2408c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "audio", "lrclk")),
2418c2ecf20Sopenharmony_ci	MPP_MODE(46,
2428c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
2438c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad7"),
2448c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "audio", "sdo")),
2458c2ecf20Sopenharmony_ci	MPP_MODE(47,
2468c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
2478c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad8"),
2488c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x3, "sd0", "clk"),
2498c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "spdifo")),
2508c2ecf20Sopenharmony_ci	MPP_MODE(48,
2518c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
2528c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad9"),
2538c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart0", "rts"),
2548c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x3, "sd0", "cmd"),
2558c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "sata1", "prsnt"),
2568c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x5, "spi0", "cs1")),
2578c2ecf20Sopenharmony_ci	MPP_MODE(49,
2588c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
2598c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad10"),
2608c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "pcie", "clkreq1"),
2618c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x3, "sd0", "d0"),
2628c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "spi1", "cs0"),
2638c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "spdifi")),
2648c2ecf20Sopenharmony_ci	MPP_MODE(50,
2658c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
2668c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad11"),
2678c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart0", "cts"),
2688c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x3, "sd0", "d1"),
2698c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "spi1", "miso"),
2708c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "rmclk")),
2718c2ecf20Sopenharmony_ci	MPP_MODE(51,
2728c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
2738c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad12"),
2748c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "i2c1", "sda"),
2758c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x3, "sd0", "d2"),
2768c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "spi1", "mosi")),
2778c2ecf20Sopenharmony_ci	MPP_MODE(52,
2788c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
2798c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad13"),
2808c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "i2c1", "sck"),
2818c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x3, "sd0", "d3"),
2828c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "spi1", "sck")),
2838c2ecf20Sopenharmony_ci	MPP_MODE(53,
2848c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
2858c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad14"),
2868c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "sd0", "clk"),
2878c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x3, "tdm", "pclk"),
2888c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "spi0", "cs2"),
2898c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x5, "pcie", "clkreq1")),
2908c2ecf20Sopenharmony_ci	MPP_MODE(54,
2918c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
2928c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ad15"),
2938c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x3, "tdm", "dtx")),
2948c2ecf20Sopenharmony_ci	MPP_MODE(55,
2958c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
2968c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "cs1"),
2978c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "txd"),
2988c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x3, "tdm", "rst"),
2998c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "sata1", "prsnt"),
3008c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x5, "sata0", "prsnt")),
3018c2ecf20Sopenharmony_ci	MPP_MODE(56,
3028c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
3038c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "cs2"),
3048c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "cts"),
3058c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x3, "uart0", "cts"),
3068c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "spi0", "cs3"),
3078c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x5, "pcie", "clkreq0"),
3088c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x6, "spi1", "cs1")),
3098c2ecf20Sopenharmony_ci	MPP_MODE(57,
3108c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
3118c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "cs3"),
3128c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "rxd"),
3138c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x3, "tdm", "fsync"),
3148c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "sata0", "prsnt"),
3158c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "sdo")),
3168c2ecf20Sopenharmony_ci	MPP_MODE(58,
3178c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
3188c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "cs0"),
3198c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "rts"),
3208c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x3, "tdm", "int"),
3218c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "extclk"),
3228c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x6, "uart0", "rts")),
3238c2ecf20Sopenharmony_ci	MPP_MODE(59,
3248c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
3258c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ale0"),
3268c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "rts"),
3278c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x3, "uart0", "rts"),
3288c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "bclk")),
3298c2ecf20Sopenharmony_ci	MPP_MODE(60,
3308c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
3318c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "ale1"),
3328c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "rxd"),
3338c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x3, "sata0", "prsnt"),
3348c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "pcie", "rstout"),
3358c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "sdi")),
3368c2ecf20Sopenharmony_ci	MPP_MODE(61,
3378c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpo", NULL),
3388c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "we1"),
3398c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "txd"),
3408c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "lrclk")),
3418c2ecf20Sopenharmony_ci	MPP_MODE(62,
3428c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
3438c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "dev", "a2"),
3448c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "uart1", "cts"),
3458c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x3, "tdm", "drx"),
3468c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x4, "pcie", "clkreq0"),
3478c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x5, "audio", "mclk"),
3488c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x6, "uart0", "cts")),
3498c2ecf20Sopenharmony_ci	MPP_MODE(63,
3508c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
3518c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "spi0", "sck"),
3528c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "tclk", NULL)),
3538c2ecf20Sopenharmony_ci	MPP_MODE(64,
3548c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
3558c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "spi0", "miso"),
3568c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "spi0", "cs1")),
3578c2ecf20Sopenharmony_ci	MPP_MODE(65,
3588c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x0, "gpio", NULL),
3598c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x1, "spi0", "mosi"),
3608c2ecf20Sopenharmony_ci	   MPP_FUNCTION(0x2, "spi0", "cs2")),
3618c2ecf20Sopenharmony_ci};
3628c2ecf20Sopenharmony_ci
3638c2ecf20Sopenharmony_cistatic struct mvebu_pinctrl_soc_info armada_370_pinctrl_info;
3648c2ecf20Sopenharmony_ci
3658c2ecf20Sopenharmony_cistatic const struct of_device_id armada_370_pinctrl_of_match[] = {
3668c2ecf20Sopenharmony_ci	{ .compatible = "marvell,mv88f6710-pinctrl" },
3678c2ecf20Sopenharmony_ci	{ },
3688c2ecf20Sopenharmony_ci};
3698c2ecf20Sopenharmony_ci
3708c2ecf20Sopenharmony_cistatic const struct mvebu_mpp_ctrl mv88f6710_mpp_controls[] = {
3718c2ecf20Sopenharmony_ci	MPP_FUNC_CTRL(0, 65, NULL, mvebu_mmio_mpp_ctrl),
3728c2ecf20Sopenharmony_ci};
3738c2ecf20Sopenharmony_ci
3748c2ecf20Sopenharmony_cistatic struct pinctrl_gpio_range mv88f6710_mpp_gpio_ranges[] = {
3758c2ecf20Sopenharmony_ci	MPP_GPIO_RANGE(0,   0,  0, 32),
3768c2ecf20Sopenharmony_ci	MPP_GPIO_RANGE(1,  32, 32, 32),
3778c2ecf20Sopenharmony_ci	MPP_GPIO_RANGE(2,  64, 64,  2),
3788c2ecf20Sopenharmony_ci};
3798c2ecf20Sopenharmony_ci
3808c2ecf20Sopenharmony_cistatic int armada_370_pinctrl_probe(struct platform_device *pdev)
3818c2ecf20Sopenharmony_ci{
3828c2ecf20Sopenharmony_ci	struct mvebu_pinctrl_soc_info *soc = &armada_370_pinctrl_info;
3838c2ecf20Sopenharmony_ci
3848c2ecf20Sopenharmony_ci	soc->variant = 0; /* no variants for Armada 370 */
3858c2ecf20Sopenharmony_ci	soc->controls = mv88f6710_mpp_controls;
3868c2ecf20Sopenharmony_ci	soc->ncontrols = ARRAY_SIZE(mv88f6710_mpp_controls);
3878c2ecf20Sopenharmony_ci	soc->modes = mv88f6710_mpp_modes;
3888c2ecf20Sopenharmony_ci	soc->nmodes = ARRAY_SIZE(mv88f6710_mpp_modes);
3898c2ecf20Sopenharmony_ci	soc->gpioranges = mv88f6710_mpp_gpio_ranges;
3908c2ecf20Sopenharmony_ci	soc->ngpioranges = ARRAY_SIZE(mv88f6710_mpp_gpio_ranges);
3918c2ecf20Sopenharmony_ci
3928c2ecf20Sopenharmony_ci	pdev->dev.platform_data = soc;
3938c2ecf20Sopenharmony_ci
3948c2ecf20Sopenharmony_ci	return mvebu_pinctrl_simple_mmio_probe(pdev);
3958c2ecf20Sopenharmony_ci}
3968c2ecf20Sopenharmony_ci
3978c2ecf20Sopenharmony_cistatic struct platform_driver armada_370_pinctrl_driver = {
3988c2ecf20Sopenharmony_ci	.driver = {
3998c2ecf20Sopenharmony_ci		.name = "armada-370-pinctrl",
4008c2ecf20Sopenharmony_ci		.of_match_table = armada_370_pinctrl_of_match,
4018c2ecf20Sopenharmony_ci	},
4028c2ecf20Sopenharmony_ci	.probe = armada_370_pinctrl_probe,
4038c2ecf20Sopenharmony_ci};
4048c2ecf20Sopenharmony_cibuiltin_platform_driver(armada_370_pinctrl_driver);
405