[U-Boot] [PATCH 05/15] pinctrl: uniphier: add UniPhier PH1-Pro5 pinctrl driver

Masahiro Yamada yamada.masahiro at socionext.com
Tue Sep 1 15:50:22 CEST 2015


Add pin configuration and pinmux support for UniPhier PH1-Pro5 SoC.

Signed-off-by: Masahiro Yamada <yamada.masahiro at socionext.com>
---

 drivers/pinctrl/uniphier/Kconfig            |   6 ++
 drivers/pinctrl/uniphier/Makefile           |   1 +
 drivers/pinctrl/uniphier/pinctrl-ph1-pro5.c | 101 ++++++++++++++++++++++++++++
 3 files changed, 108 insertions(+)
 create mode 100644 drivers/pinctrl/uniphier/pinctrl-ph1-pro5.c

diff --git a/drivers/pinctrl/uniphier/Kconfig b/drivers/pinctrl/uniphier/Kconfig
index a156a28..9d3065d 100644
--- a/drivers/pinctrl/uniphier/Kconfig
+++ b/drivers/pinctrl/uniphier/Kconfig
@@ -21,4 +21,10 @@ config PINCTRL_UNIPHIER_PH1_SLD8
 	default y
 	select PINCTRL_UNIPHIER_CORE
 
+config PINCTRL_UNIPHIER_PH1_PRO5
+	bool "UniPhier PH1-Pro5 SoC pinctrl driver"
+	depends on MACH_PH1_PRO5
+	default y
+	select PINCTRL_UNIPHIER_CORE
+
 endif
diff --git a/drivers/pinctrl/uniphier/Makefile b/drivers/pinctrl/uniphier/Makefile
index 3349fff..b0cd3e8 100644
--- a/drivers/pinctrl/uniphier/Makefile
+++ b/drivers/pinctrl/uniphier/Makefile
@@ -3,3 +3,4 @@ obj-$(CONFIG_PINCTRL_UNIPHIER_CORE)		+= pinctrl-uniphier-core.o
 obj-$(CONFIG_PINCTRL_UNIPHIER_PH1_LD4)		+= pinctrl-ph1-ld4.o
 obj-$(CONFIG_PINCTRL_UNIPHIER_PH1_PRO4)		+= pinctrl-ph1-pro4.o
 obj-$(CONFIG_PINCTRL_UNIPHIER_PH1_SLD8)		+= pinctrl-ph1-sld8.o
