summaryrefslogtreecommitdiffstats
path: root/cpu
diff options
context:
space:
mode:
authorAnatolij Gustschin <agust@denx.de>2008-02-25 20:54:04 +0100
committerWolfgang Denk <wd@denx.de>2008-03-02 21:34:55 +0100
commit4fae35a53b3e958254d6574a1cc7e10811fc6726 (patch)
treef994484fa71cbf7c8a4d95d9e4e51a3535db5a3c /cpu
parent60ec654c5eb80d0fe0c38a3bd42140215bc06484 (diff)
downloadtalos-obmc-uboot-4fae35a53b3e958254d6574a1cc7e10811fc6726.tar.gz
talos-obmc-uboot-4fae35a53b3e958254d6574a1cc7e10811fc6726.zip
ppc4xx: Fix problem in 4xx_enet.c driver
U-Boot crashes in the net loop if CONFIG_4xx_DCACHE is enabled. To reproduce the problem ensure that 'ethrotate' environment variable isn't set to "no" and then run "tftp 200000 not_existent_file". This patch tries to fix the issue. Signed-off-by: Anatolij Gustschin <agust@denx.de>
Diffstat (limited to 'cpu')
-rw-r--r--cpu/ppc4xx/4xx_enet.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/cpu/ppc4xx/4xx_enet.c b/cpu/ppc4xx/4xx_enet.c
index 44659ffcd9..5ef1005b1f 100644
--- a/cpu/ppc4xx/4xx_enet.c
+++ b/cpu/ppc4xx/4xx_enet.c
@@ -487,6 +487,9 @@ static int ppc_4xx_eth_init (struct eth_device *dev, bd_t * bis)
#endif
u32 bd_cached;
u32 bd_uncached = 0;
+#ifdef CONFIG_4xx_DCACHE
+ static u32 last_used_ea = 0;
+#endif
EMAC_4XX_HW_PST hw_p = dev->priv;
@@ -850,7 +853,12 @@ static int ppc_4xx_eth_init (struct eth_device *dev, bd_t * bis)
#ifdef CONFIG_4xx_DCACHE
flush_dcache_range(bd_cached, bd_cached + MAL_ALLOC_SIZE);
- bd_uncached = bis->bi_memsize;
+ if (!last_used_ea)
+ bd_uncached = bis->bi_memsize;
+ else
+ bd_uncached = last_used_ea + MAL_ALLOC_SIZE;
+
+ last_used_ea = bd_uncached;
program_tlb(bd_cached, bd_uncached, MAL_ALLOC_SIZE,
TLB_WORD2_I_ENABLE);
#else
OpenPOWER on IntegriCloud