diff mbox

[U-Boot,RFC,4/7] pinctrl: UniPhier: add UniPhier PH1-Pro4 pinctrl driver

Message ID 1436948198-17236-5-git-send-email-yamada.masahiro@socionext.com
State RFC
Delegated to: Simon Glass
Headers show

Commit Message

Masahiro Yamada July 15, 2015, 8:16 a.m. UTC
Add pinmux support for UniPhier PH1-Pro4 SoC.

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

 drivers/pinctrl/uniphier/Kconfig            |  4 ++
 drivers/pinctrl/uniphier/Makefile           |  1 +
 drivers/pinctrl/uniphier/pinctrl-ph1-pro4.c | 69 +++++++++++++++++++++++++++++
 3 files changed, 74 insertions(+)
 create mode 100644 drivers/pinctrl/uniphier/pinctrl-ph1-pro4.c
diff mbox

Patch

diff --git a/drivers/pinctrl/uniphier/Kconfig b/drivers/pinctrl/uniphier/Kconfig
index 5c25923..38c2f5e 100644
--- a/drivers/pinctrl/uniphier/Kconfig
+++ b/drivers/pinctrl/uniphier/Kconfig
@@ -8,4 +8,8 @@  config PINCTRL_UNIPHIER_PH1_LD4
 	bool "UniPhier PH1-LD4 SoC pinctrl driver"
 	select PINCTRL_UNIPHIER_CORE
 
+config PINCTRL_UNIPHIER_PH1_PRO4
+	bool "UniPhier PH1-Pro4 SoC pinctrl driver"
+	select PINCTRL_UNIPHIER_CORE
+
 endif
diff --git a/drivers/pinctrl/uniphier/Makefile b/drivers/pinctrl/uniphier/Makefile
index b4bd042..b1b597e 100644
--- a/drivers/pinctrl/uniphier/Makefile
+++ b/drivers/pinctrl/uniphier/Makefile
@@ -1,3 +1,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
diff --git a/drivers/pinctrl/uniphier/pinctrl-ph1-pro4.c b/drivers/pinctrl/uniphier/pinctrl-ph1-pro4.c
new file mode 100644
index 0000000..ec4322e
--- /dev/null
+++ b/drivers/pinctrl/uniphier/pinctrl-ph1-pro4.c
@@ -0,0 +1,69 @@ 
+/*
+ * 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_mux i2c0_mux[] = {{142, 0}, {143, 0}};
+static const struct uniphier_mux i2c1_mux[] = {{144, 0}, {145, 0}};
+static const struct uniphier_mux i2c2_mux[] = {{146, 0}, {147, 0}};
+static const struct uniphier_mux i2c3_mux[] = {{148, 0}, {149, 0}};
+static const struct uniphier_mux i2c6_mux[] = {{308, 6}, {309, 6}};
+static const struct uniphier_mux uart0_mux[] = {{127, 0}, {128, 0}};
+static const struct uniphier_mux uart1_mux[] = {{129, 0}, {130, 0}};
+static const struct uniphier_mux uart2_mux[] = {{131, 0}, {132, 0}};
+static const struct uniphier_mux uart3_mux[] = {{88, 2}, {89, 2}};
+static const struct uniphier_mux usb0_mux[] = {{180, 0}, {181, 0}};
+static const struct uniphier_mux usb1_mux[] = {{182, 0}, {183, 0}};
+static const struct uniphier_mux usb2_mux[] = {{184, 0}, {185, 0}};
+static const struct uniphier_mux usb3_mux[] = {{186, 0}, {187, 0}};
+
+static const struct uniphier_pinmux_data ph1_pro4_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(i2c6, i2c6),
+	UNIPHIER_PINMUX_DATA(uart0, uart0),
+	UNIPHIER_PINMUX_DATA(uart1, 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(usb3, usb3),
+};
+
+static struct uniphier_pinctrl_socdata ph1_pro4_pinctrl_socdata = {
+	.pinmux_data = ph1_pro4_pinmux_data,
+	.num_pinmux_data = ARRAY_SIZE(ph1_pro4_pinmux_data),
+	.mux_bits = 4,
+	.reg_stride = 8,
+	.load_pinctrl = true,
+};
+
+static int ph1_pro4_pinctrl_probe(struct udevice *dev)
+{
+	return uniphier_pinctrl_probe(dev, &ph1_pro4_pinctrl_socdata);
+}
+
+static const struct udevice_id ph1_pro4_pinctrl_match[] = {
+	{ .compatible = "socionext,ph1-pro4-pinctrl" },
+	{ /* sentinel */ }
+};
+
+U_BOOT_DRIVER(ph1_pro4_pinctrl) = {
+	.name = "ph1-pro4-pinctrl",
+	.id = UCLASS_PINCTRL,
+	.of_match = of_match_ptr(ph1_pro4_pinctrl_match),
+	.probe = ph1_pro4_pinctrl_probe,
+	.remove = uniphier_pinctrl_remove,
+	.priv_auto_alloc_size = sizeof(struct uniphier_pinctrl_priv),
+	.ops = &uniphier_pinctrl_ops,
+	.flags = DM_FLAG_PRE_RELOC,
+};