blob: dace726b0838d4d44a6bfbae82c872f51f895aa3 [file] [log] [blame]
Masahiro Yamadaa3438122015-09-11 20:17:34 +09001/*
2 * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <dm/device.h>
8#include <dm/pinctrl.h>
9
10#include "pinctrl-uniphier.h"
11
Masahiro Yamadaac13ce42016-04-21 14:43:10 +090012static const struct uniphier_pinctrl_pin uniphier_pro4_pins[] = {
Masahiro Yamadaa3438122015-09-11 20:17:34 +090013};
14
15static const unsigned emmc_pins[] = {40, 41, 42, 43, 51, 52, 53};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090016static const int emmc_muxvals[] = {1, 1, 1, 1, 1, 1, 1};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090017static const unsigned emmc_dat8_pins[] = {44, 45, 46, 47};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090018static const int emmc_dat8_muxvals[] = {1, 1, 1, 1};
Masahiro Yamadafc9da852016-06-29 19:39:01 +090019static const unsigned ether_mii_pins[] = {160, 161, 162, 163, 164, 165, 166,
20 167, 168, 169, 170, 171, 172, 173,
21 174, 175, 176, 177, 178, 179};
22static const int ether_mii_muxvals[] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
23 0, 0, 0, 0, 0, 0, 0};
24static const unsigned ether_rgmii_pins[] = {160, 161, 162, 163, 164, 165, 167,
25 168, 169, 170, 171, 172, 176, 177,
26 178, 179};
27static const int ether_rgmii_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
28 0, 0, 0, 0};
29static const unsigned ether_rmii_pins[] = {160, 161, 162, 165, 168, 169, 172,
30 173, 176, 177, 178, 179};
31static const int ether_rmii_muxvals[] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
32static const unsigned ether_rmiib_pins[] = {161, 162, 165, 167, 168, 169, 172,
33 173, 176, 177, 178, 179};
34static const int ether_rmiib_muxvals[] = {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090035static const unsigned i2c0_pins[] = {142, 143};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090036static const int i2c0_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090037static const unsigned i2c1_pins[] = {144, 145};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090038static const int i2c1_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090039static const unsigned i2c2_pins[] = {146, 147};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090040static const int i2c2_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090041static const unsigned i2c3_pins[] = {148, 149};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090042static const int i2c3_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090043static const unsigned i2c6_pins[] = {308, 309};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090044static const int i2c6_muxvals[] = {6, 6};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090045static const unsigned nand_pins[] = {40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
46 50, 51, 52, 53, 54};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090047static 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 +090048static const unsigned nand_cs1_pins[] = {131, 132};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090049static const int nand_cs1_muxvals[] = {1, 1};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090050static const unsigned sd_pins[] = {150, 151, 152, 153, 154, 155, 156, 157, 158};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090051static const int sd_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090052static const unsigned sd1_pins[] = {319, 320, 321, 322, 323, 324, 325, 326,
53 327};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090054static const int sd1_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090055static const unsigned uart0_pins[] = {127, 128};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090056static const int uart0_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090057static const unsigned uart1_pins[] = {129, 130};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090058static const int uart1_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090059static const unsigned uart2_pins[] = {131, 132};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090060static const int uart2_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090061static const unsigned uart3_pins[] = {88, 89};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090062static const int uart3_muxvals[] = {2, 2};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090063static const unsigned usb0_pins[] = {180, 181};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090064static const int usb0_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090065static const unsigned usb1_pins[] = {182, 183};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090066static const int usb1_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090067static const unsigned usb2_pins[] = {184, 185};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090068static const int usb2_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090069static const unsigned usb3_pins[] = {186, 187};
Masahiro Yamada5e25b9d2016-06-29 19:38:59 +090070static const int usb3_muxvals[] = {0, 0};
Masahiro Yamadaa3438122015-09-11 20:17:34 +090071
Masahiro Yamadaac13ce42016-04-21 14:43:10 +090072static const struct uniphier_pinctrl_group uniphier_pro4_groups[] = {
Masahiro Yamada64c1cc42016-06-29 19:39:00 +090073 UNIPHIER_PINCTRL_GROUP_SPL(emmc),
74 UNIPHIER_PINCTRL_GROUP_SPL(emmc_dat8),
Masahiro Yamadafc9da852016-06-29 19:39:01 +090075 UNIPHIER_PINCTRL_GROUP(ether_mii),
76 UNIPHIER_PINCTRL_GROUP(ether_rgmii),
77 UNIPHIER_PINCTRL_GROUP(ether_rmii),
78 UNIPHIER_PINCTRL_GROUP(ether_rmiib),
Masahiro Yamadaa3438122015-09-11 20:17:34 +090079 UNIPHIER_PINCTRL_GROUP(i2c0),
80 UNIPHIER_PINCTRL_GROUP(i2c1),
81 UNIPHIER_PINCTRL_GROUP(i2c2),
82 UNIPHIER_PINCTRL_GROUP(i2c3),
83 UNIPHIER_PINCTRL_GROUP(i2c6),
84 UNIPHIER_PINCTRL_GROUP(nand),
85 UNIPHIER_PINCTRL_GROUP(nand_cs1),
86 UNIPHIER_PINCTRL_GROUP(sd),
87 UNIPHIER_PINCTRL_GROUP(sd1),
Masahiro Yamada64c1cc42016-06-29 19:39:00 +090088 UNIPHIER_PINCTRL_GROUP_SPL(uart0),
89 UNIPHIER_PINCTRL_GROUP_SPL(uart1),
90 UNIPHIER_PINCTRL_GROUP_SPL(uart2),
91 UNIPHIER_PINCTRL_GROUP_SPL(uart3),
Masahiro Yamadaa3438122015-09-11 20:17:34 +090092 UNIPHIER_PINCTRL_GROUP(usb0),
93 UNIPHIER_PINCTRL_GROUP(usb1),
94 UNIPHIER_PINCTRL_GROUP(usb2),
95 UNIPHIER_PINCTRL_GROUP(usb3),
96};
97
Masahiro Yamadaac13ce42016-04-21 14:43:10 +090098static const char * const uniphier_pro4_functions[] = {
Masahiro Yamada64c1cc42016-06-29 19:39:00 +090099 UNIPHIER_PINMUX_FUNCTION_SPL(emmc),
Masahiro Yamadafc9da852016-06-29 19:39:01 +0900100 UNIPHIER_PINMUX_FUNCTION(ether_mii),
101 UNIPHIER_PINMUX_FUNCTION(ether_rgmii),
102 UNIPHIER_PINMUX_FUNCTION(ether_rmii),
Masahiro Yamada64c1cc42016-06-29 19:39:00 +0900103 UNIPHIER_PINMUX_FUNCTION(i2c0),
104 UNIPHIER_PINMUX_FUNCTION(i2c1),
105 UNIPHIER_PINMUX_FUNCTION(i2c2),
106 UNIPHIER_PINMUX_FUNCTION(i2c3),
107 UNIPHIER_PINMUX_FUNCTION(i2c6),
108 UNIPHIER_PINMUX_FUNCTION(nand),
109 UNIPHIER_PINMUX_FUNCTION(sd),
110 UNIPHIER_PINMUX_FUNCTION(sd1),
111 UNIPHIER_PINMUX_FUNCTION_SPL(uart0),
112 UNIPHIER_PINMUX_FUNCTION_SPL(uart1),
113 UNIPHIER_PINMUX_FUNCTION_SPL(uart2),
114 UNIPHIER_PINMUX_FUNCTION_SPL(uart3),
115 UNIPHIER_PINMUX_FUNCTION(usb0),
116 UNIPHIER_PINMUX_FUNCTION(usb1),
117 UNIPHIER_PINMUX_FUNCTION(usb2),
118 UNIPHIER_PINMUX_FUNCTION(usb3),
Masahiro Yamadaa3438122015-09-11 20:17:34 +0900119};
120
Masahiro Yamadaac13ce42016-04-21 14:43:10 +0900121static struct uniphier_pinctrl_socdata uniphier_pro4_pinctrl_socdata = {
122 .pins = uniphier_pro4_pins,
123 .pins_count = ARRAY_SIZE(uniphier_pro4_pins),
124 .groups = uniphier_pro4_groups,
125 .groups_count = ARRAY_SIZE(uniphier_pro4_groups),
126 .functions = uniphier_pro4_functions,
127 .functions_count = ARRAY_SIZE(uniphier_pro4_functions),
Masahiro Yamada8cc92b92016-03-24 22:32:44 +0900128 .caps = UNIPHIER_PINCTRL_CAPS_DBGMUX_SEPARATE,
Masahiro Yamadaa3438122015-09-11 20:17:34 +0900129};
130
Masahiro Yamadaac13ce42016-04-21 14:43:10 +0900131static int uniphier_pro4_pinctrl_probe(struct udevice *dev)
Masahiro Yamadaa3438122015-09-11 20:17:34 +0900132{
Masahiro Yamadaac13ce42016-04-21 14:43:10 +0900133 return uniphier_pinctrl_probe(dev, &uniphier_pro4_pinctrl_socdata);
Masahiro Yamadaa3438122015-09-11 20:17:34 +0900134}
135
Masahiro Yamadaac13ce42016-04-21 14:43:10 +0900136static const struct udevice_id uniphier_pro4_pinctrl_match[] = {
Masahiro Yamada186c1332016-06-29 19:38:57 +0900137 { .compatible = "socionext,uniphier-pro4-pinctrl" },
Masahiro Yamadaa3438122015-09-11 20:17:34 +0900138 { /* sentinel */ }
139};
140
Masahiro Yamadaac13ce42016-04-21 14:43:10 +0900141U_BOOT_DRIVER(uniphier_pro4_pinctrl) = {
142 .name = "uniphier-pro4-pinctrl",
Masahiro Yamadaa3438122015-09-11 20:17:34 +0900143 .id = UCLASS_PINCTRL,
Masahiro Yamadaac13ce42016-04-21 14:43:10 +0900144 .of_match = of_match_ptr(uniphier_pro4_pinctrl_match),
145 .probe = uniphier_pro4_pinctrl_probe,
Masahiro Yamadaa3438122015-09-11 20:17:34 +0900146 .remove = uniphier_pinctrl_remove,
147 .priv_auto_alloc_size = sizeof(struct uniphier_pinctrl_priv),
148 .ops = &uniphier_pinctrl_ops,
149 .flags = DM_FLAG_PRE_RELOC,
150};