From a1ed3a83be63bfc6e817854b29c9c0572a86bea7 Mon Sep 17 00:00:00 2001 From: Angelo Dureghello Date: Sun, 4 Feb 2018 21:13:12 +0100 Subject: [PATCH 1/3] m68k: fix mcf5441x total interrupt number Signed-off-by: Angelo Dureghello --- arch/m68k/include/asm/immap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/m68k/include/asm/immap.h b/arch/m68k/include/asm/immap.h index 06bc2a0a58..80fa25769b 100644 --- a/arch/m68k/include/asm/immap.h +++ b/arch/m68k/include/asm/immap.h @@ -362,7 +362,7 @@ #endif #define CONFIG_SYS_INTR_BASE (MMAP_INTC0) -#define CONFIG_SYS_NUM_IRQS (128) +#define CONFIG_SYS_NUM_IRQS (192) #endif /* CONFIG_M54418 */ From faae49543a0b366087cb733c26f8c581b17abe82 Mon Sep 17 00:00:00 2001 From: Angelo Dureghello Date: Sat, 4 Aug 2018 23:02:56 +0200 Subject: [PATCH 2/3] m68k: fix multiple memory accesses on swap operations On a u32 val = __sw32(*addr); multiple memory accesses are not welcome, since "addr" may be an IO peripheral register address. This patch changes __sw16/32 to perform a single memory access for the source value. Signed-off-by: Angelo Dureghello --- arch/m68k/include/asm/byteorder.h | 34 ++++++++++++++++++------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/arch/m68k/include/asm/byteorder.h b/arch/m68k/include/asm/byteorder.h index eb03b6a053..9179622250 100644 --- a/arch/m68k/include/asm/byteorder.h +++ b/arch/m68k/include/asm/byteorder.h @@ -10,21 +10,28 @@ #include #ifdef __GNUC__ -#define __sw16(x) \ - ((__u16)( \ - (((__u16)(x) & (__u16)0x00ffU) << 8) | \ - (((__u16)(x) & (__u16)0xff00U) >> 8) )) -#define __sw32(x) \ - ((__u32)( \ - (((__u32)(x)) << 24) | \ - (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \ - (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \ - (((__u32)(x)) >> 24) )) + +static inline __u32 __sw32(__u32 x) +{ + __u32 v = x; + + return v << 24 | + (v & (__u32)0x0000ff00UL) << 8 | + (v & (__u32)0x00ff0000UL) >> 8 | + v >> 24; +} + +static inline __u16 __sw16(__u16 x) +{ + __u16 v = x; + + return (v & (__u16)0x00ffU) << 8 | + (v & (__u16)0xff00U) >> 8; +} static __inline__ unsigned ld_le16(const volatile unsigned short *addr) { - unsigned result = *addr; - return __sw16(result); + return __sw16(*addr); } static __inline__ void st_le16(volatile unsigned short *addr, @@ -35,8 +42,7 @@ static __inline__ void st_le16(volatile unsigned short *addr, static __inline__ unsigned ld_le32(const volatile unsigned *addr) { - unsigned result = *addr; - return __sw32(result); + return __sw32(*addr); } static __inline__ void st_le32(volatile unsigned *addr, const unsigned val) From 2c92e4fbc69841170939a48e887c8fbbcb23d05c Mon Sep 17 00:00:00 2001 From: Angelo Dureghello Date: Thu, 25 Jan 2018 22:42:52 +0100 Subject: [PATCH 3/3] m68k: ColdFire mcf5441x, add eSDHC support This patch adds mcf5441x eSDHC support for the mcf5441x family. Signed-off-by: Angelo Dureghello --- arch/m68k/cpu/mcf5445x/cpu_init.c | 10 ++++++++++ arch/m68k/cpu/mcf5445x/speed.c | 2 ++ arch/m68k/include/asm/global_data.h | 3 +++ 3 files changed, 15 insertions(+) diff --git a/arch/m68k/cpu/mcf5445x/cpu_init.c b/arch/m68k/cpu/mcf5445x/cpu_init.c index 0b86020204..7632d9262c 100644 --- a/arch/m68k/cpu/mcf5445x/cpu_init.c +++ b/arch/m68k/cpu/mcf5445x/cpu_init.c @@ -173,6 +173,15 @@ void cpu_init_f(void) /* Lowest slew rate for UART0,1,2 */ out_8(&gpio->srcr_uart, 0x00); + +#ifdef CONFIG_FSL_ESDHC + /* eSDHC pin as faster speed */ + out_8(&gpio->srcr_sdhc, 0x03); + + /* All esdhc pins as SD */ + out_8(&gpio->par_sdhch, 0xff); + out_8(&gpio->par_sdhcl, 0xff); +#endif #endif /* CONFIG_MCF5441x */ #ifdef CONFIG_MCF5445x @@ -534,4 +543,5 @@ void cfspi_release_bus(uint bus, uint cs) clrbits_8(&gpio->par_dspiow, GPIO_PAR_DSPIOW_DSPI0PSC1); #endif } + #endif diff --git a/arch/m68k/cpu/mcf5445x/speed.c b/arch/m68k/cpu/mcf5445x/speed.c index 5214730a0f..e15e32ebde 100644 --- a/arch/m68k/cpu/mcf5445x/speed.c +++ b/arch/m68k/cpu/mcf5445x/speed.c @@ -120,6 +120,8 @@ void setup_5441x_clocks(void) temp = ((pdr & PLL_DR_OUTDIV2_BITS) >> 5) + 1; gd->bus_clk = vco / temp; /* bus clock */ + temp = ((pdr & PLL_DR_OUTDIV3_BITS) >> 10) + 1; + gd->arch.sdhc_clk = vco / temp; } #endif diff --git a/arch/m68k/include/asm/global_data.h b/arch/m68k/include/asm/global_data.h index aa0be8191a..188055e9d3 100644 --- a/arch/m68k/include/asm/global_data.h +++ b/arch/m68k/include/asm/global_data.h @@ -18,6 +18,9 @@ struct arch_global_data { unsigned long vco_clk; unsigned long flb_clk; #endif +#ifdef CONFIG_MCF5441x + unsigned long sdhc_clk; +#endif }; #include