mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Steffen Trumtrar <s.trumtrar@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Subject: [PATCH 04/14] ARM: arria10: reset-manager: don't touch l4 wdog
Date: Mon, 17 Jun 2024 13:36:26 +0200	[thread overview]
Message-ID: <20240617-v2024-05-0-topic-socfpga-arria10-xloader-v1-4-48a6eba4bb5e@pengutronix.de> (raw)
In-Reply-To: <20240617-v2024-05-0-topic-socfpga-arria10-xloader-v1-0-48a6eba4bb5e@pengutronix.de>

Leave the L4 watchdog 0 running.
If a watchdog reset happens while booting, the bootrom attempts to load
the last valid bootloader identified by the initswlastld register.

As we now hang() in arria10-xload after 10 failed FPGA writing attempts,
we need the watchdog to trigger so that the bootrom can try to start the
next bootloader image as fallback.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 arch/arm/mach-socfpga/arria10-reset-manager.c | 9 ++++++---
 arch/arm/mach-socfpga/arria10-xload.c         | 5 +++++
 include/mach/socfpga/generic.h                | 2 ++
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-socfpga/arria10-reset-manager.c b/arch/arm/mach-socfpga/arria10-reset-manager.c
index 05440cf903..6f209e7045 100644
--- a/arch/arm/mach-socfpga/arria10-reset-manager.c
+++ b/arch/arm/mach-socfpga/arria10-reset-manager.c
@@ -33,9 +33,13 @@ void arria10_reset_peripherals(void)
 	}
 
 	/* disable all components except the ECC_OCP and bootsource */
-	writel(0xffffffff, ARRIA10_RSTMGR_ADDR + ARRIA10_RSTMGR_PER1MODRST);
 	writel(~mask, ARRIA10_RSTMGR_ADDR + ARRIA10_RSTMGR_PER0MODRST);
 
+	mask = ARRIA10_RSTMGR_PER1MODRST_WATCHDOG0 |
+	       ARRIA10_RSTMGR_PER1MODRST_L4SYSTIMER0;
+	/* disable all components except L4 watchdog */
+	writel(~mask, ARRIA10_RSTMGR_ADDR + ARRIA10_RSTMGR_PER1MODRST);
+
 	mask = 0xffffffff;
 
 	if (src == BOOTSOURCE_MMC) {
@@ -65,8 +69,7 @@ void arria10_reset_deassert_dedicated_peripherals(void)
 
 	clrbits_le32(ARRIA10_RSTMGR_ADDR + ARRIA10_RSTMGR_PER0MODRST, mask);
 
-	mask = ARRIA10_RSTMGR_PER1MODRST_L4SYSTIMER0 |
-	       ARRIA10_RSTMGR_PER1MODRST_UART1 |
+	mask = ARRIA10_RSTMGR_PER1MODRST_UART1 |
 	       ARRIA10_RSTMGR_PER1MODRST_UART0;
 
 	clrbits_le32(ARRIA10_RSTMGR_ADDR + ARRIA10_RSTMGR_PER1MODRST, mask);
diff --git a/arch/arm/mach-socfpga/arria10-xload.c b/arch/arm/mach-socfpga/arria10-xload.c
index db3cc209ee..7b0d6f00fb 100644
--- a/arch/arm/mach-socfpga/arria10-xload.c
+++ b/arch/arm/mach-socfpga/arria10-xload.c
@@ -437,6 +437,11 @@ void arria10_start_image(int offset)
 	if (ret)
 		hang();
 
+	/* mark image in OCRAM as valid */
+	writel(ARRIA10_SYSMGR_ROM_INITSWSTATE_VALID, ARRIA10_SYSMGR_ROM_INITSWSTATE);
+
+	arria10_watchdog_disable();
+
 	bb = buf;
 
 	bb();
diff --git a/include/mach/socfpga/generic.h b/include/mach/socfpga/generic.h
index 6c359e2abb..1af086140f 100644
--- a/include/mach/socfpga/generic.h
+++ b/include/mach/socfpga/generic.h
@@ -85,6 +85,8 @@ static inline int arria10_device_init(struct arria10_mainpll_cfg *mainpll,
 {
 	return 0;
 }
+static void arria10_kick_l4wd0(void) {}
+static void arria10_watchdog_disable(void) {}
 #endif
 
 static inline void __udelay(unsigned us)

-- 
2.43.2




  parent reply	other threads:[~2024-06-17 11:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-17 11:36 [PATCH 00/14] ARM: SoCFPGA: arria10: clean up early bitstream loading Steffen Trumtrar
2024-06-17 11:36 ` [PATCH 01/14] ARM: arria10: system-manager: add handoff registers Steffen Trumtrar
2024-06-17 11:36 ` [PATCH 02/14] ARM: Arria10: reset manager: document reset source Steffen Trumtrar
2024-06-17 11:36 ` [PATCH 03/14] ARM: socfpga: Arria10: PE1: remove arm_cpu_lowlevel_init Steffen Trumtrar
2024-06-17 11:36 ` Steffen Trumtrar [this message]
2024-06-17 11:36 ` [PATCH 05/14] ARM: Arria10: PE1: disable l4wd0 in bringup Steffen Trumtrar
2024-06-17 11:36 ` [PATCH 06/14] ARM: Arria10: xload: rework __arria10_load_fpga Steffen Trumtrar
2024-06-17 11:36 ` [PATCH 07/14] ARM: arria10: xload: fix __arria10_load_fpga Steffen Trumtrar
2024-06-17 11:36 ` [PATCH 08/14] ARM: Arria10: xload: kick watchdog Steffen Trumtrar
2024-06-17 11:36 ` [PATCH 09/14] ARM: arria10: mark image in OCRAM as valid Steffen Trumtrar
2024-06-17 11:36 ` [PATCH 10/14] ARM: Arria10: arria10_finish_io: remove unused param Steffen Trumtrar
2024-06-17 11:36 ` [PATCH 11/14] ARM: Arria10: xload: remove useless writel Steffen Trumtrar
2024-06-17 11:36 ` [PATCH 12/14] ARM: Arria10: xload: refactor wait loops Steffen Trumtrar
2024-06-17 11:36 ` [PATCH 13/14] ARM: Arria10: xload: reduce timeout on condone Steffen Trumtrar
2024-06-17 11:36 ` [PATCH 14/14] ARM: arria10-xload: rework broken bitstream handling Steffen Trumtrar
2024-06-18  6:48 ` [PATCH 00/14] ARM: SoCFPGA: arria10: clean up early bitstream loading Sascha Hauer

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=20240617-v2024-05-0-topic-socfpga-arria10-xloader-v1-4-48a6eba4bb5e@pengutronix.de \
    --to=s.trumtrar@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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