blob: df5f2d86fa16f2e31de1fe6f4a58e3cde4647dad [file] [log] [blame]
Masahiro Yamada9a9999e2015-09-11 20:17:34 +09001/*
Masahiro Yamadafa1f73f2016-07-19 21:56:13 +09002 * Copyright (C) 2015-2016 Socionext Inc.
3 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada9a9999e2015-09-11 20:17:34 +09004 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
Simon Glass51a3ec32017-05-17 17:18:07 -06008#include <common.h>
Simon Glass11c89f32017-05-17 17:18:03 -06009#include <dm.h>
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090010#include <dm/pinctrl.h>
11
12#include "pinctrl-uniphier.h"
13
Masahiro Yamada8721b512016-04-21 14:43:10 +090014static const struct uniphier_pinctrl_pin uniphier_pro4_pins[] = {
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090015};
16
17static const unsigned emmc_pins[] = {40, 41, 42, 43, 51, 52, 53};
Masahiro Yamada9447e132016-06-29 19:38:59 +090018static const int emmc_muxvals[] = {1, 1, 1, 1, 1, 1, 1};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090019static const unsigned emmc_dat8_pins[] = {44, 45, 46, 47};
Masahiro Yamada9447e132016-06-29 19:38:59 +090020static const int emmc_dat8_muxvals[] = {1, 1, 1, 1};
Masahiro Yamadacc94a982016-06-29 19:39:01 +090021static const unsigned ether_mii_pins[] = {160, 161, 162, 163, 164, 165, 166,
22 167, 168, 169, 170, 171, 172, 173,
23 174, 175, 176, 177, 178, 179};
24static const int ether_mii_muxvals[] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
25 0, 0, 0, 0, 0, 0, 0};
26static const unsigned ether_rgmii_pins[] = {160, 161, 162, 163, 164, 165, 167,
27 168, 169, 170, 171, 172, 176, 177,
28 178, 179};
29static const int ether_rgmii_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
30 0, 0, 0, 0};
31static const unsigned ether_rmii_pins[] = {160, 161, 162, 165, 168, 169, 172,
32 173, 176, 177, 178, 179};
33static const int ether_rmii_muxvals[] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
34static const unsigned ether_rmiib_pins[] = {161, 162, 165, 167, 168, 169, 172,
35 173, 176, 177, 178, 179};
36static const int ether_rmiib_muxvals[] = {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090037static const unsigned i2c0_pins[] = {142, 143};
Masahiro Yamada9447e132016-06-29 19:38:59 +090038static const int i2c0_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090039static const unsigned i2c1_pins[] = {144, 145};
Masahiro Yamada9447e132016-06-29 19:38:59 +090040static const int i2c1_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090041static const unsigned i2c2_pins[] = {146, 147};
Masahiro Yamada9447e132016-06-29 19:38:59 +090042static const int i2c2_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090043static const unsigned i2c3_pins[] = {148, 149};
Masahiro Yamada9447e132016-06-29 19:38:59 +090044static const int i2c3_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090045static const unsigned i2c6_pins[] = {308, 309};
Masahiro Yamada9447e132016-06-29 19:38:59 +090046static const int i2c6_muxvals[] = {6, 6};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090047static const unsigned nand_pins[] = {40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
48 50, 51, 52, 53, 54};
Masahiro Yamada9447e132016-06-29 19:38:59 +090049static 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 +090050static const unsigned nand_cs1_pins[] = {131, 132};
Masahiro Yamada9447e132016-06-29 19:38:59 +090051static const int nand_cs1_muxvals[] = {1, 1};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090052static const unsigned sd_pins[] = {150, 151, 152, 153, 154, 155, 156, 157, 158};
Masahiro Yamada9447e132016-06-29 19:38:59 +090053static const int sd_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090054static const unsigned sd1_pins[] = {319, 320, 321, 322, 323, 324, 325, 326,
55 327};
Masahiro Yamada9447e132016-06-29 19:38:59 +090056static const int sd1_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
Masahiro Yamada82a51782016-09-14 01:06:04 +090057static 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};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090077static const unsigned uart0_pins[] = {127, 128};
Masahiro Yamada9447e132016-06-29 19:38:59 +090078static const int uart0_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090079static const unsigned uart1_pins[] = {129, 130};
Masahiro Yamada9447e132016-06-29 19:38:59 +090080static const int uart1_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090081static const unsigned uart2_pins[] = {131, 132};
Masahiro Yamada9447e132016-06-29 19:38:59 +090082static const int uart2_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090083static const unsigned uart3_pins[] = {88, 89};
Masahiro Yamada9447e132016-06-29 19:38:59 +090084static const int uart3_muxvals[] = {2, 2};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090085static const unsigned usb0_pins[] = {180, 181};
Masahiro Yamada9447e132016-06-29 19:38:59 +090086static const int usb0_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090087static const unsigned usb1_pins[] = {182, 183};
Masahiro Yamada9447e132016-06-29 19:38:59 +090088static const int usb1_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090089static const unsigned usb2_pins[] = {184, 185};
Masahiro Yamada9447e132016-06-29 19:38:59 +090090static const int usb2_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090091static const unsigned usb3_pins[] = {186, 187};
Masahiro Yamada9447e132016-06-29 19:38:59 +090092static const int usb3_muxvals[] = {0, 0};
Masahiro Yamada9a9999e2015-09-11 20:17:34 +090093
Masahiro Yamada8721b512016-04-21 14:43:10 +090094static const struct uniphier_pinctrl_group uniphier_pro4_groups[] = {
Masahiro Yamada65ef4f72016-06-29 19:39:00 +090095 UNIPHIER_PINCTRL_GROUP_SPL(emmc),
96 UNIPHIER_PINCTRL_GROUP_SPL(emmc_dat8),
Masahiro Yamadacc94a982016-06-29 19:39:01 +090097 UNIPHIER_PINCTRL_GROUP(ether_mii),
98 UNIPHIER_PINCTRL_GROUP(ether_rgmii),
99 UNIPHIER_PINCTRL_GROUP(ether_rmii),
100 UNIPHIER_PINCTRL_GROUP(ether_rmiib),
Masahiro Yamada9a9999e2015-09-11 20:17:34 +0900101 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),
Masahiro Yamada82a51782016-09-14 01:06:04 +0900110 UNIPHIER_PINCTRL_GROUP(system_bus),
111 UNIPHIER_PINCTRL_GROUP(system_bus_cs0),
112 UNIPHIER_PINCTRL_GROUP(system_bus_cs1),
113 UNIPHIER_PINCTRL_GROUP(system_bus_cs2),
114 UNIPHIER_PINCTRL_GROUP(system_bus_cs3),
115 UNIPHIER_PINCTRL_GROUP(system_bus_cs4),
116 UNIPHIER_PINCTRL_GROUP(system_bus_cs5),
117 UNIPHIER_PINCTRL_GROUP(system_bus_cs6),
118 UNIPHIER_PINCTRL_GROUP(system_bus_cs7),
Masahiro Yamada65ef4f72016-06-29 19:39:00 +0900119 UNIPHIER_PINCTRL_GROUP_SPL(uart0),
120 UNIPHIER_PINCTRL_GROUP_SPL(uart1),
121 UNIPHIER_PINCTRL_GROUP_SPL(uart2),
122 UNIPHIER_PINCTRL_GROUP_SPL(uart3),
Masahiro Yamada9a9999e2015-09-11 20:17:34 +0900123 UNIPHIER_PINCTRL_GROUP(usb0),
124 UNIPHIER_PINCTRL_GROUP(usb1),
125 UNIPHIER_PINCTRL_GROUP(usb2),
126 UNIPHIER_PINCTRL_GROUP(usb3),
127};
128
Masahiro Yamada8721b512016-04-21 14:43:10 +0900129static const char * const uniphier_pro4_functions[] = {
Masahiro Yamada65ef4f72016-06-29 19:39:00 +0900130 UNIPHIER_PINMUX_FUNCTION_SPL(emmc),
Masahiro Yamadacc94a982016-06-29 19:39:01 +0900131 UNIPHIER_PINMUX_FUNCTION(ether_mii),
132 UNIPHIER_PINMUX_FUNCTION(ether_rgmii),
133 UNIPHIER_PINMUX_FUNCTION(ether_rmii),
Masahiro Yamada65ef4f72016-06-29 19:39:00 +0900134 UNIPHIER_PINMUX_FUNCTION(i2c0),
135 UNIPHIER_PINMUX_FUNCTION(i2c1),
136 UNIPHIER_PINMUX_FUNCTION(i2c2),
137 UNIPHIER_PINMUX_FUNCTION(i2c3),
138 UNIPHIER_PINMUX_FUNCTION(i2c6),
139 UNIPHIER_PINMUX_FUNCTION(nand),
140 UNIPHIER_PINMUX_FUNCTION(sd),
141 UNIPHIER_PINMUX_FUNCTION(sd1),
Masahiro Yamada82a51782016-09-14 01:06:04 +0900142 UNIPHIER_PINMUX_FUNCTION(system_bus),
Masahiro Yamada65ef4f72016-06-29 19:39:00 +0900143 UNIPHIER_PINMUX_FUNCTION_SPL(uart0),
144 UNIPHIER_PINMUX_FUNCTION_SPL(uart1),
145 UNIPHIER_PINMUX_FUNCTION_SPL(uart2),
146 UNIPHIER_PINMUX_FUNCTION_SPL(uart3),
147 UNIPHIER_PINMUX_FUNCTION(usb0),
148 UNIPHIER_PINMUX_FUNCTION(usb1),
149 UNIPHIER_PINMUX_FUNCTION(usb2),
150 UNIPHIER_PINMUX_FUNCTION(usb3),
Masahiro Yamada9a9999e2015-09-11 20:17:34 +0900151};
152
Masahiro Yamada8721b512016-04-21 14:43:10 +0900153static struct uniphier_pinctrl_socdata uniphier_pro4_pinctrl_socdata = {
154 .pins = uniphier_pro4_pins,
155 .pins_count = ARRAY_SIZE(uniphier_pro4_pins),
156 .groups = uniphier_pro4_groups,
157 .groups_count = ARRAY_SIZE(uniphier_pro4_groups),
158 .functions = uniphier_pro4_functions,
159 .functions_count = ARRAY_SIZE(uniphier_pro4_functions),
Masahiro Yamada7a629ef2016-03-24 22:32:44 +0900160 .caps = UNIPHIER_PINCTRL_CAPS_DBGMUX_SEPARATE,
Masahiro Yamada9a9999e2015-09-11 20:17:34 +0900161};
162
Masahiro Yamada8721b512016-04-21 14:43:10 +0900163static int uniphier_pro4_pinctrl_probe(struct udevice *dev)
Masahiro Yamada9a9999e2015-09-11 20:17:34 +0900164{
Masahiro Yamada8721b512016-04-21 14:43:10 +0900165 return uniphier_pinctrl_probe(dev, &uniphier_pro4_pinctrl_socdata);
Masahiro Yamada9a9999e2015-09-11 20:17:34 +0900166}
167
Masahiro Yamada8721b512016-04-21 14:43:10 +0900168static const struct udevice_id uniphier_pro4_pinctrl_match[] = {
Masahiro Yamada13d8ac32016-06-29 19:38:57 +0900169 { .compatible = "socionext,uniphier-pro4-pinctrl" },
Masahiro Yamada9a9999e2015-09-11 20:17:34 +0900170 { /* sentinel */ }
171};
172
Masahiro Yamada8721b512016-04-21 14:43:10 +0900173U_BOOT_DRIVER(uniphier_pro4_pinctrl) = {
174 .name = "uniphier-pro4-pinctrl",
Masahiro Yamada9a9999e2015-09-11 20:17:34 +0900175 .id = UCLASS_PINCTRL,
Masahiro Yamada8721b512016-04-21 14:43:10 +0900176 .of_match = of_match_ptr(uniphier_pro4_pinctrl_match),
177 .probe = uniphier_pro4_pinctrl_probe,
Masahiro Yamada9a9999e2015-09-11 20:17:34 +0900178 .priv_auto_alloc_size = sizeof(struct uniphier_pinctrl_priv),
179 .ops = &uniphier_pinctrl_ops,
180 .flags = DM_FLAG_PRE_RELOC,
181};