public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
Cc: Tom Rini <trini@konsulko.com>, u-boot@lists.denx.de
Subject: [PATCH v2 3/4] board: freescale: p1_p2_rdb_pc: Avoid usage of CPLD's system reset register
Date: Mon,  1 Aug 2022 15:31:45 +0200	[thread overview]
Message-ID: <20220801133146.11481-3-pali@kernel.org> (raw)
In-Reply-To: <20220801133146.11481-1-pali@kernel.org>

CPLD's system reset register is buggy and requires workaround in U-Boot.
So use this kind of board reset only when there is no other reset option.

Introduce a new board_reset_last() callback which is last-stage
board-specific reset and implement CPLD's system reset in this new
board_reset_last() callback instead of board_reset() callback.

Fixes: 20fb58fc5a1c ("board: freescale: p1_p2_rdb_pc: Implement board_reset()")
Signed-off-by: Pali Rohár <pali@kernel.org>
---
 arch/powerpc/cpu/mpc85xx/cpu.c              | 4 ++++
 board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/cpu/mpc85xx/cpu.c b/arch/powerpc/cpu/mpc85xx/cpu.c
index 226a26ba320a..c63c17286811 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu.c
@@ -44,6 +44,7 @@ __board_reset(void)
 	/* Do nothing */
 }
 void board_reset(void) __attribute__((weak, alias("__board_reset")));
+void board_reset_last(void) __attribute__((weak, alias("__board_reset")));
 
 int checkcpu (void)
 {
@@ -328,6 +329,9 @@ int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 	/* Next try asserting HRESET_REQ */
 	out_be32(&gur->rstcr, 0x2);
 	udelay(100);
+
+	/* Attempt last-stage board-specific reset */
+	board_reset_last();
 #endif
 
 	return 1;
diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
index 16224752adb1..4bcb05bed9b8 100644
--- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
+++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
@@ -83,7 +83,7 @@ struct cpld_data {
 #define CPLD_FXS_LED	0x0F
 #define CPLD_SYS_RST	0x00
 
-void board_reset(void)
+void board_reset_last(void)
 {
 	struct cpld_data *cpld_data = (void *)(CONFIG_SYS_CPLD_BASE);
 	out_8(&cpld_data->system_rst, 1);
-- 
2.20.1


  parent reply	other threads:[~2022-08-01 13:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-01 12:23 [PATCH 1/3] board: freescale: p1_p2_rdb_pc: Add workaround for board reset reboot loop Pali Rohár
2022-05-01 12:23 ` [PATCH 2/3] board: freescale: p1_p2_rdb_pc: Add workaround for non-working watchdog Pali Rohár
2022-05-01 12:23 ` [PATCH 3/3] board: freescale: p1_p2_rdb_pc: Implement board_reset() Pali Rohár
2022-07-05 16:39 ` [PATCH 1/3] board: freescale: p1_p2_rdb_pc: Add workaround for board reset reboot loop Pali Rohár
2022-07-12 13:50   ` Pali Rohár
2022-08-01 13:31 ` [PATCH v2 1/4] " Pali Rohár
2022-08-01 13:31   ` [PATCH v2 2/4] board: freescale: p1_p2_rdb_pc: Add workaround for non-working watchdog Pali Rohár
2022-08-01 13:31   ` Pali Rohár [this message]
2022-08-01 13:31   ` [PATCH v2 4/4] board: freescale: p1_p2_rdb_pc: Turn off watchdog before reset Pali Rohár
2022-08-17 21:04   ` [PATCH v2 1/4] board: freescale: p1_p2_rdb_pc: Add workaround for board reset reboot loop Pali Rohár
2022-08-21 10:30   ` Pali Rohár
2022-08-31 12:04     ` Pali Rohár
2022-09-06  5:20       ` Peng Fan
2022-09-06  5:26       ` Peng Fan

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=20220801133146.11481-3-pali@kernel.org \
    --to=pali@kernel.org \
    --cc=peng.fan@oss.nxp.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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