public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jit Loon Lim <jit.loon.lim@intel.com>
To: u-boot@lists.denx.de
Cc: Jagan Teki <jagan@amarulasolutions.com>,
	Vignesh R <vigneshr@ti.com>, Marek <marex@denx.de>,
	Simon <simon.k.r.goldschmidt@gmail.com>,
	Tien Fong <tien.fong.chee@intel.com>,
	Kok Kiang <kok.kiang.hea@intel.com>,
	Raaj <raaj.lokanathan@intel.com>,
	Dinesh <dinesh.maniyam@intel.com>,
	Boon Khai <boon.khai.ng@intel.com>,
	Alif <alif.zakuan.yuslaimi@intel.com>,
	Teik Heng <teik.heng.chong@intel.com>,
	Hazim <muhammad.hazim.izzat.zamri@intel.com>,
	Jit Loon Lim <jit.loon.lim@intel.com>,
	Sieu Mun Tang <sieu.mun.tang@intel.com>
Subject: [PATCH v1 14/17] drivers: sysreset: add system driver for agilex5
Date: Wed, 21 Jun 2023 11:16:07 +0800	[thread overview]
Message-ID: <20230621031610.28401-15-jit.loon.lim@intel.com> (raw)
In-Reply-To: <20230621031610.28401-1-jit.loon.lim@intel.com>

This is for new platform enablement for agilex5.
Add cold, warm reset logic for new platform.

Signed-off-by: Jit Loon Lim <jit.loon.lim@intel.com>
---
 drivers/sysreset/Kconfig                    |  7 ++++
 drivers/sysreset/Makefile                   |  1 +
 drivers/sysreset/sysreset_socfpga_agilex5.c | 44 +++++++++++++++++++++
 3 files changed, 52 insertions(+)
 create mode 100644 drivers/sysreset/sysreset_socfpga_agilex5.c

diff --git a/drivers/sysreset/Kconfig b/drivers/sysreset/Kconfig
index 03f7fdd597..850191eeed 100644
--- a/drivers/sysreset/Kconfig
+++ b/drivers/sysreset/Kconfig
@@ -137,6 +137,13 @@ config SYSRESET_SOCFPGA_SOC64
 	  This enables the system reset driver support for Intel SOCFPGA
 	  SoC64 SoCs.
 
+config SYSRESET_SOCFPGA_AGILEX5
+	bool "Enable support for Intel SOCFPGA AGILEX5 device"
+	depends on ARCH_SOCFPGA && TARGET_SOCFPGA_AGILEX5
+	help
+	  This enables the system reset driver support for Intel SOCFPGA
+	  AGILEX5 device.
+
 config SYSRESET_TI_SCI
 	bool "TI System Control Interface (TI SCI) system reset driver"
 	depends on TI_SCI_PROTOCOL
diff --git a/drivers/sysreset/Makefile b/drivers/sysreset/Makefile
index 40c876764a..6631a71db6 100644
--- a/drivers/sysreset/Makefile
+++ b/drivers/sysreset/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_SYSRESET_PSCI) += sysreset_psci.o
 obj-$(CONFIG_SYSRESET_SBI) += sysreset_sbi.o
 obj-$(CONFIG_SYSRESET_SOCFPGA) += sysreset_socfpga.o
 obj-$(CONFIG_SYSRESET_SOCFPGA_SOC64) += sysreset_socfpga_soc64.o
+obj-$(CONFIG_SYSRESET_SOCFPGA_AGILEX5) += sysreset_socfpga_agilex5.o
 obj-$(CONFIG_SYSRESET_TI_SCI) += sysreset-ti-sci.o
 obj-$(CONFIG_SYSRESET_SYSCON) += sysreset_syscon.o
 obj-$(CONFIG_SYSRESET_WATCHDOG) += sysreset_watchdog.o
