Skip to contentSkip to conversation

Walnut bootloader fix

PATCH David Gibson 1 participant 1 message Sep 6, 2001

lore
Share & tools
lore
#0 lore raw

The following patch adds code to the "simple" bootloader to disable the ethernet controller on the Walnut board before booting the kernel. This is necessary on the Walnut I have, at least, or the EMAC has a tendency to DMA broadcast packets into the kernel text.

arch/ppc/boot/simple/embed_config.c renamed from linuxppc_2_4_devel/arch/ppc/boot/simple/embed_config.c +12 -0
diff -urN ../linuxppc_2_4_devel/arch/ppc/boot/simple/embed_config.c linux-bungo/arch/ppc/boot/simple/embed_config.c
@@ -638,6 +638,8 @@
 */
 #define	BOARD_INFO_VECTOR	0xFFFE0B50
 
+#define PPC405_EM0MR0_ADDR	0xEF600800;
+
 void
 embed_config(bd_t **bdp)
 {
@@ -646,6 +648,7 @@
 	bd_t	*bd, *walnut_bd;
 	bd_t *(*get_board_info)(void) =
 	    (bd_t *(*)(void))(*(unsigned long *)BOARD_INFO_VECTOR);
+	volatile u32 *em0mr0 = (volatile u32 *)PPC405_EM0MR0_ADDR;
 
 	bd = &bdinfo;
 	*bdp = bd;
@@ -668,5 +671,14 @@
 		bd->bi_busfreq = 100000000;
 		bd->bi_pci_busfreq = 66666666;
 	}
+
+	/* Now turn of the EMAC - otherwise it has a tendency to DMA
+	   crap into the kernel text */
+	mtdcr(DCRN_MALCR, MALCR_MMSR);                /* 1st reset MAL */
+
+	while (mfdcr(DCRN_MALCR) & MALCR_MMSR)
+		;    /* wait for the reset */
+
+	*em0mr0 = 0x20000000;        /* then reset EMAC */
 }
 #endif

--
David Gibson | For every complex problem there is a
[email protected] | solution which is simple, neat and
| wrong. -- H.L. Mencken
http://www.ozlabs.org/people/dgibson

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/