Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Marvell Armada 39x pinctrl driver based on mvebu pinctrl core |
| 3 | * |
| 4 | * Copyright (C) 2015 Marvell |
| 5 | * |
| 6 | * Thomas Petazzoni <thomas.petazzoni@free-electrons.com> |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | */ |
| 13 | |
| 14 | #include <linux/err.h> |
| 15 | #include <linux/init.h> |
| 16 | #include <linux/io.h> |
| 17 | #include <linux/module.h> |
| 18 | #include <linux/platform_device.h> |
| 19 | #include <linux/of.h> |
| 20 | #include <linux/of_device.h> |
| 21 | #include <linux/pinctrl/pinctrl.h> |
| 22 | |
| 23 | #include "pinctrl-mvebu.h" |
| 24 | |
| 25 | static void __iomem *mpp_base; |
| 26 | |
| 27 | static int armada_39x_mpp_ctrl_get(unsigned pid, unsigned long *config) |
| 28 | { |
| 29 | return default_mpp_ctrl_get(mpp_base, pid, config); |
| 30 | } |
| 31 | |
| 32 | static int armada_39x_mpp_ctrl_set(unsigned pid, unsigned long config) |
| 33 | { |
| 34 | return default_mpp_ctrl_set(mpp_base, pid, config); |
| 35 | } |
| 36 | |
| 37 | enum { |
| 38 | V_88F6920 = BIT(0), |
| 39 | V_88F6928 = BIT(1), |
| 40 | V_88F6920_PLUS = (V_88F6920 | V_88F6928), |
| 41 | }; |
| 42 | |
| 43 | static struct mvebu_mpp_mode armada_39x_mpp_modes[] = { |
| 44 | MPP_MODE(0, |
| 45 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 46 | MPP_VAR_FUNCTION(1, "ua0", "rxd", V_88F6920_PLUS)), |
| 47 | MPP_MODE(1, |
| 48 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 49 | MPP_VAR_FUNCTION(1, "ua0", "txd", V_88F6920_PLUS)), |
| 50 | MPP_MODE(2, |
| 51 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 52 | MPP_VAR_FUNCTION(1, "i2c0", "sck", V_88F6920_PLUS)), |
| 53 | MPP_MODE(3, |
| 54 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 55 | MPP_VAR_FUNCTION(1, "i2c0", "sda", V_88F6920_PLUS)), |
| 56 | MPP_MODE(4, |
| 57 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 58 | MPP_VAR_FUNCTION(2, "ua1", "txd", V_88F6920_PLUS), |
| 59 | MPP_VAR_FUNCTION(3, "ua0", "rts", V_88F6920_PLUS), |
| 60 | MPP_VAR_FUNCTION(7, "smi", "mdc", V_88F6920_PLUS)), |
| 61 | MPP_MODE(5, |
| 62 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 63 | MPP_VAR_FUNCTION(2, "ua1", "rxd", V_88F6920_PLUS), |
| 64 | MPP_VAR_FUNCTION(3, "ua0", "cts", V_88F6920_PLUS), |
| 65 | MPP_VAR_FUNCTION(7, "smi", "mdio", V_88F6920_PLUS)), |
| 66 | MPP_MODE(6, |
| 67 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 68 | MPP_VAR_FUNCTION(5, "dev", "cs3", V_88F6920_PLUS), |
| 69 | MPP_VAR_FUNCTION(7, "xsmi", "mdio", V_88F6920_PLUS)), |
| 70 | MPP_MODE(7, |
| 71 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 72 | MPP_VAR_FUNCTION(5, "dev", "ad9", V_88F6920_PLUS), |
| 73 | MPP_VAR_FUNCTION(7, "xsmi", "mdc", V_88F6920_PLUS)), |
| 74 | MPP_MODE(8, |
| 75 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 76 | MPP_VAR_FUNCTION(5, "dev", "ad10", V_88F6920_PLUS), |
| 77 | MPP_VAR_FUNCTION(7, "ptp", "trig", V_88F6920_PLUS)), |
| 78 | MPP_MODE(9, |
| 79 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 80 | MPP_VAR_FUNCTION(5, "dev", "ad11", V_88F6920_PLUS), |
| 81 | MPP_VAR_FUNCTION(7, "ptp", "clk", V_88F6920_PLUS)), |
| 82 | MPP_MODE(10, |
| 83 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 84 | MPP_VAR_FUNCTION(5, "dev", "ad12", V_88F6920_PLUS), |
Thomas Petazzoni | 9540cf5 | 2015-06-09 18:47:02 +0200 | [diff] [blame] | 85 | MPP_VAR_FUNCTION(7, "ptp", "evreq", V_88F6920_PLUS)), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 86 | MPP_MODE(11, |
| 87 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 88 | MPP_VAR_FUNCTION(5, "dev", "ad13", V_88F6920_PLUS), |
| 89 | MPP_VAR_FUNCTION(7, "led", "clk", V_88F6920_PLUS)), |
| 90 | MPP_MODE(12, |
| 91 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 92 | MPP_VAR_FUNCTION(2, "pcie0", "rstout", V_88F6920_PLUS), |
| 93 | MPP_VAR_FUNCTION(5, "dev", "ad14", V_88F6920_PLUS), |
| 94 | MPP_VAR_FUNCTION(7, "led", "stb", V_88F6920_PLUS)), |
| 95 | MPP_MODE(13, |
| 96 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 97 | MPP_VAR_FUNCTION(5, "dev", "ad15", V_88F6920_PLUS), |
| 98 | MPP_VAR_FUNCTION(7, "led", "data", V_88F6920_PLUS)), |
| 99 | MPP_MODE(14, |
| 100 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
Thomas Petazzoni | 100dc5d | 2015-06-09 18:47:03 +0200 | [diff] [blame] | 101 | MPP_VAR_FUNCTION(3, "dram", "vttctrl", V_88F6920_PLUS), |
Thomas Petazzoni | 7bd6a26 | 2015-06-09 18:47:06 +0200 | [diff] [blame] | 102 | MPP_VAR_FUNCTION(5, "dev", "we1", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 103 | MPP_VAR_FUNCTION(7, "ua1", "txd", V_88F6920_PLUS)), |
| 104 | MPP_MODE(15, |
| 105 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 106 | MPP_VAR_FUNCTION(3, "pcie0", "rstout", V_88F6920_PLUS), |
| 107 | MPP_VAR_FUNCTION(4, "spi0", "mosi", V_88F6920_PLUS), |
| 108 | MPP_VAR_FUNCTION(7, "i2c1", "sck", V_88F6920_PLUS)), |
| 109 | MPP_MODE(16, |
| 110 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
Thomas Petazzoni | 100dc5d | 2015-06-09 18:47:03 +0200 | [diff] [blame] | 111 | MPP_VAR_FUNCTION(3, "dram", "deccerr", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 112 | MPP_VAR_FUNCTION(4, "spi0", "miso", V_88F6920_PLUS), |
| 113 | MPP_VAR_FUNCTION(7, "i2c1", "sda", V_88F6920_PLUS)), |
| 114 | MPP_MODE(17, |
| 115 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 116 | MPP_VAR_FUNCTION(3, "ua1", "rxd", V_88F6920_PLUS), |
| 117 | MPP_VAR_FUNCTION(4, "spi0", "sck", V_88F6920_PLUS), |
| 118 | MPP_VAR_FUNCTION(7, "smi", "mdio", V_88F6920_PLUS)), |
| 119 | MPP_MODE(18, |
| 120 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 121 | MPP_VAR_FUNCTION(3, "ua1", "txd", V_88F6920_PLUS), |
| 122 | MPP_VAR_FUNCTION(4, "spi0", "cs0", V_88F6920_PLUS), |
| 123 | MPP_VAR_FUNCTION(7, "i2c2", "sck", V_88F6920_PLUS)), |
| 124 | MPP_MODE(19, |
| 125 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
Thomas Petazzoni | 52f8317 | 2015-06-09 18:47:04 +0200 | [diff] [blame] | 126 | MPP_VAR_FUNCTION(4, "sata1", "prsnt", V_88F6928), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 127 | MPP_VAR_FUNCTION(5, "ua0", "cts", V_88F6920_PLUS), |
| 128 | MPP_VAR_FUNCTION(6, "ua1", "rxd", V_88F6920_PLUS), |
| 129 | MPP_VAR_FUNCTION(7, "i2c2", "sda", V_88F6920_PLUS)), |
| 130 | MPP_MODE(20, |
| 131 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
Thomas Petazzoni | 52f8317 | 2015-06-09 18:47:04 +0200 | [diff] [blame] | 132 | MPP_VAR_FUNCTION(4, "sata0", "prsnt", V_88F6928), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 133 | MPP_VAR_FUNCTION(5, "ua0", "rts", V_88F6920_PLUS), |
| 134 | MPP_VAR_FUNCTION(6, "ua1", "txd", V_88F6920_PLUS), |
| 135 | MPP_VAR_FUNCTION(7, "smi", "mdc", V_88F6920_PLUS)), |
| 136 | MPP_MODE(21, |
| 137 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 138 | MPP_VAR_FUNCTION(1, "spi0", "cs1", V_88F6920_PLUS), |
Thomas Petazzoni | 52f8317 | 2015-06-09 18:47:04 +0200 | [diff] [blame] | 139 | MPP_VAR_FUNCTION(3, "sata0", "prsnt", V_88F6928), |
Thomas Petazzoni | ddf3f19 | 2015-06-09 18:47:05 +0200 | [diff] [blame] | 140 | MPP_VAR_FUNCTION(4, "sd0", "cmd", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 141 | MPP_VAR_FUNCTION(5, "dev", "bootcs", V_88F6920_PLUS), |
| 142 | MPP_VAR_FUNCTION(8, "ge", "rxd0", V_88F6920_PLUS)), |
| 143 | MPP_MODE(22, |
| 144 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 145 | MPP_VAR_FUNCTION(1, "spi0", "mosi", V_88F6920_PLUS), |
| 146 | MPP_VAR_FUNCTION(5, "dev", "ad0", V_88F6920_PLUS)), |
| 147 | MPP_MODE(23, |
| 148 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 149 | MPP_VAR_FUNCTION(1, "spi0", "sck", V_88F6920_PLUS), |
| 150 | MPP_VAR_FUNCTION(5, "dev", "ad2", V_88F6920_PLUS)), |
| 151 | MPP_MODE(24, |
| 152 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 153 | MPP_VAR_FUNCTION(1, "spi0", "miso", V_88F6920_PLUS), |
| 154 | MPP_VAR_FUNCTION(2, "ua0", "cts", V_88F6920_PLUS), |
| 155 | MPP_VAR_FUNCTION(3, "ua1", "rxd", V_88F6920_PLUS), |
Thomas Petazzoni | ddf3f19 | 2015-06-09 18:47:05 +0200 | [diff] [blame] | 156 | MPP_VAR_FUNCTION(4, "sd0", "d4", V_88F6920_PLUS), |
Thomas Petazzoni | 7bd6a26 | 2015-06-09 18:47:06 +0200 | [diff] [blame] | 157 | MPP_VAR_FUNCTION(5, "dev", "ready", V_88F6920_PLUS)), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 158 | MPP_MODE(25, |
| 159 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 160 | MPP_VAR_FUNCTION(1, "spi0", "cs0", V_88F6920_PLUS), |
| 161 | MPP_VAR_FUNCTION(2, "ua0", "rts", V_88F6920_PLUS), |
| 162 | MPP_VAR_FUNCTION(3, "ua1", "txd", V_88F6920_PLUS), |
Thomas Petazzoni | ddf3f19 | 2015-06-09 18:47:05 +0200 | [diff] [blame] | 163 | MPP_VAR_FUNCTION(4, "sd0", "d5", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 164 | MPP_VAR_FUNCTION(5, "dev", "cs0", V_88F6920_PLUS)), |
| 165 | MPP_MODE(26, |
| 166 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 167 | MPP_VAR_FUNCTION(1, "spi0", "cs2", V_88F6920_PLUS), |
| 168 | MPP_VAR_FUNCTION(3, "i2c1", "sck", V_88F6920_PLUS), |
Thomas Petazzoni | ddf3f19 | 2015-06-09 18:47:05 +0200 | [diff] [blame] | 169 | MPP_VAR_FUNCTION(4, "sd0", "d6", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 170 | MPP_VAR_FUNCTION(5, "dev", "cs1", V_88F6920_PLUS)), |
| 171 | MPP_MODE(27, |
| 172 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 173 | MPP_VAR_FUNCTION(1, "spi0", "cs3", V_88F6920_PLUS), |
| 174 | MPP_VAR_FUNCTION(3, "i2c1", "sda", V_88F6920_PLUS), |
Thomas Petazzoni | ddf3f19 | 2015-06-09 18:47:05 +0200 | [diff] [blame] | 175 | MPP_VAR_FUNCTION(4, "sd0", "d7", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 176 | MPP_VAR_FUNCTION(5, "dev", "cs2", V_88F6920_PLUS), |
| 177 | MPP_VAR_FUNCTION(8, "ge", "txclkout", V_88F6920_PLUS)), |
| 178 | MPP_MODE(28, |
| 179 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
Thomas Petazzoni | ddf3f19 | 2015-06-09 18:47:05 +0200 | [diff] [blame] | 180 | MPP_VAR_FUNCTION(4, "sd0", "clk", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 181 | MPP_VAR_FUNCTION(5, "dev", "ad5", V_88F6920_PLUS), |
| 182 | MPP_VAR_FUNCTION(8, "ge", "txd0", V_88F6920_PLUS)), |
| 183 | MPP_MODE(29, |
| 184 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 185 | MPP_VAR_FUNCTION(5, "dev", "ale0", V_88F6920_PLUS), |
| 186 | MPP_VAR_FUNCTION(8, "ge", "txd1", V_88F6920_PLUS)), |
| 187 | MPP_MODE(30, |
| 188 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
Thomas Petazzoni | 7bd6a26 | 2015-06-09 18:47:06 +0200 | [diff] [blame] | 189 | MPP_VAR_FUNCTION(5, "dev", "oe", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 190 | MPP_VAR_FUNCTION(8, "ge", "txd2", V_88F6920_PLUS)), |
| 191 | MPP_MODE(31, |
| 192 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 193 | MPP_VAR_FUNCTION(5, "dev", "ale1", V_88F6920_PLUS), |
| 194 | MPP_VAR_FUNCTION(8, "ge", "txd3", V_88F6920_PLUS)), |
| 195 | MPP_MODE(32, |
| 196 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
Thomas Petazzoni | 7bd6a26 | 2015-06-09 18:47:06 +0200 | [diff] [blame] | 197 | MPP_VAR_FUNCTION(5, "dev", "we0", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 198 | MPP_VAR_FUNCTION(8, "ge", "txctl", V_88F6920_PLUS)), |
| 199 | MPP_MODE(33, |
| 200 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
Thomas Petazzoni | 100dc5d | 2015-06-09 18:47:03 +0200 | [diff] [blame] | 201 | MPP_VAR_FUNCTION(1, "dram", "deccerr", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 202 | MPP_VAR_FUNCTION(5, "dev", "ad3", V_88F6920_PLUS)), |
| 203 | MPP_MODE(34, |
| 204 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 205 | MPP_VAR_FUNCTION(5, "dev", "ad1", V_88F6920_PLUS)), |
| 206 | MPP_MODE(35, |
| 207 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
Thomas Petazzoni | 691a821 | 2015-06-09 18:47:16 +0200 | [diff] [blame] | 208 | MPP_VAR_FUNCTION(1, "ref", "clk_out1", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 209 | MPP_VAR_FUNCTION(5, "dev", "a1", V_88F6920_PLUS)), |
| 210 | MPP_MODE(36, |
| 211 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 212 | MPP_VAR_FUNCTION(5, "dev", "a0", V_88F6920_PLUS)), |
| 213 | MPP_MODE(37, |
| 214 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
Thomas Petazzoni | ddf3f19 | 2015-06-09 18:47:05 +0200 | [diff] [blame] | 215 | MPP_VAR_FUNCTION(4, "sd0", "d3", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 216 | MPP_VAR_FUNCTION(5, "dev", "ad8", V_88F6920_PLUS), |
| 217 | MPP_VAR_FUNCTION(8, "ge", "rxclk", V_88F6920_PLUS)), |
| 218 | MPP_MODE(38, |
| 219 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
Thomas Petazzoni | 691a821 | 2015-06-09 18:47:16 +0200 | [diff] [blame] | 220 | MPP_VAR_FUNCTION(3, "ref", "clk_out0", V_88F6920_PLUS), |
Thomas Petazzoni | ddf3f19 | 2015-06-09 18:47:05 +0200 | [diff] [blame] | 221 | MPP_VAR_FUNCTION(4, "sd0", "d0", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 222 | MPP_VAR_FUNCTION(5, "dev", "ad4", V_88F6920_PLUS), |
| 223 | MPP_VAR_FUNCTION(8, "ge", "rxd1", V_88F6920_PLUS)), |
| 224 | MPP_MODE(39, |
| 225 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 226 | MPP_VAR_FUNCTION(1, "i2c1", "sck", V_88F6920_PLUS), |
| 227 | MPP_VAR_FUNCTION(3, "ua0", "cts", V_88F6920_PLUS), |
Thomas Petazzoni | ddf3f19 | 2015-06-09 18:47:05 +0200 | [diff] [blame] | 228 | MPP_VAR_FUNCTION(4, "sd0", "d1", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 229 | MPP_VAR_FUNCTION(5, "dev", "a2", V_88F6920_PLUS), |
| 230 | MPP_VAR_FUNCTION(8, "ge", "rxd2", V_88F6920_PLUS)), |
| 231 | MPP_MODE(40, |
| 232 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 233 | MPP_VAR_FUNCTION(1, "i2c1", "sda", V_88F6920_PLUS), |
| 234 | MPP_VAR_FUNCTION(3, "ua0", "rts", V_88F6920_PLUS), |
Thomas Petazzoni | ddf3f19 | 2015-06-09 18:47:05 +0200 | [diff] [blame] | 235 | MPP_VAR_FUNCTION(4, "sd0", "d2", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 236 | MPP_VAR_FUNCTION(5, "dev", "ad6", V_88F6920_PLUS), |
| 237 | MPP_VAR_FUNCTION(8, "ge", "rxd3", V_88F6920_PLUS)), |
| 238 | MPP_MODE(41, |
| 239 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 240 | MPP_VAR_FUNCTION(1, "ua1", "rxd", V_88F6920_PLUS), |
| 241 | MPP_VAR_FUNCTION(3, "ua0", "cts", V_88F6920_PLUS), |
| 242 | MPP_VAR_FUNCTION(4, "spi1", "cs3", V_88F6920_PLUS), |
Thomas Petazzoni | 7bd6a26 | 2015-06-09 18:47:06 +0200 | [diff] [blame] | 243 | MPP_VAR_FUNCTION(5, "dev", "burst/last", V_88F6920_PLUS), |
Thomas Petazzoni | 5cc0de1 | 2015-06-09 18:47:07 +0200 | [diff] [blame] | 244 | MPP_VAR_FUNCTION(6, "nand", "rb0", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 245 | MPP_VAR_FUNCTION(8, "ge", "rxctl", V_88F6920_PLUS)), |
| 246 | MPP_MODE(42, |
| 247 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 248 | MPP_VAR_FUNCTION(1, "ua1", "txd", V_88F6920_PLUS), |
| 249 | MPP_VAR_FUNCTION(3, "ua0", "rts", V_88F6920_PLUS), |
| 250 | MPP_VAR_FUNCTION(5, "dev", "ad7", V_88F6920_PLUS)), |
| 251 | MPP_MODE(43, |
| 252 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 253 | MPP_VAR_FUNCTION(1, "pcie0", "clkreq", V_88F6920_PLUS), |
Thomas Petazzoni | 100dc5d | 2015-06-09 18:47:03 +0200 | [diff] [blame] | 254 | MPP_VAR_FUNCTION(2, "dram", "vttctrl", V_88F6920_PLUS), |
| 255 | MPP_VAR_FUNCTION(3, "dram", "deccerr", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 256 | MPP_VAR_FUNCTION(4, "spi1", "cs2", V_88F6920_PLUS), |
| 257 | MPP_VAR_FUNCTION(5, "dev", "clkout", V_88F6920_PLUS), |
Thomas Petazzoni | 5cc0de1 | 2015-06-09 18:47:07 +0200 | [diff] [blame] | 258 | MPP_VAR_FUNCTION(6, "nand", "rb1", V_88F6920_PLUS)), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 259 | MPP_MODE(44, |
| 260 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
Thomas Petazzoni | 52f8317 | 2015-06-09 18:47:04 +0200 | [diff] [blame] | 261 | MPP_VAR_FUNCTION(1, "sata0", "prsnt", V_88F6928), |
| 262 | MPP_VAR_FUNCTION(2, "sata1", "prsnt", V_88F6928), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 263 | MPP_VAR_FUNCTION(7, "led", "clk", V_88F6920_PLUS)), |
| 264 | MPP_MODE(45, |
| 265 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
Thomas Petazzoni | 691a821 | 2015-06-09 18:47:16 +0200 | [diff] [blame] | 266 | MPP_VAR_FUNCTION(1, "ref", "clk_out0", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 267 | MPP_VAR_FUNCTION(2, "pcie0", "rstout", V_88F6920_PLUS), |
| 268 | MPP_VAR_FUNCTION(6, "ua1", "rxd", V_88F6920_PLUS)), |
| 269 | MPP_MODE(46, |
| 270 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
Thomas Petazzoni | 691a821 | 2015-06-09 18:47:16 +0200 | [diff] [blame] | 271 | MPP_VAR_FUNCTION(1, "ref", "clk_out1", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 272 | MPP_VAR_FUNCTION(2, "pcie0", "rstout", V_88F6920_PLUS), |
| 273 | MPP_VAR_FUNCTION(6, "ua1", "txd", V_88F6920_PLUS), |
| 274 | MPP_VAR_FUNCTION(7, "led", "stb", V_88F6920_PLUS)), |
| 275 | MPP_MODE(47, |
| 276 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
Thomas Petazzoni | 52f8317 | 2015-06-09 18:47:04 +0200 | [diff] [blame] | 277 | MPP_VAR_FUNCTION(1, "sata0", "prsnt", V_88F6928), |
| 278 | MPP_VAR_FUNCTION(2, "sata1", "prsnt", V_88F6928), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 279 | MPP_VAR_FUNCTION(7, "led", "data", V_88F6920_PLUS)), |
| 280 | MPP_MODE(48, |
| 281 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
Thomas Petazzoni | 52f8317 | 2015-06-09 18:47:04 +0200 | [diff] [blame] | 282 | MPP_VAR_FUNCTION(1, "sata0", "prsnt", V_88F6928), |
Thomas Petazzoni | 100dc5d | 2015-06-09 18:47:03 +0200 | [diff] [blame] | 283 | MPP_VAR_FUNCTION(2, "dram", "vttctrl", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 284 | MPP_VAR_FUNCTION(3, "tdm", "pclk", V_88F6928), |
| 285 | MPP_VAR_FUNCTION(4, "audio", "mclk", V_88F6928), |
Thomas Petazzoni | ddf3f19 | 2015-06-09 18:47:05 +0200 | [diff] [blame] | 286 | MPP_VAR_FUNCTION(5, "sd0", "d4", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 287 | MPP_VAR_FUNCTION(6, "pcie0", "clkreq", V_88F6920_PLUS), |
| 288 | MPP_VAR_FUNCTION(7, "ua1", "txd", V_88F6920_PLUS)), |
| 289 | MPP_MODE(49, |
| 290 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 291 | MPP_VAR_FUNCTION(3, "tdm", "fsync", V_88F6928), |
| 292 | MPP_VAR_FUNCTION(4, "audio", "lrclk", V_88F6928), |
Thomas Petazzoni | ddf3f19 | 2015-06-09 18:47:05 +0200 | [diff] [blame] | 293 | MPP_VAR_FUNCTION(5, "sd0", "d5", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 294 | MPP_VAR_FUNCTION(7, "ua2", "rxd", V_88F6920_PLUS)), |
| 295 | MPP_MODE(50, |
| 296 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 297 | MPP_VAR_FUNCTION(1, "pcie0", "rstout", V_88F6920_PLUS), |
| 298 | MPP_VAR_FUNCTION(3, "tdm", "drx", V_88F6928), |
| 299 | MPP_VAR_FUNCTION(4, "audio", "extclk", V_88F6928), |
Thomas Petazzoni | ddf3f19 | 2015-06-09 18:47:05 +0200 | [diff] [blame] | 300 | MPP_VAR_FUNCTION(5, "sd0", "cmd", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 301 | MPP_VAR_FUNCTION(7, "ua2", "rxd", V_88F6920_PLUS)), |
| 302 | MPP_MODE(51, |
| 303 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 304 | MPP_VAR_FUNCTION(3, "tdm", "dtx", V_88F6928), |
| 305 | MPP_VAR_FUNCTION(4, "audio", "sdo", V_88F6928), |
Thomas Petazzoni | 100dc5d | 2015-06-09 18:47:03 +0200 | [diff] [blame] | 306 | MPP_VAR_FUNCTION(5, "dram", "deccerr", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 307 | MPP_VAR_FUNCTION(7, "ua2", "txd", V_88F6920_PLUS)), |
| 308 | MPP_MODE(52, |
| 309 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 310 | MPP_VAR_FUNCTION(1, "pcie0", "rstout", V_88F6920_PLUS), |
Thomas Petazzoni | dae5597 | 2015-06-09 18:47:08 +0200 | [diff] [blame] | 311 | MPP_VAR_FUNCTION(3, "tdm", "int", V_88F6928), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 312 | MPP_VAR_FUNCTION(4, "audio", "sdi", V_88F6928), |
Thomas Petazzoni | ddf3f19 | 2015-06-09 18:47:05 +0200 | [diff] [blame] | 313 | MPP_VAR_FUNCTION(5, "sd0", "d6", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 314 | MPP_VAR_FUNCTION(7, "i2c3", "sck", V_88F6920_PLUS)), |
| 315 | MPP_MODE(53, |
| 316 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
Thomas Petazzoni | 52f8317 | 2015-06-09 18:47:04 +0200 | [diff] [blame] | 317 | MPP_VAR_FUNCTION(1, "sata1", "prsnt", V_88F6928), |
| 318 | MPP_VAR_FUNCTION(2, "sata0", "prsnt", V_88F6928), |
Thomas Petazzoni | dae5597 | 2015-06-09 18:47:08 +0200 | [diff] [blame] | 319 | MPP_VAR_FUNCTION(3, "tdm", "rst", V_88F6928), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 320 | MPP_VAR_FUNCTION(4, "audio", "bclk", V_88F6928), |
Thomas Petazzoni | ddf3f19 | 2015-06-09 18:47:05 +0200 | [diff] [blame] | 321 | MPP_VAR_FUNCTION(5, "sd0", "d7", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 322 | MPP_VAR_FUNCTION(7, "i2c3", "sda", V_88F6920_PLUS)), |
| 323 | MPP_MODE(54, |
| 324 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
Thomas Petazzoni | 52f8317 | 2015-06-09 18:47:04 +0200 | [diff] [blame] | 325 | MPP_VAR_FUNCTION(1, "sata0", "prsnt", V_88F6928), |
| 326 | MPP_VAR_FUNCTION(2, "sata1", "prsnt", V_88F6928), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 327 | MPP_VAR_FUNCTION(3, "pcie0", "rstout", V_88F6920_PLUS), |
Thomas Petazzoni | ddf3f19 | 2015-06-09 18:47:05 +0200 | [diff] [blame] | 328 | MPP_VAR_FUNCTION(5, "sd0", "d3", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 329 | MPP_VAR_FUNCTION(7, "ua3", "txd", V_88F6920_PLUS)), |
| 330 | MPP_MODE(55, |
| 331 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 332 | MPP_VAR_FUNCTION(1, "ua1", "cts", V_88F6920_PLUS), |
| 333 | MPP_VAR_FUNCTION(4, "spi1", "cs1", V_88F6920_PLUS), |
Thomas Petazzoni | ddf3f19 | 2015-06-09 18:47:05 +0200 | [diff] [blame] | 334 | MPP_VAR_FUNCTION(5, "sd0", "d0", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 335 | MPP_VAR_FUNCTION(6, "ua1", "rxd", V_88F6920_PLUS), |
| 336 | MPP_VAR_FUNCTION(7, "ua3", "rxd", V_88F6920_PLUS)), |
| 337 | MPP_MODE(56, |
| 338 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 339 | MPP_VAR_FUNCTION(1, "ua1", "rts", V_88F6920_PLUS), |
Thomas Petazzoni | 100dc5d | 2015-06-09 18:47:03 +0200 | [diff] [blame] | 340 | MPP_VAR_FUNCTION(3, "dram", "deccerr", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 341 | MPP_VAR_FUNCTION(4, "spi1", "mosi", V_88F6920_PLUS), |
| 342 | MPP_VAR_FUNCTION(6, "ua1", "txd", V_88F6920_PLUS)), |
| 343 | MPP_MODE(57, |
| 344 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 345 | MPP_VAR_FUNCTION(4, "spi1", "sck", V_88F6920_PLUS), |
Thomas Petazzoni | ddf3f19 | 2015-06-09 18:47:05 +0200 | [diff] [blame] | 346 | MPP_VAR_FUNCTION(5, "sd0", "clk", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 347 | MPP_VAR_FUNCTION(6, "ua1", "txd", V_88F6920_PLUS)), |
| 348 | MPP_MODE(58, |
| 349 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 350 | MPP_VAR_FUNCTION(2, "i2c1", "sck", V_88F6920_PLUS), |
| 351 | MPP_VAR_FUNCTION(3, "pcie2", "clkreq", V_88F6920_PLUS), |
| 352 | MPP_VAR_FUNCTION(4, "spi1", "miso", V_88F6920_PLUS), |
Thomas Petazzoni | ddf3f19 | 2015-06-09 18:47:05 +0200 | [diff] [blame] | 353 | MPP_VAR_FUNCTION(5, "sd0", "d1", V_88F6920_PLUS), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 354 | MPP_VAR_FUNCTION(6, "ua1", "rxd", V_88F6920_PLUS)), |
| 355 | MPP_MODE(59, |
| 356 | MPP_VAR_FUNCTION(0, "gpio", NULL, V_88F6920_PLUS), |
| 357 | MPP_VAR_FUNCTION(1, "pcie0", "rstout", V_88F6920_PLUS), |
| 358 | MPP_VAR_FUNCTION(2, "i2c1", "sda", V_88F6920_PLUS), |
| 359 | MPP_VAR_FUNCTION(4, "spi1", "cs0", V_88F6920_PLUS), |
Thomas Petazzoni | ddf3f19 | 2015-06-09 18:47:05 +0200 | [diff] [blame] | 360 | MPP_VAR_FUNCTION(5, "sd0", "d2", V_88F6920_PLUS)), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 361 | }; |
| 362 | |
| 363 | static struct mvebu_pinctrl_soc_info armada_39x_pinctrl_info; |
| 364 | |
Fabian Frederick | baa9946e | 2015-03-16 20:59:09 +0100 | [diff] [blame] | 365 | static const struct of_device_id armada_39x_pinctrl_of_match[] = { |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 366 | { |
| 367 | .compatible = "marvell,mv88f6920-pinctrl", |
| 368 | .data = (void *) V_88F6920, |
| 369 | }, |
| 370 | { |
| 371 | .compatible = "marvell,mv88f6928-pinctrl", |
| 372 | .data = (void *) V_88F6928, |
| 373 | }, |
| 374 | { }, |
| 375 | }; |
| 376 | |
| 377 | static struct mvebu_mpp_ctrl armada_39x_mpp_controls[] = { |
| 378 | MPP_FUNC_CTRL(0, 59, NULL, armada_39x_mpp_ctrl), |
| 379 | }; |
| 380 | |
| 381 | static struct pinctrl_gpio_range armada_39x_mpp_gpio_ranges[] = { |
| 382 | MPP_GPIO_RANGE(0, 0, 0, 32), |
Thomas Petazzoni | 7c58031 | 2015-06-09 18:47:01 +0200 | [diff] [blame] | 383 | MPP_GPIO_RANGE(1, 32, 32, 28), |
Thomas Petazzoni | ee08657 | 2015-02-06 16:57:53 +0100 | [diff] [blame] | 384 | }; |
| 385 | |
| 386 | static int armada_39x_pinctrl_probe(struct platform_device *pdev) |
| 387 | { |
| 388 | struct mvebu_pinctrl_soc_info *soc = &armada_39x_pinctrl_info; |
| 389 | const struct of_device_id *match = |
| 390 | of_match_device(armada_39x_pinctrl_of_match, &pdev->dev); |
| 391 | struct resource *res; |
| 392 | |
| 393 | if (!match) |
| 394 | return -ENODEV; |
| 395 | |
| 396 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 397 | mpp_base = devm_ioremap_resource(&pdev->dev, res); |
| 398 | if (IS_ERR(mpp_base)) |
| 399 | return PTR_ERR(mpp_base); |
| 400 | |
| 401 | soc->variant = (unsigned) match->data & 0xff; |
| 402 | soc->controls = armada_39x_mpp_controls; |
| 403 | soc->ncontrols = ARRAY_SIZE(armada_39x_mpp_controls); |
| 404 | soc->gpioranges = armada_39x_mpp_gpio_ranges; |
| 405 | soc->ngpioranges = ARRAY_SIZE(armada_39x_mpp_gpio_ranges); |
| 406 | soc->modes = armada_39x_mpp_modes; |
| 407 | soc->nmodes = armada_39x_mpp_controls[0].npins; |
| 408 | |
| 409 | pdev->dev.platform_data = soc; |
| 410 | |
| 411 | return mvebu_pinctrl_probe(pdev); |
| 412 | } |
| 413 | |
| 414 | static int armada_39x_pinctrl_remove(struct platform_device *pdev) |
| 415 | { |
| 416 | return mvebu_pinctrl_remove(pdev); |
| 417 | } |
| 418 | |
| 419 | static struct platform_driver armada_39x_pinctrl_driver = { |
| 420 | .driver = { |
| 421 | .name = "armada-39x-pinctrl", |
| 422 | .of_match_table = of_match_ptr(armada_39x_pinctrl_of_match), |
| 423 | }, |
| 424 | .probe = armada_39x_pinctrl_probe, |
| 425 | .remove = armada_39x_pinctrl_remove, |
| 426 | }; |
| 427 | |
| 428 | module_platform_driver(armada_39x_pinctrl_driver); |
| 429 | |
| 430 | MODULE_AUTHOR("Thomas Petazzoni <thomas.petazzoni@free-electrons.com>"); |
| 431 | MODULE_DESCRIPTION("Marvell Armada 39x pinctrl driver"); |
| 432 | MODULE_LICENSE("GPL v2"); |