dm thin metadata: fix __udivdi3 undefined on 32-bit
[linux/fpc-iii.git] / drivers / pinctrl / berlin / berlin-bg2cd.c
blobad8c7586137312fd77780b83a1b4b4795f837e0f
1 /*
2 * Marvell Berlin BG2CD pinctrl driver.
4 * Copyright (C) 2014 Marvell Technology Group Ltd.
6 * Antoine Ténart <antoine.tenart@free-electrons.com>
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.
13 #include <linux/module.h>
14 #include <linux/of_device.h>
15 #include <linux/platform_device.h>
16 #include <linux/regmap.h>
18 #include "berlin.h"
20 static const struct berlin_desc_group berlin2cd_soc_pinctrl_groups[] = {
21 /* G */
22 BERLIN_PINCTRL_GROUP("G0", 0x00, 0x3, 0x00,
23 BERLIN_PINCTRL_FUNCTION(0x0, "jtag"),
24 BERLIN_PINCTRL_FUNCTION(0x1, "gpio"),
25 BERLIN_PINCTRL_FUNCTION(0x2, "led"),
26 BERLIN_PINCTRL_FUNCTION(0x3, "pwm")),
27 BERLIN_PINCTRL_GROUP("G1", 0x00, 0x3, 0x03,
28 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
29 BERLIN_PINCTRL_FUNCTION(0x1, "sd0"),
30 BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
31 BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
32 BERLIN_PINCTRL_GROUP("G2", 0x00, 0x3, 0x06,
33 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
34 BERLIN_PINCTRL_FUNCTION(0x1, "sd0"),
35 BERLIN_PINCTRL_FUNCTION(0x2, "fe"),
36 BERLIN_PINCTRL_FUNCTION(0x3, "pll"),
37 BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
38 BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
39 BERLIN_PINCTRL_GROUP("G3", 0x00, 0x3, 0x09,
40 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
41 BERLIN_PINCTRL_FUNCTION(0x1, "sd0"),
42 BERLIN_PINCTRL_FUNCTION(0x2, "twsi2"),
43 BERLIN_PINCTRL_FUNCTION(0x3, "pll"),
44 BERLIN_PINCTRL_FUNCTION(0x4, "fe"),
45 BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
46 BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
47 BERLIN_PINCTRL_GROUP("G4", 0x00, 0x3, 0x0c,
48 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
49 BERLIN_PINCTRL_FUNCTION(0x1, "sd0"),
50 BERLIN_PINCTRL_FUNCTION(0x2, "twsi3"),
51 BERLIN_PINCTRL_FUNCTION(0x3, "pll"),
52 BERLIN_PINCTRL_FUNCTION(0x4, "pwm"),
53 BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
54 BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
55 BERLIN_PINCTRL_GROUP("G5", 0x00, 0x3, 0x0f,
56 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
57 BERLIN_PINCTRL_FUNCTION(0x1, "sd0"),
58 BERLIN_PINCTRL_FUNCTION(0x2, "twsi3"),
59 BERLIN_PINCTRL_FUNCTION(0x3, "arc"),
60 BERLIN_PINCTRL_FUNCTION(0x4, "pwm"),
61 BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
62 BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
63 BERLIN_PINCTRL_GROUP("G6", 0x00, 0x3, 0x12,
64 BERLIN_PINCTRL_FUNCTION(0x0, "uart0"), /* RX/TX */
65 BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
66 BERLIN_PINCTRL_GROUP("G7", 0x00, 0x3, 0x15,
67 BERLIN_PINCTRL_FUNCTION(0x0, "eddc"),
68 BERLIN_PINCTRL_FUNCTION(0x1, "twsi1"),
69 BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
70 BERLIN_PINCTRL_GROUP("G8", 0x00, 0x3, 0x18,
71 BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* SS0n */
72 BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
73 BERLIN_PINCTRL_GROUP("G9", 0x00, 0x3, 0x1b,
74 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
75 BERLIN_PINCTRL_FUNCTION(0x1, "spi1"), /* SS1n/SS2n */
76 BERLIN_PINCTRL_FUNCTION(0x3, "twsi0")),
77 BERLIN_PINCTRL_GROUP("G10", 0x00, 0x2, 0x1e,
78 BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* CLK */
79 BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
80 BERLIN_PINCTRL_GROUP("G11", 0x04, 0x2, 0x00,
81 BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* SDI/SDO */
82 BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
83 BERLIN_PINCTRL_GROUP("G12", 0x04, 0x3, 0x02,
84 BERLIN_PINCTRL_FUNCTION(0x0, "usb1"),
85 BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
86 BERLIN_PINCTRL_GROUP("G13", 0x04, 0x3, 0x05,
87 BERLIN_PINCTRL_FUNCTION(0x0, "nand"),
88 BERLIN_PINCTRL_FUNCTION(0x1, "usb0_dbg"),
89 BERLIN_PINCTRL_FUNCTION(0x2, "usb1_dbg")),
90 BERLIN_PINCTRL_GROUP("G14", 0x04, 0x1, 0x08,
91 BERLIN_PINCTRL_FUNCTION(0x0, "nand"),
92 BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
93 BERLIN_PINCTRL_GROUP("G15", 0x04, 0x3, 0x09,
94 BERLIN_PINCTRL_FUNCTION(0x0, "jtag"),
95 BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
96 BERLIN_PINCTRL_GROUP("G16", 0x04, 0x3, 0x0c,
97 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
98 BERLIN_PINCTRL_GROUP("G17", 0x04, 0x3, 0x0f,
99 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
100 BERLIN_PINCTRL_GROUP("G18", 0x04, 0x2, 0x12,
101 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
102 BERLIN_PINCTRL_GROUP("G19", 0x04, 0x2, 0x14,
103 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
104 BERLIN_PINCTRL_GROUP("G20", 0x04, 0x2, 0x16,
105 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
106 BERLIN_PINCTRL_GROUP("G21", 0x04, 0x3, 0x18,
107 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
108 BERLIN_PINCTRL_GROUP("G22", 0x04, 0x3, 0x1b,
109 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
110 BERLIN_PINCTRL_GROUP("G23", 0x08, 0x3, 0x00,
111 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
112 BERLIN_PINCTRL_GROUP("G24", 0x08, 0x2, 0x03,
113 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
114 BERLIN_PINCTRL_GROUP("G25", 0x08, 0x2, 0x05,
115 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
116 BERLIN_PINCTRL_GROUP("G26", 0x08, 0x1, 0x07,
117 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
118 BERLIN_PINCTRL_GROUP("G27", 0x08, 0x2, 0x08,
119 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
120 BERLIN_PINCTRL_GROUP("G28", 0x08, 0x3, 0x0a,
121 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
122 BERLIN_PINCTRL_GROUP("G29", 0x08, 0x3, 0x0d,
123 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
126 static const struct berlin_desc_group berlin2cd_sysmgr_pinctrl_groups[] = {
127 /* GSM */
128 BERLIN_PINCTRL_GROUP("GSM0", 0x40, 0x2, 0x00,
129 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
130 BERLIN_PINCTRL_GROUP("GSM1", 0x40, 0x2, 0x02,
131 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
132 BERLIN_PINCTRL_GROUP("GSM2", 0x40, 0x2, 0x04,
133 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
134 BERLIN_PINCTRL_GROUP("GSM3", 0x40, 0x2, 0x06,
135 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
136 BERLIN_PINCTRL_GROUP("GSM4", 0x40, 0x2, 0x08,
137 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
138 BERLIN_PINCTRL_GROUP("GSM5", 0x40, 0x2, 0x0a,
139 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
140 BERLIN_PINCTRL_GROUP("GSM6", 0x40, 0x2, 0x0c,
141 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
142 BERLIN_PINCTRL_GROUP("GSM7", 0x40, 0x1, 0x0e,
143 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
144 BERLIN_PINCTRL_GROUP("GSM8", 0x40, 0x1, 0x0f,
145 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
146 BERLIN_PINCTRL_GROUP("GSM9", 0x40, 0x1, 0x10,
147 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
148 BERLIN_PINCTRL_GROUP("GSM10", 0x40, 0x1, 0x11,
149 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
150 BERLIN_PINCTRL_GROUP("GSM11", 0x40, 0x1, 0x12,
151 BERLIN_PINCTRL_FUNCTION_UNKNOWN),
154 static const struct berlin_pinctrl_desc berlin2cd_soc_pinctrl_data = {
155 .groups = berlin2cd_soc_pinctrl_groups,
156 .ngroups = ARRAY_SIZE(berlin2cd_soc_pinctrl_groups),
159 static const struct berlin_pinctrl_desc berlin2cd_sysmgr_pinctrl_data = {
160 .groups = berlin2cd_sysmgr_pinctrl_groups,
161 .ngroups = ARRAY_SIZE(berlin2cd_sysmgr_pinctrl_groups),
164 static const struct of_device_id berlin2cd_pinctrl_match[] = {
166 .compatible = "marvell,berlin2cd-soc-pinctrl",
167 .data = &berlin2cd_soc_pinctrl_data
170 .compatible = "marvell,berlin2cd-system-pinctrl",
171 .data = &berlin2cd_sysmgr_pinctrl_data
175 MODULE_DEVICE_TABLE(of, berlin2cd_pinctrl_match);
177 static int berlin2cd_pinctrl_probe(struct platform_device *pdev)
179 const struct of_device_id *match =
180 of_match_device(berlin2cd_pinctrl_match, &pdev->dev);
182 return berlin_pinctrl_probe(pdev, match->data);
185 static struct platform_driver berlin2cd_pinctrl_driver = {
186 .probe = berlin2cd_pinctrl_probe,
187 .driver = {
188 .name = "berlin-bg2cd-pinctrl",
189 .of_match_table = berlin2cd_pinctrl_match,
192 module_platform_driver(berlin2cd_pinctrl_driver);
194 MODULE_AUTHOR("Antoine Ténart <antoine.tenart@free-electrons.com>");
195 MODULE_DESCRIPTION("Marvell Berlin BG2CD pinctrl driver");
196 MODULE_LICENSE("GPL");