106763c74SThomas Petazzoni /* 206763c74SThomas Petazzoni * Marvell Armada XP pinctrl driver based on mvebu pinctrl core 306763c74SThomas Petazzoni * 406763c74SThomas Petazzoni * Copyright (C) 2012 Marvell 506763c74SThomas Petazzoni * 606763c74SThomas Petazzoni * Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 706763c74SThomas Petazzoni * 806763c74SThomas Petazzoni * This program is free software; you can redistribute it and/or modify 906763c74SThomas Petazzoni * it under the terms of the GNU General Public License as published by 1006763c74SThomas Petazzoni * the Free Software Foundation; either version 2 of the License, or 1106763c74SThomas Petazzoni * (at your option) any later version. 1206763c74SThomas Petazzoni * 1306763c74SThomas Petazzoni * This file supports the three variants of Armada XP SoCs that are 1406763c74SThomas Petazzoni * available: mv78230, mv78260 and mv78460. From a pin muxing 1506763c74SThomas Petazzoni * perspective, the mv78230 has 49 MPP pins. The mv78260 and mv78460 1606763c74SThomas Petazzoni * both have 67 MPP pins (more GPIOs and address lines for the memory 1780b3d04fSThomas Petazzoni * bus mainly). 1806763c74SThomas Petazzoni */ 1906763c74SThomas Petazzoni 2006763c74SThomas Petazzoni #include <linux/err.h> 2106763c74SThomas Petazzoni #include <linux/init.h> 2206763c74SThomas Petazzoni #include <linux/io.h> 2306763c74SThomas Petazzoni #include <linux/module.h> 2406763c74SThomas Petazzoni #include <linux/platform_device.h> 2506763c74SThomas Petazzoni #include <linux/clk.h> 2606763c74SThomas Petazzoni #include <linux/of.h> 2706763c74SThomas Petazzoni #include <linux/of_device.h> 2806763c74SThomas Petazzoni #include <linux/pinctrl/pinctrl.h> 2906763c74SThomas Petazzoni #include <linux/bitops.h> 3006763c74SThomas Petazzoni 3106763c74SThomas Petazzoni #include "pinctrl-mvebu.h" 3206763c74SThomas Petazzoni 33ad2a4f2bSSebastian Hesselbarth static void __iomem *mpp_base; 3412149a20SThomas Petazzoni static u32 *mpp_saved_regs; 35ad2a4f2bSSebastian Hesselbarth 36ad2a4f2bSSebastian Hesselbarth static int armada_xp_mpp_ctrl_get(unsigned pid, unsigned long *config) 37ad2a4f2bSSebastian Hesselbarth { 38ad2a4f2bSSebastian Hesselbarth return default_mpp_ctrl_get(mpp_base, pid, config); 39ad2a4f2bSSebastian Hesselbarth } 40ad2a4f2bSSebastian Hesselbarth 41ad2a4f2bSSebastian Hesselbarth static int armada_xp_mpp_ctrl_set(unsigned pid, unsigned long config) 42ad2a4f2bSSebastian Hesselbarth { 43ad2a4f2bSSebastian Hesselbarth return default_mpp_ctrl_set(mpp_base, pid, config); 44ad2a4f2bSSebastian Hesselbarth } 45ad2a4f2bSSebastian Hesselbarth 4606763c74SThomas Petazzoni enum armada_xp_variant { 4706763c74SThomas Petazzoni V_MV78230 = BIT(0), 4806763c74SThomas Petazzoni V_MV78260 = BIT(1), 4906763c74SThomas Petazzoni V_MV78460 = BIT(2), 5006763c74SThomas Petazzoni V_MV78230_PLUS = (V_MV78230 | V_MV78260 | V_MV78460), 5106763c74SThomas Petazzoni V_MV78260_PLUS = (V_MV78260 | V_MV78460), 52*d7ae8f8dSKalyan Kinthada V_98DX3236 = BIT(3), 53*d7ae8f8dSKalyan Kinthada V_98DX3336 = BIT(4), 54*d7ae8f8dSKalyan Kinthada V_98DX4251 = BIT(5), 55*d7ae8f8dSKalyan Kinthada V_98DX3236_PLUS = (V_98DX3236 | V_98DX3336 | V_98DX4251), 5606763c74SThomas Petazzoni }; 5706763c74SThomas Petazzoni 5806763c74SThomas Petazzoni static struct mvebu_mpp_mode armada_xp_mpp_modes[] = { 5906763c74SThomas Petazzoni MPP_MODE(0, 6006763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 61a361cbc5SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "ge0", "txclkout", V_MV78230_PLUS), 6206763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "d0", V_MV78230_PLUS)), 6306763c74SThomas Petazzoni MPP_MODE(1, 6406763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 6506763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "ge0", "txd0", V_MV78230_PLUS), 6606763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "d1", V_MV78230_PLUS)), 6706763c74SThomas Petazzoni MPP_MODE(2, 6806763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 6906763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "ge0", "txd1", V_MV78230_PLUS), 7006763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "d2", V_MV78230_PLUS)), 7106763c74SThomas Petazzoni MPP_MODE(3, 7206763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 7306763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "ge0", "txd2", V_MV78230_PLUS), 7406763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "d3", V_MV78230_PLUS)), 7506763c74SThomas Petazzoni MPP_MODE(4, 7606763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 7706763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "ge0", "txd3", V_MV78230_PLUS), 7806763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "d4", V_MV78230_PLUS)), 7906763c74SThomas Petazzoni MPP_MODE(5, 8006763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 8106763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "ge0", "txctl", V_MV78230_PLUS), 8206763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "d5", V_MV78230_PLUS)), 8306763c74SThomas Petazzoni MPP_MODE(6, 8406763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 8506763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "ge0", "rxd0", V_MV78230_PLUS), 8606763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "d6", V_MV78230_PLUS)), 8706763c74SThomas Petazzoni MPP_MODE(7, 8806763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 8906763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "ge0", "rxd1", V_MV78230_PLUS), 9006763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "d7", V_MV78230_PLUS)), 9106763c74SThomas Petazzoni MPP_MODE(8, 9206763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 9306763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "ge0", "rxd2", V_MV78230_PLUS), 9406763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "d8", V_MV78230_PLUS)), 9506763c74SThomas Petazzoni MPP_MODE(9, 9606763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 9706763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "ge0", "rxd3", V_MV78230_PLUS), 9806763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "d9", V_MV78230_PLUS)), 9906763c74SThomas Petazzoni MPP_MODE(10, 10006763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 10106763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "ge0", "rxctl", V_MV78230_PLUS), 10206763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "d10", V_MV78230_PLUS)), 10306763c74SThomas Petazzoni MPP_MODE(11, 10406763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 10506763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "ge0", "rxclk", V_MV78230_PLUS), 10606763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "d11", V_MV78230_PLUS)), 10706763c74SThomas Petazzoni MPP_MODE(12, 10806763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 10906763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "ge0", "txd4", V_MV78230_PLUS), 110a361cbc5SThomas Petazzoni MPP_VAR_FUNCTION(0x2, "ge1", "txclkout", V_MV78230_PLUS), 11106763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "d12", V_MV78230_PLUS)), 11206763c74SThomas Petazzoni MPP_MODE(13, 11306763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 11406763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "ge0", "txd5", V_MV78230_PLUS), 11506763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x2, "ge1", "txd0", V_MV78230_PLUS), 11688b355f1SThomas Petazzoni MPP_VAR_FUNCTION(0x3, "spi1", "mosi", V_MV78230_PLUS), 11706763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "d13", V_MV78230_PLUS)), 11806763c74SThomas Petazzoni MPP_MODE(14, 11906763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 12006763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "ge0", "txd6", V_MV78230_PLUS), 12106763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x2, "ge1", "txd1", V_MV78230_PLUS), 12288b355f1SThomas Petazzoni MPP_VAR_FUNCTION(0x3, "spi1", "sck", V_MV78230_PLUS), 12306763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "d14", V_MV78230_PLUS)), 12406763c74SThomas Petazzoni MPP_MODE(15, 12506763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 12606763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "ge0", "txd7", V_MV78230_PLUS), 12706763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x2, "ge1", "txd2", V_MV78230_PLUS), 12806763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "d15", V_MV78230_PLUS)), 12906763c74SThomas Petazzoni MPP_MODE(16, 13006763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 13106763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "ge0", "txclk", V_MV78230_PLUS), 13206763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x2, "ge1", "txd3", V_MV78230_PLUS), 13388b355f1SThomas Petazzoni MPP_VAR_FUNCTION(0x3, "spi1", "cs0", V_MV78230_PLUS), 13406763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "d16", V_MV78230_PLUS)), 13506763c74SThomas Petazzoni MPP_MODE(17, 13606763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 13706763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "ge0", "col", V_MV78230_PLUS), 13806763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x2, "ge1", "txctl", V_MV78230_PLUS), 13988b355f1SThomas Petazzoni MPP_VAR_FUNCTION(0x3, "spi1", "miso", V_MV78230_PLUS), 14006763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "d17", V_MV78230_PLUS)), 14106763c74SThomas Petazzoni MPP_MODE(18, 14206763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 14306763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "ge0", "rxerr", V_MV78230_PLUS), 14406763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x2, "ge1", "rxd0", V_MV78230_PLUS), 14506763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x3, "ptp", "trig", V_MV78230_PLUS), 14606763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "d18", V_MV78230_PLUS)), 14706763c74SThomas Petazzoni MPP_MODE(19, 14806763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 14906763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "ge0", "crs", V_MV78230_PLUS), 15006763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x2, "ge1", "rxd1", V_MV78230_PLUS), 15106763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x3, "ptp", "evreq", V_MV78230_PLUS), 15206763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "d19", V_MV78230_PLUS)), 15306763c74SThomas Petazzoni MPP_MODE(20, 15406763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 15506763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "ge0", "rxd4", V_MV78230_PLUS), 15606763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x2, "ge1", "rxd2", V_MV78230_PLUS), 15706763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x3, "ptp", "clk", V_MV78230_PLUS), 15806763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "d20", V_MV78230_PLUS)), 15906763c74SThomas Petazzoni MPP_MODE(21, 16006763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 16106763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "ge0", "rxd5", V_MV78230_PLUS), 16206763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x2, "ge1", "rxd3", V_MV78230_PLUS), 163100dc5d8SThomas Petazzoni MPP_VAR_FUNCTION(0x3, "dram", "bat", V_MV78230_PLUS), 16406763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "d21", V_MV78230_PLUS)), 16506763c74SThomas Petazzoni MPP_MODE(22, 16606763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 16706763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "ge0", "rxd6", V_MV78230_PLUS), 16806763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x2, "ge1", "rxctl", V_MV78230_PLUS), 16906763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x3, "sata0", "prsnt", V_MV78230_PLUS), 17006763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "d22", V_MV78230_PLUS)), 17106763c74SThomas Petazzoni MPP_MODE(23, 17206763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 17306763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "ge0", "rxd7", V_MV78230_PLUS), 17406763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x2, "ge1", "rxclk", V_MV78230_PLUS), 17506763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x3, "sata1", "prsnt", V_MV78230_PLUS), 17606763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "d23", V_MV78230_PLUS)), 17706763c74SThomas Petazzoni MPP_MODE(24, 17806763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 17906763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "sata1", "prsnt", V_MV78230_PLUS), 18006763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x3, "tdm", "rst", V_MV78230_PLUS), 18106763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "hsync", V_MV78230_PLUS)), 18206763c74SThomas Petazzoni MPP_MODE(25, 18306763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 18406763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "sata0", "prsnt", V_MV78230_PLUS), 18506763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x3, "tdm", "pclk", V_MV78230_PLUS), 18606763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "vsync", V_MV78230_PLUS)), 18706763c74SThomas Petazzoni MPP_MODE(26, 18806763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 18906763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x3, "tdm", "fsync", V_MV78230_PLUS), 19080b3d04fSThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "clk", V_MV78230_PLUS)), 19106763c74SThomas Petazzoni MPP_MODE(27, 19206763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 19306763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "ptp", "trig", V_MV78230_PLUS), 19406763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x3, "tdm", "dtx", V_MV78230_PLUS), 19506763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "e", V_MV78230_PLUS)), 19606763c74SThomas Petazzoni MPP_MODE(28, 19706763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 19806763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "ptp", "evreq", V_MV78230_PLUS), 19906763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x3, "tdm", "drx", V_MV78230_PLUS), 20006763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "pwm", V_MV78230_PLUS)), 20106763c74SThomas Petazzoni MPP_MODE(29, 20206763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 20306763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "ptp", "clk", V_MV78230_PLUS), 20406763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x3, "tdm", "int0", V_MV78230_PLUS), 20580b3d04fSThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "ref-clk", V_MV78230_PLUS)), 20606763c74SThomas Petazzoni MPP_MODE(30, 20706763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 20806763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "sd0", "clk", V_MV78230_PLUS), 20906763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x3, "tdm", "int1", V_MV78230_PLUS)), 21006763c74SThomas Petazzoni MPP_MODE(31, 21106763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 21206763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "sd0", "cmd", V_MV78230_PLUS), 21380b3d04fSThomas Petazzoni MPP_VAR_FUNCTION(0x3, "tdm", "int2", V_MV78230_PLUS)), 21406763c74SThomas Petazzoni MPP_MODE(32, 21506763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 21606763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "sd0", "d0", V_MV78230_PLUS), 21780b3d04fSThomas Petazzoni MPP_VAR_FUNCTION(0x3, "tdm", "int3", V_MV78230_PLUS)), 21806763c74SThomas Petazzoni MPP_MODE(33, 21906763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 22006763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "sd0", "d1", V_MV78230_PLUS), 22106763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x3, "tdm", "int4", V_MV78230_PLUS), 222b19bf379SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "dram", "bat", V_MV78230_PLUS), 223b19bf379SThomas Petazzoni MPP_VAR_FUNCTION(0x5, "dram", "vttctrl", V_MV78230_PLUS)), 22406763c74SThomas Petazzoni MPP_MODE(34, 22506763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 22606763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "sd0", "d2", V_MV78230_PLUS), 22706763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x2, "sata0", "prsnt", V_MV78230_PLUS), 228b19bf379SThomas Petazzoni MPP_VAR_FUNCTION(0x3, "tdm", "int5", V_MV78230_PLUS), 229b19bf379SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "dram", "deccerr", V_MV78230_PLUS)), 23006763c74SThomas Petazzoni MPP_MODE(35, 23106763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 23206763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "sd0", "d3", V_MV78230_PLUS), 23306763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x2, "sata1", "prsnt", V_MV78230_PLUS), 23406763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x3, "tdm", "int6", V_MV78230_PLUS)), 23506763c74SThomas Petazzoni MPP_MODE(36, 23606763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 23750a7d13dSThomas Petazzoni MPP_VAR_FUNCTION(0x1, "spi0", "mosi", V_MV78230_PLUS)), 23806763c74SThomas Petazzoni MPP_MODE(37, 23906763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 24050a7d13dSThomas Petazzoni MPP_VAR_FUNCTION(0x1, "spi0", "miso", V_MV78230_PLUS)), 24106763c74SThomas Petazzoni MPP_MODE(38, 24206763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 24350a7d13dSThomas Petazzoni MPP_VAR_FUNCTION(0x1, "spi0", "sck", V_MV78230_PLUS)), 24406763c74SThomas Petazzoni MPP_MODE(39, 24506763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 24650a7d13dSThomas Petazzoni MPP_VAR_FUNCTION(0x1, "spi0", "cs0", V_MV78230_PLUS)), 24706763c74SThomas Petazzoni MPP_MODE(40, 24806763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 24950a7d13dSThomas Petazzoni MPP_VAR_FUNCTION(0x1, "spi0", "cs1", V_MV78230_PLUS), 25006763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x2, "uart2", "cts", V_MV78230_PLUS), 25106763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "vga-hsync", V_MV78230_PLUS), 25288b355f1SThomas Petazzoni MPP_VAR_FUNCTION(0x5, "pcie", "clkreq0", V_MV78230_PLUS), 25388b355f1SThomas Petazzoni MPP_VAR_FUNCTION(0x6, "spi1", "cs1", V_MV78230_PLUS)), 25406763c74SThomas Petazzoni MPP_MODE(41, 25506763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 25650a7d13dSThomas Petazzoni MPP_VAR_FUNCTION(0x1, "spi0", "cs2", V_MV78230_PLUS), 25706763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x2, "uart2", "rts", V_MV78230_PLUS), 25806763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x3, "sata1", "prsnt", V_MV78230_PLUS), 25906763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "lcd", "vga-vsync", V_MV78230_PLUS), 26088b355f1SThomas Petazzoni MPP_VAR_FUNCTION(0x5, "pcie", "clkreq1", V_MV78230_PLUS), 26188b355f1SThomas Petazzoni MPP_VAR_FUNCTION(0x6, "spi1", "cs2", V_MV78230_PLUS)), 26206763c74SThomas Petazzoni MPP_MODE(42, 26306763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 26406763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "uart2", "rxd", V_MV78230_PLUS), 26506763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x2, "uart0", "cts", V_MV78230_PLUS), 26606763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x3, "tdm", "int7", V_MV78230_PLUS), 267dae5597fSThomas Petazzoni MPP_VAR_FUNCTION(0x4, "tdm", "timer", V_MV78230_PLUS)), 26806763c74SThomas Petazzoni MPP_MODE(43, 26906763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 27006763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "uart2", "txd", V_MV78230_PLUS), 27106763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x2, "uart0", "rts", V_MV78230_PLUS), 27250a7d13dSThomas Petazzoni MPP_VAR_FUNCTION(0x3, "spi0", "cs3", V_MV78230_PLUS), 27388b355f1SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "pcie", "rstout", V_MV78230_PLUS), 27488b355f1SThomas Petazzoni MPP_VAR_FUNCTION(0x6, "spi1", "cs3", V_MV78230_PLUS)), 27506763c74SThomas Petazzoni MPP_MODE(44, 27606763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 27706763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "uart2", "cts", V_MV78230_PLUS), 27806763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x2, "uart3", "rxd", V_MV78230_PLUS), 27950a7d13dSThomas Petazzoni MPP_VAR_FUNCTION(0x3, "spi0", "cs4", V_MV78230_PLUS), 280100dc5d8SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "dram", "bat", V_MV78230_PLUS), 28188b355f1SThomas Petazzoni MPP_VAR_FUNCTION(0x5, "pcie", "clkreq2", V_MV78230_PLUS), 28288b355f1SThomas Petazzoni MPP_VAR_FUNCTION(0x6, "spi1", "cs4", V_MV78230_PLUS)), 28306763c74SThomas Petazzoni MPP_MODE(45, 28406763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 28506763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "uart2", "rts", V_MV78230_PLUS), 28606763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x2, "uart3", "txd", V_MV78230_PLUS), 28750a7d13dSThomas Petazzoni MPP_VAR_FUNCTION(0x3, "spi0", "cs5", V_MV78230_PLUS), 28888b355f1SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "sata1", "prsnt", V_MV78230_PLUS), 289b19bf379SThomas Petazzoni MPP_VAR_FUNCTION(0x5, "dram", "vttctrl", V_MV78230_PLUS), 29088b355f1SThomas Petazzoni MPP_VAR_FUNCTION(0x6, "spi1", "cs5", V_MV78230_PLUS)), 29106763c74SThomas Petazzoni MPP_MODE(46, 29206763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 29306763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "uart3", "rts", V_MV78230_PLUS), 29406763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x2, "uart1", "rts", V_MV78230_PLUS), 29550a7d13dSThomas Petazzoni MPP_VAR_FUNCTION(0x3, "spi0", "cs6", V_MV78230_PLUS), 29688b355f1SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "sata0", "prsnt", V_MV78230_PLUS), 29788b355f1SThomas Petazzoni MPP_VAR_FUNCTION(0x6, "spi1", "cs6", V_MV78230_PLUS)), 29806763c74SThomas Petazzoni MPP_MODE(47, 29906763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 30006763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "uart3", "cts", V_MV78230_PLUS), 30106763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x2, "uart1", "cts", V_MV78230_PLUS), 30250a7d13dSThomas Petazzoni MPP_VAR_FUNCTION(0x3, "spi0", "cs7", V_MV78230_PLUS), 30306763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x4, "ref", "clkout", V_MV78230_PLUS), 30488b355f1SThomas Petazzoni MPP_VAR_FUNCTION(0x5, "pcie", "clkreq3", V_MV78230_PLUS), 30588b355f1SThomas Petazzoni MPP_VAR_FUNCTION(0x6, "spi1", "cs7", V_MV78230_PLUS)), 30606763c74SThomas Petazzoni MPP_MODE(48, 30706763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), 308ea78b951SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "dev", "clkout", V_MV78230_PLUS), 309fb53b61dSThomas Petazzoni MPP_VAR_FUNCTION(0x2, "dev", "burst/last", V_MV78230_PLUS), 310fb53b61dSThomas Petazzoni MPP_VAR_FUNCTION(0x3, "nand", "rb", V_MV78230_PLUS)), 31106763c74SThomas Petazzoni MPP_MODE(49, 31206763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 31306763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "dev", "we3", V_MV78260_PLUS)), 31406763c74SThomas Petazzoni MPP_MODE(50, 31506763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 31606763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "dev", "we2", V_MV78260_PLUS)), 31706763c74SThomas Petazzoni MPP_MODE(51, 31806763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 31906763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "dev", "ad16", V_MV78260_PLUS)), 32006763c74SThomas Petazzoni MPP_MODE(52, 32106763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 32206763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "dev", "ad17", V_MV78260_PLUS)), 32306763c74SThomas Petazzoni MPP_MODE(53, 32406763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 32506763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "dev", "ad18", V_MV78260_PLUS)), 32606763c74SThomas Petazzoni MPP_MODE(54, 32706763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 32806763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "dev", "ad19", V_MV78260_PLUS)), 32906763c74SThomas Petazzoni MPP_MODE(55, 33006763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 33180b3d04fSThomas Petazzoni MPP_VAR_FUNCTION(0x1, "dev", "ad20", V_MV78260_PLUS)), 33206763c74SThomas Petazzoni MPP_MODE(56, 33306763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 33480b3d04fSThomas Petazzoni MPP_VAR_FUNCTION(0x1, "dev", "ad21", V_MV78260_PLUS)), 33506763c74SThomas Petazzoni MPP_MODE(57, 33606763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 33780b3d04fSThomas Petazzoni MPP_VAR_FUNCTION(0x1, "dev", "ad22", V_MV78260_PLUS)), 33806763c74SThomas Petazzoni MPP_MODE(58, 33906763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 34006763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "dev", "ad23", V_MV78260_PLUS)), 34106763c74SThomas Petazzoni MPP_MODE(59, 34206763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 34306763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "dev", "ad24", V_MV78260_PLUS)), 34406763c74SThomas Petazzoni MPP_MODE(60, 34506763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 34606763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "dev", "ad25", V_MV78260_PLUS)), 34706763c74SThomas Petazzoni MPP_MODE(61, 34806763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 34906763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "dev", "ad26", V_MV78260_PLUS)), 35006763c74SThomas Petazzoni MPP_MODE(62, 35106763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 35206763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "dev", "ad27", V_MV78260_PLUS)), 35306763c74SThomas Petazzoni MPP_MODE(63, 35406763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 35506763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "dev", "ad28", V_MV78260_PLUS)), 35606763c74SThomas Petazzoni MPP_MODE(64, 35706763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 35806763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "dev", "ad29", V_MV78260_PLUS)), 35906763c74SThomas Petazzoni MPP_MODE(65, 36006763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 36106763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "dev", "ad30", V_MV78260_PLUS)), 36206763c74SThomas Petazzoni MPP_MODE(66, 36306763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), 36406763c74SThomas Petazzoni MPP_VAR_FUNCTION(0x1, "dev", "ad31", V_MV78260_PLUS)), 36506763c74SThomas Petazzoni }; 36606763c74SThomas Petazzoni 367*d7ae8f8dSKalyan Kinthada static struct mvebu_mpp_mode mv98dx3236_mpp_modes[] = { 368*d7ae8f8dSKalyan Kinthada MPP_MODE(0, 369*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 370*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x2, "spi0", "mosi", V_98DX3236_PLUS), 371*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x4, "dev", "ad8", V_98DX3236_PLUS)), 372*d7ae8f8dSKalyan Kinthada MPP_MODE(1, 373*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 374*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x2, "spi0", "miso", V_98DX3236_PLUS), 375*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x4, "dev", "ad9", V_98DX3236_PLUS)), 376*d7ae8f8dSKalyan Kinthada MPP_MODE(2, 377*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 378*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x2, "spi0", "sck", V_98DX3236_PLUS), 379*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x4, "dev", "ad10", V_98DX3236_PLUS)), 380*d7ae8f8dSKalyan Kinthada MPP_MODE(3, 381*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 382*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x2, "spi0", "cs0", V_98DX3236_PLUS), 383*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x4, "dev", "ad11", V_98DX3236_PLUS)), 384*d7ae8f8dSKalyan Kinthada MPP_MODE(4, 385*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 386*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x2, "spi0", "cs1", V_98DX3236_PLUS), 387*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x3, "smi", "mdc", V_98DX3236_PLUS), 388*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x4, "dev", "cs0", V_98DX3236_PLUS)), 389*d7ae8f8dSKalyan Kinthada MPP_MODE(5, 390*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 391*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x1, "pex", "rsto", V_98DX3236_PLUS), 392*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x2, "sd0", "cmd", V_98DX4251), 393*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x4, "dev", "bootcs", V_98DX3236_PLUS)), 394*d7ae8f8dSKalyan Kinthada MPP_MODE(6, 395*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 396*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x2, "sd0", "clk", V_98DX4251), 397*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x4, "dev", "a2", V_98DX3236_PLUS)), 398*d7ae8f8dSKalyan Kinthada MPP_MODE(7, 399*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 400*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x2, "sd0", "d0", V_98DX4251), 401*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x4, "dev", "ale0", V_98DX3236_PLUS)), 402*d7ae8f8dSKalyan Kinthada MPP_MODE(8, 403*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 404*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x2, "sd0", "d1", V_98DX4251), 405*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x4, "dev", "ale1", V_98DX3236_PLUS)), 406*d7ae8f8dSKalyan Kinthada MPP_MODE(9, 407*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 408*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x2, "sd0", "d2", V_98DX4251), 409*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x4, "dev", "ready0", V_98DX3236_PLUS)), 410*d7ae8f8dSKalyan Kinthada MPP_MODE(10, 411*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 412*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x2, "sd0", "d3", V_98DX4251), 413*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x4, "dev", "ad12", V_98DX3236_PLUS)), 414*d7ae8f8dSKalyan Kinthada MPP_MODE(11, 415*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 416*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x2, "uart1", "rxd", V_98DX3236_PLUS), 417*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x3, "uart0", "cts", V_98DX3236_PLUS), 418*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x4, "dev", "ad13", V_98DX3236_PLUS)), 419*d7ae8f8dSKalyan Kinthada MPP_MODE(12, 420*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 421*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x2, "uart1", "txd", V_98DX3236_PLUS), 422*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x3, "uart0", "rts", V_98DX3236_PLUS), 423*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x4, "dev", "ad14", V_98DX3236_PLUS)), 424*d7ae8f8dSKalyan Kinthada MPP_MODE(13, 425*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 426*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x1, "intr", "out", V_98DX3236_PLUS), 427*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x4, "dev", "ad15", V_98DX3236_PLUS)), 428*d7ae8f8dSKalyan Kinthada MPP_MODE(14, 429*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 430*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x1, "i2c0", "sck", V_98DX3236_PLUS)), 431*d7ae8f8dSKalyan Kinthada MPP_MODE(15, 432*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 433*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x4, "i2c0", "sda", V_98DX3236_PLUS)), 434*d7ae8f8dSKalyan Kinthada MPP_MODE(16, 435*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 436*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x4, "dev", "oe", V_98DX3236_PLUS)), 437*d7ae8f8dSKalyan Kinthada MPP_MODE(17, 438*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 439*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x4, "dev", "clkout", V_98DX3236_PLUS)), 440*d7ae8f8dSKalyan Kinthada MPP_MODE(18, 441*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 442*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x3, "uart1", "txd", V_98DX3236_PLUS)), 443*d7ae8f8dSKalyan Kinthada MPP_MODE(19, 444*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 445*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x3, "uart1", "rxd", V_98DX3236_PLUS), 446*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x4, "dev", "rb", V_98DX3236_PLUS)), 447*d7ae8f8dSKalyan Kinthada MPP_MODE(20, 448*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 449*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x4, "dev", "we0", V_98DX3236_PLUS)), 450*d7ae8f8dSKalyan Kinthada MPP_MODE(21, 451*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 452*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x1, "dev", "ad0", V_98DX3236_PLUS)), 453*d7ae8f8dSKalyan Kinthada MPP_MODE(22, 454*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 455*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x1, "dev", "ad1", V_98DX3236_PLUS)), 456*d7ae8f8dSKalyan Kinthada MPP_MODE(23, 457*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 458*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x1, "dev", "ad2", V_98DX3236_PLUS)), 459*d7ae8f8dSKalyan Kinthada MPP_MODE(24, 460*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 461*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x1, "dev", "ad3", V_98DX3236_PLUS)), 462*d7ae8f8dSKalyan Kinthada MPP_MODE(25, 463*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 464*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x1, "dev", "ad4", V_98DX3236_PLUS)), 465*d7ae8f8dSKalyan Kinthada MPP_MODE(26, 466*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 467*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x1, "dev", "ad5", V_98DX3236_PLUS)), 468*d7ae8f8dSKalyan Kinthada MPP_MODE(27, 469*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 470*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x1, "dev", "ad6", V_98DX3236_PLUS)), 471*d7ae8f8dSKalyan Kinthada MPP_MODE(28, 472*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 473*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x1, "dev", "ad7", V_98DX3236_PLUS)), 474*d7ae8f8dSKalyan Kinthada MPP_MODE(29, 475*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 476*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x1, "dev", "a0", V_98DX3236_PLUS)), 477*d7ae8f8dSKalyan Kinthada MPP_MODE(30, 478*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpo", NULL, V_98DX3236_PLUS), 479*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x1, "dev", "a1", V_98DX3236_PLUS)), 480*d7ae8f8dSKalyan Kinthada MPP_MODE(31, 481*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 482*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x1, "slv_smi", "mdc", V_98DX3236_PLUS), 483*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x3, "smi", "mdc", V_98DX3236_PLUS), 484*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x4, "dev", "we1", V_98DX3236_PLUS)), 485*d7ae8f8dSKalyan Kinthada MPP_MODE(32, 486*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_98DX3236_PLUS), 487*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x1, "slv_smi", "mdio", V_98DX3236_PLUS), 488*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x3, "smi", "mdio", V_98DX3236_PLUS), 489*d7ae8f8dSKalyan Kinthada MPP_VAR_FUNCTION(0x4, "dev", "cs1", V_98DX3236_PLUS)), 490*d7ae8f8dSKalyan Kinthada }; 491*d7ae8f8dSKalyan Kinthada 49206763c74SThomas Petazzoni static struct mvebu_pinctrl_soc_info armada_xp_pinctrl_info; 49306763c74SThomas Petazzoni 494baa9946eSFabian Frederick static const struct of_device_id armada_xp_pinctrl_of_match[] = { 49506763c74SThomas Petazzoni { 49606763c74SThomas Petazzoni .compatible = "marvell,mv78230-pinctrl", 49706763c74SThomas Petazzoni .data = (void *) V_MV78230, 49806763c74SThomas Petazzoni }, 49906763c74SThomas Petazzoni { 50006763c74SThomas Petazzoni .compatible = "marvell,mv78260-pinctrl", 50106763c74SThomas Petazzoni .data = (void *) V_MV78260, 50206763c74SThomas Petazzoni }, 50306763c74SThomas Petazzoni { 50406763c74SThomas Petazzoni .compatible = "marvell,mv78460-pinctrl", 50506763c74SThomas Petazzoni .data = (void *) V_MV78460, 50606763c74SThomas Petazzoni }, 507*d7ae8f8dSKalyan Kinthada { 508*d7ae8f8dSKalyan Kinthada .compatible = "marvell,98dx3236-pinctrl", 509*d7ae8f8dSKalyan Kinthada .data = (void *) V_98DX3236, 510*d7ae8f8dSKalyan Kinthada }, 511*d7ae8f8dSKalyan Kinthada { 512*d7ae8f8dSKalyan Kinthada .compatible = "marvell,98dx4251-pinctrl", 513*d7ae8f8dSKalyan Kinthada .data = (void *) V_98DX4251, 514*d7ae8f8dSKalyan Kinthada }, 51506763c74SThomas Petazzoni { }, 51606763c74SThomas Petazzoni }; 51706763c74SThomas Petazzoni 51806763c74SThomas Petazzoni static struct mvebu_mpp_ctrl mv78230_mpp_controls[] = { 5191217b790SSebastian Hesselbarth MPP_FUNC_CTRL(0, 48, NULL, armada_xp_mpp_ctrl), 52006763c74SThomas Petazzoni }; 52106763c74SThomas Petazzoni 52206763c74SThomas Petazzoni static struct pinctrl_gpio_range mv78230_mpp_gpio_ranges[] = { 52306763c74SThomas Petazzoni MPP_GPIO_RANGE(0, 0, 0, 32), 52406763c74SThomas Petazzoni MPP_GPIO_RANGE(1, 32, 32, 17), 52506763c74SThomas Petazzoni }; 52606763c74SThomas Petazzoni 52706763c74SThomas Petazzoni static struct mvebu_mpp_ctrl mv78260_mpp_controls[] = { 5281217b790SSebastian Hesselbarth MPP_FUNC_CTRL(0, 66, NULL, armada_xp_mpp_ctrl), 52906763c74SThomas Petazzoni }; 53006763c74SThomas Petazzoni 53106763c74SThomas Petazzoni static struct pinctrl_gpio_range mv78260_mpp_gpio_ranges[] = { 53206763c74SThomas Petazzoni MPP_GPIO_RANGE(0, 0, 0, 32), 53306763c74SThomas Petazzoni MPP_GPIO_RANGE(1, 32, 32, 32), 53406763c74SThomas Petazzoni MPP_GPIO_RANGE(2, 64, 64, 3), 53506763c74SThomas Petazzoni }; 53606763c74SThomas Petazzoni 53706763c74SThomas Petazzoni static struct mvebu_mpp_ctrl mv78460_mpp_controls[] = { 5381217b790SSebastian Hesselbarth MPP_FUNC_CTRL(0, 66, NULL, armada_xp_mpp_ctrl), 53906763c74SThomas Petazzoni }; 54006763c74SThomas Petazzoni 54106763c74SThomas Petazzoni static struct pinctrl_gpio_range mv78460_mpp_gpio_ranges[] = { 54206763c74SThomas Petazzoni MPP_GPIO_RANGE(0, 0, 0, 32), 54306763c74SThomas Petazzoni MPP_GPIO_RANGE(1, 32, 32, 32), 54406763c74SThomas Petazzoni MPP_GPIO_RANGE(2, 64, 64, 3), 54506763c74SThomas Petazzoni }; 54606763c74SThomas Petazzoni 547*d7ae8f8dSKalyan Kinthada static struct mvebu_mpp_ctrl mv98dx3236_mpp_controls[] = { 548*d7ae8f8dSKalyan Kinthada MPP_FUNC_CTRL(0, 32, NULL, mvebu_mmio_mpp_ctrl), 549*d7ae8f8dSKalyan Kinthada }; 550*d7ae8f8dSKalyan Kinthada 551*d7ae8f8dSKalyan Kinthada static struct pinctrl_gpio_range mv98dx3236_mpp_gpio_ranges[] = { 552*d7ae8f8dSKalyan Kinthada MPP_GPIO_RANGE(0, 0, 0, 32), 553*d7ae8f8dSKalyan Kinthada }; 554*d7ae8f8dSKalyan Kinthada 55512149a20SThomas Petazzoni static int armada_xp_pinctrl_suspend(struct platform_device *pdev, 55612149a20SThomas Petazzoni pm_message_t state) 55712149a20SThomas Petazzoni { 55812149a20SThomas Petazzoni struct mvebu_pinctrl_soc_info *soc = 55912149a20SThomas Petazzoni platform_get_drvdata(pdev); 56012149a20SThomas Petazzoni int i, nregs; 56112149a20SThomas Petazzoni 56212149a20SThomas Petazzoni nregs = DIV_ROUND_UP(soc->nmodes, MVEBU_MPPS_PER_REG); 56312149a20SThomas Petazzoni 56412149a20SThomas Petazzoni for (i = 0; i < nregs; i++) 56512149a20SThomas Petazzoni mpp_saved_regs[i] = readl(mpp_base + i * 4); 56612149a20SThomas Petazzoni 56712149a20SThomas Petazzoni return 0; 56812149a20SThomas Petazzoni } 56912149a20SThomas Petazzoni 57012149a20SThomas Petazzoni static int armada_xp_pinctrl_resume(struct platform_device *pdev) 57112149a20SThomas Petazzoni { 57212149a20SThomas Petazzoni struct mvebu_pinctrl_soc_info *soc = 57312149a20SThomas Petazzoni platform_get_drvdata(pdev); 57412149a20SThomas Petazzoni int i, nregs; 57512149a20SThomas Petazzoni 57612149a20SThomas Petazzoni nregs = DIV_ROUND_UP(soc->nmodes, MVEBU_MPPS_PER_REG); 57712149a20SThomas Petazzoni 57812149a20SThomas Petazzoni for (i = 0; i < nregs; i++) 57912149a20SThomas Petazzoni writel(mpp_saved_regs[i], mpp_base + i * 4); 58012149a20SThomas Petazzoni 58112149a20SThomas Petazzoni return 0; 58212149a20SThomas Petazzoni } 58312149a20SThomas Petazzoni 584150632b0SGreg Kroah-Hartman static int armada_xp_pinctrl_probe(struct platform_device *pdev) 58506763c74SThomas Petazzoni { 58606763c74SThomas Petazzoni struct mvebu_pinctrl_soc_info *soc = &armada_xp_pinctrl_info; 58706763c74SThomas Petazzoni const struct of_device_id *match = 58806763c74SThomas Petazzoni of_match_device(armada_xp_pinctrl_of_match, &pdev->dev); 5891217b790SSebastian Hesselbarth struct resource *res; 59012149a20SThomas Petazzoni int nregs; 59106763c74SThomas Petazzoni 59206763c74SThomas Petazzoni if (!match) 59306763c74SThomas Petazzoni return -ENODEV; 59406763c74SThomas Petazzoni 5951217b790SSebastian Hesselbarth res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 5961217b790SSebastian Hesselbarth mpp_base = devm_ioremap_resource(&pdev->dev, res); 5971217b790SSebastian Hesselbarth if (IS_ERR(mpp_base)) 5981217b790SSebastian Hesselbarth return PTR_ERR(mpp_base); 5991217b790SSebastian Hesselbarth 60006763c74SThomas Petazzoni soc->variant = (unsigned) match->data & 0xff; 60106763c74SThomas Petazzoni 60206763c74SThomas Petazzoni switch (soc->variant) { 60306763c74SThomas Petazzoni case V_MV78230: 60406763c74SThomas Petazzoni soc->controls = mv78230_mpp_controls; 60506763c74SThomas Petazzoni soc->ncontrols = ARRAY_SIZE(mv78230_mpp_controls); 60606763c74SThomas Petazzoni soc->modes = armada_xp_mpp_modes; 60706763c74SThomas Petazzoni /* We don't necessarily want the full list of the 60806763c74SThomas Petazzoni * armada_xp_mpp_modes, but only the first 'n' ones 60906763c74SThomas Petazzoni * that are available on this SoC */ 61006763c74SThomas Petazzoni soc->nmodes = mv78230_mpp_controls[0].npins; 61106763c74SThomas Petazzoni soc->gpioranges = mv78230_mpp_gpio_ranges; 61206763c74SThomas Petazzoni soc->ngpioranges = ARRAY_SIZE(mv78230_mpp_gpio_ranges); 61306763c74SThomas Petazzoni break; 61406763c74SThomas Petazzoni case V_MV78260: 61506763c74SThomas Petazzoni soc->controls = mv78260_mpp_controls; 61606763c74SThomas Petazzoni soc->ncontrols = ARRAY_SIZE(mv78260_mpp_controls); 61706763c74SThomas Petazzoni soc->modes = armada_xp_mpp_modes; 61806763c74SThomas Petazzoni /* We don't necessarily want the full list of the 61906763c74SThomas Petazzoni * armada_xp_mpp_modes, but only the first 'n' ones 62006763c74SThomas Petazzoni * that are available on this SoC */ 62106763c74SThomas Petazzoni soc->nmodes = mv78260_mpp_controls[0].npins; 62206763c74SThomas Petazzoni soc->gpioranges = mv78260_mpp_gpio_ranges; 62306763c74SThomas Petazzoni soc->ngpioranges = ARRAY_SIZE(mv78260_mpp_gpio_ranges); 62406763c74SThomas Petazzoni break; 62506763c74SThomas Petazzoni case V_MV78460: 62606763c74SThomas Petazzoni soc->controls = mv78460_mpp_controls; 62706763c74SThomas Petazzoni soc->ncontrols = ARRAY_SIZE(mv78460_mpp_controls); 62806763c74SThomas Petazzoni soc->modes = armada_xp_mpp_modes; 62906763c74SThomas Petazzoni /* We don't necessarily want the full list of the 63006763c74SThomas Petazzoni * armada_xp_mpp_modes, but only the first 'n' ones 63106763c74SThomas Petazzoni * that are available on this SoC */ 63206763c74SThomas Petazzoni soc->nmodes = mv78460_mpp_controls[0].npins; 63306763c74SThomas Petazzoni soc->gpioranges = mv78460_mpp_gpio_ranges; 63406763c74SThomas Petazzoni soc->ngpioranges = ARRAY_SIZE(mv78460_mpp_gpio_ranges); 63506763c74SThomas Petazzoni break; 636*d7ae8f8dSKalyan Kinthada case V_98DX3236: 637*d7ae8f8dSKalyan Kinthada case V_98DX3336: 638*d7ae8f8dSKalyan Kinthada case V_98DX4251: 639*d7ae8f8dSKalyan Kinthada /* fall-through */ 640*d7ae8f8dSKalyan Kinthada soc->controls = mv98dx3236_mpp_controls; 641*d7ae8f8dSKalyan Kinthada soc->ncontrols = ARRAY_SIZE(mv98dx3236_mpp_controls); 642*d7ae8f8dSKalyan Kinthada soc->modes = mv98dx3236_mpp_modes; 643*d7ae8f8dSKalyan Kinthada soc->nmodes = mv98dx3236_mpp_controls[0].npins; 644*d7ae8f8dSKalyan Kinthada soc->gpioranges = mv98dx3236_mpp_gpio_ranges; 645*d7ae8f8dSKalyan Kinthada soc->ngpioranges = ARRAY_SIZE(mv98dx3236_mpp_gpio_ranges); 646*d7ae8f8dSKalyan Kinthada break; 64706763c74SThomas Petazzoni } 64806763c74SThomas Petazzoni 64912149a20SThomas Petazzoni nregs = DIV_ROUND_UP(soc->nmodes, MVEBU_MPPS_PER_REG); 65012149a20SThomas Petazzoni 65112149a20SThomas Petazzoni mpp_saved_regs = devm_kmalloc(&pdev->dev, nregs * sizeof(u32), 65212149a20SThomas Petazzoni GFP_KERNEL); 65312149a20SThomas Petazzoni if (!mpp_saved_regs) 65412149a20SThomas Petazzoni return -ENOMEM; 65512149a20SThomas Petazzoni 65606763c74SThomas Petazzoni pdev->dev.platform_data = soc; 65706763c74SThomas Petazzoni 65806763c74SThomas Petazzoni return mvebu_pinctrl_probe(pdev); 65906763c74SThomas Petazzoni } 66006763c74SThomas Petazzoni 66106763c74SThomas Petazzoni static struct platform_driver armada_xp_pinctrl_driver = { 66206763c74SThomas Petazzoni .driver = { 66306763c74SThomas Petazzoni .name = "armada-xp-pinctrl", 664f2e9394dSSachin Kamat .of_match_table = armada_xp_pinctrl_of_match, 66506763c74SThomas Petazzoni }, 66606763c74SThomas Petazzoni .probe = armada_xp_pinctrl_probe, 66712149a20SThomas Petazzoni .suspend = armada_xp_pinctrl_suspend, 66812149a20SThomas Petazzoni .resume = armada_xp_pinctrl_resume, 66906763c74SThomas Petazzoni }; 67006763c74SThomas Petazzoni 67106763c74SThomas Petazzoni module_platform_driver(armada_xp_pinctrl_driver); 67206763c74SThomas Petazzoni 67306763c74SThomas Petazzoni MODULE_AUTHOR("Thomas Petazzoni <thomas.petazzoni@free-electrons.com>"); 67406763c74SThomas Petazzoni MODULE_DESCRIPTION("Marvell Armada XP pinctrl driver"); 67506763c74SThomas Petazzoni MODULE_LICENSE("GPL v2"); 676