Skip to contentSkip to conversation

ColdFire: Add M5208EVB and MCF520x CPU support

PATCH New TsiChung Liew 1 participant 1 message Jul 8, 2009 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ColdFire: Add M5208EVB and MCF520x CPU support

---
 MAKEALL                               |    1 +
 Makefile                              |    3 +
 board/freescale/m5208evbe/Makefile    |   44 ++++
 board/freescale/m5208evbe/config.mk   |   25 +++
 board/freescale/m5208evbe/m5208evbe.c |   94 +++++++++
 board/freescale/m5208evbe/u-boot.lds  |  142 +++++++++++++
 cpu/mcf52x2/config.mk                 |    4 +
 cpu/mcf52x2/cpu.c                     |   66 ++++++
 cpu/mcf52x2/cpu_init.c                |   89 ++++++++
 cpu/mcf52x2/interrupts.c              |   10 +-
 cpu/mcf52x2/speed.c                   |   13 +-
 cpu/mcf52x2/start.S                   |   33 +++-
 include/asm-m68k/immap.h              |   29 +++
 include/asm-m68k/immap_520x.h         |  212 +++++++++++++++++++
 include/asm-m68k/m520x.h              |  358 +++++++++++++++++++++++++++++++++
 include/configs/M5208EVBE.h           |  223 ++++++++++++++++++++
 16 files changed, 1331 insertions(+), 15 deletions(-)
 create mode 100644 board/freescale/m5208evbe/Makefile
 create mode 100644 board/freescale/m5208evbe/config.mk
 create mode 100644 board/freescale/m5208evbe/m5208evbe.c
 create mode 100644 board/freescale/m5208evbe/u-boot.lds
 create mode 100644 include/asm-m68k/immap_520x.h
 create mode 100644 include/asm-m68k/m520x.h
 create mode 100644 include/configs/M5208EVBE.h
MAKEALL +1 -0
index 57dd425..09a2430 100755
@@ -752,6 +752,7 @@ LIST_coldfire="			\
 	EB+MCF-EV123		\
 	EB+MCF-EV123_internal	\
 	idmr			\
+	M5208EVBE		\
 	M52277EVB		\
 	M5235EVB		\
 	M5249EVB		\
Makefile +3 -0
index 19e40f2..3d00823 100644
@@ -1971,6 +1971,9 @@ ZPC1900_config: unconfig
 ## Coldfire
 #########################################################################
 
+M5208EVBE_config :		unconfig
+	@$(MKCONFIG) $(@:_config=) m68k mcf52x2 m5208evbe freescale
+
 M52277EVB_config \
 M52277EVB_spansion_config \
 M52277EVB_stmicro_config :	unconfig
board/freescale/m5208evbe/Makefile new file +44 -0

44 lines not on this page · raw message

board/freescale/m5208evbe/config.mk new file +25 -0
new file mode 100644
index 0000000..ce014ed
@@ -0,0 +1,25 @@
+#
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+# Coldfire contribution by Bernhard Kuhn <[email protected]>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+TEXT_BASE = 0
board/freescale/m5208evbe/m5208evbe.c new file +94 -0

94 lines not on this page · raw message

board/freescale/m5208evbe/u-boot.lds new file +142 -0

142 lines not on this page · raw message

cpu/mcf52x2/config.mk +4 -0
index 8292736..52751be 100644
@@ -26,6 +26,7 @@
 PLATFORM_RELFLAGS += -ffixed-d7 -msep-data
 
 cfg=$(shell grep configs $(OBJTREE)/include/config.h | sed 's/.*<\(configs.*\)>/\1/')
+is5208:=$(shell grep CONFIG_M5208 $(TOPDIR)/include/$(cfg))
 is5249:=$(shell grep CONFIG_M5249 $(TOPDIR)/include/$(cfg))
 is5253:=$(shell grep CONFIG_M5253 $(TOPDIR)/include/$(cfg))
 is5271:=$(shell grep CONFIG_M5271 $(TOPDIR)/include/$(cfg))
