xref: /rk3399_rockchip-uboot/drivers/pinctrl/uniphier/pinctrl-uniphier-ld11.c (revision f19955a01482d118eac0fdaf530ec6e5b08cf414)
13379987eSMasahiro Yamada /*
23379987eSMasahiro Yamada  * Copyright (C) 2016 Socionext Inc.
33379987eSMasahiro Yamada  *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
43379987eSMasahiro Yamada  *
53379987eSMasahiro Yamada  * SPDX-License-Identifier:	GPL-2.0+
63379987eSMasahiro Yamada  */
73379987eSMasahiro Yamada 
84af0d7e8SSimon Glass #include <common.h>
99d922450SSimon Glass #include <dm.h>
103379987eSMasahiro Yamada #include <dm/pinctrl.h>
113379987eSMasahiro Yamada 
123379987eSMasahiro Yamada #include "pinctrl-uniphier.h"
133379987eSMasahiro Yamada 
143379987eSMasahiro Yamada static const unsigned emmc_pins[] = {18, 19, 20, 21, 22, 23, 24, 25};
155e25b9d5SMasahiro Yamada static const int emmc_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0};
163379987eSMasahiro Yamada static const unsigned emmc_dat8_pins[] = {26, 27, 28, 29};
175e25b9d5SMasahiro Yamada static const int emmc_dat8_muxvals[] = {0, 0, 0, 0};
18fc9da85cSMasahiro Yamada static const unsigned ether_rmii_pins[] = {6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
19fc9da85cSMasahiro Yamada 					   16, 17};
20fc9da85cSMasahiro Yamada static const int ether_rmii_muxvals[] = {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4};
213379987eSMasahiro Yamada static const unsigned i2c0_pins[] = {63, 64};
225e25b9d5SMasahiro Yamada static const int i2c0_muxvals[] = {0, 0};
233379987eSMasahiro Yamada static const unsigned i2c1_pins[] = {65, 66};
245e25b9d5SMasahiro Yamada static const int i2c1_muxvals[] = {0, 0};
253379987eSMasahiro Yamada static const unsigned i2c3_pins[] = {67, 68};
265e25b9d5SMasahiro Yamada static const int i2c3_muxvals[] = {1, 1};
273379987eSMasahiro Yamada static const unsigned i2c4_pins[] = {61, 62};
285e25b9d5SMasahiro Yamada static const int i2c4_muxvals[] = {1, 1};
293379987eSMasahiro Yamada static const unsigned nand_pins[] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
303379987eSMasahiro Yamada 				     15, 16, 17};
315e25b9d5SMasahiro Yamada static const int nand_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
32865a39a2SMasahiro Yamada static const unsigned system_bus_pins[] = {1, 2, 6, 7, 8, 9, 10, 11, 12, 13,
33865a39a2SMasahiro Yamada 					   14, 15, 16, 17};
34865a39a2SMasahiro Yamada static const int system_bus_muxvals[] = {0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
35865a39a2SMasahiro Yamada 					 2};
36865a39a2SMasahiro Yamada static const unsigned system_bus_cs1_pins[] = {0};
37865a39a2SMasahiro Yamada static const int system_bus_cs1_muxvals[] = {0};
383379987eSMasahiro Yamada static const unsigned uart0_pins[] = {54, 55};
395e25b9d5SMasahiro Yamada static const int uart0_muxvals[] = {0, 0};
403379987eSMasahiro Yamada static const unsigned uart1_pins[] = {58, 59};
415e25b9d5SMasahiro Yamada static const int uart1_muxvals[] = {1, 1};
423379987eSMasahiro Yamada static const unsigned uart2_pins[] = {90, 91};
435e25b9d5SMasahiro Yamada static const int uart2_muxvals[] = {1, 1};
443379987eSMasahiro Yamada static const unsigned uart3_pins[] = {94, 95};
455e25b9d5SMasahiro Yamada static const int uart3_muxvals[] = {1, 1};
463379987eSMasahiro Yamada static const unsigned usb0_pins[] = {46, 47};
475e25b9d5SMasahiro Yamada static const int usb0_muxvals[] = {0, 0};
483379987eSMasahiro Yamada static const unsigned usb1_pins[] = {48, 49};
495e25b9d5SMasahiro Yamada static const int usb1_muxvals[] = {0, 0};
503379987eSMasahiro Yamada static const unsigned usb2_pins[] = {50, 51};
515e25b9d5SMasahiro Yamada static const int usb2_muxvals[] = {0, 0};
523379987eSMasahiro Yamada 
533379987eSMasahiro Yamada static const struct uniphier_pinctrl_group uniphier_ld11_groups[] = {
543379987eSMasahiro Yamada 	UNIPHIER_PINCTRL_GROUP(emmc),
553379987eSMasahiro Yamada 	UNIPHIER_PINCTRL_GROUP(emmc_dat8),
56fc9da85cSMasahiro Yamada 	UNIPHIER_PINCTRL_GROUP(ether_rmii),
573379987eSMasahiro Yamada 	UNIPHIER_PINCTRL_GROUP(i2c0),
583379987eSMasahiro Yamada 	UNIPHIER_PINCTRL_GROUP(i2c1),
593379987eSMasahiro Yamada 	UNIPHIER_PINCTRL_GROUP(i2c3),
603379987eSMasahiro Yamada 	UNIPHIER_PINCTRL_GROUP(i2c4),
613379987eSMasahiro Yamada 	UNIPHIER_PINCTRL_GROUP(nand),
62*ee8d037cSMasahiro Yamada 	UNIPHIER_PINCTRL_GROUP(system_bus),
63*ee8d037cSMasahiro Yamada 	UNIPHIER_PINCTRL_GROUP(system_bus_cs1),
64*ee8d037cSMasahiro Yamada 	UNIPHIER_PINCTRL_GROUP(uart0),
65*ee8d037cSMasahiro Yamada 	UNIPHIER_PINCTRL_GROUP(uart1),
66*ee8d037cSMasahiro Yamada 	UNIPHIER_PINCTRL_GROUP(uart2),
67*ee8d037cSMasahiro Yamada 	UNIPHIER_PINCTRL_GROUP(uart3),
683379987eSMasahiro Yamada 	UNIPHIER_PINCTRL_GROUP(usb0),
693379987eSMasahiro Yamada 	UNIPHIER_PINCTRL_GROUP(usb1),
703379987eSMasahiro Yamada 	UNIPHIER_PINCTRL_GROUP(usb2),
713379987eSMasahiro Yamada };
723379987eSMasahiro Yamada 
733379987eSMasahiro Yamada static const char * const uniphier_ld11_functions[] = {
7464c1cc4cSMasahiro Yamada 	UNIPHIER_PINMUX_FUNCTION(emmc),
75fc9da85cSMasahiro Yamada 	UNIPHIER_PINMUX_FUNCTION(ether_rmii),
7664c1cc4cSMasahiro Yamada 	UNIPHIER_PINMUX_FUNCTION(i2c0),
7764c1cc4cSMasahiro Yamada 	UNIPHIER_PINMUX_FUNCTION(i2c1),
7864c1cc4cSMasahiro Yamada 	UNIPHIER_PINMUX_FUNCTION(i2c3),
7964c1cc4cSMasahiro Yamada 	UNIPHIER_PINMUX_FUNCTION(i2c4),
8064c1cc4cSMasahiro Yamada 	UNIPHIER_PINMUX_FUNCTION(nand),
81*ee8d037cSMasahiro Yamada 	UNIPHIER_PINMUX_FUNCTION(system_bus),
82*ee8d037cSMasahiro Yamada 	UNIPHIER_PINMUX_FUNCTION(uart0),
83*ee8d037cSMasahiro Yamada 	UNIPHIER_PINMUX_FUNCTION(uart1),
84*ee8d037cSMasahiro Yamada 	UNIPHIER_PINMUX_FUNCTION(uart2),
85*ee8d037cSMasahiro Yamada 	UNIPHIER_PINMUX_FUNCTION(uart3),
8664c1cc4cSMasahiro Yamada 	UNIPHIER_PINMUX_FUNCTION(usb0),
8764c1cc4cSMasahiro Yamada 	UNIPHIER_PINMUX_FUNCTION(usb1),
8864c1cc4cSMasahiro Yamada 	UNIPHIER_PINMUX_FUNCTION(usb2),
893379987eSMasahiro Yamada };
903379987eSMasahiro Yamada 
913379987eSMasahiro Yamada static struct uniphier_pinctrl_socdata uniphier_ld11_pinctrl_socdata = {
923379987eSMasahiro Yamada 	.groups = uniphier_ld11_groups,
933379987eSMasahiro Yamada 	.groups_count = ARRAY_SIZE(uniphier_ld11_groups),
943379987eSMasahiro Yamada 	.functions = uniphier_ld11_functions,
953379987eSMasahiro Yamada 	.functions_count = ARRAY_SIZE(uniphier_ld11_functions),
966a6b9d5dSMasahiro Yamada 	.caps = UNIPHIER_PINCTRL_CAPS_PUPD_SIMPLE |
976a6b9d5dSMasahiro Yamada 		UNIPHIER_PINCTRL_CAPS_PERPIN_IECTRL,
983379987eSMasahiro Yamada };
993379987eSMasahiro Yamada 
uniphier_ld11_pinctrl_probe(struct udevice * dev)1003379987eSMasahiro Yamada static int uniphier_ld11_pinctrl_probe(struct udevice *dev)
1013379987eSMasahiro Yamada {
1023379987eSMasahiro Yamada 	return uniphier_pinctrl_probe(dev, &uniphier_ld11_pinctrl_socdata);
1033379987eSMasahiro Yamada }
1043379987eSMasahiro Yamada 
1053379987eSMasahiro Yamada static const struct udevice_id uniphier_ld11_pinctrl_match[] = {
1063379987eSMasahiro Yamada 	{ .compatible = "socionext,uniphier-ld11-pinctrl" },
1073379987eSMasahiro Yamada 	{ /* sentinel */ }
1083379987eSMasahiro Yamada };
1093379987eSMasahiro Yamada 
1103379987eSMasahiro Yamada U_BOOT_DRIVER(uniphier_ld11_pinctrl) = {
1113379987eSMasahiro Yamada 	.name = "uniphier-ld11-pinctrl",
1123379987eSMasahiro Yamada 	.id = UCLASS_PINCTRL,
1133379987eSMasahiro Yamada 	.of_match = of_match_ptr(uniphier_ld11_pinctrl_match),
1143379987eSMasahiro Yamada 	.probe = uniphier_ld11_pinctrl_probe,
1153379987eSMasahiro Yamada 	.priv_auto_alloc_size = sizeof(struct uniphier_pinctrl_priv),
1163379987eSMasahiro Yamada 	.ops = &uniphier_pinctrl_ops,
1173379987eSMasahiro Yamada };
118