blob: eb5978a1662c0cd1172cd2e88c2061f3f75109f5 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Masahiro Yamadaa3438122015-09-11 20:17:34 +09002/*
Masahiro Yamada4e3d8402016-07-19 21:56:13 +09003 * Copyright (C) 2015-2016 Socionext Inc.
4 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamadaa3438122015-09-11 20:17:34 +09005 */
6
Simon Glass4af0d7e2017-05-17 17:18:07 -06007#include <common.h>
Simon Glass9d922452017-05-17 17:18:03 -06008#include <dm.h>
Masahiro Yamadaa3438122015-09-11 20:17:34 +09009#include <dm/pinctrl.h>
10
11#include "pinctrl-uniphier.h"
12
Masahiro Yamadaa3438122015-09-11 20:17:34 +090013static const unsigned emmc_pins[] = {40, 41, 42, 43, 51, 52, 53};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090014static const int emmc_muxvals[] = {1, 1, 1, 1, 1, 1, 1};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090015static const unsigned emmc_dat8_pins[] = {44, 45, 46, 47};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090016static const int emmc_dat8_muxvals[] = {1, 1, 1, 1};
Masahiro Yamadafc9da852016-06-29 19:39:01 +090017static 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};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090033static const unsigned i2c0_pins[] = {142, 143};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090034static const int i2c0_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090035static const unsigned i2c1_pins[] = {144, 145};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090036static const int i2c1_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090037static const unsigned i2c2_pins[] = {146, 147};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090038static const int i2c2_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090039static const unsigned i2c3_pins[] = {148, 149};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090040static const int i2c3_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090041static const unsigned i2c6_pins[] = {308, 309};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090042static const int i2c6_muxvals[] = {6, 6};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090043static const unsigned nand_pins[] = {40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
44 50, 51, 52, 53, 54};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090045static const int nand_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090046static const unsigned nand_cs1_pins[] = {131, 132};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090047static const int nand_cs1_muxvals[] = {1, 1};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090048static const unsigned sd_pins[] = {150, 151, 152, 153, 154, 155, 156, 157, 158};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090049static const int sd_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090050static const unsigned sd1_pins[] = {319, 320, 321, 322, 323, 324, 325, 326,
51 327};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090052static const int sd1_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
Masahiro Yamada865a39a2016-09-14 01:06:04 +090053static const unsigned system_bus_pins[] = {25, 26, 27, 28, 29, 30, 31, 32, 33,
54 34, 35, 36, 37, 38};
55static const int system_bus_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
56 0};
57static const unsigned system_bus_cs0_pins[] = {318};
58static const int system_bus_cs0_muxvals[] = {5};
59static const unsigned system_bus_cs1_pins[] = {24};
60static const int system_bus_cs1_muxvals[] = {0};
61static const unsigned system_bus_cs2_pins[] = {315};
62static const int system_bus_cs2_muxvals[] = {5};
63static const unsigned system_bus_cs3_pins[] = {313};
64static const int system_bus_cs3_muxvals[] = {5};
65static const unsigned system_bus_cs4_pins[] = {305};
66static const int system_bus_cs4_muxvals[] = {5};
67static const unsigned system_bus_cs5_pins[] = {303};
68static const int system_bus_cs5_muxvals[] = {6};
69static const unsigned system_bus_cs6_pins[] = {307};
70static const int system_bus_cs6_muxvals[] = {6};
71static const unsigned system_bus_cs7_pins[] = {312};
72static const int system_bus_cs7_muxvals[] = {6};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090073static const unsigned uart0_pins[] = {127, 128};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090074static const int uart0_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090075static const unsigned uart1_pins[] = {129, 130};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090076static const int uart1_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090077static const unsigned uart2_pins[] = {131, 132};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090078static const int uart2_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090079static const unsigned uart3_pins[] = {88, 89};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090080static const int uart3_muxvals[] = {2, 2};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090081static const unsigned usb0_pins[] = {180, 181};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090082static const int usb0_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090083static const unsigned usb1_pins[] = {182, 183};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090084static const int usb1_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090085static const unsigned usb2_pins[] = {184, 185};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090086static const int usb2_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090087static const unsigned usb3_pins[] = {186, 187};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090088static const int usb3_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090089
Masahiro Yamadaac13ce42016-04-21 14:43:10 +090090static const struct uniphier_pinctrl_group uniphier_pro4_groups[] = {
Masahiro Yamada64c1cc42016-06-29 19:39:00 +090091 UNIPHIER_PINCTRL_GROUP_SPL(emmc),
92 UNIPHIER_PINCTRL_GROUP_SPL(emmc_dat8),
Masahiro Yamadafc9da852016-06-29 19:39:01 +090093 UNIPHIER_PINCTRL_GROUP(ether_mii),
94 UNIPHIER_PINCTRL_GROUP(ether_rgmii),
95 UNIPHIER_PINCTRL_GROUP(ether_rmii),
96 UNIPHIER_PINCTRL_GROUP(ether_rmiib),
Masahiro Yamadaa3438122015-09-11 20:17:34 +090097 UNIPHIER_PINCTRL_GROUP(i2c0),
98 UNIPHIER_PINCTRL_GROUP(i2c1),
99 UNIPHIER_PINCTRL_GROUP(i2c2),
100 UNIPHIER_PINCTRL_GROUP(i2c3),
101 UNIPHIER_PINCTRL_GROUP(i2c6),
102 UNIPHIER_PINCTRL_GROUP(nand),
103 UNIPHIER_PINCTRL_GROUP(nand_cs1),
104 UNIPHIER_PINCTRL_GROUP(sd),
105 UNIPHIER_PINCTRL_GROUP(sd1),
Masahiro Yamada865a39a2016-09-14 01:06:04 +0900106 UNIPHIER_PINCTRL_GROUP(system_bus),
107 UNIPHIER_PINCTRL_GROUP(system_bus_cs0),
108 UNIPHIER_PINCTRL_GROUP(system_bus_cs1),
109 UNIPHIER_PINCTRL_GROUP(system_bus_cs2),
110 UNIPHIER_PINCTRL_GROUP(system_bus_cs3),
111 UNIPHIER_PINCTRL_GROUP(system_bus_cs4),
112 UNIPHIER_PINCTRL_GROUP(system_bus_cs5),
113 UNIPHIER_PINCTRL_GROUP(system_bus_cs6),
114 UNIPHIER_PINCTRL_GROUP(system_bus_cs7),
Masahiro Yamada64c1cc42016-06-29 19:39:00 +0900115 UNIPHIER_PINCTRL_GROUP_SPL(uart0),
116 UNIPHIER_PINCTRL_GROUP_SPL(uart1),
117 UNIPHIER_PINCTRL_GROUP_SPL(uart2),
118 UNIPHIER_PINCTRL_GROUP_SPL(uart3),
Masahiro Yamadaa3438122015-09-11 20:17:34 +0900119 UNIPHIER_PINCTRL_GROUP(usb0),
120 UNIPHIER_PINCTRL_GROUP(usb1),
121 UNIPHIER_PINCTRL_GROUP(usb2),
122 UNIPHIER_PINCTRL_GROUP(usb3),
123};
124
Masahiro Yamadaac13ce42016-04-21 14:43:10 +0900125static const char * const uniphier_pro4_functions[] = {
Masahiro Yamada64c1cc42016-06-29 19:39:00 +0900126 UNIPHIER_PINMUX_FUNCTION_SPL(emmc),
Masahiro Yamadafc9da852016-06-29 19:39:01 +0900127 UNIPHIER_PINMUX_FUNCTION(ether_mii),
128 UNIPHIER_PINMUX_FUNCTION(ether_rgmii),
129 UNIPHIER_PINMUX_FUNCTION(ether_rmii),
Masahiro Yamada64c1cc42016-06-29 19:39:00 +0900130 UNIPHIER_PINMUX_FUNCTION(i2c0),
131 UNIPHIER_PINMUX_FUNCTION(i2c1),
132 UNIPHIER_PINMUX_FUNCTION(i2c2),
133 UNIPHIER_PINMUX_FUNCTION(i2c3),
134 UNIPHIER_PINMUX_FUNCTION(i2c6),
135 UNIPHIER_PINMUX_FUNCTION(nand),
136 UNIPHIER_PINMUX_FUNCTION(sd),
137 UNIPHIER_PINMUX_FUNCTION(sd1),
Masahiro Yamada865a39a2016-09-14 01:06:04 +0900138 UNIPHIER_PINMUX_FUNCTION(system_bus),
Masahiro Yamada64c1cc42016-06-29 19:39:00 +0900139 UNIPHIER_PINMUX_FUNCTION_SPL(uart0),
140 UNIPHIER_PINMUX_FUNCTION_SPL(uart1),
141 UNIPHIER_PINMUX_FUNCTION_SPL(uart2),
142 UNIPHIER_PINMUX_FUNCTION_SPL(uart3),
143 UNIPHIER_PINMUX_FUNCTION(usb0),
144 UNIPHIER_PINMUX_FUNCTION(usb1),
145 UNIPHIER_PINMUX_FUNCTION(usb2),
146 UNIPHIER_PINMUX_FUNCTION(usb3),
Masahiro Yamadaa3438122015-09-11 20:17:34 +0900147};
148
Masahiro Yamadaac13ce42016-04-21 14:43:10 +0900149static struct uniphier_pinctrl_socdata uniphier_pro4_pinctrl_socdata = {
Masahiro Yamadaac13ce42016-04-21 14:43:10 +0900150 .groups = uniphier_pro4_groups,
151 .groups_count = ARRAY_SIZE(uniphier_pro4_groups),
152 .functions = uniphier_pro4_functions,
153 .functions_count = ARRAY_SIZE(uniphier_pro4_functions),
Masahiro Yamada8cc92b92016-03-24 22:32:44 +0900154 .caps = UNIPHIER_PINCTRL_CAPS_DBGMUX_SEPARATE,
Masahiro Yamadaa3438122015-09-11 20:17:34 +0900155};
156
Masahiro Yamadaac13ce42016-04-21 14:43:10 +0900157static int uniphier_pro4_pinctrl_probe(struct udevice *dev)
Masahiro Yamadaa3438122015-09-11 20:17:34 +0900158{
Masahiro Yamadaac13ce42016-04-21 14:43:10 +0900159 return uniphier_pinctrl_probe(dev, &uniphier_pro4_pinctrl_socdata);
Masahiro Yamadaa3438122015-09-11 20:17:34 +0900160}
161
Masahiro Yamadaac13ce42016-04-21 14:43:10 +0900162static const struct udevice_id uniphier_pro4_pinctrl_match[] = {
Masahiro Yamada186c1332016-06-29 19:38:57 +0900163 { .compatible = "socionext,uniphier-pro4-pinctrl" },
Masahiro Yamadaa3438122015-09-11 20:17:34 +0900164 { /* sentinel */ }
165};
166
Masahiro Yamadaac13ce42016-04-21 14:43:10 +0900167U_BOOT_DRIVER(uniphier_pro4_pinctrl) = {
168 .name = "uniphier-pro4-pinctrl",
Masahiro Yamadaa3438122015-09-11 20:17:34 +0900169 .id = UCLASS_PINCTRL,
Masahiro Yamadaac13ce42016-04-21 14:43:10 +0900170 .of_match = of_match_ptr(uniphier_pro4_pinctrl_match),
171 .probe = uniphier_pro4_pinctrl_probe,
Masahiro Yamadaa3438122015-09-11 20:17:34 +0900172 .priv_auto_alloc_size = sizeof(struct uniphier_pinctrl_priv),
173 .ops = &uniphier_pinctrl_ops,
Bin Mengad0e8042018-10-24 06:36:33 -0700174#if !CONFIG_IS_ENABLED(OF_CONTROL)
Masahiro Yamadaa3438122015-09-11 20:17:34 +0900175 .flags = DM_FLAG_PRE_RELOC,
Bin Mengad0e8042018-10-24 06:36:33 -0700176#endif
Masahiro Yamadaa3438122015-09-11 20:17:34 +0900177};