+obj-$(CONFIG_PINCTRL_UNIPHIER_PH1_PRO5)		+= pinctrl-ph1-pro5.o
diff --git a/drivers/pinctrl/uniphier/pinctrl-ph1-pro5.c b/drivers/pinctrl/uniphier/pinctrl-ph1-pro5.c
new file mode 100644
index 0000000..63fe67b
--- /dev/null
+++ b/drivers/pinctrl/uniphier/pinctrl-ph1-pro5.c
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro at 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[] = {{112, 0}, {113, 0}};
+static const struct uniphier_pmx_data i2c1_pmx[] = {{114, 0}, {115, 0}};
+static const struct uniphier_pmx_data i2c2_pmx[] = {{116, 0}, {117, 0}};
+static const struct uniphier_pmx_data i2c3_pmx[] = {{118, 0}, {119, 0}};
+static const struct uniphier_pmx_data i2c5_pmx[] = {{87, 2}, {88, 2}};
+static const struct uniphier_pmx_data i2c5b_pmx[] = {{196, 2}, {197, 2}};
+static const struct uniphier_pmx_data i2c5c_pmx[] = {{215, 2}, {216, 2}};
+static const struct uniphier_pmx_data i2c6_pmx[] = {{101, 2}, {102, 2}};
+static const struct uniphier_pmx_data nand_pmx[] = {
+	{19, 0}, {20, 0}, {21, 0}, {22, 0}, {23, 0}, {24, 0}, {25, 0}, {28, 0},
+	{29, 0}, {30, 0}, {31, 0}, {32, 0}, {33, 0}, {34, 0}, {35, 0},
+};
+static const struct uniphier_pmx_data nand_cs1_pmx[] = {{26, 0}, {27, 0}};
+static const struct uniphier_pmx_data uart0_pmx[] = {{47, 0}, {48, 0}};
+static const struct uniphier_pmx_data uart0b_pmx[] = {{227, 3}, {228, 3}};
+static const struct uniphier_pmx_data uart1_pmx[] = {{49, 0}, {50, 0}};
+static const struct uniphier_pmx_data uart2_pmx[] = {{51, 0}, {52, 0}};
+static const struct uniphier_pmx_data uart3_pmx[] = {{53, 2}, {54, 2}};
+static const struct uniphier_pmx_data usb0_pmx[] = {{124, 0}, {125, 0}};
+static const struct uniphier_pmx_data usb1_pmx[] = {{126, 0}, {127, 0}};
+static const struct uniphier_pmx_data usb2_pmx[] = {{128, 0}, {129, 0}};
+
+static const struct uniphier_pinctrl_group ph1_pro5_groups[] = {
+	UNIPHIER_PINCTRL_GROUP(i2c0),
+	UNIPHIER_PINCTRL_GROUP(i2c1),
+	UNIPHIER_PINCTRL_GROUP(i2c2),
+	UNIPHIER_PINCTRL_GROUP(i2c3),
+	UNIPHIER_PINCTRL_GROUP(i2c5),
+	UNIPHIER_PINCTRL_GROUP(i2c5b),
+	UNIPHIER_PINCTRL_GROUP(i2c5c),
+	UNIPHIER_PINCTRL_GROUP(i2c6),
+	UNIPHIER_PINCTRL_GROUP(nand),
+	UNIPHIER_PINCTRL_GROUP(nand_cs1),
+	UNIPHIER_PINCTRL_GROUP(uart0),
+	UNIPHIER_PINCTRL_GROUP(uart0b),
+	UNIPHIER_PINCTRL_GROUP(uart1),
+	UNIPHIER_PINCTRL_GROUP(uart2),
+	UNIPHIER_PINCTRL_GROUP(uart3),
+	UNIPHIER_PINCTRL_GROUP(usb0),
+	UNIPHIER_PINCTRL_GROUP(usb1),
+	UNIPHIER_PINCTRL_GROUP(usb2),
+};
+
+static const char * const ph1_pro5_functions[] = {
+	"i2c0",
+	"i2c1",
+	"i2c2",
+	"i2c3",
+	"i2c5",
+	"i2c6",
+	"nand",
+	"uart0",
+	"uart1",
+	"uart2",
+	"uart3",
+	"usb0",
+	"usb1",
+	"usb2",
+};
+
+static struct uniphier_pinctrl_socdata ph1_pro5_pinctrl_socdata = {
+	.groups = ph1_pro5_groups,
+	.groups_count = ARRAY_SIZE(ph1_pro5_groups),
+	.functions = ph1_pro5_functions,
+	.functions_count = ARRAY_SIZE(ph1_pro5_functions),
+	.mux_bits = 4,
+	.reg_stride = 8,
+	.load_pinctrl = true,
+};
+
+static int ph1_pro5_pinctrl_probe(struct udevice *dev)
+{
+	return uniphier_pinctrl_probe(dev, &ph1_pro5_pinctrl_socdata);
+}
+
+static const struct udevice_id ph1_pro5_pinctrl_match[] = {
+	{ .compatible = "socionext,ph1-pro5-pinctrl" },
+	{ /* sentinel */ }
+};
+
+U_BOOT_DRIVER(ph1_pro5_pinctrl) = {
+	.name = "ph1-pro5-pinctrl",
+	.id = UCLASS_PINCTRL,
+	.of_match = of_match_ptr(ph1_pro5_pinctrl_match),
+	.probe = ph1_pro5_pinctrl_probe,
+	.remove = uniphier_pinctrl_remove,
+	.priv_auto_alloc_size = sizeof(struct uniphier_pinctrl_priv),
+	.ops = &uniphier_pinctrl_ops,
+	.flags = DM_FLAG_PRE_RELOC,
+};
-- 
1.9.1



More information about the U-Boot mailing list