@@ -36,6 +37,9 @@ is5282:=$(shell grep CONFIG_M5282 $(TOPDIR)/include/$(cfg))
 
 ifneq ($(findstring 4.1,$(shell $(CC) --version)),4.1)
 
+ifneq (,$(findstring CONFIG_M5208,$(is5208)))
+PLATFORM_CPPFLAGS += -mcpu=5208
+endif
 ifneq (,$(findstring CONFIG_M5249,$(is5249)))
 PLATFORM_CPPFLAGS += -mcpu=5249
 endif
cpu/mcf52x2/cpu.c +66 -0

72 lines not on this page · raw message

cpu/mcf52x2/cpu_init.c +89 -0

95 lines not on this page · raw message

cpu/mcf52x2/interrupts.c +8 -2
index 0181e4b..675995c 100644
@@ -59,13 +59,19 @@ void dtimer_intr_setup(void)
 #endif				/* CONFIG_MCFTMR */
 #endif				/* CONFIG_M5272 */
 
-#if defined(CONFIG_M5282) || defined(CONFIG_M5271) || defined(CONFIG_M5275)
+#if defined(CONFIG_M5208) || defined(CONFIG_M5282) || \
+    defined(CONFIG_M5271) || defined(CONFIG_M5275)
 int interrupt_init(void)
 {
 	volatile int0_t *intp = (int0_t *) (CONFIG_SYS_INTR_BASE);
 
 	/* Make sure all interrupts are disabled */
-	intp->imrl0 |= 0x1;
+#if defined(CONFIG_M5208)
+	intp->imrl0 = 0xFFFFFFFF;
+	intp->imrh0 = 0xFFFFFFFF;
+#else
+	intp->imrl0 |= 0x1;
+#endif
 
 	enable_interrupts();
 	return 0;
cpu/mcf52x2/speed.c +9 -4
index c93a518..b485e1c 100644
@@ -30,11 +30,16 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-/*
- * get_clocks() fills in gd->cpu_clock and gd->bus_clk
- */
+/* get_clocks() fills in gd->cpu_clock and gd->bus_clk */
 int get_clocks (void)
 {
+#if defined(CONFIG_M5208)
+	volatile pll_t *pll = (pll_t *) MMAP_PLL;
+
+	pll->odr = CONFIG_SYS_PLL_ODR;
+	pll->fdr = CONFIG_SYS_PLL_FDR;
+#endif
+
 #if defined(CONFIG_M5249) || defined(CONFIG_M5253)
 	volatile unsigned long cpll = mbar2_readLong(MCFSIM_PLLCR);
 	unsigned long pllcr;
@@ -77,7 +82,7 @@ int get_clocks (void)
 #endif
 
 	gd->cpu_clk = CONFIG_SYS_CLK;
-#if defined(CONFIG_M5249) || defined(CONFIG_M5253) || \
+#if defined(CONFIG_M5208) || defined(CONFIG_M5249) || defined(CONFIG_M5253) || \
     defined(CONFIG_M5271) || defined(CONFIG_M5275)
 	gd->bus_clk = gd->cpu_clk / 2;
 #else
cpu/mcf52x2/start.S +24 -9
index ba6b884..0dd4de5 100644
@@ -120,6 +120,12 @@ _start:
 	nop
 	move.w #0x2700,%sr
 
+#if defined(CONFIG_M5208)
+	/* Initialize RAMBAR: locate SRAM and validate it */
+	move.l	#(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0
+	movec	%d0, %RAMBAR1
+#endif
+
 #if defined(CONFIG_M5272) || defined(CONFIG_M5249) || defined(CONFIG_M5253)
 	move.l	#(CONFIG_SYS_MBAR + 1), %d0		/* set MBAR address + valid flag */
 	move.c	%d0, %MBAR
@@ -195,15 +201,6 @@ _after_flashbar_copy:
 	movec	%d0, %RAMBAR1
 #endif
 
-#if 0
-	/* invalidate and disable cache */
-	move.l	#0x01000000, %d0		/* Invalidate cache cmd */
-	movec	%d0, %CACR			/* Invalidate cache */
-	move.l	#0, %d0
-	movec	%d0, %ACR0
-	movec	%d0, %ACR1
-#endif
-
 	/* set stackpointer to end of internal ram to get some stackspace for the first c-code */
 	move.l	#(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET), %sp
 	clr.l %sp at -
@@ -340,6 +337,24 @@ _int_handler:
 
 /*------------------------------------------------------------------------------*/
 /* cache functions */
+#ifdef	CONFIG_M5208
+	.globl	icache_enable
+icache_enable:
+	move.l	#0x01000000, %d0		/* Invalidate cache cmd */
+	movec	%d0, %CACR			/* Invalidate cache */
+	move.l	#(CONFIG_SYS_SDRAM_BASE + 0xC000), %d0	/* Setup cache mask */
+	movec	%d0, %ACR0			/* Enable cache */
+
+	move.l	#0x80000200, %d0		/* Setup cache mask */
+	movec	%d0, %CACR			/* Enable cache */
+	nop
+
+	move.l #(CONFIG_SYS_INIT_RAM_ADDR+CONFIG_SYS_INIT_RAM_END-8), %a1
+	moveq	#1, %d0
+	move.l	%d0, (%a1)
+	rts
+#endif
+
 #ifdef	CONFIG_M5271
 	.globl	icache_enable
 icache_enable:
include/asm-m68k/immap.h +29 -0
index 93f730f..34b2585 100644
@@ -26,6 +26,35 @@
 #ifndef __IMMAP_H
 #define __IMMAP_H
 
+#if defined(CONFIG_MCF520x)
+#include <asm/immap_520x.h>
+#include <asm/m520x.h>
+
+#define CONFIG_SYS_FEC0_IOBASE		(MMAP_FEC0)
+#define CONFIG_SYS_UART_BASE		(MMAP_UART0 + (CONFIG_SYS_UART_PORT * 0x4000))
+
+/* Timer */
+#ifdef CONFIG_MCFTMR
+#define CONFIG_SYS_UDELAY_BASE		(MMAP_DTMR0)
+#define CONFIG_SYS_TMR_BASE		(MMAP_DTMR1)
+#define CONFIG_SYS_TMRPND_REG		(((volatile int0_t *)(CONFIG_SYS_INTR_BASE))->iprh0)
+#define CONFIG_SYS_TMRINTR_NO		(INT0_HI_DTMR1)
+#define CONFIG_SYS_TMRINTR_MASK		(INTC_IPRH_INT33)
+#define CONFIG_SYS_TMRINTR_PEND		(CONFIG_SYS_TMRINTR_MASK)
+#define CONFIG_SYS_TMRINTR_PRI		(6)
+#define CONFIG_SYS_TIMER_PRESCALER	(((gd->bus_clk / 1000000) - 1) << 8)
+#endif
+
+#ifdef CONFIG_MCFPIT
+#define CONFIG_SYS_UDELAY_BASE		(MMAP_PIT0)
+#define CONFIG_SYS_PIT_BASE		(MMAP_PIT1)
+#define CONFIG_SYS_PIT_PRESCALE	(6)
+#endif
+
+#define CONFIG_SYS_INTR_BASE		(MMAP_INTC0)
+#define CONFIG_SYS_NUM_IRQS		(128)
+#endif				/* CONFIG_M520x */
+
 #ifdef CONFIG_M52277
 #include <asm/immap_5227x.h>
 #include <asm/m5227x.h>
include/asm-m68k/immap_520x.h new file +212 -0

212 lines not on this page · raw message

include/asm-m68k/m520x.h new file +358 -0

358 lines not on this page · raw message

include/configs/M5208EVBE.h new file +223 -0

223 lines not on this page · raw message

Signature · 1 line
1.5.6.4