[U-Boot] [RFC PATCH 3/7] pinctrl: UniPhier: add UniPhier PH1-LD4 pinctrl driver

Masahiro Yamada yamada.masahiro at socionext.com
Wed Jul 15 10:16:18 CEST 2015


Add pinmux support for UniPhier PH1-LD4 SoC.

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

 drivers/pinctrl/uniphier/Kconfig           |  4 ++
 drivers/pinctrl/uniphier/Makefile          |  2 +
 drivers/pinctrl/uniphier/pinctrl-ph1-ld4.c | 69 ++++++++++++++++++++++++++++++
 3 files changed, 75 insertions(+)
 create mode 100644 drivers/pinctrl/uniphier/pinctrl-ph1-ld4.c

diff --git a/drivers/pinctrl/uniphier/Kconfig b/drivers/pinctrl/uniphier/Kconfig
index d458394..5c25923 100644
--- a/drivers/pinctrl/uniphier/Kconfig
+++ b/drivers/pinctrl/uniphier/Kconfig
@@ -4,4 +4,8 @@ config PINCTRL_UNIPHIER_CORE
 	bool
 	select PINCTRL
 
+config PINCTRL_UNIPHIER_PH1_LD4
+	bool "UniPhier PH1-LD4 SoC pinctrl driver"
+	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..66759f2
--- /dev/null
+++ b/drivers/pinctrl/uniphier/pinctrl-ph1-ld4.c
@@ -0,0 +1,69 @@
+/*
+ * 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_mux i2c0_mux[] = {{102, 0}, {103, 0}};
+static const struct uniphier_mux i2c1_mux[] = {{104, 0}, {105, 0}};
+static const struct uniphier_mux i2c2_mux[] = {{108, 2}, {109, 2}};
+static const struct uniphier_mux i2c3_mux[] = {{108, 3}, {109, 3}};
+static const struct uniphier_mux uart0_mux[] = {{85, 1}, {88, 1}};
+static const struct uniphier_mux uart1_mux[] = {{115, 13}, {116, 13}};
+static const struct uniphier_mux uart1b_mux[] = {{69, 23}, {70, 23}};
+static const struct uniphier_mux uart2_mux[] = {{128, 13}, {129, 13}};
+static const struct uniphier_mux uart3_mux[] = {{110, 1}, {111, 1}};
+static const struct uniphier_mux usb0_mux[] = {{53, 0}, {54, 0}};
+static const struct uniphier_mux usb1_mux[] = {{55, 0}, {56, 0}};
+static const struct uniphier_mux usb2_mux[] = {{155, 4}, {156, 4}};
+static const struct uniphier_mux usb2b_mux[] = {{67, 23}, {68, 23}};
+
+static const struct uniphier_pinmux_data ph1_ld4_pinmux_data[] = {
+	UNIPHIER_PINMUX_DATA(i2c0, i2c0),
+	UNIPHIER_PINMUX_DATA(i2c1, i2c1),
+	UNIPHIER_PINMUX_DATA(i2c2, i2c2),
+	UNIPHIER_PINMUX_DATA(i2c3, i2c3),
+	UNIPHIER_PINMUX_DATA(uart0, uart0),
+	UNIPHIER_PINMUX_DATA(uart1, uart1),
+	UNIPHIER_PINMUX_DATA(uart1b, uart1),
+	UNIPHIER_PINMUX_DATA(uart2, uart2),
+	UNIPHIER_PINMUX_DATA(uart3, uart3),
+	UNIPHIER_PINMUX_DATA(usb0, usb0),
+	UNIPHIER_PINMUX_DATA(usb1, usb1),
+	UNIPHIER_PINMUX_DATA(usb2, usb2),
+	UNIPHIER_PINMUX_DATA(usb2b, usb2),
+};
+
+static struct uniphier_pinctrl_socdata ph1_ld4_pinctrl_socdata = {
+	.pinmux_data = ph1_ld4_pinmux_data,
+	.num_pinmux_data = ARRAY_SIZE(ph1_ld4_pinmux_data),
+	.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,
+	.flags = DM_FLAG_PRE_RELOC,
+};
-- 
1.9.1



More information about the U-Boot mailing list