Discussion:
[uClinux-dev] [RFC/PATCH] m68knommu: add support for Coldfire m5441x
Steven King
2012-05-23 02:03:59 UTC
Permalink
The 5441x (54410/54415/54416/54417/54418) is similar to the 532x in the same
way the 532x is similar to the 5208; it doesn't have either IPSBAR nor MBAR,
instead everything resides at a fixed address. Many of the registers common
between the 5441x and the 532x live at the same address as the 532x, but of
course the 5441x has a v4e core, cache and mmu, along with 10 uarts! 6 i2c
controllers, 4 dma capable spi controllers, usb and much more. This patch is
just a quick and dirty hack to get it booting on the twr-mcf5441x board. Its
currently nommu only (well, I havent even tried it with the mmu), It doesnt
include support for the 2 fec controllers, the ones on the 5441x are just
slightly different in some non obvious way so they dont quite work yet.

Signed-off-by: Steven King <sfking at fdwdc.com>
---
arch/m68k/Kconfig.cpu | 7 +
arch/m68k/Kconfig.machine | 1 -
arch/m68k/Makefile | 1 +
arch/m68k/include/asm/gpio.h | 11 +-
arch/m68k/include/asm/m5441xsim.h | 252 +++++++++++++++++++++++++++++++
arch/m68k/include/asm/m54xxacr.h | 4 +
arch/m68k/include/asm/mcfsim.h | 2 +
arch/m68k/include/asm/mcftimer.h | 2 +-
arch/m68k/platform/coldfire/Makefile | 1 +
arch/m68k/platform/coldfire/device.c | 38 ++++-
arch/m68k/platform/coldfire/intc-simr.c | 24 ++-
arch/m68k/platform/coldfire/m5441x.c | 51 +++++++
arch/m68k/platform/coldfire/timers.c | 2 +-
13 files changed, 382 insertions(+), 14 deletions(-)

diff --git a/arch/m68k/Kconfig.cpu b/arch/m68k/Kconfig.cpu
index 8a9c767..3221433 100644
--- a/arch/m68k/Kconfig.cpu
+++ b/arch/m68k/Kconfig.cpu
@@ -252,6 +252,13 @@ config M548x
help
Freescale ColdFire 5480/5481/5482/5483/5484/5485 processor support.

+config M5441x
+ bool "MCF5441x"
+ select MMU_COLDFIRE if MMU
+ select HAVE_CACHE_CB
+ help
+ Freescale Coldfire 54410/54415/54416/54417/54418 processor support.
+
endif # COLDFIRE


diff --git a/arch/m68k/Kconfig.machine b/arch/m68k/Kconfig.machine
index 7cdf6b0..7031173 100644
--- a/arch/m68k/Kconfig.machine
+++ b/arch/m68k/Kconfig.machine
@@ -428,7 +428,6 @@ config SAVANTrosie1
help
Support for the Savant Rosie1 board.

-
if !MMU || COLDFIRE

comment "Machine Options"
diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
index 804f139..6940baf 100644
--- a/arch/m68k/Makefile
+++ b/arch/m68k/Makefile
@@ -34,6 +34,7 @@ cpuflags-$(CONFIG_M68030) :=
cpuflags-$(CONFIG_M68020) :=
cpuflags-$(CONFIG_M68360) := -m68332
cpuflags-$(CONFIG_M68000) := -m68000
+cpuflags-$(CONFIG_M5441x) := $(call cc-option,-mcpu=54455,-mcfv4e)
cpuflags-$(CONFIG_M54xx) := $(call cc-option,-mcpu=5475,-m5200)
cpuflags-$(CONFIG_M5407) := $(call cc-option,-mcpu=5407,-m5200)
cpuflags-$(CONFIG_M532x) := $(call cc-option,-mcpu=532x,-m5307)
diff --git a/arch/m68k/include/asm/gpio.h b/arch/m68k/include/asm/gpio.h
index 00d0071..f5b462a 100644
--- a/arch/m68k/include/asm/gpio.h
+++ b/arch/m68k/include/asm/gpio.h
@@ -37,7 +37,8 @@
#if defined(CONFIG_M5206) || defined(CONFIG_M5206e) || \
defined(CONFIG_M520x) || defined(CONFIG_M523x) || \
defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
- defined(CONFIG_M532x) || defined(CONFIG_M54xx)
+ defined(CONFIG_M532x) || defined(CONFIG_M54xx) || \
+ defined(CONFIG_M5441x)

/* These parts have GPIO organized by 8 bit ports */

@@ -70,7 +71,8 @@
#define mcfgpio_port(gpio) ((gpio) / MCFGPIO_PORTSIZE)

#if defined(CONFIG_M520x) || defined(CONFIG_M523x) || \
- defined(CONFIG_M527x) || defined(CONFIG_M528x) || defined(CONFIG_M532x)
+ defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
+ defined(CONFIG_M532x) || defined(CONFIG_M5441x)
/*
* These parts have an 'Edge' Port module (external interrupt/GPIO) which uses
* read-modify-write to change an output and a GPIO module which has separate
@@ -82,6 +84,11 @@
* read-modify-write as well as those controlled by the EPORT and GPIO modules.
*/
#define MCFGPIO_SCR_START 40
+#elif defined(CONFIG_M5441x)
+/*
+ * The 5441x EPORT can't be used for GPIO.
+ */
+#define MCFGPIO_SCR_START 0
#else
#define MCFGPIO_SCR_START 8
#endif
diff --git a/arch/m68k/include/asm/m5441xsim.h b/arch/m68k/include/asm/m5441xsim.h
new file mode 100644
index 0000000..a7900a5
--- /dev/null
+++ b/arch/m68k/include/asm/m5441xsim.h
@@ -0,0 +1,252 @@
+/*
+ * m5441xsim.h -- Coldfire 5441x register definitions
+ *
+ * (C) Copyright 2012, Steven King <sfking at fdwdc.com>
+*/
+
+#ifndef m5441xsim_h
+#define m5441xsim_h
+
+#define CPU_NAME "COLDFIRE(m5441x)"
+#define CPU_INSTR_PER_JIFFY 2
+#define MCF_BUSCLK (MCF_CLK / 2)
+
+#include <asm/m54xxacr.h>
+
+/*
+ * Reset Controller Module.
+ */
+
+#define MCF_RCR 0xFC0A0000
+#define MCF_RSR 0xFC0A0001
+
+#define MCF_RCR_SWRESET 0x80 /* Software reset bit */
+#define MCF_RCR_FRCSTOUT 0x40 /* Force external reset */
+
+/*
+ * Interrupt Controller Modules.
+ */
+/* the 5441x have 3 interrupt controllers, each control 64 interrupts */
+#define MCFINT_VECBASE 64
+#define MCFINT0_VECBASE MCFINT_VECBASE
+#define MCFINT1_VECBASE (MCFINT0_VECBASE + 64)
+#define MCFINT2_VECBASE (MCFINT1_VECBASE + 64)
+
+/* interrupt controller 0 */
+#define MCFINTC0_SIMR 0xfc04801c
+#define MCFINTC0_CIMR 0xfc04801d
+#define MCFINTC0_ICR0 0xfc048040
+/* interrupt controller 1 */
+#define MCFINTC1_SIMR 0xfc04c01c
+#define MCFINTC1_CIMR 0xfc04c01d
+#define MCFINTC1_ICR0 0xfc04c040
+/* interrupt controller 2 */
+#define MCFINTC2_SIMR 0xfc05001c
+#define MCFINTC2_CIMR 0xfc05001d
+#define MCFINTC2_ICR0 0xfc050040
+
+/* on interrupt controller 0 */
+#define MCFINT0_EPORT0 1
+#define MCFINT0_UART0 26
+#define MCFINT0_UART1 27
+#define MCFINT0_UART2 28
+#define MCFINT0_UART3 29
+#define MCFINT0_I2C0 30
+#define MCFINT0_DSPI0 31
+
+#define MCFINT0_TIMER0 32
+#define MCFINT0_TIMER1 33
+#define MCFINT0_TIMER2 34
+#define MCFINT0_TIMER3 35
+
+#define MCFINT0_FECRX0 36
+#define MCFINT0_FECTX0 40
+#define MCFINT0_FECENTC0 42
+
+#define MCFINT0_FECRX1 49
+#define MCFINT0_FECTX1 53
+#define MCFINT0_FECENTC1 55
+
+/* on interrupt controller 1 */
+#define MCFINT1_UART4 48
+#define MCFINT1_UART5 49
+#define MCFINT1_UART6 50
+#define MCFINT1_UART7 51
+#define MCFINT1_UART8 52
+#define MCFINT1_UART9 53
+#define MCFINT1_DSPI1 54
+#define MCFINT1_DSPI2 55
+#define MCFINT1_DSPI3 56
+#define MCFINT1_I2C1 57
+#define MCFINT1_I2C2 58
+#define MCFINT1_I2C3 59
+#define MCFINT1_I2C4 60
+#define MCFINT1_I2C5 61
+
+/* on interrupt controller 2 */
+#define MCFINTC2_RTC 26
+
+/*
+ * TIMER module.
+ */
+#define MCFTIMER_BASE1 0xFC070000 /* Base address of TIMER1 */
+#define MCFTIMER_BASE2 0xFC074000 /* Base address of TIMER2 */
+#define MCFTIMER_BASE3 0xFC078000 /* Base address of TIMER3 */
+#define MCFTIMER_BASE4 0xFC07C000 /* Base address of TIMER4 */
+
+#define MCF_IRQ_TIMER (MCFINT0_VECBASE + MCFINT0_TIMER0)
+#define MCF_IRQ_PROFILER (MCFINT0_VECBASE + MCFINT0_TIMER1)
+
+/*
+ * UART module.
+ */
+#define MCFUART_BASE0 0xfc060000 /* Base address of UART0 */
+#define MCFUART_BASE1 0xfc064000 /* Base address of UART1 */
+#define MCFUART_BASE2 0xfc068000 /* Base address of UART2 */
+#define MCFUART_BASE3 0xfc06c000 /* Base address of UART3 */
+#define MCFUART_BASE4 0xec060000 /* Base address of UART4 */
+#define MCFUART_BASE5 0xec064000 /* Base address of UART5 */
+#define MCFUART_BASE6 0xec068000 /* Base address of UART6 */
+#define MCFUART_BASE7 0xec06c000 /* Base address of UART7 */
+#define MCFUART_BASE8 0xec070000 /* Base address of UART8 */
+#define MCFUART_BASE9 0xec074000 /* Base address of UART9 */
+
+#define MCF_IRQ_UART0 (MCFINT0_VECBASE + MCFINT0_UART0)
+#define MCF_IRQ_UART1 (MCFINT0_VECBASE + MCFINT0_UART1)
+#define MCF_IRQ_UART2 (MCFINT0_VECBASE + MCFINT0_UART2)
+#define MCF_IRQ_UART3 (MCFINT0_VECBASE + MCFINT0_UART3)
+#define MCF_IRQ_UART4 (MCFINT1_VECBASE + MCFINT1_UART4)
+#define MCF_IRQ_UART5 (MCFINT1_VECBASE + MCFINT1_UART5)
+#define MCF_IRQ_UART6 (MCFINT1_VECBASE + MCFINT1_UART6)
+#define MCF_IRQ_UART7 (MCFINT1_VECBASE + MCFINT1_UART7)
+#define MCF_IRQ_UART8 (MCFINT1_VECBASE + MCFINT1_UART8)
+#define MCF_IRQ_UART9 (MCFINT1_VECBASE + MCFINT1_UART9)
+/*
+ * FEC modules.
+ */
+#define MCFFEC_BASE0 0xfc0d4004
+#define MCFFEC_SIZE0 0x800
+#define MCF_IRQ_FECRX0 (MCFINT0_VECBASE + MCFINT0_FECRX0)
+#define MCF_IRQ_FECTX0 (MCFINT0_VECBASE + MCFINT0_FECTX0)
+#define MCF_IRQ_FECENTC0 (MCFINT0_VECBASE + MCFINT0_FECENTC0)
+
+#define MCFFEC_BASE1 0xfc0d8004
+#define MCFFEC_SIZE1 0x800
+#define MCF_IRQ_FECRX1 (MCFINT0_VECBASE + MCFINT0_FECRX1)
+#define MCF_IRQ_FECTX1 (MCFINT0_VECBASE + MCFINT0_FECTX1)
+#define MCF_IRQ_FECENTC1 (MCFINT0_VECBASE + MCFINT0_FECENTC1)
+/*
+ * I2C modules.
+ */
+#define MCFI2C_BASE0 0xfc058000
+#define MCFI2C_SIZE0 0x20
+#define MCFI2C_BASE1 0xfc038000
+#define MCFI2C_SIZE1 0x20
+#define MCFI2C_BASE2 0xfc010000
+#define MCFI2C_SIZE2 0x20
+#define MCFI2C_BASE3 0xfc014000
+#define MCFI2C_SIZE3 0x20
+#define MCFI2C_BASE4 0xfc018000
+#define MCFI2C_SIZE4 0x20
+#define MCFI2C_BASE5 0xfc01c000
+#define MCFI2C_SIZE5 0x20
+
+#define MCF_IRQ_I2C0 (MCFINT0_VECBASE + MCFINT0_I2C0)
+#define MCF_IRQ_I2C1 (MCFINT1_VECBASE + MCFINT1_I2C1)
+#define MCF_IRQ_I2C2 (MCFINT1_VECBASE + MCFINT1_I2C2)
+#define MCF_IRQ_I2C3 (MCFINT1_VECBASE + MCFINT1_I2C3)
+#define MCF_IRQ_I2C4 (MCFINT1_VECBASE + MCFINT1_I2C4)
+#define MCF_IRQ_I2C5 (MCFINT1_VECBASE + MCFINT1_I2C5)
+/*
+ * EPORT Module.
+ */
+#define MCFEPORT_EPPAR 0xfc090000
+#define MCFEPORT_EPIER 0xfc090003
+#define MCFEPORT_EPFR 0xfc090006
+
+/*
+ * GPIO Module.
+ */
+#define MCFGPIO_PODR_A 0xec094000
+#define MCFGPIO_PODR_B 0xec094001
+#define MCFGPIO_PODR_C 0xec094002
+#define MCFGPIO_PODR_D 0xec094003
+#define MCFGPIO_PODR_E 0xec094004
+#define MCFGPIO_PODR_F 0xec094005
+#define MCFGPIO_PODR_G 0xec094006
+#define MCFGPIO_PODR_H 0xec094007
+#define MCFGPIO_PODR_I 0xec094008
+#define MCFGPIO_PODR_J 0xec094009
+#define MCFGPIO_PODR_K 0xec09400a
+
+#define MCFGPIO_PDDR_A 0xec09400c
+#define MCFGPIO_PDDR_B 0xec09400d
+#define MCFGPIO_PDDR_C 0xec09400e
+#define MCFGPIO_PDDR_D 0xec09400f
+#define MCFGPIO_PDDR_E 0xec094010
+#define MCFGPIO_PDDR_F 0xec094011
+#define MCFGPIO_PDDR_G 0xec094012
+#define MCFGPIO_PDDR_H 0xec094013
+#define MCFGPIO_PDDR_I 0xec094014
+#define MCFGPIO_PDDR_J 0xec094015
+#define MCFGPIO_PDDR_K 0xec094016
+
+#define MCFGPIO_PPDSDR_A 0xec094018
+#define MCFGPIO_PPDSDR_B 0xec094019
+#define MCFGPIO_PPDSDR_C 0xec09401a
+#define MCFGPIO_PPDSDR_D 0xec09401b
+#define MCFGPIO_PPDSDR_E 0xec09401c
+#define MCFGPIO_PPDSDR_F 0xec09401d
+#define MCFGPIO_PPDSDR_G 0xec09401e
+#define MCFGPIO_PPDSDR_H 0xec09401f
+#define MCFGPIO_PPDSDR_I 0xec094020
+#define MCFGPIO_PPDSDR_J 0xec094021
+#define MCFGPIO_PPDSDR_K 0xec094022
+
+#define MCFGPIO_PCLRR_A 0xec094024
+#define MCFGPIO_PCLRR_B 0xec094025
+#define MCFGPIO_PCLRR_C 0xec094026
+#define MCFGPIO_PCLRR_D 0xec094027
+#define MCFGPIO_PCLRR_E 0xec094028
+#define MCFGPIO_PCLRR_F 0xec094029
+#define MCFGPIO_PCLRR_G 0xec09402a
+#define MCFGPIO_PCLRR_H 0xec09402b
+#define MCFGPIO_PCLRR_I 0xec09402c
+#define MCFGPIO_PCLRR_J 0xec09402d
+#define MCFGPIO_PCLRR_K 0xec09402e
+
+#define MCFGPIO_PAR_FBCTL 0xec094048
+#define MCFGPIO_PAR_BE 0xec094049
+#define MCFGPIO_PAR_CS 0xec09404a
+#define MCFGPIO_PAR_CANI2C 0xec09404b
+#define MCFGPIO_PAR_IRQ0H 0xec09404c
+#define MCFGPIO_PAR_IRQ0L 0xec09404d
+#define MCFGPIO_PAR_DSPIOWH 0xec09404e
+#define MCFGPIO_PAR_DSPIOWL 0xec09404f
+#define MCFGPIO_PAR_TIMER 0xec094050
+#define MCFGPIO_PAR_UART2 0xec094051
+#define MCFGPIO_PAR_UART1 0xec094052
+#define MCFGPIO_PAR_UART0 0xec094053
+#define MCFGPIO_PAR_SDHCH 0xec094054
+#define MCFGPIO_PAR_SDHCL 0xec094055
+#define MCFGPIO_PAR_SIMP0H 0xec094056
+#define MCFGPIO_PAR_SIMP0L 0xec094057
+#define MCFGPIO_PAR_SSI0H 0xec094058
+#define MCFGPIO_PAR_SSI0L 0xec094059
+#define MCFGPIO_PAR_DEBUGH1 0xec09405a
+#define MCFGPIO_PAR_DEBUGH0 0xec09405b
+#define MCFGPIO_PAR_DEBUGl 0xec09405c
+#define MCFGPIO_PAR_FEC 0xec09405e
+
+/* generalization for generic gpio support */
+#define MCFGPIO_PODR MCFGPIO_PODR_A
+#define MCFGPIO_PDDR MCFGPIO_PDDR_A
+#define MCFGPIO_PPDR MCFGPIO_PPDSDR_A
+#define MCFGPIO_SETR MCFGPIO_PPDSDR_A
+#define MCFGPIO_CLRR MCFGPIO_PCLRR_A
+
+#define MCFGPIO_IRQ_MAX 8
+#define MCFGPIO_IRQ_VECBASE MCFINT_VECBASE
+#define MCFGPIO_PIN_MAX 112
+
+#endif /* m5441xsim_h */
diff --git a/arch/m68k/include/asm/m54xxacr.h b/arch/m68k/include/asm/m54xxacr.h
index 47906aa..192bbfe 100644
--- a/arch/m68k/include/asm/m54xxacr.h
+++ b/arch/m68k/include/asm/m54xxacr.h
@@ -55,6 +55,10 @@
#define ICACHE_SIZE 0x8000 /* instruction - 32k */
#define DCACHE_SIZE 0x8000 /* data - 32k */

+#elif defined(CONFIG_M5441x)
+
+#define ICACHE_SIZE 0x2000 /* instruction - 8k */
+#define DCACHE_SIZE 0x2000 /* data - 8k */
#endif

#define CACHE_LINE_SIZE 0x0010 /* 16 bytes */
diff --git a/arch/m68k/include/asm/mcfsim.h b/arch/m68k/include/asm/mcfsim.h
index ebd0304..6e5a8cd 100644
--- a/arch/m68k/include/asm/mcfsim.h
+++ b/arch/m68k/include/asm/mcfsim.h
@@ -43,6 +43,8 @@
#include <asm/mcfintc.h>
#elif defined(CONFIG_M54xx)
#include <asm/m54xxsim.h>
+#elif defined(CONFIG_M5441x)
+#include <asm/m5441xsim.h>
#endif

/****************************************************************************/
diff --git a/arch/m68k/include/asm/mcftimer.h b/arch/m68k/include/asm/mcftimer.h
index 351c272..da2fa43 100644
--- a/arch/m68k/include/asm/mcftimer.h
+++ b/arch/m68k/include/asm/mcftimer.h
@@ -19,7 +19,7 @@
#define MCFTIMER_TRR 0x04 /* Timer Reference (r/w) */
#define MCFTIMER_TCR 0x08 /* Timer Capture reg (r/w) */
#define MCFTIMER_TCN 0x0C /* Timer Counter reg (r/w) */
-#if defined(CONFIG_M532x)
+#if defined(CONFIG_M532x) || defined(CONFIG_M5441x)
#define MCFTIMER_TER 0x03 /* Timer Event reg (r/w) */
#else
#define MCFTIMER_TER 0x11 /* Timer Event reg (r/w) */
diff --git a/arch/m68k/platform/coldfire/Makefile b/arch/m68k/platform/coldfire/Makefile
index 76d389d..51e85e5 100644
--- a/arch/m68k/platform/coldfire/Makefile
+++ b/arch/m68k/platform/coldfire/Makefile
@@ -27,6 +27,7 @@ obj-$(CONFIG_M5307) += m5307.o timers.o intc.o reset.o
obj-$(CONFIG_M532x) += m532x.o timers.o intc-simr.o reset.o
obj-$(CONFIG_M5407) += m5407.o timers.o intc.o reset.o
obj-$(CONFIG_M54xx) += m54xx.o sltimers.o intc-2.o
+obj-$(CONFIG_M5441x) += m5441x.o timers.o intc-simr.o reset.o

obj-$(CONFIG_NETtel) += nettel.o
obj-$(CONFIG_CLEOPATRA) += nettel.o
diff --git a/arch/m68k/platform/coldfire/device.c b/arch/m68k/platform/coldfire/device.c
index 3aa77dd..11ecd23 100644
--- a/arch/m68k/platform/coldfire/device.c
+++ b/arch/m68k/platform/coldfire/device.c
@@ -20,7 +20,7 @@
#include <asm/mcfqspi.h>

/*
- * All current ColdFire parts contain from 2, 3 or 4 UARTS.
+ * All current ColdFire parts contain from 2, 3, 4 or 10 UARTS.
*/
static struct mcf_platform_uart mcf_uart_platform_data[] = {
{
@@ -43,6 +43,42 @@ static struct mcf_platform_uart mcf_uart_platform_data[] = {
.irq = MCF_IRQ_UART3,
},
#endif
+#ifdef MCFUART_BASE4
+ {
+ .mapbase = MCFUART_BASE4,
+ .irq = MCF_IRQ_UART4,
+ },
+#endif
+#ifdef MCFUART_BASE5
+ {
+ .mapbase = MCFUART_BASE5,
+ .irq = MCF_IRQ_UART5,
+ },
+#endif
+#ifdef MCFUART_BASE6
+ {
+ .mapbase = MCFUART_BASE6,
+ .irq = MCF_IRQ_UART6,
+ },
+#endif
+#ifdef MCFUART_BASE7
+ {
+ .mapbase = MCFUART_BASE7,
+ .irq = MCF_IRQ_UART7,
+ },
+#endif
+#ifdef MCFUART_BASE8
+ {
+ .mapbase = MCFUART_BASE8,
+ .irq = MCF_IRQ_UART8,
+ },
+#endif
+#ifdef MCFUART_BASE9
+ {
+ .mapbase = MCFUART_BASE9,
+ .irq = MCF_IRQ_UART9,
+ },
+#endif
{ },
};

diff --git a/arch/m68k/platform/coldfire/intc-simr.c b/arch/m68k/platform/coldfire/intc-simr.c
index 650d52e..81571fb 100644
--- a/arch/m68k/platform/coldfire/intc-simr.c
+++ b/arch/m68k/platform/coldfire/intc-simr.c
@@ -59,16 +59,18 @@ static unsigned int inline irq2ebit(unsigned int irq)
#endif

/*
- * There maybe one or two interrupt control units, each has 64
- * interrupts. If there is no second unit then MCFINTC1_* defines
- * will be 0 (and code for them optimized away).
+ * There maybe one, two or three interrupt control units, each has 64
+ * interrupts. If there is no second or third unit then MCFINTC1_* or
+ * MCFINTC2_* defines will be 0 (and code for them optimized away).
*/

static void intc_irq_mask(struct irq_data *d)
{
unsigned int irq = d->irq - MCFINT_VECBASE;

- if (MCFINTC1_SIMR && (irq > 64))
+ if (MCFINTC2_SIMR && (irq > 128))
+ __raw_writeb(irq - 128, MCFINTC2_SIMR);
+ else if (MCFINTC1_SIMR && (irq > 64))
__raw_writeb(irq - 64, MCFINTC1_SIMR);
else
__raw_writeb(irq, MCFINTC0_SIMR);
@@ -78,7 +80,9 @@ static void intc_irq_unmask(struct irq_data *d)
{
unsigned int irq = d->irq - MCFINT_VECBASE;

- if (MCFINTC1_CIMR && (irq > 64))
+ if (MCFINTC2_SIMR && (irq > 128))
+ __raw_writeb(irq - 128, MCFINTC2_SIMR);
+ else if (MCFINTC1_CIMR && (irq > 64))
__raw_writeb(irq - 64, MCFINTC1_CIMR);
else
__raw_writeb(irq, MCFINTC0_CIMR);
@@ -99,9 +103,11 @@ static unsigned int intc_irq_startup(struct irq_data *d)
unsigned int ebit = irq2ebit(irq);
u8 v;

+#if defined(MCFEPORT_EPDDR)
/* Set EPORT line as input */
v = __raw_readb(MCFEPORT_EPDDR);
__raw_writeb(v & ~(0x1 << ebit), MCFEPORT_EPDDR);
+#endif

/* Set EPORT line as interrupt source */
v = __raw_readb(MCFEPORT_EPIER);
@@ -109,12 +115,13 @@ static unsigned int intc_irq_startup(struct irq_data *d)
}

irq -= MCFINT_VECBASE;
- if (MCFINTC1_ICR0 && (irq > 64))
+ if (MCFINTC2_ICR0 && (irq > 128))
+ __raw_writeb(5, MCFINTC2_ICR0 + irq - 128);
+ else if (MCFINTC1_ICR0 && (irq > 64))
__raw_writeb(5, MCFINTC1_ICR0 + irq - 64);
else
__raw_writeb(5, MCFINTC0_ICR0 + irq);

-
intc_irq_unmask(d);
return 0;
}
@@ -176,7 +183,8 @@ void __init init_IRQ(void)
if (MCFINTC1_SIMR)
__raw_writeb(0xff, MCFINTC1_SIMR);

- eirq = MCFINT_VECBASE + 64 + (MCFINTC1_ICR0 ? 64 : 0);
+ eirq = MCFINT_VECBASE + 64 + (MCFINTC1_ICR0 ? 64 : 0) +
+ (MCFINTC2_ICR0 ? 64 : 0);
for (irq = MCFINT_VECBASE; (irq < eirq); irq++) {
if ((irq >= EINT1) && (irq <= EINT7))
irq_set_chip(irq, &intc_irq_chip_edge_port);
diff --git a/arch/m68k/platform/coldfire/m5441x.c b/arch/m68k/platform/coldfire/m5441x.c
new file mode 100644
index 0000000..edffaff
--- /dev/null
+++ b/arch/m68k/platform/coldfire/m5441x.c
@@ -0,0 +1,51 @@
+/*
+ * m5441x.c -- support for Coldfire m5441x processors
+ *
+ * (C) Copyright Steven King <sfking at fdwdc.com>
+ */
+
+#include <linux/kernel.h>
+#include <linux/param.h>
+#include <linux/init.h>
+#include <linux/io.h>
+#include <asm/machdep.h>
+#include <asm/coldfire.h>
+#include <asm/mcfsim.h>
+#include <asm/mcfuart.h>
+#include <asm/mcfdma.h>
+#include <asm/mcfgpio.h>
+
+struct mcf_gpio_chip mcf_gpio_chips[] = {
+ MCFGPF(A, 0, 8),
+ MCFGPF(B, 8, 8),
+ MCFGPF(C, 16, 8),
+ MCFGPF(D, 24, 8),
+ MCFGPF(E, 32, 8),
+ MCFGPF(F, 40, 8),
+ MCFGPF(G, 48, 8),
+ MCFGPF(H, 56, 8),
+ MCFGPF(I, 64, 8),
+ MCFGPF(J, 72, 8),
+ MCFGPF(K, 80, 8),
+};
+
+unsigned int mcf_gpio_chips_size = ARRAY_SIZE(mcf_gpio_chips);
+
+static void __init m5441x_uarts_init(void)
+{
+ __raw_writeb(0x0f, MCFGPIO_PAR_UART0);
+ __raw_writeb(0x00, MCFGPIO_PAR_UART1);
+ __raw_writeb(0x00, MCFGPIO_PAR_UART2);
+}
+
+static void __init m5441x_fec_init(void)
+{
+ __raw_writeb(0x03, MCFGPIO_PAR_FEC);
+}
+
+void __init config_BSP(char *commandp, int size)
+{
+ mach_sched_init = hw_timer_init;
+ m5441x_uarts_init();
+ m5441x_fec_init();
+}
diff --git a/arch/m68k/platform/coldfire/timers.c b/arch/m68k/platform/coldfire/timers.c
index ed96ce5..0a273e7 100644
--- a/arch/m68k/platform/coldfire/timers.c
+++ b/arch/m68k/platform/coldfire/timers.c
@@ -36,7 +36,7 @@
*/
void coldfire_profile_init(void);

-#if defined(CONFIG_M532x)
+#if defined(CONFIG_M532x) || defined(CONFIG_M5441x)
#define __raw_readtrr __raw_readl
#define __raw_writetrr __raw_writel
#else
Philippe De Muyter
2012-05-23 07:38:46 UTC
Permalink
It doesnt include support for the 2 fec controllers, the ones on the
5441x are just slightly different in some non obvious way so they dont
quite work yet.
Are they identical to the fec's of the 548x ? I have drivers for them
(actually they came from the freescale port for 2.6.25, but I have cleaned
them up, made them use phylib, and made them current for 2.6.37). I don't
know if they still would be compatible with 3.5.

Philippe
Philippe De Muyter
2012-05-23 08:55:04 UTC
Permalink
Post by Philippe De Muyter
It doesnt include support for the 2 fec controllers, the ones on the
5441x are just slightly different in some non obvious way so they dont
quite work yet.
Are they identical to the fec's of the 548x ? I have drivers for them
(actually they came from the freescale port for 2.6.25, but I have cleaned
them up, made them use phylib, and made them current for 2.6.37). I don't
know if they still would be compatible with 3.5.
It looks like the fecs on the 54xx are different, with a subset of the regular
fec registers while the 544xx have a superset; I think from googling the
error message I'm seeing it maybe a issue with the lack of kernel support for
the phy. I guess it time I learn about writing phy drivers...
Ok, the 54xx fec drivers would not help then.

Best regards

Philippe
Greg Ungerer
2012-05-25 05:55:32 UTC
Permalink
Hi Steven,
Post by Steven King
The 5441x (54410/54415/54416/54417/54418) is similar to the 532x in the same
way the 532x is similar to the 5208; it doesn't have either IPSBAR nor MBAR,
instead everything resides at a fixed address. Many of the registers common
between the 5441x and the 532x live at the same address as the 532x, but of
course the 5441x has a v4e core, cache and mmu, along with 10 uarts! 6 i2c
What a wacky Soc. I wonder what people are using them in :-)
Post by Steven King
controllers, 4 dma capable spi controllers, usb and much more. This patch is
just a quick and dirty hack to get it booting on the twr-mcf5441x board. Its
currently nommu only (well, I havent even tried it with the mmu), It doesnt
include support for the 2 fec controllers, the ones on the 5441x are just
slightly different in some non obvious way so they dont quite work yet.
Signed-off-by: Steven King<sfking at fdwdc.com>
This looks pretty good overall. Only a couple of comments below.
Otherwise I'd like to commit it to the m68knommu git tree (after the current
merge window closes).
Post by Steven King
---
arch/m68k/Kconfig.cpu | 7 +
arch/m68k/Kconfig.machine | 1 -
arch/m68k/Makefile | 1 +
arch/m68k/include/asm/gpio.h | 11 +-
arch/m68k/include/asm/m5441xsim.h | 252 +++++++++++++++++++++++++++++++
arch/m68k/include/asm/m54xxacr.h | 4 +
arch/m68k/include/asm/mcfsim.h | 2 +
arch/m68k/include/asm/mcftimer.h | 2 +-
arch/m68k/platform/coldfire/Makefile | 1 +
arch/m68k/platform/coldfire/device.c | 38 ++++-
arch/m68k/platform/coldfire/intc-simr.c | 24 ++-
arch/m68k/platform/coldfire/m5441x.c | 51 +++++++
arch/m68k/platform/coldfire/timers.c | 2 +-
13 files changed, 382 insertions(+), 14 deletions(-)
diff --git a/arch/m68k/Kconfig.cpu b/arch/m68k/Kconfig.cpu
index 8a9c767..3221433 100644
--- a/arch/m68k/Kconfig.cpu
+++ b/arch/m68k/Kconfig.cpu
@@ -252,6 +252,13 @@ config M548x
help
Freescale ColdFire 5480/5481/5482/5483/5484/5485 processor support.
+config M5441x
+ bool "MCF5441x"
+ select MMU_COLDFIRE if MMU
Maybe we should make this "depends on !MMU" until we really do
have the MMU support in place. There is pretty much no way it will
compile and work with the MMU enabled yet.
Post by Steven King
+ select HAVE_CACHE_CB
+ help
+ Freescale Coldfire 54410/54415/54416/54417/54418 processor support.
+
endif # COLDFIRE
diff --git a/arch/m68k/Kconfig.machine b/arch/m68k/Kconfig.machine
index 7cdf6b0..7031173 100644
--- a/arch/m68k/Kconfig.machine
+++ b/arch/m68k/Kconfig.machine
@@ -428,7 +428,6 @@ config SAVANTrosie1
help
Support for the Savant Rosie1 board.
-
I like clean ups... But they should go in separate patches of their own.
Post by Steven King
if !MMU || COLDFIRE
comment "Machine Options"
diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
index 804f139..6940baf 100644
--- a/arch/m68k/Makefile
+++ b/arch/m68k/Makefile
@@ -34,6 +34,7 @@ cpuflags-$(CONFIG_M68030) :=
cpuflags-$(CONFIG_M68020) :=
cpuflags-$(CONFIG_M68360) := -m68332
cpuflags-$(CONFIG_M68000) := -m68000
+cpuflags-$(CONFIG_M5441x) := $(call cc-option,-mcpu=54455,-mcfv4e)
What if the compiler supports neither -54455 or -mcfv4e?
Admittedly it would have to be a old compiler. But the thinking here
was that the second arg is the last resort fallback if the compiler
doesn't support the ideal compiler switch.

Regards
Greg


------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: gerg at snapgear.com
SnapGear Group, McAfee PHONE: +61 7 3435 2888
8 Gardner Close FAX: +61 7 3217 5323
Milton, QLD, 4064, Australia WEB: http://www.SnapGear.com
Steven King
2012-05-31 10:20:27 UTC
Permalink
Post by Greg Ungerer
This looks pretty good overall. Only a couple of comments below.
Otherwise I'd like to commit it to the m68knommu git tree (after the
current merge window closes).
Sure. Actually what I'd like to do is after the merge window closes submit a
revised patch set (I have to re-submit the fec patch anyway). Same for the
5253. Some other minor patches as well.
Post by Greg Ungerer
Post by Steven King
+config M5441x
+ bool "MCF5441x"
+ select MMU_COLDFIRE if MMU
Maybe we should make this "depends on !MMU" until we really do
have the MMU support in place. There is pretty much no way it will
compile and work with the MMU enabled yet.
Yeah, I tried compiling it with the MMU turned on. The lack of an FPU is
going to make it challenging. Although I dont understand why the m68k/mmu
code is so insistent that one needs an fpu...
Post by Greg Ungerer
Post by Steven King
diff --git a/arch/m68k/Kconfig.machine b/arch/m68k/Kconfig.machine
index 7cdf6b0..7031173 100644
--- a/arch/m68k/Kconfig.machine
+++ b/arch/m68k/Kconfig.machine
@@ -428,7 +428,6 @@ config SAVANTrosie1
help
Support for the Savant Rosie1 board.
-
I like clean ups... But they should go in separate patches of their own.
;-P I had defined a config selection for the twr-mcf5441x board, but decided
it should be in its own branch and didnt notice that sneaking in until it came
to commit.
Post by Greg Ungerer
Post by Steven King
if !MMU || COLDFIRE
comment "Machine Options"
diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
index 804f139..6940baf 100644
--- a/arch/m68k/Makefile
+++ b/arch/m68k/Makefile
@@ -34,6 +34,7 @@ cpuflags-$(CONFIG_M68030) :=
cpuflags-$(CONFIG_M68020) :=
cpuflags-$(CONFIG_M68360) := -m68332
cpuflags-$(CONFIG_M68000) := -m68000
+cpuflags-$(CONFIG_M5441x) := $(call cc-option,-mcpu=54455,-mcfv4e)
What if the compiler supports neither -54455 or -mcfv4e?
Admittedly it would have to be a old compiler. But the thinking here
was that the second arg is the last resort fallback if the compiler
doesn't support the ideal compiler switch.
It would have to be really old compiler. The -mcfv4e option appeared in gcc
3.4.0, released in april of '04. Now, I'm not saying everyone needs to use
the latest gcc - I went back to 4.3.3 for my Coldfire projects after getting
some strange crashes with 4.6.1, but I think anyone who tries to build the
latest linux kernel for a relatively new processor variant with a an 8+ year
old version of gcc deserves what they get. ;)

On the other hand, I now think this is incorrect for this processor.
Freescale, in some of their documentation refer to the 5441x as a v4m and
CodeWarrior lists v4e devices as 547x and 548x and puts the 54411x and 54455
together with the 540x.
Greg Ungerer
2012-06-01 05:11:19 UTC
Permalink
Hi Steven,
Post by Steven King
Post by Greg Ungerer
This looks pretty good overall. Only a couple of comments below.
Otherwise I'd like to commit it to the m68knommu git tree (after the
current merge window closes).
Sure. Actually what I'd like to do is after the merge window closes submit a
revised patch set (I have to re-submit the fec patch anyway). Same for the
5253. Some other minor patches as well.
Yep. I'll wait for the updated patches and apply them.
Post by Steven King
Post by Greg Ungerer
Post by Steven King
+config M5441x
+ bool "MCF5441x"
+ select MMU_COLDFIRE if MMU
Maybe we should make this "depends on !MMU" until we really do
have the MMU support in place. There is pretty much no way it will
compile and work with the MMU enabled yet.
Yeah, I tried compiling it with the MMU turned on. The lack of an FPU is
going to make it challenging. Although I dont understand why the m68k/mmu
code is so insistent that one needs an fpu...
It shouldn't be too bad. I have started using CONFIG_FPU in a lot
of the arch/m68k code so you can select to not use it. It may not be
completely able to be turned off it, but it shouldn't take too much
more work.
Post by Steven King
Post by Greg Ungerer
Post by Steven King
if !MMU || COLDFIRE
comment "Machine Options"
diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
index 804f139..6940baf 100644
--- a/arch/m68k/Makefile
+++ b/arch/m68k/Makefile
@@ -34,6 +34,7 @@ cpuflags-$(CONFIG_M68030) :=
cpuflags-$(CONFIG_M68020) :=
cpuflags-$(CONFIG_M68360) := -m68332
cpuflags-$(CONFIG_M68000) := -m68000
+cpuflags-$(CONFIG_M5441x) := $(call cc-option,-mcpu=54455,-mcfv4e)
What if the compiler supports neither -54455 or -mcfv4e?
Admittedly it would have to be a old compiler. But the thinking here
was that the second arg is the last resort fallback if the compiler
doesn't support the ideal compiler switch.
It would have to be really old compiler. The -mcfv4e option appeared in gcc
3.4.0, released in april of '04. Now, I'm not saying everyone needs to use
the latest gcc - I went back to 4.3.3 for my Coldfire projects after getting
some strange crashes with 4.6.1, but I think anyone who tries to build the
latest linux kernel for a relatively new processor variant with a an 8+ year
old version of gcc deserves what they get. ;)
If your happy with it that way then I am fine with it :-)
Post by Steven King
On the other hand, I now think this is incorrect for this processor.
Freescale, in some of their documentation refer to the 5441x as a v4m and
CodeWarrior lists v4e devices as 547x and 548x and puts the 54411x and 54455
together with the 540x.
Interesting. The set of compiler switchers that exist today doesn't
seem totally consistent or well though out...

Regards
Greg


------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: gerg at snapgear.com
SnapGear Group, McAfee PHONE: +61 7 3435 2888
8 Gardner Close FAX: +61 7 3217 5323
Milton, QLD, 4064, Australia WEB: http://www.SnapGear.com
Loading...