blob: 2704a50749e5182b7ccd7a15ee2d49f24598265a [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Masahiro Yamada9a9999e2015-09-11 20:17:34 +09002/*
Masahiro Yamadafa1f73f2016-07-19 21:56:13 +09003 * Copyright (C) 2015-2016 Socionext Inc.
4 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada9a9999e2015-09-11 20:17:34 +09005 */
6
Simon Glass11c89f32017-05-17 17:18:03 -06007#include <dm.h>
Masahiro Yamada9a9999e2015-09-11 20:17:34 +09008#include <dm/pinctrl.h>
9
10#include "pinctrl-uniphier.h"
11
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090012static const unsigned emmc_pins[] = {40, 41, 42, 43, 51, 52, 53};
Masahiro Yamada9447e132016-06-29 19:38:59 +090013static const int emmc_muxvals[] = {1, 1, 1, 1, 1, 1, 1};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090014static const unsigned emmc_dat8_pins[] = {44, 45, 46, 47};
Masahiro Yamada9447e132016-06-29 19:38:59 +090015static const int emmc_dat8_muxvals[] = {1, 1, 1, 1};
Masahiro Yamadacc94a982016-06-29 19:39:01 +090016static const unsigned ether_mii_pins[] = {160, 161, 162, 163, 164, 165, 166,
17 167, 168, 169, 170, 171, 172, 173,
18 174, 175, 176, 177, 178, 179};
19static const int ether_mii_muxvals[] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
20 0, 0, 0, 0, 0, 0, 0};
21static const unsigned ether_rgmii_pins[] = {160, 161, 162, 163, 164, 165, 167,
22 168, 169, 170, 171, 172, 176, 177,
23 178, 179};
24static const int ether_rgmii_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
25 0, 0, 0, 0};
26static const unsigned ether_rmii_pins[] = {160, 161, 162, 165, 168, 169, 172,
27 173, 176, 177, 178, 179};
28static const int ether_rmii_muxvals[] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
29static const unsigned ether_rmiib_pins[] = {161, 162, 165, 167, 168, 169, 172,
30 173, 176, 177, 178, 179};
31static const int ether_rmiib_muxvals[] = {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090032static const unsigned i2c0_pins[] = {142, 143};
Masahiro Yamada9447e132016-06-29 19:38:59 +090033static const int i2c0_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090034static const unsigned i2c1_pins[] = {144, 145};
Masahiro Yamada9447e132016-06-29 19:38:59 +090035static const int i2c1_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090036static const unsigned i2c2_pins[] = {146, 147};
Masahiro Yamada9447e132016-06-29 19:38:59 +090037static const int i2c2_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090038static const unsigned i2c3_pins[] = {148, 149};
Masahiro Yamada9447e132016-06-29 19:38:59 +090039static const int i2c3_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090040static const unsigned i2c6_pins[] = {308, 309};
Masahiro Yamada9447e132016-06-29 19:38:59 +090041static const int i2c6_muxvals[] = {6, 6};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090042static const unsigned nand_pins[] = {40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
43 50, 51, 52, 53, 54};
Masahiro Yamada9447e132016-06-29 19:38:59 +090044static const int nand_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090045static const unsigned nand_cs1_pins[] = {131, 132};
Masahiro Yamada9447e132016-06-29 19:38:59 +090046static const int nand_cs1_muxvals[] = {1, 1};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090047static const unsigned sd_pins[] = {150, 151, 152, 153, 154, 155, 156, 157, 158};
Masahiro Yamada9447e132016-06-29 19:38:59 +090048static const int sd_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090049static const unsigned sd1_pins[] = {319, 320, 321, 322, 323, 324, 325, 326,
50 327};
Masahiro Yamada9447e132016-06-29 19:38:59 +090051static const int sd1_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
Kunihiko Hayashi9cc3bf62019-06-11 10:06:13 +090052static const unsigned spi0_pins[] = {199, 200, 201, 202};
53static const int spi0_muxvals[] = {11, 11, 11, 11};
54static const unsigned spi1_pins[] = {195, 196, 197, 198, 235, 238, 239};
55static const int spi1_muxvals[] = {11, 11, 11, 11, 11, 11, 11};
Masahiro Yamada82a51782016-09-14 01:06:04 +090056static const unsigned system_bus_pins[] = {25, 26, 27, 28, 29, 30, 31, 32, 33,
57 34, 35, 36, 37, 38};
58static const int system_bus_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
59 0};
60static const unsigned system_bus_cs0_pins[] = {318};
61static const int system_bus_cs0_muxvals[] = {5};
62static const unsigned system_bus_cs1_pins[] = {24};
63static const int system_bus_cs1_muxvals[] = {0};
64static const unsigned system_bus_cs2_pins[] = {315};
65static const int system_bus_cs2_muxvals[] = {5};
66static const unsigned system_bus_cs3_pins[] = {313};
67static const int system_bus_cs3_muxvals[] = {5};
68static const unsigned system_bus_cs4_pins[] = {305};
69static const int system_bus_cs4_muxvals[] = {5};
70static const unsigned system_bus_cs5_pins[] = {303};
71static const int system_bus_cs5_muxvals[] = {6};
72static const unsigned system_bus_cs6_pins[] = {307};
73static const int system_bus_cs6_muxvals[] = {6};
74static const unsigned system_bus_cs7_pins[] = {312};
75static const int system_bus_cs7_muxvals[] = {6};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090076static const unsigned uart0_pins[] = {127, 128};
Masahiro Yamada9447e132016-06-29 19:38:59 +090077static const int uart0_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090078static const unsigned uart1_pins[] = {129, 130};
Masahiro Yamada9447e132016-06-29 19:38:59 +090079static const int uart1_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090080static const unsigned uart2_pins[] = {131, 132};
Masahiro Yamada9447e132016-06-29 19:38:59 +090081static const int uart2_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090082static const unsigned uart3_pins[] = {88, 89};
Masahiro Yamada9447e132016-06-29 19:38:59 +090083static const int uart3_muxvals[] = {2, 2};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090084static const unsigned usb0_pins[] = {180, 181};
Masahiro Yamada9447e132016-06-29 19:38:59 +090085static const int usb0_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090086static const unsigned usb1_pins[] = {182, 183};
Masahiro Yamada9447e132016-06-29 19:38:59 +090087static const int usb1_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090088static const unsigned usb2_pins[] = {184, 185};
Masahiro Yamada9447e132016-06-29 19:38:59 +090089static const int usb2_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090090static const unsigned usb3_pins[] = {186, 187};
Masahiro Yamada9447e132016-06-29 19:38:59 +090091static const int usb3_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090092
Masahiro Yamada8721b512016-04-21 14:43:10 +090093static const struct uniphier_pinctrl_group uniphier_pro4_groups[] = {
Masahiro Yamada65ef4f72016-06-29 19:39:00 +090094 UNIPHIER_PINCTRL_GROUP_SPL(emmc),
95 UNIPHIER_PINCTRL_GROUP_SPL(emmc_dat8),
Masahiro Yamadacc94a982016-06-29 19:39:01 +090096 UNIPHIER_PINCTRL_GROUP(ether_mii),
97 UNIPHIER_PINCTRL_GROUP(ether_rgmii),
98 UNIPHIER_PINCTRL_GROUP(ether_rmii),
99 UNIPHIER_PINCTRL_GROUP(ether_rmiib),
Masahiro Yamada9a9999e2015-09-11 20:17:34 +0900100 UNIPHIER_PINCTRL_GROUP(i2c0),
101 UNIPHIER_PINCTRL_GROUP(i2c1),
102 UNIPHIER_PINCTRL_GROUP(i2c2),
103 UNIPHIER_PINCTRL_GROUP(i2c3),
104 UNIPHIER_PINCTRL_GROUP(i2c6),
105 UNIPHIER_PINCTRL_GROUP(nand),
106 UNIPHIER_PINCTRL_GROUP(nand_cs1),
107 UNIPHIER_PINCTRL_GROUP(sd),
108 UNIPHIER_PINCTRL_GROUP(sd1),
Kunihiko Hayashi9cc3bf62019-06-11 10:06:13 +0900109 UNIPHIER_PINCTRL_GROUP(spi0),
110 UNIPHIER_PINCTRL_GROUP(spi1),
Masahiro Yamada82a51782016-09-14 01:06:04 +0900111 UNIPHIER_PINCTRL_GROUP(system_bus),
112 UNIPHIER_PINCTRL_GROUP(system_bus_cs0),
113 UNIPHIER_PINCTRL_GROUP(system_bus_cs1),
114 UNIPHIER_PINCTRL_GROUP(system_bus_cs2),
115 UNIPHIER_PINCTRL_GROUP(system_bus_cs3),
116 UNIPHIER_PINCTRL_GROUP(system_bus_cs4),
117 UNIPHIER_PINCTRL_GROUP(system_bus_cs5),
118 UNIPHIER_PINCTRL_GROUP(system_bus_cs6),
119 UNIPHIER_PINCTRL_GROUP(system_bus_cs7),
Masahiro Yamada65ef4f72016-06-29 19:39:00 +0900120 UNIPHIER_PINCTRL_GROUP_SPL(uart0),
121 UNIPHIER_PINCTRL_GROUP_SPL(uart1),
122 UNIPHIER_PINCTRL_GROUP_SPL(uart2),
123 UNIPHIER_PINCTRL_GROUP_SPL(uart3),
Masahiro Yamada9a9999e2015-09-11 20:17:34 +0900124 UNIPHIER_PINCTRL_GROUP(usb0),
125 UNIPHIER_PINCTRL_GROUP(usb1),
126 UNIPHIER_PINCTRL_GROUP(usb2),
127 UNIPHIER_PINCTRL_GROUP(usb3),
128};
129
Masahiro Yamada8721b512016-04-21 14:43:10 +0900130static const char * const uniphier_pro4_functions[] = {
Masahiro Yamada65ef4f72016-06-29 19:39:00 +0900131 UNIPHIER_PINMUX_FUNCTION_SPL(emmc),
Masahiro Yamadacc94a982016-06-29 19:39:01 +0900132 UNIPHIER_PINMUX_FUNCTION(ether_mii),
133 UNIPHIER_PINMUX_FUNCTION(ether_rgmii),
134 UNIPHIER_PINMUX_FUNCTION(ether_rmii),
Masahiro Yamada65ef4f72016-06-29 19:39:00 +0900135 UNIPHIER_PINMUX_FUNCTION(i2c0),
136 UNIPHIER_PINMUX_FUNCTION(i2c1),
137 UNIPHIER_PINMUX_FUNCTION(i2c2),
138 UNIPHIER_PINMUX_FUNCTION(i2c3),
139 UNIPHIER_PINMUX_FUNCTION(i2c6),
140 UNIPHIER_PINMUX_FUNCTION(nand),
141 UNIPHIER_PINMUX_FUNCTION(sd),
142 UNIPHIER_PINMUX_FUNCTION(sd1),
Kunihiko Hayashi9cc3bf62019-06-11 10:06:13 +0900143 UNIPHIER_PINMUX_FUNCTION(spi0),
144 UNIPHIER_PINMUX_FUNCTION(spi1),
Masahiro Yamada82a51782016-09-14 01:06:04 +0900145 UNIPHIER_PINMUX_FUNCTION(system_bus),
Masahiro Yamada65ef4f72016-06-29 19:39:00 +0900146 UNIPHIER_PINMUX_FUNCTION_SPL(uart0),
147 UNIPHIER_PINMUX_FUNCTION_SPL(uart1),
148 UNIPHIER_PINMUX_FUNCTION_SPL(uart2),
149 UNIPHIER_PINMUX_FUNCTION_SPL(uart3),
150 UNIPHIER_PINMUX_FUNCTION(usb0),
151 UNIPHIER_PINMUX_FUNCTION(usb1),
152 UNIPHIER_PINMUX_FUNCTION(usb2),
153 UNIPHIER_PINMUX_FUNCTION(usb3),
Masahiro Yamada9a9999e2015-09-11 20:17:34 +0900154};
155
Masahiro Yamada8721b512016-04-21 14:43:10 +0900156static struct uniphier_pinctrl_socdata uniphier_pro4_pinctrl_socdata = {
Masahiro Yamada8721b512016-04-21 14:43:10 +0900157 .groups = uniphier_pro4_groups,
158 .groups_count = ARRAY_SIZE(uniphier_pro4_groups),
159 .functions = uniphier_pro4_functions,
160 .functions_count = ARRAY_SIZE(uniphier_pro4_functions),
Masahiro Yamada7a629ef2016-03-24 22:32:44 +0900161 .caps = UNIPHIER_PINCTRL_CAPS_DBGMUX_SEPARATE,
Masahiro Yamada9a9999e2015-09-11 20:17:34 +0900162};
163
Masahiro Yamada8721b512016-04-21 14:43:10 +0900164static int uniphier_pro4_pinctrl_probe(struct udevice *dev)
Masahiro Yamada9a9999e2015-09-11 20:17:34 +0900165{
Masahiro Yamada8721b512016-04-21 14:43:10 +0900166 return uniphier_pinctrl_probe(dev, &uniphier_pro4_pinctrl_socdata);
Masahiro Yamada9a9999e2015-09-11 20:17:34 +0900167}
168
Masahiro Yamada8721b512016-04-21 14:43:10 +0900169static const struct udevice_id uniphier_pro4_pinctrl_match[] = {
Masahiro Yamada13d8ac32016-06-29 19:38:57 +0900170 { .compatible = "socionext,uniphier-pro4-pinctrl" },
Masahiro Yamada9a9999e2015-09-11 20:17:34 +0900171 { /* sentinel */ }
172};
173
Masahiro Yamada8721b512016-04-21 14:43:10 +0900174U_BOOT_DRIVER(uniphier_pro4_pinctrl) = {
175 .name = "uniphier-pro4-pinctrl",
Masahiro Yamada9a9999e2015-09-11 20:17:34 +0900176 .id = UCLASS_PINCTRL,
Masahiro Yamada8721b512016-04-21 14:43:10 +0900177 .of_match = of_match_ptr(uniphier_pro4_pinctrl_match),
178 .probe = uniphier_pro4_pinctrl_probe,
Simon Glass8a2b47f2020-12-03 16:55:17 -0700179 .priv_auto = sizeof(struct uniphier_pinctrl_priv),
Masahiro Yamada9a9999e2015-09-11 20:17:34 +0900180 .ops = &uniphier_pinctrl_ops,
Bin Mengc2908c62018-10-24 06:36:33 -0700181#if !CONFIG_IS_ENABLED(OF_CONTROL)
Masahiro Yamada9a9999e2015-09-11 20:17:34 +0900182 .flags = DM_FLAG_PRE_RELOC,
Bin Mengc2908c62018-10-24 06:36:33 -0700183#endif
Masahiro Yamada9a9999e2015-09-11 20:17:34 +0900184};