dm: Fix up inclusion of common.h
[platform/kernel/u-boot.git] / drivers / pinctrl / uniphier / pinctrl-uniphier-sld3.c
1 /*
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 <common.h>
9 #include <dm.h>
10 #include <dm/pinctrl.h>
11
12 #include "pinctrl-uniphier.h"
13
14 static const unsigned emmc_pins[] = {55, 56, 60};
15 static const int emmc_muxvals[] = {1, 1, 1};
16 static const unsigned emmc_dat8_pins[] = {57};
17 static const int emmc_dat8_muxvals[] = {1};
18 static const unsigned ether_mii_pins[] = {35, 107, 108, 109, 110, 111, 112,
19                                           113};
20 static const int ether_mii_muxvals[] = {1, 2, 2, 2, 2, 2, 2, 2};
21 static const unsigned ether_rmii_pins[] = {35};
22 static const int ether_rmii_muxvals[] = {1};
23 static const unsigned i2c0_pins[] = {36};
24 static const int i2c0_muxvals[] = {0};
25 static const unsigned nand_pins[] = {38, 39, 40, 58, 59};
26 static const int nand_muxvals[] = {1, 1, 1, 1, 1};
27 static const unsigned nand_cs1_pins[] = {41};
28 static const int nand_cs1_muxvals[] = {1};
29 static const unsigned sd_pins[] = {42, 43, 44, 45};
30 static const int sd_muxvals[] = {1, 1, 1, 1};
31 static const unsigned system_bus_pins[] = {46, 50, 51, 53, 54, 73, 74, 75, 76,
32                                            77, 78, 79, 80, 88, 89, 91, 92, 99};
33 static const int system_bus_muxvals[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
34                                          1, 1, 1, 1, 1};
35 static const unsigned system_bus_cs0_pins[] = {93};
36 static const int system_bus_cs0_muxvals[] = {1};
37 static const unsigned system_bus_cs1_pins[] = {94};
38 static const int system_bus_cs1_muxvals[] = {1};
39 static const unsigned system_bus_cs2_pins[] = {95};
40 static const int system_bus_cs2_muxvals[] = {1};
41 static const unsigned system_bus_cs3_pins[] = {96};
42 static const int system_bus_cs3_muxvals[] = {1};
43 static const unsigned system_bus_cs4_pins[] = {81};
44 static const int system_bus_cs4_muxvals[] = {1};
45 static const unsigned system_bus_cs5_pins[] = {82};
46 static const int system_bus_cs5_muxvals[] = {1};
47 static const unsigned uart0_pins[] = {63, 64};
48 static const int uart0_muxvals[] = {0, 1};
49 static const unsigned uart1_pins[] = {65, 66};
50 static const int uart1_muxvals[] = {0, 1};
51 static const unsigned uart2_pins[] = {96, 102};
52 static const int uart2_muxvals[] = {2, 2};
53 static const unsigned usb0_pins[] = {13, 14};
54 static const int usb0_muxvals[] = {0, 1};
55 static const unsigned usb1_pins[] = {15, 16};
56 static const int usb1_muxvals[] = {0, 1};
57 static const unsigned usb2_pins[] = {17, 18};
58 static const int usb2_muxvals[] = {0, 1};
59 static const unsigned usb3_pins[] = {19, 20};
60 static const int usb3_muxvals[] = {0, 1};
61
62 static 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
87 static 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
104 static 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
112 static int uniphier_sld3_pinctrl_probe(struct udevice *dev)
113 {
114         return uniphier_pinctrl_probe(dev, &uniphier_sld3_pinctrl_socdata);
115 }
116
117 static const struct udevice_id uniphier_sld3_pinctrl_match[] = {
118         { .compatible = "socionext,uniphier-sld3-pinctrl" },
119         { /* sentinel */ }
120 };
121
122 U_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 };