[U-Boot] [PATCH] 8xx: prevent a machine check in scc_init().

Gary Jennejohn garyj at denx.de
Sun Sep 14 11:49:24 CEST 2008


Signed-off-by: Gary Jennejohn <garyj at 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
*********************************************************************


More information about the U-Boot mailing list