blob: e2bab0f75fc509955b2a35379911cb3e0cbf8b42 [file] [log] [blame]
Maxime Ripard0e37f882013-01-18 22:30:34 +01001/*
2 * Allwinner A1X SoCs pinctrl driver.
3 *
4 * Copyright (C) 2012 Maxime Ripard
5 *
6 * Maxime Ripard <maxime.ripard@free-electrons.com>
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#include <linux/io.h>
Emilio López950707c2013-03-22 11:20:40 -030014#include <linux/clk.h>
Maxime Ripard08e9e612013-01-28 21:33:12 +010015#include <linux/gpio.h>
Maxime Ripard60242db2013-06-08 12:05:44 +020016#include <linux/irqdomain.h>
Maxime Ripard0e37f882013-01-18 22:30:34 +010017#include <linux/module.h>
18#include <linux/of.h>
19#include <linux/of_address.h>
20#include <linux/of_device.h>
Maxime Ripard60242db2013-06-08 12:05:44 +020021#include <linux/of_irq.h>
Maxime Ripard0e37f882013-01-18 22:30:34 +010022#include <linux/pinctrl/consumer.h>
23#include <linux/pinctrl/machine.h>
24#include <linux/pinctrl/pinctrl.h>
25#include <linux/pinctrl/pinconf-generic.h>
26#include <linux/pinctrl/pinmux.h>
27#include <linux/platform_device.h>
28#include <linux/slab.h>
29
30#include "core.h"
31#include "pinctrl-sunxi.h"
32
Maxime Ripard9f5b6b32013-01-26 15:36:53 +010033static const struct sunxi_desc_pin sun4i_a10_pins[] = {
34 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA0,
35 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +010036 SUNXI_FUNCTION(0x1, "gpio_out"),
Maxime Ripardcb51f8e2013-03-27 14:12:33 +010037 SUNXI_FUNCTION(0x2, "emac"), /* ERXD3 */
Maxime Ripardb5f50bf2013-03-06 16:12:44 +010038 SUNXI_FUNCTION(0x3, "spi1"), /* CS0 */
39 SUNXI_FUNCTION(0x4, "uart2")), /* RTS */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +010040 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA1,
41 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +010042 SUNXI_FUNCTION(0x1, "gpio_out"),
Maxime Ripardcb51f8e2013-03-27 14:12:33 +010043 SUNXI_FUNCTION(0x2, "emac"), /* ERXD2 */
Maxime Ripardb5f50bf2013-03-06 16:12:44 +010044 SUNXI_FUNCTION(0x3, "spi1"), /* CLK */
45 SUNXI_FUNCTION(0x4, "uart2")), /* CTS */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +010046 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA2,
47 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +010048 SUNXI_FUNCTION(0x1, "gpio_out"),
Maxime Ripardcb51f8e2013-03-27 14:12:33 +010049 SUNXI_FUNCTION(0x2, "emac"), /* ERXD1 */
Maxime Ripardb5f50bf2013-03-06 16:12:44 +010050 SUNXI_FUNCTION(0x3, "spi1"), /* MOSI */
51 SUNXI_FUNCTION(0x4, "uart2")), /* TX */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +010052 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA3,
53 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +010054 SUNXI_FUNCTION(0x1, "gpio_out"),
Maxime Ripardcb51f8e2013-03-27 14:12:33 +010055 SUNXI_FUNCTION(0x2, "emac"), /* ERXD0 */
Maxime Ripardb5f50bf2013-03-06 16:12:44 +010056 SUNXI_FUNCTION(0x3, "spi1"), /* MISO */
57 SUNXI_FUNCTION(0x4, "uart2")), /* RX */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +010058 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA4,
59 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +010060 SUNXI_FUNCTION(0x1, "gpio_out"),
Maxime Ripardcb51f8e2013-03-27 14:12:33 +010061 SUNXI_FUNCTION(0x2, "emac"), /* ETXD3 */
Maxime Ripardb5f50bf2013-03-06 16:12:44 +010062 SUNXI_FUNCTION(0x3, "spi1")), /* CS1 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +010063 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA5,
64 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +010065 SUNXI_FUNCTION(0x1, "gpio_out"),
Maxime Ripardcb51f8e2013-03-27 14:12:33 +010066 SUNXI_FUNCTION(0x2, "emac"), /* ETXD2 */
Maxime Ripardb5f50bf2013-03-06 16:12:44 +010067 SUNXI_FUNCTION(0x3, "spi3")), /* CS0 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +010068 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA6,
69 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +010070 SUNXI_FUNCTION(0x1, "gpio_out"),
Maxime Ripardcb51f8e2013-03-27 14:12:33 +010071 SUNXI_FUNCTION(0x2, "emac"), /* ETXD1 */
Maxime Ripardb5f50bf2013-03-06 16:12:44 +010072 SUNXI_FUNCTION(0x3, "spi3")), /* CLK */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +010073 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA7,
74 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +010075 SUNXI_FUNCTION(0x1, "gpio_out"),
Maxime Ripardcb51f8e2013-03-27 14:12:33 +010076 SUNXI_FUNCTION(0x2, "emac"), /* ETXD0 */
Maxime Ripardb5f50bf2013-03-06 16:12:44 +010077 SUNXI_FUNCTION(0x3, "spi3")), /* MOSI */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +010078 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA8,
79 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +010080 SUNXI_FUNCTION(0x1, "gpio_out"),
Maxime Ripardcb51f8e2013-03-27 14:12:33 +010081 SUNXI_FUNCTION(0x2, "emac"), /* ERXCK */
Maxime Ripardb5f50bf2013-03-06 16:12:44 +010082 SUNXI_FUNCTION(0x3, "spi3")), /* MISO */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +010083 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA9,
84 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +010085 SUNXI_FUNCTION(0x1, "gpio_out"),
Maxime Ripardcb51f8e2013-03-27 14:12:33 +010086 SUNXI_FUNCTION(0x2, "emac"), /* ERXERR */
Maxime Ripardb5f50bf2013-03-06 16:12:44 +010087 SUNXI_FUNCTION(0x3, "spi3")), /* CS1 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +010088 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA10,
89 SUNXI_FUNCTION(0x0, "gpio_in"),
90 SUNXI_FUNCTION(0x1, "gpio_out"),
Maxime Ripardcb51f8e2013-03-27 14:12:33 +010091 SUNXI_FUNCTION(0x2, "emac"), /* ERXDV */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +010092 SUNXI_FUNCTION(0x4, "uart1")), /* TX */
93 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA11,
94 SUNXI_FUNCTION(0x0, "gpio_in"),
95 SUNXI_FUNCTION(0x1, "gpio_out"),
Maxime Ripardcb51f8e2013-03-27 14:12:33 +010096 SUNXI_FUNCTION(0x2, "emac"), /* EMDC */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +010097 SUNXI_FUNCTION(0x4, "uart1")), /* RX */
98 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA12,
99 SUNXI_FUNCTION(0x0, "gpio_in"),
100 SUNXI_FUNCTION(0x1, "gpio_out"),
Maxime Ripardcb51f8e2013-03-27 14:12:33 +0100101 SUNXI_FUNCTION(0x2, "emac"), /* EMDIO */
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100102 SUNXI_FUNCTION(0x3, "uart6"), /* TX */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100103 SUNXI_FUNCTION(0x4, "uart1")), /* RTS */
104 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA13,
105 SUNXI_FUNCTION(0x0, "gpio_in"),
106 SUNXI_FUNCTION(0x1, "gpio_out"),
Maxime Ripardcb51f8e2013-03-27 14:12:33 +0100107 SUNXI_FUNCTION(0x2, "emac"), /* ETXEN */
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100108 SUNXI_FUNCTION(0x3, "uart6"), /* RX */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100109 SUNXI_FUNCTION(0x4, "uart1")), /* CTS */
110 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA14,
111 SUNXI_FUNCTION(0x0, "gpio_in"),
112 SUNXI_FUNCTION(0x1, "gpio_out"),
Maxime Ripardcb51f8e2013-03-27 14:12:33 +0100113 SUNXI_FUNCTION(0x2, "emac"), /* ETXCK */
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100114 SUNXI_FUNCTION(0x3, "uart7"), /* TX */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100115 SUNXI_FUNCTION(0x4, "uart1")), /* DTR */
116 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA15,
117 SUNXI_FUNCTION(0x0, "gpio_in"),
118 SUNXI_FUNCTION(0x1, "gpio_out"),
Maxime Ripardcb51f8e2013-03-27 14:12:33 +0100119 SUNXI_FUNCTION(0x2, "emac"), /* ECRS */
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100120 SUNXI_FUNCTION(0x3, "uart7"), /* RX */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100121 SUNXI_FUNCTION(0x4, "uart1")), /* DSR */
122 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA16,
123 SUNXI_FUNCTION(0x0, "gpio_in"),
124 SUNXI_FUNCTION(0x1, "gpio_out"),
Maxime Ripardcb51f8e2013-03-27 14:12:33 +0100125 SUNXI_FUNCTION(0x2, "emac"), /* ECOL */
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100126 SUNXI_FUNCTION(0x3, "can"), /* TX */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100127 SUNXI_FUNCTION(0x4, "uart1")), /* DCD */
128 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA17,
129 SUNXI_FUNCTION(0x0, "gpio_in"),
130 SUNXI_FUNCTION(0x1, "gpio_out"),
Maxime Ripardcb51f8e2013-03-27 14:12:33 +0100131 SUNXI_FUNCTION(0x2, "emac"), /* ETXERR */
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100132 SUNXI_FUNCTION(0x3, "can"), /* RX */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100133 SUNXI_FUNCTION(0x4, "uart1")), /* RING */
134 /* Hole */
135 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB0,
136 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100137 SUNXI_FUNCTION(0x1, "gpio_out"),
138 SUNXI_FUNCTION(0x2, "i2c0")), /* SCK */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100139 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB1,
140 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100141 SUNXI_FUNCTION(0x1, "gpio_out"),
142 SUNXI_FUNCTION(0x2, "i2c0")), /* SDA */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100143 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB2,
144 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100145 SUNXI_FUNCTION(0x1, "gpio_out"),
146 SUNXI_FUNCTION(0x2, "pwm")), /* PWM0 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100147 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB3,
148 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100149 SUNXI_FUNCTION(0x1, "gpio_out"),
150 SUNXI_FUNCTION(0x2, "ir0")), /* TX */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100151 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB4,
152 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100153 SUNXI_FUNCTION(0x1, "gpio_out"),
154 SUNXI_FUNCTION(0x2, "ir0")), /* RX */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100155 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB5,
156 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100157 SUNXI_FUNCTION(0x1, "gpio_out"),
158 SUNXI_FUNCTION(0x2, "i2s"), /* MCLK */
159 SUNXI_FUNCTION(0x3, "ac97")), /* MCLK */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100160 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB6,
161 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100162 SUNXI_FUNCTION(0x1, "gpio_out"),
163 SUNXI_FUNCTION(0x2, "i2s"), /* BCLK */
164 SUNXI_FUNCTION(0x3, "ac97")), /* BCLK */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100165 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB7,
166 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100167 SUNXI_FUNCTION(0x1, "gpio_out"),
168 SUNXI_FUNCTION(0x2, "i2s"), /* LRCK */
169 SUNXI_FUNCTION(0x3, "ac97")), /* SYNC */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100170 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB8,
171 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100172 SUNXI_FUNCTION(0x1, "gpio_out"),
173 SUNXI_FUNCTION(0x2, "i2s"), /* DO0 */
174 SUNXI_FUNCTION(0x3, "ac97")), /* DO */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100175 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB9,
176 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100177 SUNXI_FUNCTION(0x1, "gpio_out"),
178 SUNXI_FUNCTION(0x2, "i2s")), /* DO1 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100179 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB10,
180 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100181 SUNXI_FUNCTION(0x1, "gpio_out"),
182 SUNXI_FUNCTION(0x2, "i2s")), /* DO2 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100183 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB11,
184 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100185 SUNXI_FUNCTION(0x1, "gpio_out"),
186 SUNXI_FUNCTION(0x2, "i2s")), /* DO3 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100187 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB12,
188 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100189 SUNXI_FUNCTION(0x1, "gpio_out"),
190 SUNXI_FUNCTION(0x2, "i2s"), /* DI */
191 SUNXI_FUNCTION(0x3, "ac97")), /* DI */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100192 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB13,
193 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100194 SUNXI_FUNCTION(0x1, "gpio_out"),
195 SUNXI_FUNCTION(0x2, "spi2")), /* CS1 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100196 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB14,
197 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100198 SUNXI_FUNCTION(0x1, "gpio_out"),
199 SUNXI_FUNCTION(0x2, "spi2"), /* CS0 */
200 SUNXI_FUNCTION(0x3, "jtag")), /* MS0 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100201 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB15,
202 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100203 SUNXI_FUNCTION(0x1, "gpio_out"),
204 SUNXI_FUNCTION(0x2, "spi2"), /* CLK */
205 SUNXI_FUNCTION(0x3, "jtag")), /* CK0 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100206 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB16,
207 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100208 SUNXI_FUNCTION(0x1, "gpio_out"),
209 SUNXI_FUNCTION(0x2, "spi2"), /* MOSI */
210 SUNXI_FUNCTION(0x3, "jtag")), /* DO0 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100211 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB17,
212 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100213 SUNXI_FUNCTION(0x1, "gpio_out"),
214 SUNXI_FUNCTION(0x2, "spi2"), /* MISO */
215 SUNXI_FUNCTION(0x3, "jtag")), /* DI0 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100216 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB18,
217 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100218 SUNXI_FUNCTION(0x1, "gpio_out"),
219 SUNXI_FUNCTION(0x2, "i2c1")), /* SCK */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100220 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB19,
221 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100222 SUNXI_FUNCTION(0x1, "gpio_out"),
223 SUNXI_FUNCTION(0x2, "i2c1")), /* SDA */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100224 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB20,
225 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100226 SUNXI_FUNCTION(0x1, "gpio_out"),
227 SUNXI_FUNCTION(0x2, "i2c2")), /* SCK */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100228 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB21,
229 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100230 SUNXI_FUNCTION(0x1, "gpio_out"),
231 SUNXI_FUNCTION(0x2, "i2c2")), /* SDA */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100232 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB22,
233 SUNXI_FUNCTION(0x0, "gpio_in"),
234 SUNXI_FUNCTION(0x1, "gpio_out"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100235 SUNXI_FUNCTION(0x2, "uart0"), /* TX */
236 SUNXI_FUNCTION(0x3, "ir1")), /* TX */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100237 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB23,
238 SUNXI_FUNCTION(0x0, "gpio_in"),
239 SUNXI_FUNCTION(0x1, "gpio_out"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100240 SUNXI_FUNCTION(0x2, "uart0"), /* RX */
241 SUNXI_FUNCTION(0x3, "ir1")), /* RX */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100242 /* Hole */
243 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC0,
244 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100245 SUNXI_FUNCTION(0x1, "gpio_out"),
246 SUNXI_FUNCTION(0x2, "nand0"), /* NWE */
247 SUNXI_FUNCTION(0x3, "spi0")), /* MOSI */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100248 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC1,
249 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100250 SUNXI_FUNCTION(0x1, "gpio_out"),
251 SUNXI_FUNCTION(0x2, "nand0"), /* NALE */
252 SUNXI_FUNCTION(0x3, "spi0")), /* MISO */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100253 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC2,
254 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100255 SUNXI_FUNCTION(0x1, "gpio_out"),
256 SUNXI_FUNCTION(0x2, "nand0"), /* NCLE */
257 SUNXI_FUNCTION(0x3, "spi0")), /* SCK */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100258 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC3,
259 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100260 SUNXI_FUNCTION(0x1, "gpio_out"),
261 SUNXI_FUNCTION(0x2, "nand0")), /* NCE1 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100262 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC4,
263 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100264 SUNXI_FUNCTION(0x1, "gpio_out"),
265 SUNXI_FUNCTION(0x2, "nand0")), /* NCE0 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100266 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC5,
267 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100268 SUNXI_FUNCTION(0x1, "gpio_out"),
269 SUNXI_FUNCTION(0x2, "nand0")), /* NRE# */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100270 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC6,
271 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100272 SUNXI_FUNCTION(0x1, "gpio_out"),
273 SUNXI_FUNCTION(0x2, "nand0"), /* NRB0 */
274 SUNXI_FUNCTION(0x3, "mmc2")), /* CMD */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100275 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC7,
276 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100277 SUNXI_FUNCTION(0x1, "gpio_out"),
278 SUNXI_FUNCTION(0x2, "nand0"), /* NRB1 */
279 SUNXI_FUNCTION(0x3, "mmc2")), /* CLK */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100280 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC8,
281 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100282 SUNXI_FUNCTION(0x1, "gpio_out"),
283 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ0 */
284 SUNXI_FUNCTION(0x3, "mmc2")), /* D0 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100285 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC9,
286 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100287 SUNXI_FUNCTION(0x1, "gpio_out"),
288 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ1 */
289 SUNXI_FUNCTION(0x3, "mmc2")), /* D1 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100290 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC10,
291 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100292 SUNXI_FUNCTION(0x1, "gpio_out"),
293 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ2 */
294 SUNXI_FUNCTION(0x3, "mmc2")), /* D2 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100295 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC11,
296 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100297 SUNXI_FUNCTION(0x1, "gpio_out"),
298 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ3 */
299 SUNXI_FUNCTION(0x3, "mmc2")), /* D3 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100300 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC12,
301 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100302 SUNXI_FUNCTION(0x1, "gpio_out"),
303 SUNXI_FUNCTION(0x2, "nand0")), /* NDQ4 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100304 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC13,
305 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100306 SUNXI_FUNCTION(0x1, "gpio_out"),
307 SUNXI_FUNCTION(0x2, "nand0")), /* NDQ5 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100308 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC14,
309 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100310 SUNXI_FUNCTION(0x1, "gpio_out"),
311 SUNXI_FUNCTION(0x2, "nand0")), /* NDQ6 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100312 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC15,
313 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100314 SUNXI_FUNCTION(0x1, "gpio_out"),
315 SUNXI_FUNCTION(0x2, "nand0")), /* NDQ7 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100316 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC16,
317 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100318 SUNXI_FUNCTION(0x1, "gpio_out"),
319 SUNXI_FUNCTION(0x2, "nand0")), /* NWP */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100320 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC17,
321 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100322 SUNXI_FUNCTION(0x1, "gpio_out"),
323 SUNXI_FUNCTION(0x2, "nand0")), /* NCE2 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100324 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC18,
325 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100326 SUNXI_FUNCTION(0x1, "gpio_out"),
327 SUNXI_FUNCTION(0x2, "nand0")), /* NCE3 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100328 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC19,
329 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100330 SUNXI_FUNCTION(0x1, "gpio_out"),
331 SUNXI_FUNCTION(0x2, "nand0"), /* NCE4 */
332 SUNXI_FUNCTION(0x3, "spi2")), /* CS0 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100333 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC20,
334 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100335 SUNXI_FUNCTION(0x1, "gpio_out"),
336 SUNXI_FUNCTION(0x2, "nand0"), /* NCE5 */
337 SUNXI_FUNCTION(0x3, "spi2")), /* CLK */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100338 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC21,
339 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100340 SUNXI_FUNCTION(0x1, "gpio_out"),
341 SUNXI_FUNCTION(0x2, "nand0"), /* NCE6 */
342 SUNXI_FUNCTION(0x3, "spi2")), /* MOSI */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100343 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC22,
344 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100345 SUNXI_FUNCTION(0x1, "gpio_out"),
346 SUNXI_FUNCTION(0x2, "nand0"), /* NCE7 */
347 SUNXI_FUNCTION(0x3, "spi2")), /* MISO */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100348 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC23,
349 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100350 SUNXI_FUNCTION(0x1, "gpio_out"),
351 SUNXI_FUNCTION(0x3, "spi0")), /* CS0 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100352 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC24,
353 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100354 SUNXI_FUNCTION(0x1, "gpio_out"),
355 SUNXI_FUNCTION(0x2, "nand0")), /* NDQS */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100356 /* Hole */
357 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD0,
358 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100359 SUNXI_FUNCTION(0x1, "gpio_out"),
360 SUNXI_FUNCTION(0x2, "lcd0"), /* D0 */
361 SUNXI_FUNCTION(0x3, "lvds0")), /* VP0 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100362 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD1,
363 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100364 SUNXI_FUNCTION(0x1, "gpio_out"),
365 SUNXI_FUNCTION(0x2, "lcd0"), /* D1 */
366 SUNXI_FUNCTION(0x3, "lvds0")), /* VN0 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100367 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD2,
368 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100369 SUNXI_FUNCTION(0x1, "gpio_out"),
370 SUNXI_FUNCTION(0x2, "lcd0"), /* D2 */
371 SUNXI_FUNCTION(0x3, "lvds0")), /* VP1 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100372 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD3,
373 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100374 SUNXI_FUNCTION(0x1, "gpio_out"),
375 SUNXI_FUNCTION(0x2, "lcd0"), /* D3 */
376 SUNXI_FUNCTION(0x3, "lvds0")), /* VN1 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100377 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD4,
378 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100379 SUNXI_FUNCTION(0x1, "gpio_out"),
380 SUNXI_FUNCTION(0x2, "lcd0"), /* D4 */
381 SUNXI_FUNCTION(0x3, "lvds0")), /* VP2 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100382 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD5,
383 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100384 SUNXI_FUNCTION(0x1, "gpio_out"),
385 SUNXI_FUNCTION(0x2, "lcd0"), /* D5 */
386 SUNXI_FUNCTION(0x3, "lvds0")), /* VN2 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100387 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD6,
388 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100389 SUNXI_FUNCTION(0x1, "gpio_out"),
390 SUNXI_FUNCTION(0x2, "lcd0"), /* D6 */
391 SUNXI_FUNCTION(0x3, "lvds0")), /* VPC */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100392 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD7,
393 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100394 SUNXI_FUNCTION(0x1, "gpio_out"),
395 SUNXI_FUNCTION(0x2, "lcd0"), /* D7 */
396 SUNXI_FUNCTION(0x3, "lvds0")), /* VNC */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100397 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD8,
398 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100399 SUNXI_FUNCTION(0x1, "gpio_out"),
400 SUNXI_FUNCTION(0x2, "lcd0"), /* D8 */
401 SUNXI_FUNCTION(0x3, "lvds0")), /* VP3 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100402 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD9,
403 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100404 SUNXI_FUNCTION(0x1, "gpio_out"),
405 SUNXI_FUNCTION(0x2, "lcd0"), /* D9 */
406 SUNXI_FUNCTION(0x3, "lvds0")), /* VM3 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100407 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD10,
408 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100409 SUNXI_FUNCTION(0x1, "gpio_out"),
410 SUNXI_FUNCTION(0x2, "lcd0"), /* D10 */
411 SUNXI_FUNCTION(0x3, "lvds1")), /* VP0 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100412 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD11,
413 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100414 SUNXI_FUNCTION(0x1, "gpio_out"),
415 SUNXI_FUNCTION(0x2, "lcd0"), /* D11 */
416 SUNXI_FUNCTION(0x3, "lvds1")), /* VN0 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100417 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD12,
418 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100419 SUNXI_FUNCTION(0x1, "gpio_out"),
420 SUNXI_FUNCTION(0x2, "lcd0"), /* D12 */
421 SUNXI_FUNCTION(0x3, "lvds1")), /* VP1 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100422 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD13,
423 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100424 SUNXI_FUNCTION(0x1, "gpio_out"),
425 SUNXI_FUNCTION(0x2, "lcd0"), /* D13 */
426 SUNXI_FUNCTION(0x3, "lvds1")), /* VN1 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100427 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD14,
428 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100429 SUNXI_FUNCTION(0x1, "gpio_out"),
430 SUNXI_FUNCTION(0x2, "lcd0"), /* D14 */
431 SUNXI_FUNCTION(0x3, "lvds1")), /* VP2 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100432 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD15,
433 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100434 SUNXI_FUNCTION(0x1, "gpio_out"),
435 SUNXI_FUNCTION(0x2, "lcd0"), /* D15 */
436 SUNXI_FUNCTION(0x3, "lvds1")), /* VN2 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100437 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD16,
438 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100439 SUNXI_FUNCTION(0x1, "gpio_out"),
440 SUNXI_FUNCTION(0x2, "lcd0"), /* D16 */
441 SUNXI_FUNCTION(0x3, "lvds1")), /* VPC */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100442 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD17,
443 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100444 SUNXI_FUNCTION(0x1, "gpio_out"),
445 SUNXI_FUNCTION(0x2, "lcd0"), /* D17 */
446 SUNXI_FUNCTION(0x3, "lvds1")), /* VNC */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100447 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD18,
448 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100449 SUNXI_FUNCTION(0x1, "gpio_out"),
450 SUNXI_FUNCTION(0x2, "lcd0"), /* D18 */
451 SUNXI_FUNCTION(0x3, "lvds1")), /* VP3 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100452 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD19,
453 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100454 SUNXI_FUNCTION(0x1, "gpio_out"),
455 SUNXI_FUNCTION(0x2, "lcd0"), /* D19 */
456 SUNXI_FUNCTION(0x3, "lvds1")), /* VN3 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100457 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD20,
458 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100459 SUNXI_FUNCTION(0x1, "gpio_out"),
460 SUNXI_FUNCTION(0x2, "lcd0"), /* D20 */
461 SUNXI_FUNCTION(0x3, "csi1")), /* MCLK */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100462 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD21,
463 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100464 SUNXI_FUNCTION(0x1, "gpio_out"),
465 SUNXI_FUNCTION(0x2, "lcd0"), /* D21 */
466 SUNXI_FUNCTION(0x3, "sim")), /* VPPEN */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100467 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD22,
468 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100469 SUNXI_FUNCTION(0x1, "gpio_out"),
470 SUNXI_FUNCTION(0x2, "lcd0"), /* D22 */
471 SUNXI_FUNCTION(0x3, "sim")), /* VPPPP */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100472 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD23,
473 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100474 SUNXI_FUNCTION(0x1, "gpio_out"),
475 SUNXI_FUNCTION(0x2, "lcd0"), /* D23 */
476 SUNXI_FUNCTION(0x3, "sim")), /* DET */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100477 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD24,
478 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100479 SUNXI_FUNCTION(0x1, "gpio_out"),
480 SUNXI_FUNCTION(0x2, "lcd0"), /* CLK */
481 SUNXI_FUNCTION(0x3, "sim")), /* VCCEN */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100482 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD25,
483 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100484 SUNXI_FUNCTION(0x1, "gpio_out"),
485 SUNXI_FUNCTION(0x2, "lcd0"), /* DE */
486 SUNXI_FUNCTION(0x3, "sim")), /* RST */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100487 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD26,
488 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100489 SUNXI_FUNCTION(0x1, "gpio_out"),
490 SUNXI_FUNCTION(0x2, "lcd0"), /* HSYNC */
491 SUNXI_FUNCTION(0x3, "sim")), /* SCK */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100492 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD27,
493 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100494 SUNXI_FUNCTION(0x1, "gpio_out"),
495 SUNXI_FUNCTION(0x2, "lcd0"), /* VSYNC */
496 SUNXI_FUNCTION(0x3, "sim")), /* SDA */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100497 /* Hole */
498 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE0,
499 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100500 SUNXI_FUNCTION(0x1, "gpio_out"),
501 SUNXI_FUNCTION(0x2, "ts0"), /* CLK */
502 SUNXI_FUNCTION(0x3, "csi0")), /* PCK */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100503 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE1,
504 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100505 SUNXI_FUNCTION(0x1, "gpio_out"),
506 SUNXI_FUNCTION(0x2, "ts0"), /* ERR */
507 SUNXI_FUNCTION(0x3, "csi0")), /* CK */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100508 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE2,
509 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100510 SUNXI_FUNCTION(0x1, "gpio_out"),
511 SUNXI_FUNCTION(0x2, "ts0"), /* SYNC */
512 SUNXI_FUNCTION(0x3, "csi0")), /* HSYNC */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100513 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE3,
514 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100515 SUNXI_FUNCTION(0x1, "gpio_out"),
516 SUNXI_FUNCTION(0x2, "ts0"), /* DVLD */
517 SUNXI_FUNCTION(0x3, "csi0")), /* VSYNC */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100518 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE4,
519 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100520 SUNXI_FUNCTION(0x1, "gpio_out"),
521 SUNXI_FUNCTION(0x2, "ts0"), /* D0 */
522 SUNXI_FUNCTION(0x3, "csi0")), /* D0 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100523 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE5,
524 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100525 SUNXI_FUNCTION(0x1, "gpio_out"),
526 SUNXI_FUNCTION(0x2, "ts0"), /* D1 */
527 SUNXI_FUNCTION(0x3, "csi0"), /* D1 */
528 SUNXI_FUNCTION(0x4, "sim")), /* VPPEN */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100529 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE6,
530 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100531 SUNXI_FUNCTION(0x1, "gpio_out"),
532 SUNXI_FUNCTION(0x2, "ts0"), /* D2 */
533 SUNXI_FUNCTION(0x3, "csi0")), /* D2 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100534 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE7,
535 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100536 SUNXI_FUNCTION(0x1, "gpio_out"),
537 SUNXI_FUNCTION(0x2, "ts0"), /* D3 */
538 SUNXI_FUNCTION(0x3, "csi0")), /* D3 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100539 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE8,
540 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100541 SUNXI_FUNCTION(0x1, "gpio_out"),
542 SUNXI_FUNCTION(0x2, "ts0"), /* D4 */
543 SUNXI_FUNCTION(0x3, "csi0")), /* D4 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100544 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE9,
545 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100546 SUNXI_FUNCTION(0x1, "gpio_out"),
547 SUNXI_FUNCTION(0x2, "ts0"), /* D5 */
548 SUNXI_FUNCTION(0x3, "csi0")), /* D5 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100549 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE10,
550 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100551 SUNXI_FUNCTION(0x1, "gpio_out"),
552 SUNXI_FUNCTION(0x2, "ts0"), /* D6 */
553 SUNXI_FUNCTION(0x3, "csi0")), /* D6 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100554 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE11,
555 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100556 SUNXI_FUNCTION(0x1, "gpio_out"),
557 SUNXI_FUNCTION(0x2, "ts0"), /* D7 */
558 SUNXI_FUNCTION(0x3, "csi0")), /* D7 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100559 /* Hole */
560 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF0,
561 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100562 SUNXI_FUNCTION(0x1, "gpio_out"),
563 SUNXI_FUNCTION(0x2, "mmc0"), /* D1 */
564 SUNXI_FUNCTION(0x4, "jtag")), /* MSI */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100565 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF1,
566 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100567 SUNXI_FUNCTION(0x1, "gpio_out"),
568 SUNXI_FUNCTION(0x2, "mmc0"), /* D0 */
569 SUNXI_FUNCTION(0x4, "jtag")), /* DI1 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100570 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF2,
571 SUNXI_FUNCTION(0x0, "gpio_in"),
572 SUNXI_FUNCTION(0x1, "gpio_out"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100573 SUNXI_FUNCTION(0x2, "mmc0"), /* CLK */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100574 SUNXI_FUNCTION(0x4, "uart0")), /* TX */
575 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF3,
576 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100577 SUNXI_FUNCTION(0x1, "gpio_out"),
578 SUNXI_FUNCTION(0x2, "mmc0"), /* CMD */
579 SUNXI_FUNCTION(0x4, "jtag")), /* DO1 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100580 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF4,
581 SUNXI_FUNCTION(0x0, "gpio_in"),
582 SUNXI_FUNCTION(0x1, "gpio_out"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100583 SUNXI_FUNCTION(0x2, "mmc0"), /* D3 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100584 SUNXI_FUNCTION(0x4, "uart0")), /* RX */
585 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF5,
586 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100587 SUNXI_FUNCTION(0x1, "gpio_out"),
588 SUNXI_FUNCTION(0x2, "mmc0"), /* D2 */
589 SUNXI_FUNCTION(0x4, "jtag")), /* CK1 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100590 /* Hole */
591 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG0,
592 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100593 SUNXI_FUNCTION(0x1, "gpio_out"),
594 SUNXI_FUNCTION(0x2, "ts1"), /* CLK */
595 SUNXI_FUNCTION(0x3, "csi1"), /* PCK */
596 SUNXI_FUNCTION(0x4, "mmc1")), /* CMD */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100597 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG1,
598 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100599 SUNXI_FUNCTION(0x1, "gpio_out"),
600 SUNXI_FUNCTION(0x2, "ts1"), /* ERR */
601 SUNXI_FUNCTION(0x3, "csi1"), /* CK */
602 SUNXI_FUNCTION(0x4, "mmc1")), /* CLK */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100603 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG2,
604 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100605 SUNXI_FUNCTION(0x1, "gpio_out"),
606 SUNXI_FUNCTION(0x2, "ts1"), /* SYNC */
607 SUNXI_FUNCTION(0x3, "csi1"), /* HSYNC */
608 SUNXI_FUNCTION(0x4, "mmc1")), /* D0 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100609 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG3,
610 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100611 SUNXI_FUNCTION(0x1, "gpio_out"),
612 SUNXI_FUNCTION(0x2, "ts1"), /* DVLD */
613 SUNXI_FUNCTION(0x3, "csi1"), /* VSYNC */
614 SUNXI_FUNCTION(0x4, "mmc1")), /* D1 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100615 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG4,
616 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100617 SUNXI_FUNCTION(0x1, "gpio_out"),
618 SUNXI_FUNCTION(0x2, "ts1"), /* D0 */
619 SUNXI_FUNCTION(0x3, "csi1"), /* D0 */
620 SUNXI_FUNCTION(0x4, "mmc1"), /* D2 */
621 SUNXI_FUNCTION(0x5, "csi0")), /* D8 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100622 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG5,
623 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100624 SUNXI_FUNCTION(0x1, "gpio_out"),
625 SUNXI_FUNCTION(0x2, "ts1"), /* D1 */
626 SUNXI_FUNCTION(0x3, "csi1"), /* D1 */
627 SUNXI_FUNCTION(0x4, "mmc1"), /* D3 */
628 SUNXI_FUNCTION(0x5, "csi0")), /* D9 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100629 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG6,
630 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100631 SUNXI_FUNCTION(0x1, "gpio_out"),
632 SUNXI_FUNCTION(0x2, "ts1"), /* D2 */
633 SUNXI_FUNCTION(0x3, "csi1"), /* D2 */
634 SUNXI_FUNCTION(0x4, "uart3"), /* TX */
635 SUNXI_FUNCTION(0x5, "csi0")), /* D10 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100636 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG7,
637 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100638 SUNXI_FUNCTION(0x1, "gpio_out"),
639 SUNXI_FUNCTION(0x2, "ts1"), /* D3 */
640 SUNXI_FUNCTION(0x3, "csi1"), /* D3 */
641 SUNXI_FUNCTION(0x4, "uart3"), /* RX */
642 SUNXI_FUNCTION(0x5, "csi0")), /* D11 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100643 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG8,
644 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100645 SUNXI_FUNCTION(0x1, "gpio_out"),
646 SUNXI_FUNCTION(0x2, "ts1"), /* D4 */
647 SUNXI_FUNCTION(0x3, "csi1"), /* D4 */
648 SUNXI_FUNCTION(0x4, "uart3"), /* RTS */
649 SUNXI_FUNCTION(0x5, "csi0")), /* D12 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100650 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG9,
651 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100652 SUNXI_FUNCTION(0x1, "gpio_out"),
653 SUNXI_FUNCTION(0x2, "ts1"), /* D5 */
654 SUNXI_FUNCTION(0x3, "csi1"), /* D5 */
655 SUNXI_FUNCTION(0x4, "uart3"), /* CTS */
656 SUNXI_FUNCTION(0x5, "csi0")), /* D13 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100657 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG10,
658 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100659 SUNXI_FUNCTION(0x1, "gpio_out"),
660 SUNXI_FUNCTION(0x2, "ts1"), /* D6 */
661 SUNXI_FUNCTION(0x3, "csi1"), /* D6 */
662 SUNXI_FUNCTION(0x4, "uart4"), /* TX */
663 SUNXI_FUNCTION(0x5, "csi0")), /* D14 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100664 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG11,
665 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100666 SUNXI_FUNCTION(0x1, "gpio_out"),
667 SUNXI_FUNCTION(0x2, "ts1"), /* D7 */
668 SUNXI_FUNCTION(0x3, "csi1"), /* D7 */
669 SUNXI_FUNCTION(0x4, "uart4"), /* RX */
670 SUNXI_FUNCTION(0x5, "csi0")), /* D15 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100671 /* Hole */
672 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH0,
673 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100674 SUNXI_FUNCTION(0x1, "gpio_out"),
675 SUNXI_FUNCTION(0x2, "lcd1"), /* D0 */
676 SUNXI_FUNCTION(0x3, "pata"), /* ATAA0 */
677 SUNXI_FUNCTION(0x4, "uart3"), /* TX */
678 SUNXI_FUNCTION(0x7, "csi1")), /* D0 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100679 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH1,
680 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100681 SUNXI_FUNCTION(0x1, "gpio_out"),
682 SUNXI_FUNCTION(0x2, "lcd1"), /* D1 */
683 SUNXI_FUNCTION(0x3, "pata"), /* ATAA1 */
684 SUNXI_FUNCTION(0x4, "uart3"), /* RX */
685 SUNXI_FUNCTION(0x7, "csi1")), /* D1 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100686 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH2,
687 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100688 SUNXI_FUNCTION(0x1, "gpio_out"),
689 SUNXI_FUNCTION(0x2, "lcd1"), /* D2 */
690 SUNXI_FUNCTION(0x3, "pata"), /* ATAA2 */
691 SUNXI_FUNCTION(0x4, "uart3"), /* RTS */
692 SUNXI_FUNCTION(0x7, "csi1")), /* D2 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100693 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH3,
694 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100695 SUNXI_FUNCTION(0x1, "gpio_out"),
696 SUNXI_FUNCTION(0x2, "lcd1"), /* D3 */
697 SUNXI_FUNCTION(0x3, "pata"), /* ATAIRQ */
698 SUNXI_FUNCTION(0x4, "uart3"), /* CTS */
699 SUNXI_FUNCTION(0x7, "csi1")), /* D3 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100700 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH4,
701 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100702 SUNXI_FUNCTION(0x1, "gpio_out"),
703 SUNXI_FUNCTION(0x2, "lcd1"), /* D4 */
704 SUNXI_FUNCTION(0x3, "pata"), /* ATAD0 */
705 SUNXI_FUNCTION(0x4, "uart4"), /* TX */
706 SUNXI_FUNCTION(0x7, "csi1")), /* D4 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100707 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH5,
708 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100709 SUNXI_FUNCTION(0x1, "gpio_out"),
710 SUNXI_FUNCTION(0x2, "lcd1"), /* D5 */
711 SUNXI_FUNCTION(0x3, "pata"), /* ATAD1 */
712 SUNXI_FUNCTION(0x4, "uart4"), /* RX */
713 SUNXI_FUNCTION(0x7, "csi1")), /* D5 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100714 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH6,
715 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100716 SUNXI_FUNCTION(0x1, "gpio_out"),
717 SUNXI_FUNCTION(0x2, "lcd1"), /* D6 */
718 SUNXI_FUNCTION(0x3, "pata"), /* ATAD2 */
719 SUNXI_FUNCTION(0x4, "uart5"), /* TX */
720 SUNXI_FUNCTION(0x5, "ms"), /* BS */
721 SUNXI_FUNCTION(0x7, "csi1")), /* D6 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100722 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH7,
723 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100724 SUNXI_FUNCTION(0x1, "gpio_out"),
725 SUNXI_FUNCTION(0x2, "lcd1"), /* D7 */
726 SUNXI_FUNCTION(0x3, "pata"), /* ATAD3 */
727 SUNXI_FUNCTION(0x4, "uart5"), /* RX */
728 SUNXI_FUNCTION(0x5, "ms"), /* CLK */
729 SUNXI_FUNCTION(0x7, "csi1")), /* D7 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100730 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH8,
731 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100732 SUNXI_FUNCTION(0x1, "gpio_out"),
733 SUNXI_FUNCTION(0x2, "lcd1"), /* D8 */
734 SUNXI_FUNCTION(0x3, "pata"), /* ATAD4 */
735 SUNXI_FUNCTION(0x4, "keypad"), /* IN0 */
736 SUNXI_FUNCTION(0x5, "ms"), /* D0 */
737 SUNXI_FUNCTION(0x7, "csi1")), /* D8 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100738 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH9,
739 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100740 SUNXI_FUNCTION(0x1, "gpio_out"),
741 SUNXI_FUNCTION(0x2, "lcd1"), /* D9 */
742 SUNXI_FUNCTION(0x3, "pata"), /* ATAD5 */
743 SUNXI_FUNCTION(0x4, "keypad"), /* IN1 */
744 SUNXI_FUNCTION(0x5, "ms"), /* D1 */
745 SUNXI_FUNCTION(0x7, "csi1")), /* D9 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100746 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH10,
747 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100748 SUNXI_FUNCTION(0x1, "gpio_out"),
749 SUNXI_FUNCTION(0x2, "lcd1"), /* D10 */
750 SUNXI_FUNCTION(0x3, "pata"), /* ATAD6 */
751 SUNXI_FUNCTION(0x4, "keypad"), /* IN2 */
752 SUNXI_FUNCTION(0x5, "ms"), /* D2 */
753 SUNXI_FUNCTION(0x7, "csi1")), /* D10 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100754 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH11,
755 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100756 SUNXI_FUNCTION(0x1, "gpio_out"),
757 SUNXI_FUNCTION(0x2, "lcd1"), /* D11 */
758 SUNXI_FUNCTION(0x3, "pata"), /* ATAD7 */
759 SUNXI_FUNCTION(0x4, "keypad"), /* IN3 */
760 SUNXI_FUNCTION(0x5, "ms"), /* D3 */
761 SUNXI_FUNCTION(0x7, "csi1")), /* D11 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100762 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH12,
763 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100764 SUNXI_FUNCTION(0x1, "gpio_out"),
765 SUNXI_FUNCTION(0x2, "lcd1"), /* D12 */
766 SUNXI_FUNCTION(0x3, "pata"), /* ATAD8 */
767 SUNXI_FUNCTION(0x4, "ps2"), /* SCK1 */
768 SUNXI_FUNCTION(0x7, "csi1")), /* D12 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100769 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH13,
770 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100771 SUNXI_FUNCTION(0x1, "gpio_out"),
772 SUNXI_FUNCTION(0x2, "lcd1"), /* D13 */
773 SUNXI_FUNCTION(0x3, "pata"), /* ATAD9 */
774 SUNXI_FUNCTION(0x4, "ps2"), /* SDA1 */
775 SUNXI_FUNCTION(0x5, "sim"), /* RST */
776 SUNXI_FUNCTION(0x7, "csi1")), /* D13 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100777 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH14,
778 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100779 SUNXI_FUNCTION(0x1, "gpio_out"),
780 SUNXI_FUNCTION(0x2, "lcd1"), /* D14 */
781 SUNXI_FUNCTION(0x3, "pata"), /* ATAD10 */
782 SUNXI_FUNCTION(0x4, "keypad"), /* IN4 */
783 SUNXI_FUNCTION(0x5, "sim"), /* VPPEN */
784 SUNXI_FUNCTION(0x7, "csi1")), /* D14 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100785 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH15,
786 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100787 SUNXI_FUNCTION(0x1, "gpio_out"),
788 SUNXI_FUNCTION(0x2, "lcd1"), /* D15 */
789 SUNXI_FUNCTION(0x3, "pata"), /* ATAD11 */
790 SUNXI_FUNCTION(0x4, "keypad"), /* IN5 */
791 SUNXI_FUNCTION(0x5, "sim"), /* VPPPP */
792 SUNXI_FUNCTION(0x7, "csi1")), /* D15 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100793 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH16,
794 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100795 SUNXI_FUNCTION(0x1, "gpio_out"),
796 SUNXI_FUNCTION(0x2, "lcd1"), /* D16 */
797 SUNXI_FUNCTION(0x3, "pata"), /* ATAD12 */
798 SUNXI_FUNCTION(0x4, "keypad"), /* IN6 */
799 SUNXI_FUNCTION(0x7, "csi1")), /* D16 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100800 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH17,
801 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100802 SUNXI_FUNCTION(0x1, "gpio_out"),
803 SUNXI_FUNCTION(0x2, "lcd1"), /* D17 */
804 SUNXI_FUNCTION(0x3, "pata"), /* ATAD13 */
805 SUNXI_FUNCTION(0x4, "keypad"), /* IN7 */
806 SUNXI_FUNCTION(0x5, "sim"), /* VCCEN */
807 SUNXI_FUNCTION(0x7, "csi1")), /* D17 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100808 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH18,
809 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100810 SUNXI_FUNCTION(0x1, "gpio_out"),
811 SUNXI_FUNCTION(0x2, "lcd1"), /* D18 */
812 SUNXI_FUNCTION(0x3, "pata"), /* ATAD14 */
813 SUNXI_FUNCTION(0x4, "keypad"), /* OUT0 */
814 SUNXI_FUNCTION(0x5, "sim"), /* SCK */
815 SUNXI_FUNCTION(0x7, "csi1")), /* D18 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100816 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH19,
817 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100818 SUNXI_FUNCTION(0x1, "gpio_out"),
819 SUNXI_FUNCTION(0x2, "lcd1"), /* D19 */
820 SUNXI_FUNCTION(0x3, "pata"), /* ATAD15 */
821 SUNXI_FUNCTION(0x4, "keypad"), /* OUT1 */
822 SUNXI_FUNCTION(0x5, "sim"), /* SDA */
823 SUNXI_FUNCTION(0x7, "csi1")), /* D19 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100824 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH20,
825 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100826 SUNXI_FUNCTION(0x1, "gpio_out"),
827 SUNXI_FUNCTION(0x2, "lcd1"), /* D20 */
828 SUNXI_FUNCTION(0x3, "pata"), /* ATAOE */
829 SUNXI_FUNCTION(0x4, "can"), /* TX */
830 SUNXI_FUNCTION(0x7, "csi1")), /* D20 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100831 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH21,
832 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100833 SUNXI_FUNCTION(0x1, "gpio_out"),
834 SUNXI_FUNCTION(0x2, "lcd1"), /* D21 */
835 SUNXI_FUNCTION(0x3, "pata"), /* ATADREQ */
836 SUNXI_FUNCTION(0x4, "can"), /* RX */
837 SUNXI_FUNCTION(0x7, "csi1")), /* D21 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100838 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH22,
839 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100840 SUNXI_FUNCTION(0x1, "gpio_out"),
841 SUNXI_FUNCTION(0x2, "lcd1"), /* D22 */
842 SUNXI_FUNCTION(0x3, "pata"), /* ATADACK */
843 SUNXI_FUNCTION(0x4, "keypad"), /* OUT2 */
844 SUNXI_FUNCTION(0x5, "mmc1"), /* CMD */
845 SUNXI_FUNCTION(0x7, "csi1")), /* D22 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100846 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH23,
847 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100848 SUNXI_FUNCTION(0x1, "gpio_out"),
849 SUNXI_FUNCTION(0x2, "lcd1"), /* D23 */
850 SUNXI_FUNCTION(0x3, "pata"), /* ATACS0 */
851 SUNXI_FUNCTION(0x4, "keypad"), /* OUT3 */
852 SUNXI_FUNCTION(0x5, "mmc1"), /* CLK */
853 SUNXI_FUNCTION(0x7, "csi1")), /* D23 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100854 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH24,
855 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100856 SUNXI_FUNCTION(0x1, "gpio_out"),
857 SUNXI_FUNCTION(0x2, "lcd1"), /* CLK */
858 SUNXI_FUNCTION(0x3, "pata"), /* ATACS1 */
859 SUNXI_FUNCTION(0x4, "keypad"), /* OUT4 */
860 SUNXI_FUNCTION(0x5, "mmc1"), /* D0 */
861 SUNXI_FUNCTION(0x7, "csi1")), /* PCLK */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100862 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH25,
863 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100864 SUNXI_FUNCTION(0x1, "gpio_out"),
865 SUNXI_FUNCTION(0x2, "lcd1"), /* DE */
866 SUNXI_FUNCTION(0x3, "pata"), /* ATAIORDY */
867 SUNXI_FUNCTION(0x4, "keypad"), /* OUT5 */
868 SUNXI_FUNCTION(0x5, "mmc1"), /* D1 */
869 SUNXI_FUNCTION(0x7, "csi1")), /* FIELD */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100870 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH26,
871 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100872 SUNXI_FUNCTION(0x1, "gpio_out"),
873 SUNXI_FUNCTION(0x2, "lcd1"), /* HSYNC */
874 SUNXI_FUNCTION(0x3, "pata"), /* ATAIOR */
875 SUNXI_FUNCTION(0x4, "keypad"), /* OUT6 */
876 SUNXI_FUNCTION(0x5, "mmc1"), /* D2 */
877 SUNXI_FUNCTION(0x7, "csi1")), /* HSYNC */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100878 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH27,
879 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100880 SUNXI_FUNCTION(0x1, "gpio_out"),
881 SUNXI_FUNCTION(0x2, "lcd1"), /* VSYNC */
882 SUNXI_FUNCTION(0x3, "pata"), /* ATAIOW */
883 SUNXI_FUNCTION(0x4, "keypad"), /* OUT7 */
884 SUNXI_FUNCTION(0x5, "mmc1"), /* D3 */
885 SUNXI_FUNCTION(0x7, "csi1")), /* VSYNC */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100886 /* Hole */
887 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI0,
888 SUNXI_FUNCTION(0x0, "gpio_in"),
889 SUNXI_FUNCTION(0x1, "gpio_out")),
890 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI1,
891 SUNXI_FUNCTION(0x0, "gpio_in"),
892 SUNXI_FUNCTION(0x1, "gpio_out")),
893 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI2,
894 SUNXI_FUNCTION(0x0, "gpio_in"),
895 SUNXI_FUNCTION(0x1, "gpio_out")),
896 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI3,
897 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100898 SUNXI_FUNCTION(0x1, "gpio_out"),
899 SUNXI_FUNCTION(0x2, "pwm")), /* PWM1 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100900 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI4,
901 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100902 SUNXI_FUNCTION(0x1, "gpio_out"),
903 SUNXI_FUNCTION(0x2, "mmc3")), /* CMD */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100904 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI5,
905 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100906 SUNXI_FUNCTION(0x1, "gpio_out"),
907 SUNXI_FUNCTION(0x2, "mmc3")), /* CLK */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100908 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI6,
909 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100910 SUNXI_FUNCTION(0x1, "gpio_out"),
911 SUNXI_FUNCTION(0x2, "mmc3")), /* D0 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100912 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI7,
913 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100914 SUNXI_FUNCTION(0x1, "gpio_out"),
915 SUNXI_FUNCTION(0x2, "mmc3")), /* D1 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100916 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI8,
917 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100918 SUNXI_FUNCTION(0x1, "gpio_out"),
919 SUNXI_FUNCTION(0x2, "mmc3")), /* D2 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100920 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI9,
921 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100922 SUNXI_FUNCTION(0x1, "gpio_out"),
923 SUNXI_FUNCTION(0x2, "mmc3")), /* D3 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100924 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI10,
925 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100926 SUNXI_FUNCTION(0x1, "gpio_out"),
927 SUNXI_FUNCTION(0x2, "spi0"), /* CS0 */
928 SUNXI_FUNCTION(0x3, "uart5")), /* TX */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100929 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI11,
930 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100931 SUNXI_FUNCTION(0x1, "gpio_out"),
932 SUNXI_FUNCTION(0x2, "spi0"), /* CLK */
933 SUNXI_FUNCTION(0x3, "uart5")), /* RX */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100934 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI12,
935 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100936 SUNXI_FUNCTION(0x1, "gpio_out"),
937 SUNXI_FUNCTION(0x2, "spi0"), /* MOSI */
938 SUNXI_FUNCTION(0x3, "uart6")), /* TX */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100939 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI13,
940 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100941 SUNXI_FUNCTION(0x1, "gpio_out"),
942 SUNXI_FUNCTION(0x2, "spi0"), /* MISO */
943 SUNXI_FUNCTION(0x3, "uart6")), /* RX */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100944 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI14,
945 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100946 SUNXI_FUNCTION(0x1, "gpio_out"),
947 SUNXI_FUNCTION(0x2, "spi0"), /* CS1 */
948 SUNXI_FUNCTION(0x3, "ps2"), /* SCK1 */
949 SUNXI_FUNCTION(0x4, "timer4")), /* TCLKIN0 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100950 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI15,
951 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100952 SUNXI_FUNCTION(0x1, "gpio_out"),
953 SUNXI_FUNCTION(0x2, "spi1"), /* CS1 */
954 SUNXI_FUNCTION(0x3, "ps2"), /* SDA1 */
955 SUNXI_FUNCTION(0x4, "timer5")), /* TCLKIN1 */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100956 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI16,
957 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100958 SUNXI_FUNCTION(0x1, "gpio_out"),
959 SUNXI_FUNCTION(0x2, "spi1"), /* CS0 */
960 SUNXI_FUNCTION(0x3, "uart2")), /* RTS */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100961 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI17,
962 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100963 SUNXI_FUNCTION(0x1, "gpio_out"),
964 SUNXI_FUNCTION(0x2, "spi1"), /* CLK */
965 SUNXI_FUNCTION(0x3, "uart2")), /* CTS */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100966 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI18,
967 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100968 SUNXI_FUNCTION(0x1, "gpio_out"),
969 SUNXI_FUNCTION(0x2, "spi1"), /* MOSI */
970 SUNXI_FUNCTION(0x3, "uart2")), /* TX */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100971 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI19,
972 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100973 SUNXI_FUNCTION(0x1, "gpio_out"),
974 SUNXI_FUNCTION(0x2, "spi1"), /* MISO */
975 SUNXI_FUNCTION(0x3, "uart2")), /* RX */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100976 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI20,
977 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100978 SUNXI_FUNCTION(0x1, "gpio_out"),
979 SUNXI_FUNCTION(0x2, "ps2"), /* SCK0 */
980 SUNXI_FUNCTION(0x3, "uart7"), /* TX */
981 SUNXI_FUNCTION(0x4, "hdmi")), /* HSCL */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100982 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI21,
983 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardb5f50bf2013-03-06 16:12:44 +0100984 SUNXI_FUNCTION(0x1, "gpio_out"),
985 SUNXI_FUNCTION(0x2, "ps2"), /* SDA0 */
986 SUNXI_FUNCTION(0x3, "uart7"), /* RX */
987 SUNXI_FUNCTION(0x4, "hdmi")), /* HSDA */
Maxime Ripard9f5b6b32013-01-26 15:36:53 +0100988};
989
Maxime Ripardeaa3d842013-01-18 22:30:35 +0100990static const struct sunxi_desc_pin sun5i_a13_pins[] = {
991 /* Hole */
992 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB0,
993 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +0100994 SUNXI_FUNCTION(0x1, "gpio_out"),
995 SUNXI_FUNCTION(0x2, "i2c0")), /* SCK */
Maxime Ripardeaa3d842013-01-18 22:30:35 +0100996 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB1,
997 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +0100998 SUNXI_FUNCTION(0x1, "gpio_out"),
999 SUNXI_FUNCTION(0x2, "i2c0")), /* SDA */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001000 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB2,
1001 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001002 SUNXI_FUNCTION(0x1, "gpio_out"),
1003 SUNXI_FUNCTION(0x2, "pwm")),
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001004 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB3,
1005 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001006 SUNXI_FUNCTION(0x1, "gpio_out"),
1007 SUNXI_FUNCTION(0x2, "ir0")), /* TX */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001008 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB4,
1009 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001010 SUNXI_FUNCTION(0x1, "gpio_out"),
1011 SUNXI_FUNCTION(0x2, "ir0")), /* RX */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001012 /* Hole */
1013 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB10,
1014 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001015 SUNXI_FUNCTION(0x1, "gpio_out"),
1016 SUNXI_FUNCTION(0x2, "spi2")), /* CS1 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001017 /* Hole */
1018 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB15,
1019 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001020 SUNXI_FUNCTION(0x1, "gpio_out"),
1021 SUNXI_FUNCTION(0x2, "i2c1")), /* SCK */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001022 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB16,
1023 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001024 SUNXI_FUNCTION(0x1, "gpio_out"),
1025 SUNXI_FUNCTION(0x2, "i2c1")), /* SDA */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001026 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB17,
1027 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001028 SUNXI_FUNCTION(0x1, "gpio_out"),
1029 SUNXI_FUNCTION(0x2, "i2c2")), /* SCK */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001030 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB18,
1031 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001032 SUNXI_FUNCTION(0x1, "gpio_out"),
1033 SUNXI_FUNCTION(0x2, "i2c2")), /* SDA */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001034 /* Hole */
1035 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC0,
1036 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001037 SUNXI_FUNCTION(0x1, "gpio_out"),
1038 SUNXI_FUNCTION(0x2, "nand0"), /* NWE */
1039 SUNXI_FUNCTION(0x3, "spi0")), /* MOSI */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001040 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC1,
1041 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001042 SUNXI_FUNCTION(0x1, "gpio_out"),
1043 SUNXI_FUNCTION(0x2, "nand0"), /* NALE */
1044 SUNXI_FUNCTION(0x3, "spi0")), /* MISO */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001045 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC2,
1046 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001047 SUNXI_FUNCTION(0x1, "gpio_out"),
1048 SUNXI_FUNCTION(0x2, "nand0"), /* NCLE */
1049 SUNXI_FUNCTION(0x3, "spi0")), /* CLK */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001050 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC3,
1051 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001052 SUNXI_FUNCTION(0x1, "gpio_out"),
1053 SUNXI_FUNCTION(0x2, "nand0"), /* NCE1 */
1054 SUNXI_FUNCTION(0x3, "spi0")), /* CS0 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001055 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC4,
1056 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001057 SUNXI_FUNCTION(0x1, "gpio_out"),
1058 SUNXI_FUNCTION(0x2, "nand0")), /* NCE0 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001059 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC5,
1060 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001061 SUNXI_FUNCTION(0x1, "gpio_out"),
1062 SUNXI_FUNCTION(0x2, "nand0")), /* NRE */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001063 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC6,
1064 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001065 SUNXI_FUNCTION(0x1, "gpio_out"),
1066 SUNXI_FUNCTION(0x2, "nand0"), /* NRB0 */
1067 SUNXI_FUNCTION(0x3, "mmc2")), /* CMD */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001068 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC7,
1069 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001070 SUNXI_FUNCTION(0x1, "gpio_out"),
1071 SUNXI_FUNCTION(0x2, "nand0"), /* NRB1 */
1072 SUNXI_FUNCTION(0x3, "mmc2")), /* CLK */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001073 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC8,
1074 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001075 SUNXI_FUNCTION(0x1, "gpio_out"),
1076 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ0 */
1077 SUNXI_FUNCTION(0x3, "mmc2")), /* D0 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001078 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC9,
1079 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001080 SUNXI_FUNCTION(0x1, "gpio_out"),
1081 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ1 */
1082 SUNXI_FUNCTION(0x3, "mmc2")), /* D1 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001083 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC10,
1084 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001085 SUNXI_FUNCTION(0x1, "gpio_out"),
1086 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ2 */
1087 SUNXI_FUNCTION(0x3, "mmc2")), /* D2 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001088 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC11,
1089 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001090 SUNXI_FUNCTION(0x1, "gpio_out"),
1091 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ3 */
1092 SUNXI_FUNCTION(0x3, "mmc2")), /* D3 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001093 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC12,
1094 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001095 SUNXI_FUNCTION(0x1, "gpio_out"),
1096 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ4 */
1097 SUNXI_FUNCTION(0x3, "mmc2")), /* D4 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001098 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC13,
1099 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001100 SUNXI_FUNCTION(0x1, "gpio_out"),
1101 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ5 */
1102 SUNXI_FUNCTION(0x3, "mmc2")), /* D5 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001103 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC14,
1104 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001105 SUNXI_FUNCTION(0x1, "gpio_out"),
1106 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ6 */
1107 SUNXI_FUNCTION(0x3, "mmc2")), /* D6 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001108 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC15,
1109 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001110 SUNXI_FUNCTION(0x1, "gpio_out"),
1111 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ7 */
1112 SUNXI_FUNCTION(0x3, "mmc2")), /* D7 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001113 /* Hole */
1114 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC19,
1115 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001116 SUNXI_FUNCTION(0x1, "gpio_out"),
1117 SUNXI_FUNCTION(0x2, "nand0"), /* NDQS */
1118 SUNXI_FUNCTION(0x4, "uart3")), /* RTS */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001119 /* Hole */
1120 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD2,
1121 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001122 SUNXI_FUNCTION(0x1, "gpio_out"),
1123 SUNXI_FUNCTION(0x2, "lcd0")), /* D2 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001124 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD3,
1125 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001126 SUNXI_FUNCTION(0x1, "gpio_out"),
1127 SUNXI_FUNCTION(0x2, "lcd0")), /* D3 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001128 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD4,
1129 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001130 SUNXI_FUNCTION(0x1, "gpio_out"),
1131 SUNXI_FUNCTION(0x2, "lcd0")), /* D4 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001132 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD5,
1133 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001134 SUNXI_FUNCTION(0x1, "gpio_out"),
1135 SUNXI_FUNCTION(0x2, "lcd0")), /* D5 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001136 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD6,
1137 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001138 SUNXI_FUNCTION(0x1, "gpio_out"),
1139 SUNXI_FUNCTION(0x2, "lcd0")), /* D6 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001140 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD7,
1141 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001142 SUNXI_FUNCTION(0x1, "gpio_out"),
1143 SUNXI_FUNCTION(0x2, "lcd0")), /* D7 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001144 /* Hole */
1145 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD10,
1146 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001147 SUNXI_FUNCTION(0x1, "gpio_out"),
1148 SUNXI_FUNCTION(0x2, "lcd0")), /* D10 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001149 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD11,
1150 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001151 SUNXI_FUNCTION(0x1, "gpio_out"),
1152 SUNXI_FUNCTION(0x2, "lcd0")), /* D11 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001153 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD12,
1154 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001155 SUNXI_FUNCTION(0x1, "gpio_out"),
1156 SUNXI_FUNCTION(0x2, "lcd0")), /* D12 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001157 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD13,
1158 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001159 SUNXI_FUNCTION(0x1, "gpio_out"),
1160 SUNXI_FUNCTION(0x2, "lcd0")), /* D13 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001161 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD14,
1162 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001163 SUNXI_FUNCTION(0x1, "gpio_out"),
1164 SUNXI_FUNCTION(0x2, "lcd0")), /* D14 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001165 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD15,
1166 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001167 SUNXI_FUNCTION(0x1, "gpio_out"),
1168 SUNXI_FUNCTION(0x2, "lcd0")), /* D15 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001169 /* Hole */
1170 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD18,
1171 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001172 SUNXI_FUNCTION(0x1, "gpio_out"),
1173 SUNXI_FUNCTION(0x2, "lcd0")), /* D18 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001174 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD19,
1175 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001176 SUNXI_FUNCTION(0x1, "gpio_out"),
1177 SUNXI_FUNCTION(0x2, "lcd0")), /* D19 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001178 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD20,
1179 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001180 SUNXI_FUNCTION(0x1, "gpio_out"),
1181 SUNXI_FUNCTION(0x2, "lcd0")), /* D20 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001182 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD21,
1183 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001184 SUNXI_FUNCTION(0x1, "gpio_out"),
1185 SUNXI_FUNCTION(0x2, "lcd0")), /* D21 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001186 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD22,
1187 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001188 SUNXI_FUNCTION(0x1, "gpio_out"),
1189 SUNXI_FUNCTION(0x2, "lcd0")), /* D22 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001190 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD23,
1191 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001192 SUNXI_FUNCTION(0x1, "gpio_out"),
1193 SUNXI_FUNCTION(0x2, "lcd0")), /* D23 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001194 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD24,
1195 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001196 SUNXI_FUNCTION(0x1, "gpio_out"),
1197 SUNXI_FUNCTION(0x2, "lcd0")), /* CLK */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001198 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD25,
1199 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001200 SUNXI_FUNCTION(0x1, "gpio_out"),
1201 SUNXI_FUNCTION(0x2, "lcd0")), /* DE */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001202 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD26,
1203 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001204 SUNXI_FUNCTION(0x1, "gpio_out"),
1205 SUNXI_FUNCTION(0x2, "lcd0")), /* HSYNC */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001206 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD27,
1207 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001208 SUNXI_FUNCTION(0x1, "gpio_out"),
1209 SUNXI_FUNCTION(0x2, "lcd0")), /* VSYNC */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001210 /* Hole */
1211 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE0,
1212 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001213 SUNXI_FUNCTION(0x3, "csi0"), /* PCLK */
1214 SUNXI_FUNCTION(0x4, "spi2")), /* CS0 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001215 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE1,
1216 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001217 SUNXI_FUNCTION(0x3, "csi0"), /* MCLK */
1218 SUNXI_FUNCTION(0x4, "spi2")), /* CLK */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001219 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE2,
1220 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001221 SUNXI_FUNCTION(0x3, "csi0"), /* HSYNC */
1222 SUNXI_FUNCTION(0x4, "spi2")), /* MOSI */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001223 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE3,
1224 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001225 SUNXI_FUNCTION(0x1, "gpio_out"),
1226 SUNXI_FUNCTION(0x3, "csi0"), /* VSYNC */
1227 SUNXI_FUNCTION(0x4, "spi2")), /* MISO */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001228 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE4,
1229 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001230 SUNXI_FUNCTION(0x1, "gpio_out"),
1231 SUNXI_FUNCTION(0x3, "csi0"), /* D0 */
1232 SUNXI_FUNCTION(0x4, "mmc2")), /* D0 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001233 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE5,
1234 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001235 SUNXI_FUNCTION(0x1, "gpio_out"),
1236 SUNXI_FUNCTION(0x3, "csi0"), /* D1 */
1237 SUNXI_FUNCTION(0x4, "mmc2")), /* D1 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001238 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE6,
1239 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001240 SUNXI_FUNCTION(0x1, "gpio_out"),
1241 SUNXI_FUNCTION(0x3, "csi0"), /* D2 */
1242 SUNXI_FUNCTION(0x4, "mmc2")), /* D2 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001243 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE7,
1244 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001245 SUNXI_FUNCTION(0x1, "gpio_out"),
1246 SUNXI_FUNCTION(0x3, "csi0"), /* D3 */
1247 SUNXI_FUNCTION(0x4, "mmc2")), /* D3 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001248 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE8,
1249 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001250 SUNXI_FUNCTION(0x1, "gpio_out"),
1251 SUNXI_FUNCTION(0x3, "csi0"), /* D4 */
1252 SUNXI_FUNCTION(0x4, "mmc2")), /* CMD */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001253 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE9,
1254 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001255 SUNXI_FUNCTION(0x1, "gpio_out"),
1256 SUNXI_FUNCTION(0x3, "csi0"), /* D5 */
1257 SUNXI_FUNCTION(0x4, "mmc2")), /* CLK */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001258 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE10,
1259 SUNXI_FUNCTION(0x0, "gpio_in"),
1260 SUNXI_FUNCTION(0x1, "gpio_out"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001261 SUNXI_FUNCTION(0x3, "csi0"), /* D6 */
Maxime Ripardae1575f2013-01-26 15:36:52 +01001262 SUNXI_FUNCTION(0x4, "uart1")), /* TX */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001263 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE11,
1264 SUNXI_FUNCTION(0x0, "gpio_in"),
1265 SUNXI_FUNCTION(0x1, "gpio_out"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001266 SUNXI_FUNCTION(0x3, "csi0"), /* D7 */
Maxime Ripardae1575f2013-01-26 15:36:52 +01001267 SUNXI_FUNCTION(0x4, "uart1")), /* RX */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001268 /* Hole */
1269 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF0,
1270 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001271 SUNXI_FUNCTION(0x1, "gpio_out"),
1272 SUNXI_FUNCTION(0x4, "mmc0")), /* D1 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001273 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF1,
1274 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001275 SUNXI_FUNCTION(0x1, "gpio_out"),
1276 SUNXI_FUNCTION(0x4, "mmc0")), /* D0 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001277 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF2,
1278 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001279 SUNXI_FUNCTION(0x1, "gpio_out"),
1280 SUNXI_FUNCTION(0x4, "mmc0")), /* CLK */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001281 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF3,
1282 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001283 SUNXI_FUNCTION(0x1, "gpio_out"),
1284 SUNXI_FUNCTION(0x4, "mmc0")), /* CMD */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001285 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF4,
1286 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001287 SUNXI_FUNCTION(0x1, "gpio_out"),
1288 SUNXI_FUNCTION(0x4, "mmc0")), /* D3 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001289 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF5,
1290 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001291 SUNXI_FUNCTION(0x1, "gpio_out"),
1292 SUNXI_FUNCTION(0x4, "mmc0")), /* D2 */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001293 /* Hole */
1294 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG0,
1295 SUNXI_FUNCTION(0x0, "gpio_in"),
1296 SUNXI_FUNCTION(0x1, "gpio_out")),
1297 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG1,
1298 SUNXI_FUNCTION(0x0, "gpio_in"),
1299 SUNXI_FUNCTION(0x1, "gpio_out")),
1300 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG2,
1301 SUNXI_FUNCTION(0x0, "gpio_in"),
1302 SUNXI_FUNCTION(0x1, "gpio_out")),
1303 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG3,
1304 SUNXI_FUNCTION(0x0, "gpio_in"),
1305 SUNXI_FUNCTION(0x1, "gpio_out"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001306 SUNXI_FUNCTION(0x2, "mmc1"), /* CMD */
Maxime Ripardae1575f2013-01-26 15:36:52 +01001307 SUNXI_FUNCTION(0x4, "uart1")), /* TX */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001308 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG4,
1309 SUNXI_FUNCTION(0x0, "gpio_in"),
1310 SUNXI_FUNCTION(0x1, "gpio_out"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001311 SUNXI_FUNCTION(0x2, "mmc1"), /* CLK */
Maxime Ripardae1575f2013-01-26 15:36:52 +01001312 SUNXI_FUNCTION(0x4, "uart1")), /* RX */
Maxime Ripardee341a92013-03-06 16:12:45 +01001313/* Hole */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001314 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG9,
1315 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001316 SUNXI_FUNCTION(0x1, "gpio_out"),
1317 SUNXI_FUNCTION(0x2, "spi1"), /* CS0 */
1318 SUNXI_FUNCTION(0x3, "uart3")), /* TX */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001319 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG10,
1320 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001321 SUNXI_FUNCTION(0x1, "gpio_out"),
1322 SUNXI_FUNCTION(0x2, "spi1"), /* CLK */
1323 SUNXI_FUNCTION(0x3, "uart3")), /* RX */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001324 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG11,
1325 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001326 SUNXI_FUNCTION(0x1, "gpio_out"),
1327 SUNXI_FUNCTION(0x2, "spi1"), /* MOSI */
1328 SUNXI_FUNCTION(0x3, "uart3")), /* CTS */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001329 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG12,
1330 SUNXI_FUNCTION(0x0, "gpio_in"),
Maxime Ripardee341a92013-03-06 16:12:45 +01001331 SUNXI_FUNCTION(0x1, "gpio_out"),
1332 SUNXI_FUNCTION(0x2, "spi1"), /* MISO */
1333 SUNXI_FUNCTION(0x3, "uart3")), /* RTS */
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001334};
1335
Maxime Ripard9f5b6b32013-01-26 15:36:53 +01001336static const struct sunxi_pinctrl_desc sun4i_a10_pinctrl_data = {
1337 .pins = sun4i_a10_pins,
1338 .npins = ARRAY_SIZE(sun4i_a10_pins),
1339};
1340
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001341static const struct sunxi_pinctrl_desc sun5i_a13_pinctrl_data = {
1342 .pins = sun5i_a13_pins,
1343 .npins = ARRAY_SIZE(sun5i_a13_pins),
1344};
1345
Maxime Ripard0e37f882013-01-18 22:30:34 +01001346static struct sunxi_pinctrl_group *
1347sunxi_pinctrl_find_group_by_name(struct sunxi_pinctrl *pctl, const char *group)
1348{
1349 int i;
1350
1351 for (i = 0; i < pctl->ngroups; i++) {
1352 struct sunxi_pinctrl_group *grp = pctl->groups + i;
1353
1354 if (!strcmp(grp->name, group))
1355 return grp;
1356 }
1357
1358 return NULL;
1359}
1360
1361static struct sunxi_pinctrl_function *
1362sunxi_pinctrl_find_function_by_name(struct sunxi_pinctrl *pctl,
1363 const char *name)
1364{
1365 struct sunxi_pinctrl_function *func = pctl->functions;
1366 int i;
1367
1368 for (i = 0; i < pctl->nfunctions; i++) {
1369 if (!func[i].name)
1370 break;
1371
1372 if (!strcmp(func[i].name, name))
1373 return func + i;
1374 }
1375
1376 return NULL;
1377}
1378
1379static struct sunxi_desc_function *
1380sunxi_pinctrl_desc_find_function_by_name(struct sunxi_pinctrl *pctl,
1381 const char *pin_name,
1382 const char *func_name)
1383{
1384 int i;
1385
1386 for (i = 0; i < pctl->desc->npins; i++) {
1387 const struct sunxi_desc_pin *pin = pctl->desc->pins + i;
1388
1389 if (!strcmp(pin->pin.name, pin_name)) {
1390 struct sunxi_desc_function *func = pin->functions;
1391
1392 while (func->name) {
1393 if (!strcmp(func->name, func_name))
1394 return func;
1395
1396 func++;
1397 }
1398 }
1399 }
1400
1401 return NULL;
1402}
1403
Maxime Ripard814d4f22013-06-08 12:05:43 +02001404static struct sunxi_desc_function *
1405sunxi_pinctrl_desc_find_function_by_pin(struct sunxi_pinctrl *pctl,
1406 const u16 pin_num,
1407 const char *func_name)
1408{
1409 int i;
1410
1411 for (i = 0; i < pctl->desc->npins; i++) {
1412 const struct sunxi_desc_pin *pin = pctl->desc->pins + i;
1413
1414 if (pin->pin.number == pin_num) {
1415 struct sunxi_desc_function *func = pin->functions;
1416
1417 while (func->name) {
1418 if (!strcmp(func->name, func_name))
1419 return func;
1420
1421 func++;
1422 }
1423 }
1424 }
1425
1426 return NULL;
1427}
1428
Maxime Ripard0e37f882013-01-18 22:30:34 +01001429static int sunxi_pctrl_get_groups_count(struct pinctrl_dev *pctldev)
1430{
1431 struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev);
1432
1433 return pctl->ngroups;
1434}
1435
1436static const char *sunxi_pctrl_get_group_name(struct pinctrl_dev *pctldev,
1437 unsigned group)
1438{
1439 struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev);
1440
1441 return pctl->groups[group].name;
1442}
1443
1444static int sunxi_pctrl_get_group_pins(struct pinctrl_dev *pctldev,
1445 unsigned group,
1446 const unsigned **pins,
1447 unsigned *num_pins)
1448{
1449 struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev);
1450
1451 *pins = (unsigned *)&pctl->groups[group].pin;
1452 *num_pins = 1;
1453
1454 return 0;
1455}
1456
1457static int sunxi_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
1458 struct device_node *node,
1459 struct pinctrl_map **map,
1460 unsigned *num_maps)
1461{
1462 struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev);
1463 unsigned long *pinconfig;
1464 struct property *prop;
1465 const char *function;
1466 const char *group;
1467 int ret, nmaps, i = 0;
1468 u32 val;
1469
1470 *map = NULL;
1471 *num_maps = 0;
1472
1473 ret = of_property_read_string(node, "allwinner,function", &function);
1474 if (ret) {
1475 dev_err(pctl->dev,
1476 "missing allwinner,function property in node %s\n",
1477 node->name);
1478 return -EINVAL;
1479 }
1480
1481 nmaps = of_property_count_strings(node, "allwinner,pins") * 2;
1482 if (nmaps < 0) {
1483 dev_err(pctl->dev,
1484 "missing allwinner,pins property in node %s\n",
1485 node->name);
1486 return -EINVAL;
1487 }
1488
1489 *map = kmalloc(nmaps * sizeof(struct pinctrl_map), GFP_KERNEL);
1490 if (!map)
1491 return -ENOMEM;
1492
1493 of_property_for_each_string(node, "allwinner,pins", prop, group) {
1494 struct sunxi_pinctrl_group *grp =
1495 sunxi_pinctrl_find_group_by_name(pctl, group);
1496 int j = 0, configlen = 0;
1497
1498 if (!grp) {
1499 dev_err(pctl->dev, "unknown pin %s", group);
1500 continue;
1501 }
1502
1503 if (!sunxi_pinctrl_desc_find_function_by_name(pctl,
1504 grp->name,
1505 function)) {
1506 dev_err(pctl->dev, "unsupported function %s on pin %s",
1507 function, group);
1508 continue;
1509 }
1510
1511 (*map)[i].type = PIN_MAP_TYPE_MUX_GROUP;
1512 (*map)[i].data.mux.group = group;
1513 (*map)[i].data.mux.function = function;
1514
1515 i++;
1516
1517 (*map)[i].type = PIN_MAP_TYPE_CONFIGS_GROUP;
1518 (*map)[i].data.configs.group_or_pin = group;
1519
1520 if (of_find_property(node, "allwinner,drive", NULL))
1521 configlen++;
1522 if (of_find_property(node, "allwinner,pull", NULL))
1523 configlen++;
1524
1525 pinconfig = kzalloc(configlen * sizeof(*pinconfig), GFP_KERNEL);
1526
1527 if (!of_property_read_u32(node, "allwinner,drive", &val)) {
1528 u16 strength = (val + 1) * 10;
1529 pinconfig[j++] =
1530 pinconf_to_config_packed(PIN_CONFIG_DRIVE_STRENGTH,
1531 strength);
1532 }
1533
1534 if (!of_property_read_u32(node, "allwinner,pull", &val)) {
1535 enum pin_config_param pull = PIN_CONFIG_END;
1536 if (val == 1)
1537 pull = PIN_CONFIG_BIAS_PULL_UP;
1538 else if (val == 2)
1539 pull = PIN_CONFIG_BIAS_PULL_DOWN;
1540 pinconfig[j++] = pinconf_to_config_packed(pull, 0);
1541 }
1542
1543 (*map)[i].data.configs.configs = pinconfig;
1544 (*map)[i].data.configs.num_configs = configlen;
1545
1546 i++;
1547 }
1548
1549 *num_maps = nmaps;
1550
1551 return 0;
1552}
1553
1554static void sunxi_pctrl_dt_free_map(struct pinctrl_dev *pctldev,
1555 struct pinctrl_map *map,
1556 unsigned num_maps)
1557{
1558 int i;
1559
1560 for (i = 0; i < num_maps; i++) {
1561 if (map[i].type == PIN_MAP_TYPE_CONFIGS_GROUP)
1562 kfree(map[i].data.configs.configs);
1563 }
1564
1565 kfree(map);
1566}
1567
Laurent Pinchart022ab142013-02-16 10:25:07 +01001568static const struct pinctrl_ops sunxi_pctrl_ops = {
Maxime Ripard0e37f882013-01-18 22:30:34 +01001569 .dt_node_to_map = sunxi_pctrl_dt_node_to_map,
1570 .dt_free_map = sunxi_pctrl_dt_free_map,
1571 .get_groups_count = sunxi_pctrl_get_groups_count,
1572 .get_group_name = sunxi_pctrl_get_group_name,
1573 .get_group_pins = sunxi_pctrl_get_group_pins,
1574};
1575
1576static int sunxi_pconf_group_get(struct pinctrl_dev *pctldev,
1577 unsigned group,
1578 unsigned long *config)
1579{
1580 struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev);
1581
1582 *config = pctl->groups[group].config;
1583
1584 return 0;
1585}
1586
1587static int sunxi_pconf_group_set(struct pinctrl_dev *pctldev,
1588 unsigned group,
1589 unsigned long config)
1590{
1591 struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev);
1592 struct sunxi_pinctrl_group *g = &pctl->groups[group];
1593 u32 val, mask;
1594 u16 strength;
1595 u8 dlevel;
1596
1597 switch (pinconf_to_config_param(config)) {
1598 case PIN_CONFIG_DRIVE_STRENGTH:
1599 strength = pinconf_to_config_argument(config);
1600 if (strength > 40)
1601 return -EINVAL;
1602 /*
1603 * We convert from mA to what the register expects:
1604 * 0: 10mA
1605 * 1: 20mA
1606 * 2: 30mA
1607 * 3: 40mA
1608 */
1609 dlevel = strength / 10 - 1;
1610 val = readl(pctl->membase + sunxi_dlevel_reg(g->pin));
1611 mask = DLEVEL_PINS_MASK << sunxi_dlevel_offset(g->pin);
1612 writel((val & ~mask) | dlevel << sunxi_dlevel_offset(g->pin),
1613 pctl->membase + sunxi_dlevel_reg(g->pin));
1614 break;
1615 case PIN_CONFIG_BIAS_PULL_UP:
1616 val = readl(pctl->membase + sunxi_pull_reg(g->pin));
1617 mask = PULL_PINS_MASK << sunxi_pull_offset(g->pin);
1618 writel((val & ~mask) | 1 << sunxi_pull_offset(g->pin),
1619 pctl->membase + sunxi_pull_reg(g->pin));
1620 break;
1621 case PIN_CONFIG_BIAS_PULL_DOWN:
1622 val = readl(pctl->membase + sunxi_pull_reg(g->pin));
1623 mask = PULL_PINS_MASK << sunxi_pull_offset(g->pin);
1624 writel((val & ~mask) | 2 << sunxi_pull_offset(g->pin),
1625 pctl->membase + sunxi_pull_reg(g->pin));
1626 break;
1627 default:
1628 break;
1629 }
1630
1631 /* cache the config value */
1632 g->config = config;
1633
1634 return 0;
1635}
1636
Laurent Pinchart022ab142013-02-16 10:25:07 +01001637static const struct pinconf_ops sunxi_pconf_ops = {
Maxime Ripard0e37f882013-01-18 22:30:34 +01001638 .pin_config_group_get = sunxi_pconf_group_get,
1639 .pin_config_group_set = sunxi_pconf_group_set,
1640};
1641
1642static int sunxi_pmx_get_funcs_cnt(struct pinctrl_dev *pctldev)
1643{
1644 struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev);
1645
1646 return pctl->nfunctions;
1647}
1648
1649static const char *sunxi_pmx_get_func_name(struct pinctrl_dev *pctldev,
1650 unsigned function)
1651{
1652 struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev);
1653
1654 return pctl->functions[function].name;
1655}
1656
1657static int sunxi_pmx_get_func_groups(struct pinctrl_dev *pctldev,
1658 unsigned function,
1659 const char * const **groups,
1660 unsigned * const num_groups)
1661{
1662 struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev);
1663
1664 *groups = pctl->functions[function].groups;
1665 *num_groups = pctl->functions[function].ngroups;
1666
1667 return 0;
1668}
1669
1670static void sunxi_pmx_set(struct pinctrl_dev *pctldev,
1671 unsigned pin,
1672 u8 config)
1673{
1674 struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev);
1675
1676 u32 val = readl(pctl->membase + sunxi_mux_reg(pin));
1677 u32 mask = MUX_PINS_MASK << sunxi_mux_offset(pin);
1678 writel((val & ~mask) | config << sunxi_mux_offset(pin),
1679 pctl->membase + sunxi_mux_reg(pin));
1680}
1681
1682static int sunxi_pmx_enable(struct pinctrl_dev *pctldev,
1683 unsigned function,
1684 unsigned group)
1685{
1686 struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev);
1687 struct sunxi_pinctrl_group *g = pctl->groups + group;
1688 struct sunxi_pinctrl_function *func = pctl->functions + function;
1689 struct sunxi_desc_function *desc =
1690 sunxi_pinctrl_desc_find_function_by_name(pctl,
1691 g->name,
1692 func->name);
1693
1694 if (!desc)
1695 return -EINVAL;
1696
1697 sunxi_pmx_set(pctldev, g->pin, desc->muxval);
1698
1699 return 0;
1700}
1701
Maxime Ripard08e9e612013-01-28 21:33:12 +01001702static int
1703sunxi_pmx_gpio_set_direction(struct pinctrl_dev *pctldev,
1704 struct pinctrl_gpio_range *range,
1705 unsigned offset,
1706 bool input)
1707{
1708 struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev);
1709 struct sunxi_desc_function *desc;
Maxime Ripard08e9e612013-01-28 21:33:12 +01001710 const char *func;
Maxime Ripard08e9e612013-01-28 21:33:12 +01001711
1712 if (input)
1713 func = "gpio_in";
1714 else
1715 func = "gpio_out";
1716
Maxime Ripard814d4f22013-06-08 12:05:43 +02001717 desc = sunxi_pinctrl_desc_find_function_by_pin(pctl, offset, func);
1718 if (!desc)
1719 return -EINVAL;
Maxime Ripard08e9e612013-01-28 21:33:12 +01001720
1721 sunxi_pmx_set(pctldev, offset, desc->muxval);
1722
Maxime Ripard814d4f22013-06-08 12:05:43 +02001723 return 0;
Maxime Ripard08e9e612013-01-28 21:33:12 +01001724}
1725
Laurent Pinchart022ab142013-02-16 10:25:07 +01001726static const struct pinmux_ops sunxi_pmx_ops = {
Maxime Ripard0e37f882013-01-18 22:30:34 +01001727 .get_functions_count = sunxi_pmx_get_funcs_cnt,
1728 .get_function_name = sunxi_pmx_get_func_name,
1729 .get_function_groups = sunxi_pmx_get_func_groups,
1730 .enable = sunxi_pmx_enable,
Maxime Ripard08e9e612013-01-28 21:33:12 +01001731 .gpio_set_direction = sunxi_pmx_gpio_set_direction,
Maxime Ripard0e37f882013-01-18 22:30:34 +01001732};
1733
1734static struct pinctrl_desc sunxi_pctrl_desc = {
1735 .confops = &sunxi_pconf_ops,
1736 .pctlops = &sunxi_pctrl_ops,
1737 .pmxops = &sunxi_pmx_ops,
1738};
1739
Maxime Ripard08e9e612013-01-28 21:33:12 +01001740static int sunxi_pinctrl_gpio_request(struct gpio_chip *chip, unsigned offset)
1741{
1742 return pinctrl_request_gpio(chip->base + offset);
1743}
1744
1745static void sunxi_pinctrl_gpio_free(struct gpio_chip *chip, unsigned offset)
1746{
1747 pinctrl_free_gpio(chip->base + offset);
1748}
1749
1750static int sunxi_pinctrl_gpio_direction_input(struct gpio_chip *chip,
1751 unsigned offset)
1752{
1753 return pinctrl_gpio_direction_input(chip->base + offset);
1754}
1755
1756static int sunxi_pinctrl_gpio_get(struct gpio_chip *chip, unsigned offset)
1757{
1758 struct sunxi_pinctrl *pctl = dev_get_drvdata(chip->dev);
1759
1760 u32 reg = sunxi_data_reg(offset);
1761 u8 index = sunxi_data_offset(offset);
1762 u32 val = (readl(pctl->membase + reg) >> index) & DATA_PINS_MASK;
1763
1764 return val;
1765}
1766
1767static int sunxi_pinctrl_gpio_direction_output(struct gpio_chip *chip,
1768 unsigned offset, int value)
1769{
1770 return pinctrl_gpio_direction_output(chip->base + offset);
1771}
1772
1773static void sunxi_pinctrl_gpio_set(struct gpio_chip *chip,
1774 unsigned offset, int value)
1775{
1776 struct sunxi_pinctrl *pctl = dev_get_drvdata(chip->dev);
1777 u32 reg = sunxi_data_reg(offset);
1778 u8 index = sunxi_data_offset(offset);
1779
1780 writel((value & DATA_PINS_MASK) << index, pctl->membase + reg);
1781}
1782
Maxime Riparda0d72092013-02-03 12:10:11 +01001783static int sunxi_pinctrl_gpio_of_xlate(struct gpio_chip *gc,
1784 const struct of_phandle_args *gpiospec,
1785 u32 *flags)
1786{
1787 int pin, base;
1788
1789 base = PINS_PER_BANK * gpiospec->args[0];
1790 pin = base + gpiospec->args[1];
1791
1792 if (pin > (gc->base + gc->ngpio))
1793 return -EINVAL;
1794
1795 if (flags)
1796 *flags = gpiospec->args[2];
1797
1798 return pin;
1799}
1800
Maxime Ripard60242db2013-06-08 12:05:44 +02001801static int sunxi_pinctrl_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
1802{
1803 struct sunxi_pinctrl *pctl = dev_get_drvdata(chip->dev);
1804 struct sunxi_desc_function *desc;
1805
1806 if (offset > chip->ngpio)
1807 return -ENXIO;
1808
1809 desc = sunxi_pinctrl_desc_find_function_by_pin(pctl, offset, "irq");
1810 if (!desc)
1811 return -EINVAL;
1812
1813 pctl->irq_array[desc->irqnum] = offset;
1814
1815 dev_dbg(chip->dev, "%s: request IRQ for GPIO %d, return %d\n",
1816 chip->label, offset + chip->base, desc->irqnum);
1817
1818 return irq_find_mapping(pctl->domain, desc->irqnum);
1819}
1820
Maxime Ripard08e9e612013-01-28 21:33:12 +01001821static struct gpio_chip sunxi_pinctrl_gpio_chip = {
1822 .owner = THIS_MODULE,
1823 .request = sunxi_pinctrl_gpio_request,
1824 .free = sunxi_pinctrl_gpio_free,
1825 .direction_input = sunxi_pinctrl_gpio_direction_input,
1826 .direction_output = sunxi_pinctrl_gpio_direction_output,
1827 .get = sunxi_pinctrl_gpio_get,
1828 .set = sunxi_pinctrl_gpio_set,
Maxime Riparda0d72092013-02-03 12:10:11 +01001829 .of_xlate = sunxi_pinctrl_gpio_of_xlate,
Maxime Ripard60242db2013-06-08 12:05:44 +02001830 .to_irq = sunxi_pinctrl_gpio_to_irq,
Maxime Riparda0d72092013-02-03 12:10:11 +01001831 .of_gpio_n_cells = 3,
Maxime Ripard08e9e612013-01-28 21:33:12 +01001832 .can_sleep = 0,
1833};
1834
Maxime Ripard60242db2013-06-08 12:05:44 +02001835static int sunxi_pinctrl_irq_set_type(struct irq_data *d,
1836 unsigned int type)
1837{
1838 struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d);
1839 u32 reg = sunxi_irq_cfg_reg(d->hwirq);
1840 u8 index = sunxi_irq_cfg_offset(d->hwirq);
1841 u8 mode;
1842
1843 switch (type) {
1844 case IRQ_TYPE_EDGE_RISING:
1845 mode = IRQ_EDGE_RISING;
1846 break;
1847 case IRQ_TYPE_EDGE_FALLING:
1848 mode = IRQ_EDGE_FALLING;
1849 break;
1850 case IRQ_TYPE_EDGE_BOTH:
1851 mode = IRQ_EDGE_BOTH;
1852 break;
1853 case IRQ_TYPE_LEVEL_HIGH:
1854 mode = IRQ_LEVEL_HIGH;
1855 break;
1856 case IRQ_TYPE_LEVEL_LOW:
1857 mode = IRQ_LEVEL_LOW;
1858 break;
1859 default:
1860 return -EINVAL;
1861 }
1862
1863 writel((mode & IRQ_CFG_IRQ_MASK) << index, pctl->membase + reg);
1864
1865 return 0;
1866}
1867
1868static void sunxi_pinctrl_irq_mask_ack(struct irq_data *d)
1869{
1870 struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d);
1871 u32 ctrl_reg = sunxi_irq_ctrl_reg(d->hwirq);
1872 u8 ctrl_idx = sunxi_irq_ctrl_offset(d->hwirq);
1873 u32 status_reg = sunxi_irq_status_reg(d->hwirq);
1874 u8 status_idx = sunxi_irq_status_offset(d->hwirq);
1875 u32 val;
1876
1877 /* Mask the IRQ */
1878 val = readl(pctl->membase + ctrl_reg);
1879 writel(val & ~(1 << ctrl_idx), pctl->membase + ctrl_reg);
1880
1881 /* Clear the IRQ */
1882 writel(1 << status_idx, pctl->membase + status_reg);
1883}
1884
1885static void sunxi_pinctrl_irq_mask(struct irq_data *d)
1886{
1887 struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d);
1888 u32 reg = sunxi_irq_ctrl_reg(d->hwirq);
1889 u8 idx = sunxi_irq_ctrl_offset(d->hwirq);
1890 u32 val;
1891
1892 /* Mask the IRQ */
1893 val = readl(pctl->membase + reg);
1894 writel(val & ~(1 << idx), pctl->membase + reg);
1895}
1896
1897static void sunxi_pinctrl_irq_unmask(struct irq_data *d)
1898{
1899 struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d);
1900 struct sunxi_desc_function *func;
1901 u32 reg = sunxi_irq_ctrl_reg(d->hwirq);
1902 u8 idx = sunxi_irq_ctrl_offset(d->hwirq);
1903 u32 val;
1904
1905 func = sunxi_pinctrl_desc_find_function_by_pin(pctl,
1906 pctl->irq_array[d->hwirq],
1907 "irq");
1908
1909 /* Change muxing to INT mode */
1910 sunxi_pmx_set(pctl->pctl_dev, pctl->irq_array[d->hwirq], func->muxval);
1911
1912 /* Unmask the IRQ */
1913 val = readl(pctl->membase + reg);
1914 writel(val | (1 << idx), pctl->membase + reg);
1915}
1916
1917static struct irq_chip sunxi_pinctrl_irq_chip = {
1918 .irq_mask = sunxi_pinctrl_irq_mask,
1919 .irq_mask_ack = sunxi_pinctrl_irq_mask_ack,
1920 .irq_unmask = sunxi_pinctrl_irq_unmask,
1921 .irq_set_type = sunxi_pinctrl_irq_set_type,
1922};
1923
1924static void sunxi_pinctrl_irq_handler(unsigned irq, struct irq_desc *desc)
1925{
1926 struct sunxi_pinctrl *pctl = irq_get_handler_data(irq);
1927 const unsigned long reg = readl(pctl->membase + IRQ_STATUS_REG);
1928
1929 /* Clear all interrupts */
1930 writel(reg, pctl->membase + IRQ_STATUS_REG);
1931
1932 if (reg) {
1933 int irqoffset;
1934
1935 for_each_set_bit(irqoffset, &reg, SUNXI_IRQ_NUMBER) {
1936 int pin_irq = irq_find_mapping(pctl->domain, irqoffset);
1937 generic_handle_irq(pin_irq);
1938 }
1939 }
1940}
1941
Maxime Ripard0e37f882013-01-18 22:30:34 +01001942static struct of_device_id sunxi_pinctrl_match[] = {
Maxime Ripard9f5b6b32013-01-26 15:36:53 +01001943 { .compatible = "allwinner,sun4i-a10-pinctrl", .data = (void *)&sun4i_a10_pinctrl_data },
Maxime Ripardeaa3d842013-01-18 22:30:35 +01001944 { .compatible = "allwinner,sun5i-a13-pinctrl", .data = (void *)&sun5i_a13_pinctrl_data },
Maxime Ripard0e37f882013-01-18 22:30:34 +01001945 {}
1946};
1947MODULE_DEVICE_TABLE(of, sunxi_pinctrl_match);
1948
1949static int sunxi_pinctrl_add_function(struct sunxi_pinctrl *pctl,
1950 const char *name)
1951{
1952 struct sunxi_pinctrl_function *func = pctl->functions;
1953
1954 while (func->name) {
1955 /* function already there */
1956 if (strcmp(func->name, name) == 0) {
1957 func->ngroups++;
1958 return -EEXIST;
1959 }
1960 func++;
1961 }
1962
1963 func->name = name;
1964 func->ngroups = 1;
1965
1966 pctl->nfunctions++;
1967
1968 return 0;
1969}
1970
1971static int sunxi_pinctrl_build_state(struct platform_device *pdev)
1972{
1973 struct sunxi_pinctrl *pctl = platform_get_drvdata(pdev);
1974 int i;
1975
1976 pctl->ngroups = pctl->desc->npins;
1977
1978 /* Allocate groups */
1979 pctl->groups = devm_kzalloc(&pdev->dev,
1980 pctl->ngroups * sizeof(*pctl->groups),
1981 GFP_KERNEL);
1982 if (!pctl->groups)
1983 return -ENOMEM;
1984
1985 for (i = 0; i < pctl->desc->npins; i++) {
1986 const struct sunxi_desc_pin *pin = pctl->desc->pins + i;
1987 struct sunxi_pinctrl_group *group = pctl->groups + i;
1988
1989 group->name = pin->pin.name;
1990 group->pin = pin->pin.number;
1991 }
1992
1993 /*
1994 * We suppose that we won't have any more functions than pins,
1995 * we'll reallocate that later anyway
1996 */
1997 pctl->functions = devm_kzalloc(&pdev->dev,
1998 pctl->desc->npins * sizeof(*pctl->functions),
1999 GFP_KERNEL);
2000 if (!pctl->functions)
2001 return -ENOMEM;
2002
2003 /* Count functions and their associated groups */
2004 for (i = 0; i < pctl->desc->npins; i++) {
2005 const struct sunxi_desc_pin *pin = pctl->desc->pins + i;
2006 struct sunxi_desc_function *func = pin->functions;
2007
2008 while (func->name) {
2009 sunxi_pinctrl_add_function(pctl, func->name);
2010 func++;
2011 }
2012 }
2013
2014 pctl->functions = krealloc(pctl->functions,
2015 pctl->nfunctions * sizeof(*pctl->functions),
2016 GFP_KERNEL);
2017
2018 for (i = 0; i < pctl->desc->npins; i++) {
2019 const struct sunxi_desc_pin *pin = pctl->desc->pins + i;
2020 struct sunxi_desc_function *func = pin->functions;
2021
2022 while (func->name) {
2023 struct sunxi_pinctrl_function *func_item;
2024 const char **func_grp;
2025
2026 func_item = sunxi_pinctrl_find_function_by_name(pctl,
2027 func->name);
2028 if (!func_item)
2029 return -EINVAL;
2030
2031 if (!func_item->groups) {
2032 func_item->groups =
2033 devm_kzalloc(&pdev->dev,
2034 func_item->ngroups * sizeof(*func_item->groups),
2035 GFP_KERNEL);
2036 if (!func_item->groups)
2037 return -ENOMEM;
2038 }
2039
2040 func_grp = func_item->groups;
2041 while (*func_grp)
2042 func_grp++;
2043
2044 *func_grp = pin->pin.name;
2045 func++;
2046 }
2047 }
2048
2049 return 0;
2050}
2051
2052static int sunxi_pinctrl_probe(struct platform_device *pdev)
2053{
2054 struct device_node *node = pdev->dev.of_node;
2055 const struct of_device_id *device;
2056 struct pinctrl_pin_desc *pins;
2057 struct sunxi_pinctrl *pctl;
Maxime Ripard08e9e612013-01-28 21:33:12 +01002058 int i, ret, last_pin;
Emilio López950707c2013-03-22 11:20:40 -03002059 struct clk *clk;
Maxime Ripard0e37f882013-01-18 22:30:34 +01002060
2061 pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL);
2062 if (!pctl)
2063 return -ENOMEM;
2064 platform_set_drvdata(pdev, pctl);
2065
2066 pctl->membase = of_iomap(node, 0);
2067 if (!pctl->membase)
2068 return -ENOMEM;
2069
2070 device = of_match_device(sunxi_pinctrl_match, &pdev->dev);
2071 if (!device)
2072 return -ENODEV;
2073
2074 pctl->desc = (struct sunxi_pinctrl_desc *)device->data;
2075
2076 ret = sunxi_pinctrl_build_state(pdev);
2077 if (ret) {
2078 dev_err(&pdev->dev, "dt probe failed: %d\n", ret);
2079 return ret;
2080 }
2081
2082 pins = devm_kzalloc(&pdev->dev,
2083 pctl->desc->npins * sizeof(*pins),
2084 GFP_KERNEL);
2085 if (!pins)
2086 return -ENOMEM;
2087
2088 for (i = 0; i < pctl->desc->npins; i++)
2089 pins[i] = pctl->desc->pins[i].pin;
2090
2091 sunxi_pctrl_desc.name = dev_name(&pdev->dev);
2092 sunxi_pctrl_desc.owner = THIS_MODULE;
2093 sunxi_pctrl_desc.pins = pins;
2094 sunxi_pctrl_desc.npins = pctl->desc->npins;
2095 pctl->dev = &pdev->dev;
2096 pctl->pctl_dev = pinctrl_register(&sunxi_pctrl_desc,
2097 &pdev->dev, pctl);
2098 if (!pctl->pctl_dev) {
2099 dev_err(&pdev->dev, "couldn't register pinctrl driver\n");
2100 return -EINVAL;
2101 }
2102
Maxime Ripard08e9e612013-01-28 21:33:12 +01002103 pctl->chip = devm_kzalloc(&pdev->dev, sizeof(*pctl->chip), GFP_KERNEL);
2104 if (!pctl->chip) {
2105 ret = -ENOMEM;
2106 goto pinctrl_error;
2107 }
2108
2109 last_pin = pctl->desc->pins[pctl->desc->npins - 1].pin.number;
2110 pctl->chip = &sunxi_pinctrl_gpio_chip;
2111 pctl->chip->ngpio = round_up(last_pin, PINS_PER_BANK);
2112 pctl->chip->label = dev_name(&pdev->dev);
2113 pctl->chip->dev = &pdev->dev;
2114 pctl->chip->base = 0;
2115
2116 ret = gpiochip_add(pctl->chip);
2117 if (ret)
2118 goto pinctrl_error;
2119
2120 for (i = 0; i < pctl->desc->npins; i++) {
2121 const struct sunxi_desc_pin *pin = pctl->desc->pins + i;
2122
2123 ret = gpiochip_add_pin_range(pctl->chip, dev_name(&pdev->dev),
2124 pin->pin.number,
2125 pin->pin.number, 1);
2126 if (ret)
2127 goto gpiochip_error;
2128 }
2129
Emilio López950707c2013-03-22 11:20:40 -03002130 clk = devm_clk_get(&pdev->dev, NULL);
Wei Yongjund72f88a2013-05-23 17:32:14 +08002131 if (IS_ERR(clk)) {
2132 ret = PTR_ERR(clk);
Emilio López950707c2013-03-22 11:20:40 -03002133 goto gpiochip_error;
Wei Yongjund72f88a2013-05-23 17:32:14 +08002134 }
Emilio López950707c2013-03-22 11:20:40 -03002135
2136 clk_prepare_enable(clk);
2137
Maxime Ripard60242db2013-06-08 12:05:44 +02002138 pctl->irq = irq_of_parse_and_map(node, 0);
2139 if (!pctl->irq) {
2140 ret = -EINVAL;
2141 goto gpiochip_error;
2142 }
2143
2144 pctl->domain = irq_domain_add_linear(node, SUNXI_IRQ_NUMBER,
2145 &irq_domain_simple_ops, NULL);
2146 if (!pctl->domain) {
2147 dev_err(&pdev->dev, "Couldn't register IRQ domain\n");
2148 ret = -ENOMEM;
2149 goto gpiochip_error;
2150 }
2151
2152 for (i = 0; i < SUNXI_IRQ_NUMBER; i++) {
2153 int irqno = irq_create_mapping(pctl->domain, i);
2154
2155 irq_set_chip_and_handler(irqno, &sunxi_pinctrl_irq_chip,
2156 handle_simple_irq);
2157 irq_set_chip_data(irqno, pctl);
2158 };
2159
2160 irq_set_chained_handler(pctl->irq, sunxi_pinctrl_irq_handler);
2161 irq_set_handler_data(pctl->irq, pctl);
2162
Maxime Ripard08e9e612013-01-28 21:33:12 +01002163 dev_info(&pdev->dev, "initialized sunXi PIO driver\n");
Maxime Ripard0e37f882013-01-18 22:30:34 +01002164
2165 return 0;
Maxime Ripard08e9e612013-01-28 21:33:12 +01002166
2167gpiochip_error:
Axel Lin97fc4632013-05-19 13:58:37 +08002168 if (gpiochip_remove(pctl->chip))
2169 dev_err(&pdev->dev, "failed to remove gpio chip\n");
Maxime Ripard08e9e612013-01-28 21:33:12 +01002170pinctrl_error:
2171 pinctrl_unregister(pctl->pctl_dev);
2172 return ret;
Maxime Ripard0e37f882013-01-18 22:30:34 +01002173}
2174
2175static struct platform_driver sunxi_pinctrl_driver = {
2176 .probe = sunxi_pinctrl_probe,
2177 .driver = {
2178 .name = "sunxi-pinctrl",
2179 .owner = THIS_MODULE,
2180 .of_match_table = sunxi_pinctrl_match,
2181 },
2182};
2183module_platform_driver(sunxi_pinctrl_driver);
2184
2185MODULE_AUTHOR("Maxime Ripard <maxime.ripard@free-electrons.com");
2186MODULE_DESCRIPTION("Allwinner A1X pinctrl driver");
2187MODULE_LICENSE("GPL");