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