18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Marvell Armada XP 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 * This file supports the three variants of Armada XP SoCs that are 108c2ecf20Sopenharmony_ci * available: mv78230, mv78260 and mv78460. From a pin muxing 118c2ecf20Sopenharmony_ci * perspective, the mv78230 has 49 MPP pins. The mv78260 and mv78460 128c2ecf20Sopenharmony_ci * both have 67 MPP pins (more GPIOs and address lines for the memory 138c2ecf20Sopenharmony_ci * bus mainly). 148c2ecf20Sopenharmony_ci */ 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#include <linux/err.h> 178c2ecf20Sopenharmony_ci#include <linux/init.h> 188c2ecf20Sopenharmony_ci#include <linux/io.h> 198c2ecf20Sopenharmony_ci#include <linux/platform_device.h> 208c2ecf20Sopenharmony_ci#include <linux/clk.h> 218c2ecf20Sopenharmony_ci#include <linux/of.h> 228c2ecf20Sopenharmony_ci#include <linux/of_device.h> 238c2ecf20Sopenharmony_ci#include <linux/pinctrl/pinctrl.h> 248c2ecf20Sopenharmony_ci#include <linux/bitops.h> 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci#include "pinctrl-mvebu.h" 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_cistatic u32 *mpp_saved_regs; 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_cienum armada_xp_variant { 318c2ecf20Sopenharmony_ci V_MV78230 = BIT(0), 328c2ecf20Sopenharmony_ci V_MV78260 = BIT(1), 338c2ecf20Sopenharmony_ci V_MV78460 = BIT(2), 348c2ecf20Sopenharmony_ci V_MV78230_PLUS = (V_MV78230 | V_MV78260 | V_MV78460), 358c2ecf20Sopenharmony_ci V_MV78260_PLUS = (V_MV78260 | V_MV78460), 368c2ecf20Sopenharmony_ci V_98DX3236 = BIT(3), 378c2ecf20Sopenharmony_ci V_98DX3336 = BIT(4), 388c2ecf20Sopenharmony_ci V_98DX4251 = BIT(5), 398c2ecf20Sopenharmony_ci V_98DX3236_PLUS = (V_98DX3236 | V_98DX3336 | V_98DX4251), 408c2ecf20Sopenharmony_ci}; 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_cistatic struct mvebu_mpp_mode armada_xp_mpp_modes[] = { 438c2ecf20Sopenharmony_ci MPP_MODE(0, 448c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 458c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "ge0", "txclkout", V_MV78230_PLUS), 468c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "d0", V_MV78230_PLUS)), 478c2ecf20Sopenharmony_ci MPP_MODE(1, 488c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 498c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "ge0", "txd0", V_MV78230_PLUS), 508c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "d1", V_MV78230_PLUS)), 518c2ecf20Sopenharmony_ci MPP_MODE(2, 528c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 538c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "ge0", "txd1", V_MV78230_PLUS), 548c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "d2", V_MV78230_PLUS)), 558c2ecf20Sopenharmony_ci MPP_MODE(3, 568c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 578c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "ge0", "txd2", V_MV78230_PLUS), 588c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "d3", V_MV78230_PLUS)), 598c2ecf20Sopenharmony_ci MPP_MODE(4, 608c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 618c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "ge0", "txd3", V_MV78230_PLUS), 628c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "d4", V_MV78230_PLUS)), 638c2ecf20Sopenharmony_ci MPP_MODE(5, 648c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 658c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "ge0", "txctl", V_MV78230_PLUS), 668c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "d5", V_MV78230_PLUS)), 678c2ecf20Sopenharmony_ci MPP_MODE(6, 688c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 698c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "ge0", "rxd0", V_MV78230_PLUS), 708c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "d6", V_MV78230_PLUS)), 718c2ecf20Sopenharmony_ci MPP_MODE(7, 728c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 738c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "ge0", "rxd1", V_MV78230_PLUS), 748c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "d7", V_MV78230_PLUS)), 758c2ecf20Sopenharmony_ci MPP_MODE(8, 768c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 778c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "ge0", "rxd2", V_MV78230_PLUS), 788c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "d8", V_MV78230_PLUS)), 798c2ecf20Sopenharmony_ci MPP_MODE(9, 808c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 818c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "ge0", "rxd3", V_MV78230_PLUS), 828c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "d9", V_MV78230_PLUS)), 838c2ecf20Sopenharmony_ci MPP_MODE(10, 848c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 858c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "ge0", "rxctl", V_MV78230_PLUS), 868c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "d10", V_MV78230_PLUS)), 878c2ecf20Sopenharmony_ci MPP_MODE(11, 888c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 898c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "ge0", "rxclk", V_MV78230_PLUS), 908c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "d11", V_MV78230_PLUS)), 918c2ecf20Sopenharmony_ci MPP_MODE(12, 928c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 938c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "ge0", "txd4", V_MV78230_PLUS), 948c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "ge1", "txclkout", V_MV78230_PLUS), 958c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "d12", V_MV78230_PLUS)), 968c2ecf20Sopenharmony_ci MPP_MODE(13, 978c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 988c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "ge0", "txd5", V_MV78230_PLUS), 998c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "ge1", "txd0", V_MV78230_PLUS), 1008c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "spi1", "mosi", V_MV78230_PLUS), 1018c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "d13", V_MV78230_PLUS)), 1028c2ecf20Sopenharmony_ci MPP_MODE(14, 1038c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 1048c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "ge0", "txd6", V_MV78230_PLUS), 1058c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "ge1", "txd1", V_MV78230_PLUS), 1068c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "spi1", "sck", V_MV78230_PLUS), 1078c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "d14", V_MV78230_PLUS)), 1088c2ecf20Sopenharmony_ci MPP_MODE(15, 1098c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 1108c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "ge0", "txd7", V_MV78230_PLUS), 1118c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "ge1", "txd2", V_MV78230_PLUS), 1128c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "d15", V_MV78230_PLUS)), 1138c2ecf20Sopenharmony_ci MPP_MODE(16, 1148c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 1158c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "ge0", "txclk", V_MV78230_PLUS), 1168c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "ge1", "txd3", V_MV78230_PLUS), 1178c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "spi1", "cs0", V_MV78230_PLUS), 1188c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "d16", V_MV78230_PLUS)), 1198c2ecf20Sopenharmony_ci MPP_MODE(17, 1208c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 1218c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "ge0", "col", V_MV78230_PLUS), 1228c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "ge1", "txctl", V_MV78230_PLUS), 1238c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "spi1", "miso", V_MV78230_PLUS), 1248c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "d17", V_MV78230_PLUS)), 1258c2ecf20Sopenharmony_ci MPP_MODE(18, 1268c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 1278c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "ge0", "rxerr", V_MV78230_PLUS), 1288c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "ge1", "rxd0", V_MV78230_PLUS), 1298c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "ptp", "trig", V_MV78230_PLUS), 1308c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "d18", V_MV78230_PLUS)), 1318c2ecf20Sopenharmony_ci MPP_MODE(19, 1328c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 1338c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "ge0", "crs", V_MV78230_PLUS), 1348c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "ge1", "rxd1", V_MV78230_PLUS), 1358c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "ptp", "evreq", V_MV78230_PLUS), 1368c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "d19", V_MV78230_PLUS)), 1378c2ecf20Sopenharmony_ci MPP_MODE(20, 1388c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 1398c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "ge0", "rxd4", V_MV78230_PLUS), 1408c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "ge1", "rxd2", V_MV78230_PLUS), 1418c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "ptp", "clk", V_MV78230_PLUS), 1428c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "d20", V_MV78230_PLUS)), 1438c2ecf20Sopenharmony_ci MPP_MODE(21, 1448c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 1458c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "ge0", "rxd5", V_MV78230_PLUS), 1468c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "ge1", "rxd3", V_MV78230_PLUS), 1478c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "dram", "bat", V_MV78230_PLUS), 1488c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "d21", V_MV78230_PLUS)), 1498c2ecf20Sopenharmony_ci MPP_MODE(22, 1508c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 1518c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "ge0", "rxd6", V_MV78230_PLUS), 1528c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "ge1", "rxctl", V_MV78230_PLUS), 1538c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "sata0", "prsnt", V_MV78230_PLUS), 1548c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "d22", V_MV78230_PLUS)), 1558c2ecf20Sopenharmony_ci MPP_MODE(23, 1568c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 1578c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "ge0", "rxd7", V_MV78230_PLUS), 1588c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "ge1", "rxclk", V_MV78230_PLUS), 1598c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "sata1", "prsnt", V_MV78230_PLUS), 1608c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "d23", V_MV78230_PLUS)), 1618c2ecf20Sopenharmony_ci MPP_MODE(24, 1628c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 1638c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "sata1", "prsnt", V_MV78230_PLUS), 1648c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "tdm", "rst", V_MV78230_PLUS), 1658c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "hsync", V_MV78230_PLUS)), 1668c2ecf20Sopenharmony_ci MPP_MODE(25, 1678c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 1688c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "sata0", "prsnt", V_MV78230_PLUS), 1698c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "tdm", "pclk", V_MV78230_PLUS), 1708c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "vsync", V_MV78230_PLUS)), 1718c2ecf20Sopenharmony_ci MPP_MODE(26, 1728c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 1738c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "tdm", "fsync", V_MV78230_PLUS), 1748c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "clk", V_MV78230_PLUS)), 1758c2ecf20Sopenharmony_ci MPP_MODE(27, 1768c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 1778c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "ptp", "trig", V_MV78230_PLUS), 1788c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "tdm", "dtx", V_MV78230_PLUS), 1798c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "e", V_MV78230_PLUS)), 1808c2ecf20Sopenharmony_ci MPP_MODE(28, 1818c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 1828c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "ptp", "evreq", V_MV78230_PLUS), 1838c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "tdm", "drx", V_MV78230_PLUS), 1848c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "pwm", V_MV78230_PLUS)), 1858c2ecf20Sopenharmony_ci MPP_MODE(29, 1868c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 1878c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "ptp", "clk", V_MV78230_PLUS), 1888c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "tdm", "int0", V_MV78230_PLUS), 1898c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "ref-clk", V_MV78230_PLUS)), 1908c2ecf20Sopenharmony_ci MPP_MODE(30, 1918c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 1928c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "sd0", "clk", V_MV78230_PLUS), 1938c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "tdm", "int1", V_MV78230_PLUS)), 1948c2ecf20Sopenharmony_ci MPP_MODE(31, 1958c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 1968c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "sd0", "cmd", V_MV78230_PLUS), 1978c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "tdm", "int2", V_MV78230_PLUS)), 1988c2ecf20Sopenharmony_ci MPP_MODE(32, 1998c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 2008c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "sd0", "d0", V_MV78230_PLUS), 2018c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "tdm", "int3", V_MV78230_PLUS)), 2028c2ecf20Sopenharmony_ci MPP_MODE(33, 2038c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 2048c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "sd0", "d1", V_MV78230_PLUS), 2058c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "tdm", "int4", V_MV78230_PLUS), 2068c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dram", "bat", V_MV78230_PLUS), 2078c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x5, "dram", "vttctrl", V_MV78230_PLUS)), 2088c2ecf20Sopenharmony_ci MPP_MODE(34, 2098c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 2108c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "sd0", "d2", V_MV78230_PLUS), 2118c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "sata0", "prsnt", V_MV78230_PLUS), 2128c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "tdm", "int5", V_MV78230_PLUS), 2138c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dram", "deccerr", V_MV78230_PLUS)), 2148c2ecf20Sopenharmony_ci MPP_MODE(35, 2158c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 2168c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "sd0", "d3", V_MV78230_PLUS), 2178c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "sata1", "prsnt", V_MV78230_PLUS), 2188c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "tdm", "int6", V_MV78230_PLUS)), 2198c2ecf20Sopenharmony_ci MPP_MODE(36, 2208c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 2218c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "spi0", "mosi", V_MV78230_PLUS)), 2228c2ecf20Sopenharmony_ci MPP_MODE(37, 2238c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 2248c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "spi0", "miso", V_MV78230_PLUS)), 2258c2ecf20Sopenharmony_ci MPP_MODE(38, 2268c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 2278c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "spi0", "sck", V_MV78230_PLUS)), 2288c2ecf20Sopenharmony_ci MPP_MODE(39, 2298c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 2308c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "spi0", "cs0", V_MV78230_PLUS)), 2318c2ecf20Sopenharmony_ci MPP_MODE(40, 2328c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 2338c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "spi0", "cs1", V_MV78230_PLUS), 2348c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "uart2", "cts", V_MV78230_PLUS), 2358c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "vga-hsync", V_MV78230_PLUS), 2368c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x5, "pcie", "clkreq0", V_MV78230_PLUS), 2378c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x6, "spi1", "cs1", V_MV78230_PLUS)), 2388c2ecf20Sopenharmony_ci MPP_MODE(41, 2398c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 2408c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "spi0", "cs2", V_MV78230_PLUS), 2418c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "uart2", "rts", V_MV78230_PLUS), 2428c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "sata1", "prsnt", V_MV78230_PLUS), 2438c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "lcd", "vga-vsync", V_MV78230_PLUS), 2448c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x5, "pcie", "clkreq1", V_MV78230_PLUS), 2458c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x6, "spi1", "cs2", V_MV78230_PLUS)), 2468c2ecf20Sopenharmony_ci MPP_MODE(42, 2478c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 2488c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "uart2", "rxd", V_MV78230_PLUS), 2498c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "uart0", "cts", V_MV78230_PLUS), 2508c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "tdm", "int7", V_MV78230_PLUS), 2518c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "tdm", "timer", V_MV78230_PLUS)), 2528c2ecf20Sopenharmony_ci MPP_MODE(43, 2538c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 2548c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "uart2", "txd", V_MV78230_PLUS), 2558c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "uart0", "rts", V_MV78230_PLUS), 2568c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "spi0", "cs3", V_MV78230_PLUS), 2578c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "pcie", "rstout", V_MV78230_PLUS), 2588c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x6, "spi1", "cs3", V_MV78230_PLUS)), 2598c2ecf20Sopenharmony_ci MPP_MODE(44, 2608c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 2618c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "uart2", "cts", V_MV78230_PLUS), 2628c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "uart3", "rxd", V_MV78230_PLUS), 2638c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "spi0", "cs4", V_MV78230_PLUS), 2648c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dram", "bat", V_MV78230_PLUS), 2658c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x5, "pcie", "clkreq2", V_MV78230_PLUS), 2668c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x6, "spi1", "cs4", V_MV78230_PLUS)), 2678c2ecf20Sopenharmony_ci MPP_MODE(45, 2688c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 2698c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "uart2", "rts", V_MV78230_PLUS), 2708c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "uart3", "txd", V_MV78230_PLUS), 2718c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "spi0", "cs5", V_MV78230_PLUS), 2728c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "sata1", "prsnt", V_MV78230_PLUS), 2738c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x5, "dram", "vttctrl", V_MV78230_PLUS), 2748c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x6, "spi1", "cs5", V_MV78230_PLUS)), 2758c2ecf20Sopenharmony_ci MPP_MODE(46, 2768c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 2778c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "uart3", "rts", V_MV78230_PLUS), 2788c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "uart1", "rts", V_MV78230_PLUS), 2798c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "spi0", "cs6", V_MV78230_PLUS), 2808c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "sata0", "prsnt", V_MV78230_PLUS), 2818c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x6, "spi1", "cs6", V_MV78230_PLUS)), 2828c2ecf20Sopenharmony_ci MPP_MODE(47, 2838c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 2848c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "uart3", "cts", V_MV78230_PLUS), 2858c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "uart1", "cts", V_MV78230_PLUS), 2868c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "spi0", "cs7", V_MV78230_PLUS), 2878c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "ref", "clkout", V_MV78230_PLUS), 2888c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x5, "pcie", "clkreq3", V_MV78230_PLUS), 2898c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x6, "spi1", "cs7", V_MV78230_PLUS)), 2908c2ecf20Sopenharmony_ci MPP_MODE(48, 2918c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 2928c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "dev", "clkout", V_MV78230_PLUS), 2938c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "dev", "burst/last", V_MV78230_PLUS), 2948c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "nand", "rb", V_MV78230_PLUS)), 2958c2ecf20Sopenharmony_ci MPP_MODE(49, 2968c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 2978c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "dev", "we3", V_MV78260_PLUS)), 2988c2ecf20Sopenharmony_ci MPP_MODE(50, 2998c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 3008c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "dev", "we2", V_MV78260_PLUS)), 3018c2ecf20Sopenharmony_ci MPP_MODE(51, 3028c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 3038c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "dev", "ad16", V_MV78260_PLUS)), 3048c2ecf20Sopenharmony_ci MPP_MODE(52, 3058c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 3068c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "dev", "ad17", V_MV78260_PLUS)), 3078c2ecf20Sopenharmony_ci MPP_MODE(53, 3088c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 3098c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "dev", "ad18", V_MV78260_PLUS)), 3108c2ecf20Sopenharmony_ci MPP_MODE(54, 3118c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 3128c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "dev", "ad19", V_MV78260_PLUS)), 3138c2ecf20Sopenharmony_ci MPP_MODE(55, 3148c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 3158c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "dev", "ad20", V_MV78260_PLUS)), 3168c2ecf20Sopenharmony_ci MPP_MODE(56, 3178c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 3188c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "dev", "ad21", V_MV78260_PLUS)), 3198c2ecf20Sopenharmony_ci MPP_MODE(57, 3208c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 3218c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "dev", "ad22", V_MV78260_PLUS)), 3228c2ecf20Sopenharmony_ci MPP_MODE(58, 3238c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 3248c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "dev", "ad23", V_MV78260_PLUS)), 3258c2ecf20Sopenharmony_ci MPP_MODE(59, 3268c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 3278c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "dev", "ad24", V_MV78260_PLUS)), 3288c2ecf20Sopenharmony_ci MPP_MODE(60, 3298c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 3308c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "dev", "ad25", V_MV78260_PLUS)), 3318c2ecf20Sopenharmony_ci MPP_MODE(61, 3328c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 3338c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "dev", "ad26", V_MV78260_PLUS)), 3348c2ecf20Sopenharmony_ci MPP_MODE(62, 3358c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 3368c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "dev", "ad27", V_MV78260_PLUS)), 3378c2ecf20Sopenharmony_ci MPP_MODE(63, 3388c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 3398c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "dev", "ad28", V_MV78260_PLUS)), 3408c2ecf20Sopenharmony_ci MPP_MODE(64, 3418c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 3428c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "dev", "ad29", V_MV78260_PLUS)), 3438c2ecf20Sopenharmony_ci MPP_MODE(65, 3448c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 3458c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "dev", "ad30", V_MV78260_PLUS)), 3468c2ecf20Sopenharmony_ci MPP_MODE(66, 3478c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 3488c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "dev", "ad31", V_MV78260_PLUS)), 3498c2ecf20Sopenharmony_ci}; 3508c2ecf20Sopenharmony_ci 3518c2ecf20Sopenharmony_cistatic struct mvebu_mpp_mode mv98dx3236_mpp_modes[] = { 3528c2ecf20Sopenharmony_ci MPP_MODE(0, 3538c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 3548c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "spi0", "mosi", V_98DX3236_PLUS), 3558c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "ad8", V_98DX3236_PLUS)), 3568c2ecf20Sopenharmony_ci MPP_MODE(1, 3578c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 3588c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "spi0", "miso", V_98DX3236_PLUS), 3598c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "ad9", V_98DX3236_PLUS)), 3608c2ecf20Sopenharmony_ci MPP_MODE(2, 3618c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 3628c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "spi0", "sck", V_98DX3236_PLUS), 3638c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "ad10", V_98DX3236_PLUS)), 3648c2ecf20Sopenharmony_ci MPP_MODE(3, 3658c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 3668c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "spi0", "cs0", V_98DX3236_PLUS), 3678c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "ad11", V_98DX3236_PLUS)), 3688c2ecf20Sopenharmony_ci MPP_MODE(4, 3698c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 3708c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "spi0", "cs1", V_98DX3236_PLUS), 3718c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "smi", "mdc", V_98DX3236_PLUS), 3728c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "cs0", V_98DX3236_PLUS)), 3738c2ecf20Sopenharmony_ci MPP_MODE(5, 3748c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 3758c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "pex", "rsto", V_98DX3236_PLUS), 3768c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "sd0", "cmd", V_98DX4251), 3778c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "bootcs", V_98DX3236_PLUS)), 3788c2ecf20Sopenharmony_ci MPP_MODE(6, 3798c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 3808c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "sd0", "clk", V_98DX4251), 3818c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "a2", V_98DX3236_PLUS)), 3828c2ecf20Sopenharmony_ci MPP_MODE(7, 3838c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 3848c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "sd0", "d0", V_98DX4251), 3858c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "ale0", V_98DX3236_PLUS)), 3868c2ecf20Sopenharmony_ci MPP_MODE(8, 3878c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 3888c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "sd0", "d1", V_98DX4251), 3898c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "ale1", V_98DX3236_PLUS)), 3908c2ecf20Sopenharmony_ci MPP_MODE(9, 3918c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 3928c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "sd0", "d2", V_98DX4251), 3938c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "ready0", V_98DX3236_PLUS)), 3948c2ecf20Sopenharmony_ci MPP_MODE(10, 3958c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 3968c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "sd0", "d3", V_98DX4251), 3978c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "ad12", V_98DX3236_PLUS)), 3988c2ecf20Sopenharmony_ci MPP_MODE(11, 3998c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 4008c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "uart1", "rxd", V_98DX3236_PLUS), 4018c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "uart0", "cts", V_98DX3236_PLUS), 4028c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "ad13", V_98DX3236_PLUS)), 4038c2ecf20Sopenharmony_ci MPP_MODE(12, 4048c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 4058c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x2, "uart1", "txd", V_98DX3236_PLUS), 4068c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "uart0", "rts", V_98DX3236_PLUS), 4078c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "ad14", V_98DX3236_PLUS)), 4088c2ecf20Sopenharmony_ci MPP_MODE(13, 4098c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 4108c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "intr", "out", V_98DX3236_PLUS), 4118c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "ad15", V_98DX3236_PLUS)), 4128c2ecf20Sopenharmony_ci MPP_MODE(14, 4138c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 4148c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "i2c0", "sck", V_98DX3236_PLUS)), 4158c2ecf20Sopenharmony_ci MPP_MODE(15, 4168c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 4178c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "i2c0", "sda", V_98DX3236_PLUS)), 4188c2ecf20Sopenharmony_ci MPP_MODE(16, 4198c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 4208c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "oe", V_98DX3236_PLUS)), 4218c2ecf20Sopenharmony_ci MPP_MODE(17, 4228c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 4238c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "clkout", V_98DX3236_PLUS)), 4248c2ecf20Sopenharmony_ci MPP_MODE(18, 4258c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 4268c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "uart1", "txd", V_98DX3236_PLUS)), 4278c2ecf20Sopenharmony_ci MPP_MODE(19, 4288c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 4298c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "uart1", "rxd", V_98DX3236_PLUS), 4308c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "nand", "rb", V_98DX3236_PLUS)), 4318c2ecf20Sopenharmony_ci MPP_MODE(20, 4328c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 4338c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "we0", V_98DX3236_PLUS)), 4348c2ecf20Sopenharmony_ci MPP_MODE(21, 4358c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 4368c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "ad0", V_98DX3236_PLUS)), 4378c2ecf20Sopenharmony_ci MPP_MODE(22, 4388c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 4398c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "ad1", V_98DX3236_PLUS)), 4408c2ecf20Sopenharmony_ci MPP_MODE(23, 4418c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 4428c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "ad2", V_98DX3236_PLUS)), 4438c2ecf20Sopenharmony_ci MPP_MODE(24, 4448c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 4458c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "ad3", V_98DX3236_PLUS)), 4468c2ecf20Sopenharmony_ci MPP_MODE(25, 4478c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 4488c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "ad4", V_98DX3236_PLUS)), 4498c2ecf20Sopenharmony_ci MPP_MODE(26, 4508c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 4518c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "ad5", V_98DX3236_PLUS)), 4528c2ecf20Sopenharmony_ci MPP_MODE(27, 4538c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 4548c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "ad6", V_98DX3236_PLUS)), 4558c2ecf20Sopenharmony_ci MPP_MODE(28, 4568c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 4578c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "ad7", V_98DX3236_PLUS)), 4588c2ecf20Sopenharmony_ci MPP_MODE(29, 4598c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 4608c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "a0", V_98DX3236_PLUS)), 4618c2ecf20Sopenharmony_ci MPP_MODE(30, 4628c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 4638c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "a1", V_98DX3236_PLUS)), 4648c2ecf20Sopenharmony_ci MPP_MODE(31, 4658c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 4668c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "slv_smi", "mdc", V_98DX3236_PLUS), 4678c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "smi", "mdc", V_98DX3236_PLUS), 4688c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "we1", V_98DX3236_PLUS)), 4698c2ecf20Sopenharmony_ci MPP_MODE(32, 4708c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 4718c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x1, "slv_smi", "mdio", V_98DX3236_PLUS), 4728c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x3, "smi", "mdio", V_98DX3236_PLUS), 4738c2ecf20Sopenharmony_ci MPP_VAR_FUNCTION(0x4, "dev", "cs1", V_98DX3236_PLUS)), 4748c2ecf20Sopenharmony_ci}; 4758c2ecf20Sopenharmony_ci 4768c2ecf20Sopenharmony_cistatic struct mvebu_pinctrl_soc_info armada_xp_pinctrl_info; 4778c2ecf20Sopenharmony_ci 4788c2ecf20Sopenharmony_cistatic const struct of_device_id armada_xp_pinctrl_of_match[] = { 4798c2ecf20Sopenharmony_ci { 4808c2ecf20Sopenharmony_ci .compatible = "marvell,mv78230-pinctrl", 4818c2ecf20Sopenharmony_ci .data = (void *) V_MV78230, 4828c2ecf20Sopenharmony_ci }, 4838c2ecf20Sopenharmony_ci { 4848c2ecf20Sopenharmony_ci .compatible = "marvell,mv78260-pinctrl", 4858c2ecf20Sopenharmony_ci .data = (void *) V_MV78260, 4868c2ecf20Sopenharmony_ci }, 4878c2ecf20Sopenharmony_ci { 4888c2ecf20Sopenharmony_ci .compatible = "marvell,mv78460-pinctrl", 4898c2ecf20Sopenharmony_ci .data = (void *) V_MV78460, 4908c2ecf20Sopenharmony_ci }, 4918c2ecf20Sopenharmony_ci { 4928c2ecf20Sopenharmony_ci .compatible = "marvell,98dx3236-pinctrl", 4938c2ecf20Sopenharmony_ci .data = (void *) V_98DX3236, 4948c2ecf20Sopenharmony_ci }, 4958c2ecf20Sopenharmony_ci { 4968c2ecf20Sopenharmony_ci .compatible = "marvell,98dx4251-pinctrl", 4978c2ecf20Sopenharmony_ci .data = (void *) V_98DX4251, 4988c2ecf20Sopenharmony_ci }, 4998c2ecf20Sopenharmony_ci { }, 5008c2ecf20Sopenharmony_ci}; 5018c2ecf20Sopenharmony_ci 5028c2ecf20Sopenharmony_cistatic const struct mvebu_mpp_ctrl mv78230_mpp_controls[] = { 5038c2ecf20Sopenharmony_ci MPP_FUNC_CTRL(0, 48, NULL, mvebu_mmio_mpp_ctrl), 5048c2ecf20Sopenharmony_ci}; 5058c2ecf20Sopenharmony_ci 5068c2ecf20Sopenharmony_cistatic struct pinctrl_gpio_range mv78230_mpp_gpio_ranges[] = { 5078c2ecf20Sopenharmony_ci MPP_GPIO_RANGE(0, 0, 0, 32), 5088c2ecf20Sopenharmony_ci MPP_GPIO_RANGE(1, 32, 32, 17), 5098c2ecf20Sopenharmony_ci}; 5108c2ecf20Sopenharmony_ci 5118c2ecf20Sopenharmony_cistatic const struct mvebu_mpp_ctrl mv78260_mpp_controls[] = { 5128c2ecf20Sopenharmony_ci MPP_FUNC_CTRL(0, 66, NULL, mvebu_mmio_mpp_ctrl), 5138c2ecf20Sopenharmony_ci}; 5148c2ecf20Sopenharmony_ci 5158c2ecf20Sopenharmony_cistatic struct pinctrl_gpio_range mv78260_mpp_gpio_ranges[] = { 5168c2ecf20Sopenharmony_ci MPP_GPIO_RANGE(0, 0, 0, 32), 5178c2ecf20Sopenharmony_ci MPP_GPIO_RANGE(1, 32, 32, 32), 5188c2ecf20Sopenharmony_ci MPP_GPIO_RANGE(2, 64, 64, 3), 5198c2ecf20Sopenharmony_ci}; 5208c2ecf20Sopenharmony_ci 5218c2ecf20Sopenharmony_cistatic const struct mvebu_mpp_ctrl mv78460_mpp_controls[] = { 5228c2ecf20Sopenharmony_ci MPP_FUNC_CTRL(0, 66, NULL, mvebu_mmio_mpp_ctrl), 5238c2ecf20Sopenharmony_ci}; 5248c2ecf20Sopenharmony_ci 5258c2ecf20Sopenharmony_cistatic struct pinctrl_gpio_range mv78460_mpp_gpio_ranges[] = { 5268c2ecf20Sopenharmony_ci MPP_GPIO_RANGE(0, 0, 0, 32), 5278c2ecf20Sopenharmony_ci MPP_GPIO_RANGE(1, 32, 32, 32), 5288c2ecf20Sopenharmony_ci MPP_GPIO_RANGE(2, 64, 64, 3), 5298c2ecf20Sopenharmony_ci}; 5308c2ecf20Sopenharmony_ci 5318c2ecf20Sopenharmony_cistatic struct mvebu_mpp_ctrl mv98dx3236_mpp_controls[] = { 5328c2ecf20Sopenharmony_ci MPP_FUNC_CTRL(0, 32, NULL, mvebu_mmio_mpp_ctrl), 5338c2ecf20Sopenharmony_ci}; 5348c2ecf20Sopenharmony_ci 5358c2ecf20Sopenharmony_cistatic struct pinctrl_gpio_range mv98dx3236_mpp_gpio_ranges[] = { 5368c2ecf20Sopenharmony_ci MPP_GPIO_RANGE(0, 0, 0, 32), 5378c2ecf20Sopenharmony_ci}; 5388c2ecf20Sopenharmony_ci 5398c2ecf20Sopenharmony_cistatic int armada_xp_pinctrl_suspend(struct platform_device *pdev, 5408c2ecf20Sopenharmony_ci pm_message_t state) 5418c2ecf20Sopenharmony_ci{ 5428c2ecf20Sopenharmony_ci struct mvebu_pinctrl_soc_info *soc = 5438c2ecf20Sopenharmony_ci platform_get_drvdata(pdev); 5448c2ecf20Sopenharmony_ci int i, nregs; 5458c2ecf20Sopenharmony_ci 5468c2ecf20Sopenharmony_ci nregs = DIV_ROUND_UP(soc->nmodes, MVEBU_MPPS_PER_REG); 5478c2ecf20Sopenharmony_ci 5488c2ecf20Sopenharmony_ci for (i = 0; i < nregs; i++) 5498c2ecf20Sopenharmony_ci mpp_saved_regs[i] = readl(soc->control_data[0].base + i * 4); 5508c2ecf20Sopenharmony_ci 5518c2ecf20Sopenharmony_ci return 0; 5528c2ecf20Sopenharmony_ci} 5538c2ecf20Sopenharmony_ci 5548c2ecf20Sopenharmony_cistatic int armada_xp_pinctrl_resume(struct platform_device *pdev) 5558c2ecf20Sopenharmony_ci{ 5568c2ecf20Sopenharmony_ci struct mvebu_pinctrl_soc_info *soc = 5578c2ecf20Sopenharmony_ci platform_get_drvdata(pdev); 5588c2ecf20Sopenharmony_ci int i, nregs; 5598c2ecf20Sopenharmony_ci 5608c2ecf20Sopenharmony_ci nregs = DIV_ROUND_UP(soc->nmodes, MVEBU_MPPS_PER_REG); 5618c2ecf20Sopenharmony_ci 5628c2ecf20Sopenharmony_ci for (i = 0; i < nregs; i++) 5638c2ecf20Sopenharmony_ci writel(mpp_saved_regs[i], soc->control_data[0].base + i * 4); 5648c2ecf20Sopenharmony_ci 5658c2ecf20Sopenharmony_ci return 0; 5668c2ecf20Sopenharmony_ci} 5678c2ecf20Sopenharmony_ci 5688c2ecf20Sopenharmony_cistatic int armada_xp_pinctrl_probe(struct platform_device *pdev) 5698c2ecf20Sopenharmony_ci{ 5708c2ecf20Sopenharmony_ci struct mvebu_pinctrl_soc_info *soc = &armada_xp_pinctrl_info; 5718c2ecf20Sopenharmony_ci const struct of_device_id *match = 5728c2ecf20Sopenharmony_ci of_match_device(armada_xp_pinctrl_of_match, &pdev->dev); 5738c2ecf20Sopenharmony_ci int nregs; 5748c2ecf20Sopenharmony_ci 5758c2ecf20Sopenharmony_ci if (!match) 5768c2ecf20Sopenharmony_ci return -ENODEV; 5778c2ecf20Sopenharmony_ci 5788c2ecf20Sopenharmony_ci soc->variant = (unsigned) match->data & 0xff; 5798c2ecf20Sopenharmony_ci 5808c2ecf20Sopenharmony_ci switch (soc->variant) { 5818c2ecf20Sopenharmony_ci case V_MV78230: 5828c2ecf20Sopenharmony_ci soc->controls = mv78230_mpp_controls; 5838c2ecf20Sopenharmony_ci soc->ncontrols = ARRAY_SIZE(mv78230_mpp_controls); 5848c2ecf20Sopenharmony_ci soc->modes = armada_xp_mpp_modes; 5858c2ecf20Sopenharmony_ci /* We don't necessarily want the full list of the 5868c2ecf20Sopenharmony_ci * armada_xp_mpp_modes, but only the first 'n' ones 5878c2ecf20Sopenharmony_ci * that are available on this SoC */ 5888c2ecf20Sopenharmony_ci soc->nmodes = mv78230_mpp_controls[0].npins; 5898c2ecf20Sopenharmony_ci soc->gpioranges = mv78230_mpp_gpio_ranges; 5908c2ecf20Sopenharmony_ci soc->ngpioranges = ARRAY_SIZE(mv78230_mpp_gpio_ranges); 5918c2ecf20Sopenharmony_ci break; 5928c2ecf20Sopenharmony_ci case V_MV78260: 5938c2ecf20Sopenharmony_ci soc->controls = mv78260_mpp_controls; 5948c2ecf20Sopenharmony_ci soc->ncontrols = ARRAY_SIZE(mv78260_mpp_controls); 5958c2ecf20Sopenharmony_ci soc->modes = armada_xp_mpp_modes; 5968c2ecf20Sopenharmony_ci /* We don't necessarily want the full list of the 5978c2ecf20Sopenharmony_ci * armada_xp_mpp_modes, but only the first 'n' ones 5988c2ecf20Sopenharmony_ci * that are available on this SoC */ 5998c2ecf20Sopenharmony_ci soc->nmodes = mv78260_mpp_controls[0].npins; 6008c2ecf20Sopenharmony_ci soc->gpioranges = mv78260_mpp_gpio_ranges; 6018c2ecf20Sopenharmony_ci soc->ngpioranges = ARRAY_SIZE(mv78260_mpp_gpio_ranges); 6028c2ecf20Sopenharmony_ci break; 6038c2ecf20Sopenharmony_ci case V_MV78460: 6048c2ecf20Sopenharmony_ci soc->controls = mv78460_mpp_controls; 6058c2ecf20Sopenharmony_ci soc->ncontrols = ARRAY_SIZE(mv78460_mpp_controls); 6068c2ecf20Sopenharmony_ci soc->modes = armada_xp_mpp_modes; 6078c2ecf20Sopenharmony_ci /* We don't necessarily want the full list of the 6088c2ecf20Sopenharmony_ci * armada_xp_mpp_modes, but only the first 'n' ones 6098c2ecf20Sopenharmony_ci * that are available on this SoC */ 6108c2ecf20Sopenharmony_ci soc->nmodes = mv78460_mpp_controls[0].npins; 6118c2ecf20Sopenharmony_ci soc->gpioranges = mv78460_mpp_gpio_ranges; 6128c2ecf20Sopenharmony_ci soc->ngpioranges = ARRAY_SIZE(mv78460_mpp_gpio_ranges); 6138c2ecf20Sopenharmony_ci break; 6148c2ecf20Sopenharmony_ci case V_98DX3236: 6158c2ecf20Sopenharmony_ci case V_98DX3336: 6168c2ecf20Sopenharmony_ci case V_98DX4251: 6178c2ecf20Sopenharmony_ci /* fall-through */ 6188c2ecf20Sopenharmony_ci soc->controls = mv98dx3236_mpp_controls; 6198c2ecf20Sopenharmony_ci soc->ncontrols = ARRAY_SIZE(mv98dx3236_mpp_controls); 6208c2ecf20Sopenharmony_ci soc->modes = mv98dx3236_mpp_modes; 6218c2ecf20Sopenharmony_ci soc->nmodes = mv98dx3236_mpp_controls[0].npins; 6228c2ecf20Sopenharmony_ci soc->gpioranges = mv98dx3236_mpp_gpio_ranges; 6238c2ecf20Sopenharmony_ci soc->ngpioranges = ARRAY_SIZE(mv98dx3236_mpp_gpio_ranges); 6248c2ecf20Sopenharmony_ci break; 6258c2ecf20Sopenharmony_ci } 6268c2ecf20Sopenharmony_ci 6278c2ecf20Sopenharmony_ci nregs = DIV_ROUND_UP(soc->nmodes, MVEBU_MPPS_PER_REG); 6288c2ecf20Sopenharmony_ci 6298c2ecf20Sopenharmony_ci mpp_saved_regs = devm_kmalloc_array(&pdev->dev, nregs, sizeof(u32), 6308c2ecf20Sopenharmony_ci GFP_KERNEL); 6318c2ecf20Sopenharmony_ci if (!mpp_saved_regs) 6328c2ecf20Sopenharmony_ci return -ENOMEM; 6338c2ecf20Sopenharmony_ci 6348c2ecf20Sopenharmony_ci pdev->dev.platform_data = soc; 6358c2ecf20Sopenharmony_ci 6368c2ecf20Sopenharmony_ci return mvebu_pinctrl_simple_mmio_probe(pdev); 6378c2ecf20Sopenharmony_ci} 6388c2ecf20Sopenharmony_ci 6398c2ecf20Sopenharmony_cistatic struct platform_driver armada_xp_pinctrl_driver = { 6408c2ecf20Sopenharmony_ci .driver = { 6418c2ecf20Sopenharmony_ci .name = "armada-xp-pinctrl", 6428c2ecf20Sopenharmony_ci .of_match_table = armada_xp_pinctrl_of_match, 6438c2ecf20Sopenharmony_ci }, 6448c2ecf20Sopenharmony_ci .probe = armada_xp_pinctrl_probe, 6458c2ecf20Sopenharmony_ci .suspend = armada_xp_pinctrl_suspend, 6468c2ecf20Sopenharmony_ci .resume = armada_xp_pinctrl_resume, 6478c2ecf20Sopenharmony_ci}; 6488c2ecf20Sopenharmony_cibuiltin_platform_driver(armada_xp_pinctrl_driver); 649