public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Gary Jennejohn <garyj@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] 8xx: prevent a machine check in scc_init().
Date: Sun, 14 Sep 2008 11:49:24 +0200	[thread overview]
Message-ID: <20080914114924.0090d95c@peedub.jennejohn.org> (raw)


Signed-off-by: Gary Jennejohn <garyj@denx.de>
---
 cpu/mpc8xx/scc.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/cpu/mpc8xx/scc.c b/cpu/mpc8xx/scc.c
index 09a3db1..9ffeb11 100644
--- a/cpu/mpc8xx/scc.c
+++ b/cpu/mpc8xx/scc.c
@@ -70,6 +70,9 @@ static int scc_recv(struct eth_device* dev);
 static int scc_init (struct eth_device* dev, bd_t * bd);
 static void scc_halt(struct eth_device* dev);
 
+/* avoid unnecessary reinitialization of the SCC */
+static int scc_init_completed;
+
 int scc_initialize(bd_t *bis)
 {
 	struct eth_device* dev;
@@ -193,6 +196,19 @@ static int scc_init (struct eth_device *dev, bd_t * bis)
 
 	volatile immap_t *immr = (immap_t *) CFG_IMMR;
 
+	/*
+	 * This routine is called again and again from eth_init(),
+	 * especially when CONFIG_NETCONSOLE is defined and
+	 * stdout=nc.
+	 * Avoid unneccessary flailing, otherwise we can get a panic here.
+	 */
+	if (scc_init_completed) {
+		immr->im_ioport.iop_pcso |= (PC_ENET_CLSN | PC_ENET_RENA);
+		immr->im_cpm.cp_scc[SCC_ENET].scc_gsmrl |=
+			(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
+		return 1;
+	}
+
 #if defined(CONFIG_LWMON)
 	reset_phy();
 #endif
@@ -544,6 +560,7 @@ static int scc_init (struct eth_device *dev, bd_t * bis)
 	udelay (100000);	/* wait 100 ms */
 #endif
 
+	scc_init_completed = 1;
 	return 1;
 }
 
-- 
1.5.4.3

---
Gary Jennejohn
*********************************************************************
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
*********************************************************************

             reply	other threads:[~2008-09-14  9:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-14  9:49 Gary Jennejohn [this message]
2008-09-14 17:07 ` [U-Boot] [PATCH] 8xx: prevent a machine check in scc_init() Wolfgang Denk
2008-09-15  8:59   ` Gary Jennejohn
2008-09-15 10:58     ` Wolfgang Denk
2008-09-18 11:52 ` [U-Boot] [PATCH V2] " Gary Jennejohn
2008-09-22 20:26   ` Wolfgang Denk
2008-09-26  5:29     ` Ben Warren

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=20080914114924.0090d95c@peedub.jennejohn.org \
    --to=garyj@denx.de \
    --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