
Add pin configuration and pinmux support for UniPhier PH1-LD4 SoC.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
drivers/pinctrl/uniphier/Kconfig | 6 ++ drivers/pinctrl/uniphier/Makefile | 2 + drivers/pinctrl/uniphier/pinctrl-ph1-ld4.c | 92 ++++++++++++++++++++++++++++++ 3 files changed, 100 insertions(+) create mode 100644 drivers/pinctrl/uniphier/pinctrl-ph1-ld4.c
diff --git a/drivers/pinctrl/uniphier/Kconfig b/drivers/pinctrl/uniphier/Kconfig index 29a623d..03593cd 100644 --- a/drivers/pinctrl/uniphier/Kconfig +++ b/drivers/pinctrl/uniphier/Kconfig @@ -3,4 +3,10 @@ if ARCH_UNIPHIER config PINCTRL_UNIPHIER_CORE bool
+config PINCTRL_UNIPHIER_PH1_LD4 + bool "UniPhier PH1-LD4 SoC pinctrl driver" + depends on MACH_PH1_LD4 + default y + select PINCTRL_UNIPHIER_CORE + endif diff --git a/drivers/pinctrl/uniphier/Makefile b/drivers/pinctrl/uniphier/Makefile index 748aa1b..b4bd042 100644 --- a/drivers/pinctrl/uniphier/Makefile +++ b/drivers/pinctrl/uniphier/Makefile @@ -1 +1,3 @@ obj-$(CONFIG_PINCTRL_UNIPHIER_CORE) += pinctrl-uniphier-core.o + +obj-$(CONFIG_PINCTRL_UNIPHIER_PH1_LD4) += pinctrl-ph1-ld4.o diff --git a/drivers/pinctrl/uniphier/pinctrl-ph1-ld4.c b/drivers/pinctrl/uniphier/pinctrl-ph1-ld4.c new file mode 100644 index 0000000..d92e9bf --- /dev/null +++ b/drivers/pinctrl/uniphier/pinctrl-ph1-ld4.c @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2015 Masahiro Yamada yamada.masahiro@socionext.com + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <dm/device.h> +#include <dm/pinctrl.h> + +#include "pinctrl-uniphier.h" + +static const struct uniphier_pmx_data i2c0_pmx[] = {{102, 0}, {103, 0}}; +static const struct uniphier_pmx_data i2c1_pmx[] = {{104, 0}, {105, 0}}; +static const struct uniphier_pmx_data i2c2_pmx[] = {{108, 2}, {109, 2}}; +static const struct uniphier_pmx_data i2c3_pmx[] = {{108, 3}, {109, 3}}; +static const struct uniphier_pmx_data nand_pmx[] = { + {24, 0}, {25, 0}, {26, 0}, {27, 0}, {28, 0}, {29, 0}, {30, 0}, {31, 0}, + {158, 0}, {159, 0}, {160, 0}, {161, 0}, {162, 0}, {163, 0}, {164, 0}, +}; +static const struct uniphier_pmx_data nand_cs1_pmx[] = {{22, 0}, {23, 0}}; +static const struct uniphier_pmx_data uart0_pmx[] = {{85, 1}, {88, 1}}; +static const struct uniphier_pmx_data uart1_pmx[] = {{155, 13}, {156, 13}}; +static const struct uniphier_pmx_data uart1b_pmx[] = {{69, 23}, {70, 23}}; +static const struct uniphier_pmx_data uart2_pmx[] = {{128, 13}, {129, 13}}; +static const struct uniphier_pmx_data uart3_pmx[] = {{110, 1}, {111, 1}}; +static const struct uniphier_pmx_data usb0_pmx[] = {{53, 0}, {54, 0}}; +static const struct uniphier_pmx_data usb1_pmx[] = {{55, 0}, {56, 0}}; +static const struct uniphier_pmx_data usb2_pmx[] = {{155, 4}, {156, 4}}; +static const struct uniphier_pmx_data usb2b_pmx[] = {{67, 23}, {68, 23}}; + +static const struct uniphier_pinctrl_group ph1_ld4_groups[] = { + UNIPHIER_PINCTRL_GROUP(i2c0), + UNIPHIER_PINCTRL_GROUP(i2c1), + UNIPHIER_PINCTRL_GROUP(i2c2), + UNIPHIER_PINCTRL_GROUP(i2c3), + UNIPHIER_PINCTRL_GROUP(nand), + UNIPHIER_PINCTRL_GROUP(nand_cs1), + UNIPHIER_PINCTRL_GROUP(uart0), + UNIPHIER_PINCTRL_GROUP(uart1), + UNIPHIER_PINCTRL_GROUP(uart1b), + UNIPHIER_PINCTRL_GROUP(uart2), + UNIPHIER_PINCTRL_GROUP(uart3), + UNIPHIER_PINCTRL_GROUP(usb0), + UNIPHIER_PINCTRL_GROUP(usb1), + UNIPHIER_PINCTRL_GROUP(usb2), + UNIPHIER_PINCTRL_GROUP(usb2b), +}; + +static const char * const ph1_ld4_functions[] = { + "i2c0", + "i2c1", + "i2c2", + "i2c3", + "nand", + "uart0", + "uart1", + "uart2", + "uart3", + "usb0", + "usb1", + "usb2", +}; + +static struct uniphier_pinctrl_socdata ph1_ld4_pinctrl_socdata = { + .groups = ph1_ld4_groups, + .groups_count = ARRAY_SIZE(ph1_ld4_groups), + .functions = ph1_ld4_functions, + .functions_count = ARRAY_SIZE(ph1_ld4_functions), + .mux_bits = 8, + .reg_stride = 4, + .load_pinctrl = false, +}; + +static int ph1_ld4_pinctrl_probe(struct udevice *dev) +{ + return uniphier_pinctrl_probe(dev, &ph1_ld4_pinctrl_socdata); +} + +static const struct udevice_id ph1_ld4_pinctrl_match[] = { + { .compatible = "socionext,ph1-ld4-pinctrl" }, + { /* sentinel */ } +}; + +U_BOOT_DRIVER(ph1_ld4_pinctrl) = { + .name = "ph1-ld4-pinctrl", + .id = UCLASS_PINCTRL, + .of_match = of_match_ptr(ph1_ld4_pinctrl_match), + .probe = ph1_ld4_pinctrl_probe, + .remove = uniphier_pinctrl_remove, + .priv_auto_alloc_size = sizeof(struct uniphier_pinctrl_priv), + .ops = &uniphier_pinctrl_ops, +};