[U-Boot] [RFC 13/35] reset: sunxi: Add DM reset driver template for the A64 SoC
Jagan Teki
jagan at amarulasolutions.com
Mon Jul 16 11:28:28 UTC 2018
Create the template for a new DM reset driver for the Allwinner A64 SoC.
Signed-off-by: Jagan Teki <jagan at amarulasolutions.com>
---
drivers/reset/Kconfig | 2 +
drivers/reset/Makefile | 1 +
drivers/reset/sunxi/Kconfig | 19 ++++++++++
drivers/reset/sunxi/Makefile | 7 ++++
drivers/reset/sunxi/reset_a64.c | 67 +++++++++++++++++++++++++++++++++
5 files changed, 96 insertions(+)
create mode 100644 drivers/reset/sunxi/Kconfig
create mode 100644 drivers/reset/sunxi/Makefile
create mode 100644 drivers/reset/sunxi/reset_a64.c
diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig
index 33c39b7fb6..f95b38a35f 100644
--- a/drivers/reset/Kconfig
+++ b/drivers/reset/Kconfig
@@ -98,4 +98,6 @@ config RESET_SOCFPGA
help
Support for reset controller on SoCFPGA platform.
+source "drivers/reset/sunxi/Kconfig"
+
endmenu
diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
index ad08be4c8c..7530b5368d 100644
--- a/drivers/reset/Makefile
+++ b/drivers/reset/Makefile
@@ -15,3 +15,4 @@ obj-$(CONFIG_AST2500_RESET) += ast2500-reset.o
obj-$(CONFIG_RESET_ROCKCHIP) += reset-rockchip.o
obj-$(CONFIG_RESET_MESON) += reset-meson.o
obj-$(CONFIG_RESET_SOCFPGA) += reset-socfpga.o
+obj-$(CONFIG_RESET_SUNXI) += sunxi/
diff --git a/drivers/reset/sunxi/Kconfig b/drivers/reset/sunxi/Kconfig
new file mode 100644
index 0000000000..c0dfa56071
--- /dev/null
+++ b/drivers/reset/sunxi/Kconfig
@@ -0,0 +1,19 @@
+config RESET_SUNXI
+ bool "RESET support for Allwinner SoCs"
+ depends on ARCH_SUNXI
+ depends on CLK_SUNXI
+ select DM_RESET
+ help
+ This enables support for common reset driver API on Allwinner
+ SoCs.
+
+if RESET_SUNXI
+
+config RESET_SUN50I_A64
+ bool "Reset driver for Allwinner A64"
+ default MACH_SUN50I
+ help
+ This enables common reset driver support for platforms based
+ on Allwinner A64 SoC.
+
+endif # RESET_SUNXI
diff --git a/drivers/reset/sunxi/Makefile b/drivers/reset/sunxi/Makefile
new file mode 100644
index 0000000000..cc80b11818
--- /dev/null
+++ b/drivers/reset/sunxi/Makefile
@@ -0,0 +1,7 @@
+#
+# Copyright (C) 2018 Amarula Solutions
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-$(CONFIG_RESET_SUN50I_A64) += reset_a64.o
diff --git a/drivers/reset/sunxi/reset_a64.c b/drivers/reset/sunxi/reset_a64.c
new file mode 100644
index 0000000000..595af5aa6e
--- /dev/null
+++ b/drivers/reset/sunxi/reset_a64.c
@@ -0,0 +1,67 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (C) 2018 Amarula Solutions B.V.
+ * Author: Jagan Teki <jagan at amarulasolutions.com>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <errno.h>
+#include <reset-uclass.h>
+#include <asm/io.h>
+#include <dm/lists.h>
+#include <dt-bindings/reset/sun50i-a64-ccu.h>
+
+struct a64_reset_priv {
+ void *base;
+};
+
+static int a64_reset_request(struct reset_ctl *reset_ctl)
+{
+ debug("%s(#%ld)\n", __func__, reset_ctl->id);
+
+ return 0;
+}
+
+static int a64_reset_free(struct reset_ctl *reset_ctl)
+{
+ debug("%s(#%ld)\n", __func__, reset_ctl->id);
+
+ return 0;
+}
+
+static int a64_reset_assert(struct reset_ctl *reset_ctl)
+{
+ debug("%s(#%ld)\n", __func__, reset_ctl->id);
+
+ debug(" unhandled\n");
+ return -EINVAL;
+}
+
+static int a64_reset_deassert(struct reset_ctl *reset_ctl)
+{
+ debug("%s(#%ld)\n", __func__, reset_ctl->id);
+
+ debug(" unhandled\n");
+ return -EINVAL;
+}
+
+struct reset_ops a64_reset_ops = {
+ .request = a64_reset_request,
+ .free = a64_reset_free,
+ .rst_assert = a64_reset_assert,
+ .rst_deassert = a64_reset_deassert,
+};
+
+static int a64_reset_probe(struct udevice *dev)
+{
+ return 0;
+}
+
+U_BOOT_DRIVER(reset_sun50i_a64) = {
+ .name = "sun50i_a64_reset",
+ .id = UCLASS_RESET,
+ .ops = &a64_reset_ops,
+ .probe = a64_reset_probe,
+ .priv_auto_alloc_size = sizeof(struct a64_reset_priv),
+};
--
2.17.1
More information about the U-Boot
mailing list