1
2
3
4
5
6
7#include <common.h>
8#include <dm.h>
9#include <dm/pinctrl.h>
10
11#include "pinctrl-uniphier.h"
12
13static const unsigned emmc_pins[] = {40, 41, 42, 43, 51, 52, 53};
14static const int emmc_muxvals[] = {1, 1, 1, 1, 1, 1, 1};
15static const unsigned emmc_dat8_pins[] = {44, 45, 46, 47};
16static const int emmc_dat8_muxvals[] = {1, 1, 1, 1};
17static const unsigned ether_mii_pins[] = {160, 161, 162, 163, 164, 165, 166,
18 167, 168, 169, 170, 171, 172, 173,
19 174, 175, 176, 177, 178, 179};
20static const int ether_mii_muxvals[] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
21 0, 0, 0, 0, 0, 0, 0};
22static const unsigned ether_rgmii_pins[] = {160, 161, 162, 163, 164, 165, 167,
23 168, 169, 170, 171, 172, 176, 177,
24 178, 179};
25static const int ether_rgmii_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
26 0, 0, 0, 0};
27static const unsigned ether_rmii_pins[] = {160, 161, 162, 165, 168, 169, 172,
28 173, 176, 177, 178, 179};
29static const int ether_rmii_muxvals[] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
30static const unsigned ether_rmiib_pins[] = {161, 162, 165, 167, 168, 169, 172,
31 173, 176, 177, 178, 179};
32static const int ether_rmiib_muxvals[] = {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0};
33static const unsigned i2c0_pins[] = {142, 143};
34static const int i2c0_muxvals[] = {0, 0};
35static const unsigned i2c1_pins[] = {144, 145};
36static const int i2c1_muxvals[] = {0, 0};
37static const unsigned i2c2_pins[] = {146, 147};
38static const int i2c2_muxvals[] = {0, 0};
39static const unsigned i2c3_pins[] = {148, 149};
40static const int i2c3_muxvals[] = {0, 0};
41static const unsigned i2c6_pins[] = {308, 309};
42static const int i2c6_muxvals[] = {6, 6};
43static const unsigned nand_pins[] = {40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
44 50, 51, 52, 53, 54};
45static const int nand_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
46static const unsigned nand_cs1_pins[] = {131, 132};
47static const int nand_cs1_muxvals[] = {1, 1};
48static const unsigned sd_pins[] = {150, 151, 152, 153, 154, 155, 156, 157, 158};
49static const int sd_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
50static const unsigned sd1_pins[] = {319, 320, 321, 322, 323, 324, 325, 326,
51 327};
52static const int sd1_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
53static const unsigned spi0_pins[] = {199, 200, 201, 202};
54static const int spi0_muxvals[] = {11, 11, 11, 11};
55static const unsigned spi1_pins[] = {195, 196, 197, 198, 235, 238, 239};
56static const int spi1_muxvals[] = {11, 11, 11, 11, 11, 11, 11};
57static const unsigned system_bus_pins[] = {25, 26, 27, 28, 29, 30, 31, 32, 33,
58 34, 35, 36, 37, 38};
59static const int system_bus_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
60 0};
61static const unsigned system_bus_cs0_pins[] = {318};
62static const int system_bus_cs0_muxvals[] = {5};
63static const unsigned system_bus_cs1_pins[] = {24};
64static const int system_bus_cs1_muxvals[] = {0};
65static const unsigned system_bus_cs2_pins[] = {315};
66static const int system_bus_cs2_muxvals[] = {5};
67static const unsigned system_bus_cs3_pins[] = {313};
68static const int system_bus_cs3_muxvals[] = {5};
69static const unsigned system_bus_cs4_pins[] = {305};
70static const int system_bus_cs4_muxvals[] = {5};
71static const unsigned system_bus_cs5_pins[] = {303};
72static const int system_bus_cs5_muxvals[] = {6};
73static const unsigned system_bus_cs6_pins[] = {307};
74static const int system_bus_cs6_muxvals[] = {6};
75static const unsigned system_bus_cs7_pins[] = {312};
76static const int system_bus_cs7_muxvals[] = {6};
77static const unsigned uart0_pins[] = {127, 128};
78static const int uart0_muxvals[] = {0, 0};
79static const unsigned uart1_pins[] = {129, 130};
80static const int uart1_muxvals[] = {0, 0};
81static const unsigned uart2_pins[] = {131, 132};
82static const int uart2_muxvals[] = {0, 0};
83static const unsigned uart3_pins[] = {88, 89};
84static const int uart3_muxvals[] = {2, 2};
85static const unsigned usb0_pins[] = {180, 181};
86static const int usb0_muxvals[] = {0, 0};
87static const unsigned usb1_pins[] = {182, 183};
88static const int usb1_muxvals[] = {0, 0};
89static const unsigned usb2_pins[] = {184, 185};
90static const int usb2_muxvals[] = {0, 0};
91static const unsigned usb3_pins[] = {186, 187};
92static const int usb3_muxvals[] = {0, 0};
93
94static const struct uniphier_pinctrl_group uniphier_pro4_groups[] = {
95 UNIPHIER_PINCTRL_GROUP_SPL(emmc),
96 UNIPHIER_PINCTRL_GROUP_SPL(emmc_dat8),
97 UNIPHIER_PINCTRL_GROUP(ether_mii),
98 UNIPHIER_PINCTRL_GROUP(ether_rgmii),
99 UNIPHIER_PINCTRL_GROUP(ether_rmii),
100 UNIPHIER_PINCTRL_GROUP(ether_rmiib),
101 UNIPHIER_PINCTRL_GROUP(i2c0),
102 UNIPHIER_PINCTRL_GROUP(i2c1),
103 UNIPHIER_PINCTRL_GROUP(i2c2),
104 UNIPHIER_PINCTRL_GROUP(i2c3),
105 UNIPHIER_PINCTRL_GROUP(i2c6),
106 UNIPHIER_PINCTRL_GROUP(nand),
107 UNIPHIER_PINCTRL_GROUP(nand_cs1),
108 UNIPHIER_PINCTRL_GROUP(sd),
109 UNIPHIER_PINCTRL_GROUP(sd1),
110 UNIPHIER_PINCTRL_GROUP(spi0),
111 UNIPHIER_PINCTRL_GROUP(spi1),
112 UNIPHIER_PINCTRL_GROUP(system_bus),
113 UNIPHIER_PINCTRL_GROUP(system_bus_cs0),
114 UNIPHIER_PINCTRL_GROUP(system_bus_cs1),
115 UNIPHIER_PINCTRL_GROUP(system_bus_cs2),
116 UNIPHIER_PINCTRL_GROUP(system_bus_cs3),
117 UNIPHIER_PINCTRL_GROUP(system_bus_cs4),
118 UNIPHIER_PINCTRL_GROUP(system_bus_cs5),
119 UNIPHIER_PINCTRL_GROUP(system_bus_cs6),
120 UNIPHIER_PINCTRL_GROUP(system_bus_cs7),
121 UNIPHIER_PINCTRL_GROUP_SPL(uart0),
122 UNIPHIER_PINCTRL_GROUP_SPL(uart1),
123 UNIPHIER_PINCTRL_GROUP_SPL(uart2),
124 UNIPHIER_PINCTRL_GROUP_SPL(uart3),
125 UNIPHIER_PINCTRL_GROUP(usb0),
126 UNIPHIER_PINCTRL_GROUP(usb1),
127 UNIPHIER_PINCTRL_GROUP(usb2),
128 UNIPHIER_PINCTRL_GROUP(usb3),
129};
130
131static const char * const uniphier_pro4_functions[] = {
132 UNIPHIER_PINMUX_FUNCTION_SPL(emmc),
133 UNIPHIER_PINMUX_FUNCTION(ether_mii),
134 UNIPHIER_PINMUX_FUNCTION(ether_rgmii),
135 UNIPHIER_PINMUX_FUNCTION(ether_rmii),
136 UNIPHIER_PINMUX_FUNCTION(i2c0),
137 UNIPHIER_PINMUX_FUNCTION(i2c1),
138 UNIPHIER_PINMUX_FUNCTION(i2c2),
139 UNIPHIER_PINMUX_FUNCTION(i2c3),
140 UNIPHIER_PINMUX_FUNCTION(i2c6),
141 UNIPHIER_PINMUX_FUNCTION(nand),
142 UNIPHIER_PINMUX_FUNCTION(sd),
143 UNIPHIER_PINMUX_FUNCTION(sd1),
144 UNIPHIER_PINMUX_FUNCTION(spi0),
145 UNIPHIER_PINMUX_FUNCTION(spi1),
146 UNIPHIER_PINMUX_FUNCTION(system_bus),
147 UNIPHIER_PINMUX_FUNCTION_SPL(uart0),
148 UNIPHIER_PINMUX_FUNCTION_SPL(uart1),
149 UNIPHIER_PINMUX_FUNCTION_SPL(uart2),
150 UNIPHIER_PINMUX_FUNCTION_SPL(uart3),
151 UNIPHIER_PINMUX_FUNCTION(usb0),
152 UNIPHIER_PINMUX_FUNCTION(usb1),
153 UNIPHIER_PINMUX_FUNCTION(usb2),
154 UNIPHIER_PINMUX_FUNCTION(usb3),
155};
156
157static struct uniphier_pinctrl_socdata uniphier_pro4_pinctrl_socdata = {
158 .groups = uniphier_pro4_groups,
159 .groups_count = ARRAY_SIZE(uniphier_pro4_groups),
160 .functions = uniphier_pro4_functions,
161 .functions_count = ARRAY_SIZE(uniphier_pro4_functions),
162 .caps = UNIPHIER_PINCTRL_CAPS_DBGMUX_SEPARATE,
163};
164
165static int uniphier_pro4_pinctrl_probe(struct udevice *dev)
166{
167 return uniphier_pinctrl_probe(dev, &uniphier_pro4_pinctrl_socdata);
168}
169
170static const struct udevice_id uniphier_pro4_pinctrl_match[] = {
171 { .compatible = "socionext,uniphier-pro4-pinctrl" },
172 { }
173};
174
175U_BOOT_DRIVER(uniphier_pro4_pinctrl) = {
176 .name = "uniphier-pro4-pinctrl",
177 .id = UCLASS_PINCTRL,
178 .of_match = of_match_ptr(uniphier_pro4_pinctrl_match),
179 .probe = uniphier_pro4_pinctrl_probe,
180 .priv_auto_alloc_size = sizeof(struct uniphier_pinctrl_priv),
181 .ops = &uniphier_pinctrl_ops,
182#if !CONFIG_IS_ENABLED(OF_CONTROL)
183 .flags = DM_FLAG_PRE_RELOC,
184#endif
185};
186