blob: e9cc9d205d83c51aa4554c7aafc10cb2c91d22d6 [file] [log] [blame]
Masahiro Yamadaa01867f2016-09-17 03:32:59 +09001/*
2 * Copyright (C) 2016 Socionext Inc.
3 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
4 *
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 Yamadaa01867f2016-09-17 03:32:59 +090010#include <dm/pinctrl.h>
11
12#include "pinctrl-uniphier.h"
13
14static const unsigned emmc_pins[] = {55, 56, 60};
15static const int emmc_muxvals[] = {1, 1, 1};
16static const unsigned emmc_dat8_pins[] = {57};
17static const int emmc_dat8_muxvals[] = {1};
18static const unsigned ether_mii_pins[] = {35, 107, 108, 109, 110, 111, 112,
19 113};
20static const int ether_mii_muxvals[] = {1, 2, 2, 2, 2, 2, 2, 2};
21static const unsigned ether_rmii_pins[] = {35};
22static const int ether_rmii_muxvals[] = {1};
23static const unsigned i2c0_pins[] = {36};
24static const int i2c0_muxvals[] = {0};
25static const unsigned nand_pins[] = {38, 39, 40, 58, 59};
26static const int nand_muxvals[] = {1, 1, 1, 1, 1};
27static const unsigned nand_cs1_pins[] = {41};
28static const int nand_cs1_muxvals[] = {1};
29static const unsigned sd_pins[] = {42, 43, 44, 45};
30static const int sd_muxvals[] = {1, 1, 1, 1};
31static const unsigned system_bus_pins[] = {46, 50, 51, 53, 54, 73, 74, 75, 76,
32 77, 78, 79, 80, 88, 89, 91, 92, 99};
33static const int system_bus_muxvals[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
34 1, 1, 1, 1, 1};
35static const unsigned system_bus_cs0_pins[] = {93};
36static const int system_bus_cs0_muxvals[] = {1};
37static const unsigned system_bus_cs1_pins[] = {94};
38static const int system_bus_cs1_muxvals[] = {1};
39static const unsigned system_bus_cs2_pins[] = {95};
40static const int system_bus_cs2_muxvals[] = {1};
41static const unsigned system_bus_cs3_pins[] = {96};
42static const int system_bus_cs3_muxvals[] = {1};
43static const unsigned system_bus_cs4_pins[] = {81};
44static const int system_bus_cs4_muxvals[] = {1};
45static const unsigned system_bus_cs5_pins[] = {82};
46static const int system_bus_cs5_muxvals[] = {1};
47static const unsigned uart0_pins[] = {63, 64};
48static const int uart0_muxvals[] = {0, 1};
49static const unsigned uart1_pins[] = {65, 66};
50static const int uart1_muxvals[] = {0, 1};
51static const unsigned uart2_pins[] = {96, 102};
52static const int uart2_muxvals[] = {2, 2};
53static const unsigned usb0_pins[] = {13, 14};
54static const int usb0_muxvals[] = {0, 1};
55static const unsigned usb1_pins[] = {15, 16};
56static const int usb1_muxvals[] = {0, 1};
57static const unsigned usb2_pins[] = {17, 18};
58static const int usb2_muxvals[] = {0, 1};
59static const unsigned usb3_pins[] = {19, 20};
60static const int usb3_muxvals[] = {0, 1};
61
62static const struct uniphier_pinctrl_group uniphier_sld3_groups[] = {
63 UNIPHIER_PINCTRL_GROUP_SPL(emmc),
64 UNIPHIER_PINCTRL_GROUP_SPL(emmc_dat8),
65 UNIPHIER_PINCTRL_GROUP(ether_mii),
66 UNIPHIER_PINCTRL_GROUP(ether_rmii),
67 UNIPHIER_PINCTRL_GROUP(i2c0),
68 UNIPHIER_PINCTRL_GROUP(nand),
69 UNIPHIER_PINCTRL_GROUP(nand_cs1),
70 UNIPHIER_PINCTRL_GROUP(sd),
71 UNIPHIER_PINCTRL_GROUP(system_bus),
72 UNIPHIER_PINCTRL_GROUP(system_bus_cs0),
73 UNIPHIER_PINCTRL_GROUP(system_bus_cs1),
74 UNIPHIER_PINCTRL_GROUP(system_bus_cs2),
75 UNIPHIER_PINCTRL_GROUP(system_bus_cs3),
76 UNIPHIER_PINCTRL_GROUP(system_bus_cs4),
77 UNIPHIER_PINCTRL_GROUP(system_bus_cs5),
78 UNIPHIER_PINCTRL_GROUP_SPL(uart0),
79 UNIPHIER_PINCTRL_GROUP_SPL(uart1),
80 UNIPHIER_PINCTRL_GROUP_SPL(uart2),
81 UNIPHIER_PINCTRL_GROUP(usb0),
82 UNIPHIER_PINCTRL_GROUP(usb1),
83 UNIPHIER_PINCTRL_GROUP(usb2),
84 UNIPHIER_PINCTRL_GROUP(usb3)
85};
86
87static const char * const uniphier_sld3_functions[] = {
88 UNIPHIER_PINMUX_FUNCTION_SPL(emmc),
89 UNIPHIER_PINMUX_FUNCTION(ether_mii),
90 UNIPHIER_PINMUX_FUNCTION(ether_rmii),
91 UNIPHIER_PINMUX_FUNCTION(i2c0),
92 UNIPHIER_PINMUX_FUNCTION(nand),
93 UNIPHIER_PINMUX_FUNCTION(sd),
94 UNIPHIER_PINMUX_FUNCTION(system_bus),
95 UNIPHIER_PINMUX_FUNCTION_SPL(uart0),
96 UNIPHIER_PINMUX_FUNCTION_SPL(uart1),
97 UNIPHIER_PINMUX_FUNCTION_SPL(uart2),
98 UNIPHIER_PINMUX_FUNCTION(usb0),
99 UNIPHIER_PINMUX_FUNCTION(usb1),
100 UNIPHIER_PINMUX_FUNCTION(usb2),
101 UNIPHIER_PINMUX_FUNCTION(usb3),
102};
103
104static struct uniphier_pinctrl_socdata uniphier_sld3_pinctrl_socdata = {
105 .groups = uniphier_sld3_groups,
106 .groups_count = ARRAY_SIZE(uniphier_sld3_groups),
107 .functions = uniphier_sld3_functions,
108 .functions_count = ARRAY_SIZE(uniphier_sld3_functions),
109 .caps = UNIPHIER_PINCTRL_CAPS_MUX_4BIT,
110};
111
112static int uniphier_sld3_pinctrl_probe(struct udevice *dev)
113{
114 return uniphier_pinctrl_probe(dev, &uniphier_sld3_pinctrl_socdata);
115}
116
117static const struct udevice_id uniphier_sld3_pinctrl_match[] = {
118 { .compatible = "socionext,uniphier-sld3-pinctrl" },
119 { /* sentinel */ }
120};
121
122U_BOOT_DRIVER(uniphier_sld3_pinctrl) = {
123 .name = "uniphier-sld3-pinctrl",
124 .id = UCLASS_PINCTRL,
125 .of_match = of_match_ptr(uniphier_sld3_pinctrl_match),
126 .probe = uniphier_sld3_pinctrl_probe,
127 .priv_auto_alloc_size = sizeof(struct uniphier_pinctrl_priv),
128 .ops = &uniphier_pinctrl_ops,
129};