All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/7] Blackfin: use on-chip reset func with newer parts
Date: Mon, 23 May 2011 23:30:55 -0400	[thread overview]
Message-ID: <1306207860-5124-3-git-send-email-vapier@gentoo.org> (raw)
In-Reply-To: <1306207860-5124-1-git-send-email-vapier@gentoo.org>

Turns out the documentation is wrong and doing "RAISE 1" does not result
in a software reset, only a core reset.  So when the on-chip rom has a
functioning reset helper, use it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 arch/blackfin/cpu/reset.c |   70 ++++++++++++++++++++++-----------------------
 1 files changed, 34 insertions(+), 36 deletions(-)

diff --git a/arch/blackfin/cpu/reset.c b/arch/blackfin/cpu/reset.c
index 9307e9f..e23dcc7 100644
--- a/arch/blackfin/cpu/reset.c
+++ b/arch/blackfin/cpu/reset.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <command.h>
 #include <asm/blackfin.h>
+#include <asm/mach-common/bits/bootrom.h>
 #include "cpu.h"
 
 /* A system soft reset makes external memory unusable so force
@@ -29,46 +30,40 @@ static void bfin_reset(void)
 	 */
 	__builtin_bfin_ssync();
 
-	/* The bootrom checks to see how it was reset and will
-	 * automatically perform a software reset for us when
-	 * it starts executing after the core reset.
-	 */
-	if (ANOMALY_05000353 || ANOMALY_05000386) {
-		/* Initiate System software reset. */
-		bfin_write_SWRST(0x7);
+	/* Initiate System software reset. */
+	bfin_write_SWRST(0x7);
 
-		/* Due to the way reset is handled in the hardware, we need
-		 * to delay for 10 SCLKS.  The only reliable way to do this is
-		 * to calculate the CCLK/SCLK ratio and multiply 10.  For now,
-		 * we'll assume worse case which is a 1:15 ratio.
-		 */
-		asm(
-			"LSETUP (1f, 1f) LC0 = %0\n"
-			"1: nop;"
-			:
-			: "a" (15 * 10)
-			: "LC0", "LB0", "LT0"
-		);
+	/* Due to the way reset is handled in the hardware, we need
+	 * to delay for 10 SCLKS.  The only reliable way to do this is
+	 * to calculate the CCLK/SCLK ratio and multiply 10.  For now,
+	 * we'll assume worse case which is a 1:15 ratio.
+	 */
+	asm(
+		"LSETUP (1f, 1f) LC0 = %0\n"
+		"1: nop;"
+		:
+		: "a" (15 * 10)
+		: "LC0", "LB0", "LT0"
+	);
 
-		/* Clear System software reset */
-		bfin_write_SWRST(0);
+	/* Clear System software reset */
+	bfin_write_SWRST(0);
 
-		/* The BF526 ROM will crash during reset */
+	/* The BF526 ROM will crash during reset */
 #if defined(__ADSPBF522__) || defined(__ADSPBF524__) || defined(__ADSPBF526__)
-		bfin_read_SWRST();
+	bfin_read_SWRST();
 #endif
 
-		/* Wait for the SWRST write to complete.  Cannot rely on SSYNC
-		 * though as the System state is all reset now.
-		 */
-		asm(
-			"LSETUP (1f, 1f) LC1 = %0\n"
-			"1: nop;"
-			:
-			: "a" (15 * 1)
-			: "LC1", "LB1", "LT1"
-		);
-	}
+	/* Wait for the SWRST write to complete.  Cannot rely on SSYNC
+	 * though as the System state is all reset now.
+	 */
+	asm(
+		"LSETUP (1f, 1f) LC1 = %0\n"
+		"1: nop;"
+		:
+		: "a" (15 * 1)
+		: "LC1", "LB1", "LT1"
+	);
 
 	while (1)
 		/* Issue core reset */
@@ -84,7 +79,10 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	if (board_reset)
 		board_reset();
-	while (1)
-		asm("jump (%0);" : : "a" (bfin_reset));
+	if (ANOMALY_05000353 || ANOMALY_05000386)
+		while (1)
+			asm("jump (%0);" : : "a" (bfin_reset));
+	else
+		bfrom_SoftReset((void *)(L1_SRAM_SCRATCH_END - 20));
 	return 0;
 }
-- 
1.7.5.rc3

  parent reply	other threads:[~2011-05-24  3:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-24  3:30 [U-Boot] [PATCH 0/7] Blackfin fixes for 2011.06 Mike Frysinger
2011-05-24  3:30 ` [U-Boot] [PATCH 1/7] Blackfin: use common LDSCRIPT logic Mike Frysinger
2011-05-24  3:30 ` Mike Frysinger [this message]
2011-05-24  3:30 ` [U-Boot] [PATCH 3/7] Blackfin: bf548-ezkit/bf561-ezkit: update env location Mike Frysinger
2011-05-24  3:30 ` [U-Boot] [PATCH 4/7] Blackfin: boards: build zlib dir with -O2 Mike Frysinger
2011-05-24  3:30 ` [U-Boot] [PATCH 5/7] Blackfin: cm-bf537e/cm-bf537u/tcm-bf537: update network settings Mike Frysinger
2011-05-24  3:30 ` [U-Boot] [PATCH 6/7] Blackfin: cm-bf537e/cm-bf537u/tcm-bf537: enable mmc_spi support Mike Frysinger
2011-05-24  3:31 ` [U-Boot] [PATCH 7/7] Blackfin: cm-bf537e/cm-bf537u/tcm-bf537: update embedded env settings Mike Frysinger
2011-05-24  3:32 ` [U-Boot] Pull request u-boot-blackfin.git Mike Frysinger
2011-06-01 19:58   ` Wolfgang Denk
2011-06-02 15:02     ` Mike Frysinger
2011-06-02 20:46       ` Wolfgang Denk
2011-06-03 17:28   ` [U-Boot] Pull request u-boot-blackfin.git (v2) Mike Frysinger
2011-06-08 21:28     ` Wolfgang Denk

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=1306207860-5124-3-git-send-email-vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.