diff --git a/drivers/sysreset/sysreset_socfpga_agilex5.c b/drivers/sysreset/sysreset_socfpga_agilex5.c
new file mode 100644
index 0000000000..7b05ffd269
--- /dev/null
+++ b/drivers/sysreset/sysreset_socfpga_agilex5.c
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 Intel Corporation <www.intel.com>
+ *
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <env.h>
+#include <errno.h>
+#include <sysreset.h>
+#include <asm/arch/reset_manager.h>
+#include <asm/system.h>
+
+static int socfpga_sysreset_request(struct udevice *dev,
+				    enum sysreset_t type)
+{
+#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_ATF)
+	const char *reset = env_get("reset");
+
+	if (reset && !strcmp(reset, "warm")) {
+		/* request a warm reset */
+		puts("Do warm reset now...\n");
+
+		/* doing architecture system reset */
+		psci_system_reset2(0, 0);
+	} else {
+		puts("Issuing cold reset REBOOT_HPS\n");
+		psci_system_reset();
+	}
+#endif
+
+	return -EINPROGRESS;
+}
+
+static struct sysreset_ops socfpga_sysreset = {
+	.request = socfpga_sysreset_request,
+};
+
+U_BOOT_DRIVER(sysreset_socfpga) = {
+	.id	= UCLASS_SYSRESET,
+	.name	= "socfpga_sysreset",
+	.ops	= &socfpga_sysreset,
+};
-- 
2.26.2


  parent reply	other threads:[~2023-06-21  3:19 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-21  3:15 [PATCH v1 00/17] Agilex5 Platform Enablement Jit Loon Lim
2023-06-21  3:15 ` [PATCH v1 01/17] arch: arm: update kconfig for new platform agilex5 Jit Loon Lim
2023-06-28  8:17   ` Chee, Tien Fong
2023-06-30  8:18     ` Lim, Jit Loon
2023-06-21  3:15 ` [PATCH v1 02/17] arch: arm: dts: add dts and dtsi " Jit Loon Lim
2023-06-28  9:13   ` Chee, Tien Fong
2023-06-30  8:29     ` Lim, Jit Loon
2023-06-21  3:15 ` [PATCH v1 03/17] arch: arm: mach-socfpga: add new platform agilex5 mach-socfpga enablement Jit Loon Lim
2023-06-28  9:49   ` Chee, Tien Fong
2023-06-21  3:15 ` [PATCH v1 04/17] arch: arm: mach-socfpga: include: mach: " Jit Loon Lim
2023-06-21  3:15 ` [PATCH v1 05/17] board: intel: add new platform agilex5 socdk Jit Loon Lim
2023-06-21  3:15 ` [PATCH v1 06/17] configs: add new platform agilex5 defconfig Jit Loon Lim
2023-06-21  3:16 ` [PATCH v1 07/17] doc: device-tree-bindings: misc: add secreg text file for agilex5 Jit Loon Lim
2023-06-21  3:16 ` [PATCH v1 08/17] drivers: ddr: altera: add ddr support " Jit Loon Lim
2023-06-21  3:16 ` [PATCH v1 09/17] drivers: clk: altera: add clock " Jit Loon Lim
2023-06-21  3:16 ` [PATCH v1 10/17] drivers: misc: update driver misc " Jit Loon Lim
2023-06-21  3:16 ` [PATCH v1 11/17] drivers: mmc: add mmc/cadence driver " Jit Loon Lim
2023-06-21  3:16 ` [PATCH v1 12/17] drivers: phy: add combo phy " Jit Loon Lim
2023-06-21  3:16 ` [PATCH v1 13/17] drivers: reset: add reset " Jit Loon Lim
2023-06-21  3:16 ` Jit Loon Lim [this message]
2023-06-21  3:16 ` [PATCH v1 15/17] drivers: watchdog: update watchdog " Jit Loon Lim
2023-06-21  3:16 ` [PATCH v1 16/17] includes: add and update configuration " Jit Loon Lim
2023-06-21  3:16 ` [PATCH v1 17/17] tools: binman: update binman tool " Jit Loon Lim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230621031610.28401-15-jit.loon.lim@intel.com \
    --to=jit.loon.lim@intel.com \
    --cc=alif.zakuan.yuslaimi@intel.com \
    --cc=boon.khai.ng@intel.com \
    --cc=dinesh.maniyam@intel.com \
    --cc=jagan@amarulasolutions.com \
    --cc=kok.kiang.hea@intel.com \
    --cc=marex@denx.de \
    --cc=muhammad.hazim.izzat.zamri@intel.com \
    --cc=raaj.lokanathan@intel.com \
    --cc=sieu.mun.tang@intel.com \
    --cc=simon.k.r.goldschmidt@gmail.com \
    --cc=teik.heng.chong@intel.com \
    --cc=tien.fong.chee@intel.com \
    --cc=u-boot@lists.denx.de \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox