1ce3ed59dSThomas Petazzoni /* 2ce3ed59dSThomas Petazzoni * Marvell Armada 375 pinctrl driver based on mvebu pinctrl core 3ce3ed59dSThomas Petazzoni * 4ce3ed59dSThomas Petazzoni * Copyright (C) 2012 Marvell 5ce3ed59dSThomas Petazzoni * 6ce3ed59dSThomas Petazzoni * Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 7ce3ed59dSThomas Petazzoni * 8ce3ed59dSThomas Petazzoni * This program is free software; you can redistribute it and/or modify 9ce3ed59dSThomas Petazzoni * it under the terms of the GNU General Public License as published by 10ce3ed59dSThomas Petazzoni * the Free Software Foundation; either version 2 of the License, or 11ce3ed59dSThomas Petazzoni * (at your option) any later version. 12ce3ed59dSThomas Petazzoni */ 13ce3ed59dSThomas Petazzoni 14ce3ed59dSThomas Petazzoni #include <linux/err.h> 15ce3ed59dSThomas Petazzoni #include <linux/init.h> 16ce3ed59dSThomas Petazzoni #include <linux/io.h> 17ce3ed59dSThomas Petazzoni #include <linux/module.h> 18ce3ed59dSThomas Petazzoni #include <linux/platform_device.h> 19ce3ed59dSThomas Petazzoni #include <linux/clk.h> 20ce3ed59dSThomas Petazzoni #include <linux/of.h> 21ce3ed59dSThomas Petazzoni #include <linux/of_device.h> 22ce3ed59dSThomas Petazzoni #include <linux/pinctrl/pinctrl.h> 23ce3ed59dSThomas Petazzoni 24ce3ed59dSThomas Petazzoni #include "pinctrl-mvebu.h" 25ce3ed59dSThomas Petazzoni 26ce3ed59dSThomas Petazzoni static void __iomem *mpp_base; 27ce3ed59dSThomas Petazzoni 28ce3ed59dSThomas Petazzoni static int armada_375_mpp_ctrl_get(unsigned pid, unsigned long *config) 29ce3ed59dSThomas Petazzoni { 30ce3ed59dSThomas Petazzoni return default_mpp_ctrl_get(mpp_base, pid, config); 31ce3ed59dSThomas Petazzoni } 32ce3ed59dSThomas Petazzoni 33ce3ed59dSThomas Petazzoni static int armada_375_mpp_ctrl_set(unsigned pid, unsigned long config) 34ce3ed59dSThomas Petazzoni { 35ce3ed59dSThomas Petazzoni return default_mpp_ctrl_set(mpp_base, pid, config); 36ce3ed59dSThomas Petazzoni } 37ce3ed59dSThomas Petazzoni 38ce3ed59dSThomas Petazzoni static struct mvebu_mpp_mode mv88f6720_mpp_modes[] = { 39ce3ed59dSThomas Petazzoni MPP_MODE(0, 40ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 41ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "dev", "ad2"), 42ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "spi0", "cs1"), 43ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "spi1", "cs1"), 44ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "nand", "io2")), 45ce3ed59dSThomas Petazzoni MPP_MODE(1, 46ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 47ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "dev", "ad3"), 48ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "spi0", "mosi"), 49ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "spi1", "mosi"), 50ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "nand", "io3")), 51ce3ed59dSThomas Petazzoni MPP_MODE(2, 52ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 53ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "dev", "ad4"), 549540cf53SThomas Petazzoni MPP_FUNCTION(0x2, "ptp", "evreq"), 55ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "led", "c0"), 56ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x4, "audio", "sdi"), 57ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "nand", "io4"), 58ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x6, "spi1", "mosi")), 59ce3ed59dSThomas Petazzoni MPP_MODE(3, 60ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 61ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "dev", "ad5"), 629540cf53SThomas Petazzoni MPP_FUNCTION(0x2, "ptp", "trig"), 63ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "led", "p3"), 64ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x4, "audio", "mclk"), 65ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "nand", "io5"), 66ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x6, "spi1", "miso")), 67ce3ed59dSThomas Petazzoni MPP_MODE(4, 68ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 69ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "dev", "ad6"), 70ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "spi0", "miso"), 71ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "spi1", "miso"), 72ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "nand", "io6")), 73ce3ed59dSThomas Petazzoni MPP_MODE(5, 74ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 75ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "dev", "ad7"), 76ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "spi0", "cs2"), 77ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "spi1", "cs2"), 78ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "nand", "io7"), 79ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x6, "spi1", "miso")), 80ce3ed59dSThomas Petazzoni MPP_MODE(6, 81ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 82ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "dev", "ad0"), 83ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "led", "p1"), 84f32f01e1SThomas Petazzoni MPP_FUNCTION(0x4, "audio", "lrclk"), 85ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "nand", "io0")), 86ce3ed59dSThomas Petazzoni MPP_MODE(7, 87ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 88ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "dev", "ad1"), 89ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "ptp", "clk"), 90ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "led", "p2"), 91ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x4, "audio", "extclk"), 92ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "nand", "io1")), 93ce3ed59dSThomas Petazzoni MPP_MODE(8, 94ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 95ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "dev", "bootcs"), 96ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "spi0", "cs0"), 97ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "spi1", "cs0"), 98ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "nand", "ce")), 99ce3ed59dSThomas Petazzoni MPP_MODE(9, 100ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 101ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "spi0", "sck"), 102ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "spi1", "sck"), 103ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "nand", "we")), 104ce3ed59dSThomas Petazzoni MPP_MODE(10, 105ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 106ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "dram", "vttctrl"), 107ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "led", "c1"), 108ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "nand", "re"), 109ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x6, "spi1", "sck")), 110ce3ed59dSThomas Petazzoni MPP_MODE(11, 111ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 112ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "dev", "a0"), 113ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "led", "c2"), 114ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x4, "audio", "sdo"), 115ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "nand", "cle")), 116ce3ed59dSThomas Petazzoni MPP_MODE(12, 117ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 118ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "dev", "a1"), 119ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x4, "audio", "bclk"), 120ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "nand", "ale")), 121ce3ed59dSThomas Petazzoni MPP_MODE(13, 122ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 1237bd6a26dSThomas Petazzoni MPP_FUNCTION(0x1, "dev", "ready"), 124d4974c16SThomas Petazzoni MPP_FUNCTION(0x2, "pcie0", "rstout"), 125d4974c16SThomas Petazzoni MPP_FUNCTION(0x3, "pcie1", "rstout"), 126ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "nand", "rb"), 127ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x6, "spi1", "mosi")), 128ce3ed59dSThomas Petazzoni MPP_MODE(14, 129ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 130ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "i2c0", "sda"), 131ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "uart1", "txd")), 132ce3ed59dSThomas Petazzoni MPP_MODE(15, 133ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 134ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "i2c0", "sck"), 135ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "uart1", "rxd")), 136ce3ed59dSThomas Petazzoni MPP_MODE(16, 137ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 138ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "uart0", "txd")), 139ce3ed59dSThomas Petazzoni MPP_MODE(17, 140ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 141ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "uart0", "rxd")), 142ce3ed59dSThomas Petazzoni MPP_MODE(18, 143ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 144dae5597fSThomas Petazzoni MPP_FUNCTION(0x2, "tdm", "int")), 145ce3ed59dSThomas Petazzoni MPP_MODE(19, 146ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 147dae5597fSThomas Petazzoni MPP_FUNCTION(0x2, "tdm", "rst")), 148ce3ed59dSThomas Petazzoni MPP_MODE(20, 149ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 150ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "tdm", "pclk")), 151ce3ed59dSThomas Petazzoni MPP_MODE(21, 152ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 153ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "tdm", "fsync")), 154ce3ed59dSThomas Petazzoni MPP_MODE(22, 155ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 156ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "tdm", "drx")), 157ce3ed59dSThomas Petazzoni MPP_MODE(23, 158ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 159ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "tdm", "dtx")), 160ce3ed59dSThomas Petazzoni MPP_MODE(24, 161ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 162ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "led", "p0"), 163ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "ge1", "rxd0"), 164ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "sd", "cmd"), 165ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x4, "uart0", "rts"), 166ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "spi0", "cs0"), 167ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x6, "dev", "cs1")), 168ce3ed59dSThomas Petazzoni MPP_MODE(25, 169ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 170ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "led", "p2"), 171ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "ge1", "rxd1"), 172ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "sd", "d0"), 173ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x4, "uart0", "cts"), 174ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "spi0", "mosi"), 175ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x6, "dev", "cs2")), 176ce3ed59dSThomas Petazzoni MPP_MODE(26, 177ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 178ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "pcie0", "clkreq"), 179ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "ge1", "rxd2"), 180ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "sd", "d2"), 181ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x4, "uart1", "rts"), 182ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "spi0", "cs1"), 183ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x6, "led", "c1")), 184ce3ed59dSThomas Petazzoni MPP_MODE(27, 185ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 186ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "pcie1", "clkreq"), 187ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "ge1", "rxd3"), 188ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "sd", "d1"), 189ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x4, "uart1", "cts"), 190ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "spi0", "miso"), 191ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x6, "led", "c2")), 192ce3ed59dSThomas Petazzoni MPP_MODE(28, 193ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 194ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "led", "p3"), 195ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "ge1", "txctl"), 196ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "sd", "clk"), 197ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "dram", "vttctrl")), 198ce3ed59dSThomas Petazzoni MPP_MODE(29, 199ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 200ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "pcie1", "clkreq"), 201ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "ge1", "rxclk"), 202ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "sd", "d3"), 203ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "spi0", "sck"), 204d4974c16SThomas Petazzoni MPP_FUNCTION(0x6, "pcie0", "rstout")), 205ce3ed59dSThomas Petazzoni MPP_MODE(30, 206ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 207ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "ge1", "txd0"), 208ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "spi1", "cs0"), 209ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "led", "p3"), 2109540cf53SThomas Petazzoni MPP_FUNCTION(0x6, "ptp", "evreq")), 211ce3ed59dSThomas Petazzoni MPP_MODE(31, 212ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 213ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "ge1", "txd1"), 214ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "spi1", "mosi"), 215ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "led", "p0")), 216ce3ed59dSThomas Petazzoni MPP_MODE(32, 217ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 218ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "ge1", "txd2"), 219ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "spi1", "sck"), 2209540cf53SThomas Petazzoni MPP_FUNCTION(0x4, "ptp", "trig"), 221ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "led", "c0")), 222ce3ed59dSThomas Petazzoni MPP_MODE(33, 223ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 224ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "ge1", "txd3"), 225ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "spi1", "miso"), 226ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "led", "p2")), 227ce3ed59dSThomas Petazzoni MPP_MODE(34, 228ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 229ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "ge1", "txclkout"), 230ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "spi1", "sck"), 231ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "led", "c1")), 232ce3ed59dSThomas Petazzoni MPP_MODE(35, 233ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 234ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "ge1", "rxctl"), 235ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "spi1", "cs1"), 236ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x4, "spi0", "cs2"), 237ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "led", "p1")), 238ce3ed59dSThomas Petazzoni MPP_MODE(36, 239ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 240ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "pcie0", "clkreq"), 241ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "led", "c2")), 242ce3ed59dSThomas Petazzoni MPP_MODE(37, 243ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 244ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "pcie0", "clkreq"), 245dae5597fSThomas Petazzoni MPP_FUNCTION(0x2, "tdm", "int"), 246ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x4, "ge", "mdc")), 247ce3ed59dSThomas Petazzoni MPP_MODE(38, 248ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 249ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "pcie1", "clkreq"), 250ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x4, "ge", "mdio")), 251ce3ed59dSThomas Petazzoni MPP_MODE(39, 252ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 253ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x4, "ref", "clkout"), 254ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "led", "p3")), 255ce3ed59dSThomas Petazzoni MPP_MODE(40, 256ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 257ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x4, "uart1", "txd"), 258ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "led", "p0")), 259ce3ed59dSThomas Petazzoni MPP_MODE(41, 260ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 261ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x4, "uart1", "rxd"), 262ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "led", "p1")), 263ce3ed59dSThomas Petazzoni MPP_MODE(42, 264ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 265ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "spi1", "cs2"), 266ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x4, "led", "c0"), 267ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x6, "ptp", "clk")), 268ce3ed59dSThomas Petazzoni MPP_MODE(43, 269ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 270ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "sata0", "prsnt"), 271ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x4, "dram", "vttctrl"), 272ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "led", "c1")), 273ce3ed59dSThomas Petazzoni MPP_MODE(44, 274ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 275ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x4, "sata0", "prsnt")), 276ce3ed59dSThomas Petazzoni MPP_MODE(45, 277ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 278ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "spi0", "cs2"), 279d4974c16SThomas Petazzoni MPP_FUNCTION(0x4, "pcie0", "rstout"), 280ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "led", "c2"), 281ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x6, "spi1", "cs2")), 282ce3ed59dSThomas Petazzoni MPP_MODE(46, 283ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 284ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "led", "p0"), 285ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "ge0", "txd0"), 286ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "ge1", "txd0"), 2877bd6a26dSThomas Petazzoni MPP_FUNCTION(0x6, "dev", "we1")), 288ce3ed59dSThomas Petazzoni MPP_MODE(47, 289ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 290ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "led", "p1"), 291ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "ge0", "txd1"), 292ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "ge1", "txd1"), 2939540cf53SThomas Petazzoni MPP_FUNCTION(0x5, "ptp", "trig"), 294ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x6, "dev", "ale0")), 295ce3ed59dSThomas Petazzoni MPP_MODE(48, 296ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 297ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "led", "p2"), 298ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "ge0", "txd2"), 299ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "ge1", "txd2"), 300ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x6, "dev", "ale1")), 301ce3ed59dSThomas Petazzoni MPP_MODE(49, 302ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 303ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "led", "p3"), 304ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "ge0", "txd3"), 305ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "ge1", "txd3"), 306ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x6, "dev", "a2")), 307ce3ed59dSThomas Petazzoni MPP_MODE(50, 308ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 309ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "led", "c0"), 310ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "ge0", "rxd0"), 311ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "ge1", "rxd0"), 3129540cf53SThomas Petazzoni MPP_FUNCTION(0x5, "ptp", "evreq"), 313ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x6, "dev", "ad12")), 314ce3ed59dSThomas Petazzoni MPP_MODE(51, 315ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 316ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "led", "c1"), 317ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "ge0", "rxd1"), 318ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "ge1", "rxd1"), 319ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x6, "dev", "ad8")), 320ce3ed59dSThomas Petazzoni MPP_MODE(52, 321ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 322ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "led", "c2"), 323ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "ge0", "rxd2"), 324ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "ge1", "rxd2"), 325ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "i2c0", "sda"), 326ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x6, "dev", "ad9")), 327ce3ed59dSThomas Petazzoni MPP_MODE(53, 328ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 329d4974c16SThomas Petazzoni MPP_FUNCTION(0x1, "pcie1", "rstout"), 330ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "ge0", "rxd3"), 331ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "ge1", "rxd3"), 332ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x5, "i2c0", "sck"), 333ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x6, "dev", "ad10")), 334ce3ed59dSThomas Petazzoni MPP_MODE(54, 335ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 336d4974c16SThomas Petazzoni MPP_FUNCTION(0x1, "pcie0", "rstout"), 337ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "ge0", "rxctl"), 338ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "ge1", "rxctl"), 339ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x6, "dev", "ad11")), 340ce3ed59dSThomas Petazzoni MPP_MODE(55, 341ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 342ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "ge0", "rxclk"), 343ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "ge1", "rxclk"), 344ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x6, "dev", "cs0")), 345ce3ed59dSThomas Petazzoni MPP_MODE(56, 346ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 347ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "ge0", "txclkout"), 348ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "ge1", "txclkout"), 349ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x6, "dev", "oe")), 350ce3ed59dSThomas Petazzoni MPP_MODE(57, 351ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 352ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "ge0", "txctl"), 353ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "ge1", "txctl"), 3547bd6a26dSThomas Petazzoni MPP_FUNCTION(0x6, "dev", "we0")), 355ce3ed59dSThomas Petazzoni MPP_MODE(58, 356ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 357ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x4, "led", "c0")), 358ce3ed59dSThomas Petazzoni MPP_MODE(59, 359ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 360ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x4, "led", "c1")), 361ce3ed59dSThomas Petazzoni MPP_MODE(60, 362ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 363ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "uart1", "txd"), 364ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x4, "led", "c2"), 365ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x6, "dev", "ad13")), 366ce3ed59dSThomas Petazzoni MPP_MODE(61, 367ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 368ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "i2c1", "sda"), 369ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "uart1", "rxd"), 370ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x3, "spi1", "cs2"), 371ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x4, "led", "p0"), 372ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x6, "dev", "ad14")), 373ce3ed59dSThomas Petazzoni MPP_MODE(62, 374ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 375ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "i2c1", "sck"), 376ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x4, "led", "p1"), 377ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x6, "dev", "ad15")), 378ce3ed59dSThomas Petazzoni MPP_MODE(63, 379ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 3809540cf53SThomas Petazzoni MPP_FUNCTION(0x2, "ptp", "trig"), 381ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x4, "led", "p2"), 3827bd6a26dSThomas Petazzoni MPP_FUNCTION(0x6, "dev", "burst/last")), 383ce3ed59dSThomas Petazzoni MPP_MODE(64, 384ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 385ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x2, "dram", "vttctrl"), 386ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x4, "led", "p3")), 387ce3ed59dSThomas Petazzoni MPP_MODE(65, 388ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 389ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x1, "sata1", "prsnt")), 390ce3ed59dSThomas Petazzoni MPP_MODE(66, 391ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x0, "gpio", NULL), 3929540cf53SThomas Petazzoni MPP_FUNCTION(0x2, "ptp", "evreq"), 393ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x4, "spi1", "cs3"), 394d4974c16SThomas Petazzoni MPP_FUNCTION(0x5, "pcie0", "rstout"), 395ce3ed59dSThomas Petazzoni MPP_FUNCTION(0x6, "dev", "cs3")), 396ce3ed59dSThomas Petazzoni }; 397ce3ed59dSThomas Petazzoni 398ce3ed59dSThomas Petazzoni static struct mvebu_pinctrl_soc_info armada_375_pinctrl_info; 399ce3ed59dSThomas Petazzoni 400baa9946eSFabian Frederick static const struct of_device_id armada_375_pinctrl_of_match[] = { 401ce3ed59dSThomas Petazzoni { .compatible = "marvell,mv88f6720-pinctrl" }, 402ce3ed59dSThomas Petazzoni { }, 403ce3ed59dSThomas Petazzoni }; 404ce3ed59dSThomas Petazzoni 40530be3fb9SRussell King static const struct mvebu_mpp_ctrl mv88f6720_mpp_controls[] = { 406ce3ed59dSThomas Petazzoni MPP_FUNC_CTRL(0, 69, NULL, armada_375_mpp_ctrl), 407ce3ed59dSThomas Petazzoni }; 408ce3ed59dSThomas Petazzoni 409ce3ed59dSThomas Petazzoni static struct pinctrl_gpio_range mv88f6720_mpp_gpio_ranges[] = { 410ce3ed59dSThomas Petazzoni MPP_GPIO_RANGE(0, 0, 0, 32), 411ce3ed59dSThomas Petazzoni MPP_GPIO_RANGE(1, 32, 32, 32), 412ce3ed59dSThomas Petazzoni MPP_GPIO_RANGE(2, 64, 64, 3), 413ce3ed59dSThomas Petazzoni }; 414ce3ed59dSThomas Petazzoni 415ce3ed59dSThomas Petazzoni static int armada_375_pinctrl_probe(struct platform_device *pdev) 416ce3ed59dSThomas Petazzoni { 417ce3ed59dSThomas Petazzoni struct mvebu_pinctrl_soc_info *soc = &armada_375_pinctrl_info; 418ce3ed59dSThomas Petazzoni struct resource *res; 419ce3ed59dSThomas Petazzoni 420ce3ed59dSThomas Petazzoni res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 421ce3ed59dSThomas Petazzoni mpp_base = devm_ioremap_resource(&pdev->dev, res); 422ce3ed59dSThomas Petazzoni if (IS_ERR(mpp_base)) 423ce3ed59dSThomas Petazzoni return PTR_ERR(mpp_base); 424ce3ed59dSThomas Petazzoni 425ce3ed59dSThomas Petazzoni soc->variant = 0; /* no variants for Armada 375 */ 426ce3ed59dSThomas Petazzoni soc->controls = mv88f6720_mpp_controls; 427ce3ed59dSThomas Petazzoni soc->ncontrols = ARRAY_SIZE(mv88f6720_mpp_controls); 428ce3ed59dSThomas Petazzoni soc->modes = mv88f6720_mpp_modes; 429ce3ed59dSThomas Petazzoni soc->nmodes = ARRAY_SIZE(mv88f6720_mpp_modes); 430ce3ed59dSThomas Petazzoni soc->gpioranges = mv88f6720_mpp_gpio_ranges; 431ce3ed59dSThomas Petazzoni soc->ngpioranges = ARRAY_SIZE(mv88f6720_mpp_gpio_ranges); 432ce3ed59dSThomas Petazzoni 433ce3ed59dSThomas Petazzoni pdev->dev.platform_data = soc; 434ce3ed59dSThomas Petazzoni 435ce3ed59dSThomas Petazzoni return mvebu_pinctrl_probe(pdev); 436ce3ed59dSThomas Petazzoni } 437ce3ed59dSThomas Petazzoni 438ce3ed59dSThomas Petazzoni static struct platform_driver armada_375_pinctrl_driver = { 439ce3ed59dSThomas Petazzoni .driver = { 440ce3ed59dSThomas Petazzoni .name = "armada-375-pinctrl", 441ce3ed59dSThomas Petazzoni .of_match_table = of_match_ptr(armada_375_pinctrl_of_match), 442ce3ed59dSThomas Petazzoni }, 443ce3ed59dSThomas Petazzoni .probe = armada_375_pinctrl_probe, 444ce3ed59dSThomas Petazzoni }; 445ce3ed59dSThomas Petazzoni 446ce3ed59dSThomas Petazzoni module_platform_driver(armada_375_pinctrl_driver); 447ce3ed59dSThomas Petazzoni 448ce3ed59dSThomas Petazzoni MODULE_AUTHOR("Thomas Petazzoni <thomas.petazzoni@free-electrons.com>"); 449ce3ed59dSThomas Petazzoni MODULE_DESCRIPTION("Marvell Armada 375 pinctrl driver"); 450ce3ed59dSThomas Petazzoni MODULE_LICENSE("GPL v2"); 451