[U-Boot] [PATCH 04/15] pinctrl: uniphier: add UniPhier PH1-sLD8 pinctrl driver

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


Add pin configuration and pinmux support for UniPhier PH1-sLD8 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-sld8.c | 88 +++++++++++++++++++++++++++++
 3 files changed, 95 insertions(+)
 create mode 100644 drivers/pinctrl/uniphier/pinctrl-ph1-sld8.c

diff --git a/drivers/pinctrl/uniphier/Kconfig b/drivers/pinctrl/uniphier/Kconfig
index c417a9f..a156a28 100644
--- a/drivers/pinctrl/uniphier/Kconfig
+++ b/drivers/pinctrl/uniphier/Kconfig
@@ -15,4 +15,10 @@ config PINCTRL_UNIPHIER_PH1_PRO4
 	default y
 	select PINCTRL_UNIPHIER_CORE
 
+config PINCTRL_UNIPHIER_PH1_SLD8
+	bool "UniPhier PH1-sLD8 SoC pinctrl driver"
+	depends on MACH_PH1_SLD8
+	default y
+	select PINCTRL_UNIPHIER_CORE
+
 endif
diff --git a/drivers/pinctrl/uniphier/Makefile b/drivers/pinctrl/uniphier/Makefile
index b1b597e..3349fff 100644
--- a/drivers/pinctrl/uniphier/Makefile
+++ b/drivers/pinctrl/uniphier/Makefile
@@ -2,3 +2,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
diff --git a/drivers/pinctrl/uniphier/pinctrl-ph1-sld8.c b/drivers/pinctrl/uniphier/pinctrl-ph1-sld8.c
new file mode 100644
index 0000000..b2c28c6
--- /dev/null
+++ b/drivers/pinctrl/uniphier/pinctrl-ph1-sld8.c
@@ -0,0 +1,88 @@
+/*
+ * 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[] = {{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[] = {
+	{15, 0}, {16, 0}, {17, 0}, {18, 0}, {19, 0}, {20, 0}, {21, 0}, {24, 0},
+	{25, 0}, {26, 0}, {27, 0}, {28, 0}, {29, 0}, {30, 0}, {31, 0},
+};
+static const struct uniphier_pmx_data nand_cs1_pmx[] = {{22, 0}, {23, 0}};
+static const struct uniphier_pmx_data uart0_pmx[] = {{70, 3}, {71, 3}};
+static const struct uniphier_pmx_data uart1_pmx[] = {{114, 0}, {115, 0}};
+static const struct uniphier_pmx_data uart2_pmx[] = {{112, 1}, {113, 1}};
+static const struct uniphier_pmx_data uart3_pmx[] = {{110, 1}, {111, 1}};
+static const struct uniphier_pmx_data usb0_pmx[] = {{41, 0}, {42, 0}};
+static const struct uniphier_pmx_data usb1_pmx[] = {{43, 0}, {44, 0}};
+static const struct uniphier_pmx_data usb2_pmx[] = {{114, 1}, {115, 1}};
+
+static const struct uniphier_pinctrl_group ph1_sld8_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(uart2),
+	UNIPHIER_PINCTRL_GROUP(uart3),
+	UNIPHIER_PINCTRL_GROUP(usb0),
+	UNIPHIER_PINCTRL_GROUP(usb1),
+	UNIPHIER_PINCTRL_GROUP(usb2),
+};
+
+static const char * const ph1_sld8_functions[] = {
+	"i2c0",
+	"i2c1",
+	"i2c2",
+	"i2c3",
+	"nand",
+	"uart0",
+	"uart1",
+	"uart2",
+	"uart3",
+	"usb0",
+	"usb1",
+	"usb2",
+};
+
+static struct uniphier_pinctrl_socdata ph1_sld8_pinctrl_socdata = {
+	.groups = ph1_sld8_groups,
+	.groups_count = ARRAY_SIZE(ph1_sld8_groups),
+	.functions = ph1_sld8_functions,
+	.functions_count = ARRAY_SIZE(ph1_sld8_functions),
+	.mux_bits = 8,
+	.reg_stride = 4,
+	.load_pinctrl = false,
+};
+
+static int ph1_sld8_pinctrl_probe(struct udevice *dev)
+{
+	return uniphier_pinctrl_probe(dev, &ph1_sld8_pinctrl_socdata);
+}
+
+static const struct udevice_id ph1_sld8_pinctrl_match[] = {
+	{ .compatible = "socionext,ph1-sld8-pinctrl" },
+	{ /* sentinel */ }
+};
+
+U_BOOT_DRIVER(ph1_sld8_pinctrl) = {
+	.name = "ph1-sld8-pinctrl",
+	.id = UCLASS_PINCTRL,
+	.of_match = of_match_ptr(ph1_sld8_pinctrl_match),
+	.probe = ph1_sld8_pinctrl_probe,
+	.remove = uniphier_pinctrl_remove,
+	.priv_auto_alloc_size = sizeof(struct uniphier_pinctrl_priv),
+	.ops = &uniphier_pinctrl_ops,
+};
-- 
1.9.1



More information about the U-Boot mailing list