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

Gary Jennejohn garyj at denx.de
Thu Sep 18 13:52:24 CEST 2008


Without this change DPRAM can be exhausted when CFG_ALLOC_DPRAM is
defined, which eventually leads to a machine check.  This change
assures that DPRAM is allocated only once in that case.

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

diff --git a/cpu/mpc8xx/scc.c b/cpu/mpc8xx/scc.c
index 09a3db1..d91289a 100644
--- a/cpu/mpc8xx/scc.c
+++ b/cpu/mpc8xx/scc.c
@@ -216,7 +216,9 @@ static int scc_init (struct eth_device *dev, bd_t * bis)
 	txIdx = 0;
 
 #ifdef CFG_ALLOC_DPRAM
-	rtx = (RTXBD *) (immr->im_cpm.cp_dpmem +
+	/* Avoid exhausting DPRAM. */
+	if (rtx == NULL)
+		rtx = (RTXBD *) (immr->im_cpm.cp_dpmem +
 			 dpram_alloc_align (sizeof (RTXBD), 8));
 #else
 	rtx = (RTXBD *) (immr->im_cpm.cp_dpmem + CPM_SCC_BASE);
-- 
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