public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] 8xx: prevent a machine check in scc_init().
@ 2008-09-14  9:49 Gary Jennejohn
  2008-09-14 17:07 ` Wolfgang Denk
  2008-09-18 11:52 ` [U-Boot] [PATCH V2] " Gary Jennejohn
  0 siblings, 2 replies; 7+ messages in thread
From: Gary Jennejohn @ 2008-09-14  9:49 UTC (permalink / raw)
  To: u-boot


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
*********************************************************************

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-09-26  5:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-14  9:49 [U-Boot] [PATCH] 8xx: prevent a machine check in scc_init() Gary Jennejohn
2008-09-14 17:07 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox