 arch/ppc/Kconfig                        |    7 +
 arch/ppc/boot/simple/embed_config.c     |  130 +++++++++++++++++++++++++++++++-
 arch/ppc/boot/simple/head.S             |    6 -
 arch/ppc/platforms/ep852.h              |  105 +++++++++++++++++++++++++
 arch/ppc/syslib/m8xx_setup.c            |    5 +
 drivers/serial/cpm_uart/cpm_uart_cpm1.c |    2 
 include/asm-ppc/mpc8xx.h                |    4 
 7 files changed, 252 insertions(+), 7 deletions(-)

--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ ppc-2.6/arch/ppc/platforms/ep852.h	2006-03-16 14:48:11.000000000 -0500
@@ -0,0 +1,105 @@
+/*
+ * Support for Embedded Planet's EP852
+ *
+ * Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
+ */
+#ifdef __KERNEL__
+#ifndef __MACH_EP852_DEFS
+#define __MACH_EP852_DEFS
+
+#include <linux/config.h>
+
+#ifndef __ASSEMBLY__
+/* FIXME */
+typedef struct bd_info {
+	unsigned int	bi_memstart;	/* Memory start address */
+	unsigned int	bi_memsize;	/* Memory (end) size in bytes */
+	unsigned int	bi_intfreq;	/* Internal Freq, in Hz */
+	unsigned int	bi_busfreq;	/* Bus Freq, in Hz */
+	unsigned char	bi_enetaddr[6];
+	unsigned int	bi_baudrate;
+	unsigned int	bi_nvramsize;
+} bd_t;
+
+extern bd_t m8xx_board_info;
+
+/* Memory map is configured by the PROM startup.
+ * We just map a few things we need.  The CSR is actually 4 byte-wide
+ * registers that can be accessed as 8-, 16-, or 32-bit values.
+ */
+#define EP852_CSR_ADDR		((uint)0xfa400000)
+#define EP852_CSR_SIZE		((uint)(4 * 1024))
+#define IMAP_ADDR		((uint)0xfa200000)
+#define IMAP_SIZE		((uint)(64 * 1024))
+#define PCMCIA_MEM_ADDR		((uint)0x04000000)
+#define PCMCIA_MEM_SIZE		((uint)(64 * 1024))
+#define PCMCIA_IO_ADDR		((uint)0x04400000)
+#define PCMCIA_IO_SIZE		((uint)(4 * 1024))
+
+/* Things of interest in the CSR.
+*/
+#define BCSR0_ETHEN		((uint)0x80000000)
+#define BCSR0_ETHLPBK		((uint)0x40000000)
+#define BCSR0_COLTESTDIS	((uint)0x20000000)
+#define BCSR0_FULLDPLXDIS	((uint)0x10000000)
+#define BCSR0_LED4		((uint)0x08000000)
+#define BCSR0_LED5		((uint)0x04000000)
+#define BCSR0_ENNVRAM		((uint)0x02000000)
+#define BCSR0_ENMONXVCR		((uint)0x01000000)
+
+#define BCSR1_SMCRTS1		((uint)0x00800000)
+#define BCSR1_SMCCTS1		((uint)0x00400000)
+#define BCSR1_FLASH_WP		((uint)0x00200000)
+#define BCSR1_IPA5SEL		((uint)0x00100000)
+#define BCSR1_PCVCTL0		((uint)0x00080000)
+#define BCSR1_PCVCTL1		((uint)0x00040000)
+#define BCSR1_PCVCTL2		((uint)0x00020000)
+#define BCSR1_PCVCTL3		((uint)0x00010000)
+
+#define BCSR2_MIIRST		((uint)0x00008000)
+#define BCSR2_MIIPWRDWN		((uint)0x00004000)
+#define BCSR2_FIRQ		((uint)0x00002000)
+#define BCSR2_MIICTL		((uint)0x00001000)
+#define BCSR2_FLIG10		((uint)0x00000800)
+#define BCSR2_FLIG100		((uint)0x00000400)
+#define BCSR2_FACTH		((uint)0x00000200)
+#define BCSR2_FACTL		((uint)0x00000100)
+
+#define BCSR3_D0		((uint)0x00000080)
+#define BCSR3_D1		((uint)0x00000040)
+#define BCSR3_D2		((uint)0x00000020)
+#define BCSR3_D3		((uint)0x00000010)
+#define BCSR3_MPLX_LIN		((uint)0x00000008)
+#define BCSR3_BSY		((uint)0x00000004)
+#define BCSR3_IRQRTC		((uint)0x00000002)
+#define BCSR3_ENRTCIRQ		((uint)0x00000001)
+
+/* FEC stuff */
+#define FEC_INTERRUPT	7
+#define PHY_ADDR	0x00
+
+/* define IO_BASE for pcmcia */
+#define _IO_BASE 0x80000000
+#define _IO_BASE_SIZE 0x1000
+
+/* CPM Ethernet through SCCx. */
+#define PA_ENET_RXD	((ushort)0x0004)
+#define PA_ENET_TXD	((ushort)0x0008)
+#define PA_ENET_TCLK	((ushort)0x0200)
+#define PA_ENET_RCLK	((ushort)0x0800)
+#define PB_ENET_TENA	((uint)0x00002000)
+#define PC_ENET_CLSN	((ushort)0x0040)
+#define PC_ENET_RENA	((ushort)0x0080)
+
+#define SICR_ENET_MASK	((uint)0x0000ff00)
+#define SICR_ENET_CLKRT	((uint)0x00003d00)
+
+/*
+ * We don't use the 8259.
+ */
+#define NR_8259_INTS	0
+
+#endif /* !__ASSEMBLY__ */
+#endif /* __MACH_EP852_DEFS */
+#endif /* __KERNEL__ */
+
--- ppc-2.6.orig/arch/ppc/Kconfig	2006-03-16 13:48:44.000000000 -0500
+++ ppc-2.6/arch/ppc/Kconfig	2006-03-16 14:48:11.000000000 -0500
@@ -465,6 +465,13 @@
 config LANTEC
 	bool "LANTEC"
 
+config EP852
+	bool "EP852"
+	help
+	  Embedded Planet's EP852 is a PC104 form-factor based on a MPC852 with
+	  a fast Ethernet port, PCMCIA conector, 2 serial ports or 1 serial
+	  port and a Ethernet port.
+
 config MBX
 	bool "MBX"
 	help
--- ppc-2.6.orig/include/asm-ppc/mpc8xx.h	2006-03-16 13:48:45.000000000 -0500
+++ ppc-2.6/include/asm-ppc/mpc8xx.h	2006-03-16 14:48:11.000000000 -0500
@@ -60,6 +60,10 @@
 #include <platforms/ccm.h>
 #endif
 
+#if defined(CONFIG_EP852)
+#include <platforms/ep852.h>
+#endif
+
 #if defined(CONFIG_LANTEC)
 #include <platforms/lantec.h>
 #endif
--- ppc-2.6.orig/arch/ppc/boot/simple/embed_config.c	2006-03-16 13:48:44.000000000 -0500
+++ ppc-2.6/arch/ppc/boot/simple/embed_config.c	2006-03-16 15:08:47.000000000 -0500
@@ -97,7 +97,8 @@
 #endif /* CONFIG_MBX */
 
 #if defined(CONFIG_RPXLITE) || defined(CONFIG_RPXCLASSIC) || \
-	defined(CONFIG_RPX8260) || defined(CONFIG_EP405)
+	defined(CONFIG_RPX8260) || defined(CONFIG_EP405) || \
+	defined(CONFIG_EP852)
 /* Helper functions for Embedded Planet boards.
 */
 /* Because I didn't find anything that would do this.......
@@ -164,7 +165,8 @@
 }
 #endif
 
-#if defined(CONFIG_RPXLITE) || defined(CONFIG_RPXCLASSIC)
+#if defined(CONFIG_RPXLITE) || defined(CONFIG_RPXCLASSIC) || \
+	defined(CONFIG_EP852)
 static void
 rpx_brate(bd_t *bd, u_char *cp)
 {
@@ -180,7 +182,9 @@
 
 	bd->bi_baudrate = rate * 100;
 }
+#endif
 
+#if defined(CONFIG_RPXLITE) || defined(CONFIG_RPXCLASSIC)
 static void
 rpx_cpuspeed(bd_t *bd, u_char *cp)
 {
@@ -217,7 +221,8 @@
 }
 #endif
 
-#if defined(CONFIG_RPXLITE) || defined(CONFIG_RPXCLASSIC) || defined(CONFIG_EP405)
+#if defined(CONFIG_RPXLITE) || defined(CONFIG_RPXCLASSIC) || \
+	defined(CONFIG_EP405) || defined(CONFIG_EP852)
 static void
 rpx_memsize(bd_t *bd, u_char *cp)
 {
@@ -234,7 +239,7 @@
 	bd->bi_memsize = size * 1024 * 1024;
 }
 #endif /* LITE || CLASSIC || EP405 */
-#if defined(CONFIG_EP405)
+#if defined(CONFIG_EP405) || defined(CONFIG_EP852)
 static void
 rpx_nvramsize(bd_t *bd, u_char *cp)
 {
@@ -926,3 +931,120 @@
 #endif
 }
 #endif
+
+#ifdef CONFIG_EP852
+static void ep852_console(bd_t *bd, char *key)
+{
+#if 0
+	if (!strncmp(key, "SMC", 3)) {
+
+	}
+	else (!strncmp(key, "SCC", 3)) {
+
+	}
+#endif
+}
+
+static void ep852_freq(bd_t *bd, char *key)
+{
+	bd->bi_intfreq = 0;
+
+	while (*key != '\n') {
+		bd->bi_intfreq = bd->bi_intfreq * 10 + (*key - '0');
+		key++;
+	}
+	bd->bi_busfreq = bd->bi_intfreq;
+}
+
+void embed_config(bd_t **bdp)
+{
+	bd_t	*bd;
+	char	*keys;
+
+	bd = &bdinfo;
+
+*bdp = bd;
+bd->bi_memstart  = 0;
+bd->bi_memsize   = 16000000;
+bd->bi_intfreq   = 100000000;
+bd->bi_busfreq   = 50000000;
+bd->bi_baudrate  = 115200;
+return;
+
+	for (keys = (char *)*bdp; ; keys++) {
+		switch(*keys) {
+			case 'S':
+				keys++;
+				if (*keys == 'P') {
+					keys++;
+					if (*keys == '=') {
+						keys++;
+						ep852_console(bd, keys);
+					}
+					break;
+				}
+				if (*keys == 'B') {
+					keys++;
+					if (*keys == '=') {
+						keys++;
+						rpx_brate(bd, keys);
+					}
+					break;
+				}
+				break;
+			case 'E':
+				keys++;
+				if (*keys == 'A') {
+					keys++;
+					if (*keys == '=') {
+						keys++;
+						rpx_eth(bd, keys);
+					}
+					break;
+				}
+				break;
+			case 'D':
+				keys++;
+				if (*keys == '1') {
+					keys++;
+					if (*keys == '=') {
+						keys++;
+						rpx_memsize(bd, keys);
+					}
+					break;
+				}
+				break;
+			case 'N':
+				keys++;
+				if (*keys == 'V') {
+					keys++;
+					if (*keys == '=') {
+						keys++;
+						rpx_nvramsize(bd, keys);
+					}
+					break;
+				}
+				break;
+			case 'X':
+				keys++;
+				if (*keys == 'T') {
+					keys++;
+					if (*keys == '=') {
+						keys++;
+						ep852_freq(bd, keys);
+					}
+					break;
+				}
+				break;
+			default:
+				break;
+		}
+		while (*keys++ != '\n');
+		if (*keys == '\n')
+			/* the arguments ends with two new lines */
+			break;
+	}
+	*bdp = bd;
+}
+#endif	/* CONFIG_EP852 */
+
--- ppc-2.6.orig/arch/ppc/boot/simple/head.S	2006-03-16 13:48:45.000000000 -0500
+++ ppc-2.6/arch/ppc/boot/simple/head.S	2006-03-16 14:48:11.000000000 -0500
@@ -57,7 +57,8 @@
 	isync
 #endif
 
-#if defined(CONFIG_MBX) || defined(CONFIG_RPX8260) || defined(CONFIG_PPC_PREP)
+#if defined(CONFIG_MBX) || defined(CONFIG_RPX8260) || \
+    defined(CONFIG_PPC_PREP) || defined(CONFIG_EP852)
 	mr	r29,r3	/* On the MBX860, r3 is the board info pointer.
 			 * On the RPXSUPER, r3 points to the NVRAM
 			 * configuration keys.
@@ -120,7 +121,8 @@
 	mtspr	SPRN_DER,r4
 #endif
 
-#if defined(CONFIG_MBX) || defined(CONFIG_RPX8260) || defined(CONFIG_PPC_PREP)
+#if defined(CONFIG_MBX) || defined(CONFIG_RPX8260) || \
+    defined(CONFIG_PPC_PREP) || defined(CONFIG_EP852)
 	mr	r4,r29	/* put the board info pointer where the relocate
 			 * routine will find it
 			 */
--- ppc-2.6.orig/arch/ppc/syslib/m8xx_setup.c	2006-03-16 13:48:45.000000000 -0500
+++ ppc-2.6/arch/ppc/syslib/m8xx_setup.c	2006-03-16 16:16:23.000000000 -0500
@@ -377,6 +377,11 @@
 #if defined(CONFIG_NETTA)
 	io_block_mapping(_IO_BASE,_IO_BASE,_IO_BASE_SIZE, _PAGE_IO);
 #endif
+#if 0
+volatile char *bcsr = (volatile char *)EP852_CSR_ADDR;
+io_block_mapping(EP852_CSR_ADDR, EP852_CSR_ADDR, EP852_CSR_SIZE, _PAGE_IO);
+*bcsr &= ~(0x30);
+#endif
 }
 
 void __init
--- ppc-2.6.orig/drivers/serial/cpm_uart/cpm_uart_cpm1.c	2006-03-16 13:48:45.000000000 -0500
+++ ppc-2.6/drivers/serial/cpm_uart/cpm_uart_cpm1.c	2006-03-16 14:48:11.000000000 -0500
@@ -84,7 +84,7 @@
 	volatile cpm8xx_t *cp = cpmp;
 
 	(void)cp;	/* fix warning */
-#if defined (CONFIG_MPC885ADS)
+#if defined (CONFIG_MPC885ADS) || defined(CONFIG_EP852)
 	/* Enable SMC1 transceivers */
 	{
 		cp->cp_pepar |= 0x000000c0;

