From 81d33350bab8b6889ac0f9c98bce58128be1c72d Mon Sep 17 00:00:00 2001 From: Greg Ungerer Date: Thu, 25 Aug 2016 23:10:59 +1000 Subject: m68k: set appropriate machine type for m5411x SoC platforms Create a new machine type for platforms based around the ColdFire 5441x SoC family. Set that machine type on startup when building for this platform type. Currently the ColdFire head.S hard codes a M54xx machine type at startup - since that is the only platform type currently supported with MMU enabled. The m5441x has an MMU and this change forms part of the support required to run it with the MMU enabled. Signed-off-by: Greg Ungerer --- arch/m68k/kernel/setup_mm.c | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/m68k/kernel') diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c index 5b8ec4d5f8e8..13f4640bb84f 100644 --- a/arch/m68k/kernel/setup_mm.c +++ b/arch/m68k/kernel/setup_mm.c @@ -341,6 +341,7 @@ void __init setup_arch(char **cmdline_p) #endif #ifdef CONFIG_COLDFIRE case MACH_M54XX: + case MACH_M5441X: config_BSP(NULL, 0); break; #endif -- cgit v1.2.3-55-g7522 From 8912eaccb981fd7c2624cbfd56c47c1f6f051420 Mon Sep 17 00:00:00 2001 From: Greg Ungerer Date: Mon, 29 Aug 2016 16:43:51 +1000 Subject: m68k: always make available dump_fpu() Our local m68k architecture dump_fpu() is conditionally compiled in on CONFIG_FPU. That is OK for all existing MMU enabled CPU types, but won't handle the case for some ColdFire SoC CPU parts that we want to support that have no FPU hardware. dump_fpu() is expected to be present by the ELF loader, so we must always have it available and exported. Remove the conditional and reorganize the dump_fpu hard FPU code path to let the compiler remove code when not needed. This change based on changes and discussion from Yannick Gicquel . Signed-off-by: Greg Ungerer --- arch/m68k/kernel/process.c | 56 +++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'arch/m68k/kernel') diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c index c55ff719fa72..4ba1ae7345c3 100644 --- a/arch/m68k/kernel/process.c +++ b/arch/m68k/kernel/process.c @@ -203,11 +203,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, } /* Fill in the fpu structure for a core dump. */ -#ifdef CONFIG_FPU int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu) { - char fpustate[216]; - if (FPU_IS_EMU) { int i; @@ -222,37 +219,40 @@ int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu) return 1; } - /* First dump the fpu context to avoid protocol violation. */ - asm volatile ("fsave %0" :: "m" (fpustate[0]) : "memory"); - if (!CPU_IS_060 ? !fpustate[0] : !fpustate[2]) - return 0; + if (IS_ENABLED(CONFIG_FPU)) { + char fpustate[216]; - if (CPU_IS_COLDFIRE) { - asm volatile ("fmovel %/fpiar,%0\n\t" - "fmovel %/fpcr,%1\n\t" - "fmovel %/fpsr,%2\n\t" - "fmovemd %/fp0-%/fp7,%3" - : - : "m" (fpu->fpcntl[0]), - "m" (fpu->fpcntl[1]), - "m" (fpu->fpcntl[2]), - "m" (fpu->fpregs[0]) - : "memory"); - } else { - asm volatile ("fmovem %/fpiar/%/fpcr/%/fpsr,%0" - : - : "m" (fpu->fpcntl[0]) - : "memory"); - asm volatile ("fmovemx %/fp0-%/fp7,%0" - : - : "m" (fpu->fpregs[0]) - : "memory"); + /* First dump the fpu context to avoid protocol violation. */ + asm volatile ("fsave %0" :: "m" (fpustate[0]) : "memory"); + if (!CPU_IS_060 ? !fpustate[0] : !fpustate[2]) + return 0; + + if (CPU_IS_COLDFIRE) { + asm volatile ("fmovel %/fpiar,%0\n\t" + "fmovel %/fpcr,%1\n\t" + "fmovel %/fpsr,%2\n\t" + "fmovemd %/fp0-%/fp7,%3" + : + : "m" (fpu->fpcntl[0]), + "m" (fpu->fpcntl[1]), + "m" (fpu->fpcntl[2]), + "m" (fpu->fpregs[0]) + : "memory"); + } else { + asm volatile ("fmovem %/fpiar/%/fpcr/%/fpsr,%0" + : + : "m" (fpu->fpcntl[0]) + : "memory"); + asm volatile ("fmovemx %/fp0-%/fp7,%0" + : + : "m" (fpu->fpregs[0]) + : "memory"); + } } return 1; } EXPORT_SYMBOL(dump_fpu); -#endif /* CONFIG_FPU */ unsigned long get_wchan(struct task_struct *p) { -- cgit v1.2.3-55-g7522 From 6d3ec8056208a799abd5ff434cbfc4db2be38140 Mon Sep 17 00:00:00 2001 From: Greg Ungerer Date: Mon, 29 Aug 2016 17:01:24 +1000 Subject: m68k: only generate FPU instructions if CONFIG_FPU enabled Most of the m68k code that supports a hardware FPU is surrounded by CONFIG_FPU. Be consistent and surround the hardware FPU instruction setup in setup_mm.c with CONFIG_FPU as well as the check for CONFIG_M68KFPU_EMU_ONLY. The existing classic m68k architectures all define CONFIG_FPU, so they see no change from this. But on ColdFire where we do not support the emulated FP code we can now compile without CONFIG_FPU being set as well. Signed-off-by: Greg Ungerer --- arch/m68k/kernel/setup_mm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/m68k/kernel') diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c index 13f4640bb84f..adbb80698da2 100644 --- a/arch/m68k/kernel/setup_mm.c +++ b/arch/m68k/kernel/setup_mm.c @@ -245,7 +245,7 @@ void __init setup_arch(char **cmdline_p) * We should really do our own FPU check at startup. * [what do we do with buggy 68LC040s? if we have problems * with them, we should add a test to check_bugs() below] */ -#ifndef CONFIG_M68KFPU_EMU_ONLY +#if defined(CONFIG_FPU) && !defined(CONFIG_M68KFPU_EMU_ONLY) /* clear the fpu if we have one */ if (m68k_fputype & (FPU_68881|FPU_68882|FPU_68040|FPU_68060|FPU_COLDFIRE)) { volatile int zero = 0; -- cgit v1.2.3-55-g7522 From 2a744007c332f9d604b95aaecb106596c52ab001 Mon Sep 17 00:00:00 2001 From: Greg Ungerer Date: Mon, 29 Aug 2016 17:12:32 +1000 Subject: m68k: don't panic if no hardware FPU defined If we boot up and find no hardware FPU we panic and die. Change this behavior to be that if we boot up and we _expect_ a hardware FPU to be present then panic. Don't panic if we don't actually expect to have any hardware FPU. This lets us compile a kernel without FPU if we really choose too. Signed-off-by: Greg Ungerer --- arch/m68k/kernel/setup_mm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/m68k/kernel') diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c index adbb80698da2..9afad2b64c13 100644 --- a/arch/m68k/kernel/setup_mm.c +++ b/arch/m68k/kernel/setup_mm.c @@ -549,7 +549,7 @@ module_init(proc_hardware_init); void check_bugs(void) { -#ifndef CONFIG_M68KFPU_EMU +#if defined(CONFIG_FPU) && !defined(CONFIG_M68KFPU_EMU) if (m68k_fputype == 0) { pr_emerg("*** YOU DO NOT HAVE A FLOATING POINT UNIT, " "WHICH IS REQUIRED BY LINUX/M68K ***\n"); -- cgit v1.2.3-55-g7522 From aa5ac789bd96c7a6628a8167de562fa660f1f481 Mon Sep 17 00:00:00 2001 From: Greg Ungerer Date: Mon, 5 Sep 2016 15:23:50 +1000 Subject: m68k: generalize uboot command line support The uboot command line support needs to be used by both MMU and no-MMU setups, but currently we only have the code in the no-MMU code paths. Move the uboot command line processing code into its own file. Add appropriate calls to it from both the MMU and no-MMU arch setup code. Signed-off-by: Greg Ungerer Acked-by: Geert Uytterhoeven --- arch/m68k/include/asm/bootinfo.h | 6 +++ arch/m68k/kernel/Makefile | 1 + arch/m68k/kernel/setup_mm.c | 1 + arch/m68k/kernel/setup_no.c | 81 +---------------------------- arch/m68k/kernel/uboot.c | 107 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 117 insertions(+), 79 deletions(-) create mode 100644 arch/m68k/kernel/uboot.c (limited to 'arch/m68k/kernel') diff --git a/arch/m68k/include/asm/bootinfo.h b/arch/m68k/include/asm/bootinfo.h index 8e213267f8e7..81c91af8ec6c 100644 --- a/arch/m68k/include/asm/bootinfo.h +++ b/arch/m68k/include/asm/bootinfo.h @@ -22,6 +22,12 @@ extern void save_bootinfo(const struct bi_record *bi); static inline void save_bootinfo(const struct bi_record *bi) {} #endif +#ifdef CONFIG_UBOOT +void process_uboot_commandline(char *commandp, int size); +#else +static inline void process_uboot_commandline(char *commandp, int size) {} +#endif + #endif /* __ASSEMBLY__ */ diff --git a/arch/m68k/kernel/Makefile b/arch/m68k/kernel/Makefile index e47778f8588d..8a1c4d3f91c8 100644 --- a/arch/m68k/kernel/Makefile +++ b/arch/m68k/kernel/Makefile @@ -24,6 +24,7 @@ obj-$(CONFIG_HAS_DMA) += dma.o obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o obj-$(CONFIG_BOOTINFO_PROC) += bootinfo_proc.o +obj-$(CONFIG_UBOOT) += uboot.o obj-$(CONFIG_EARLY_PRINTK) += early_printk.o diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c index 9afad2b64c13..9f61f517f810 100644 --- a/arch/m68k/kernel/setup_mm.c +++ b/arch/m68k/kernel/setup_mm.c @@ -274,6 +274,7 @@ void __init setup_arch(char **cmdline_p) strncpy(m68k_command_line, CONFIG_BOOTPARAM_STRING, CL_SIZE); m68k_command_line[CL_SIZE - 1] = 0; #endif /* CONFIG_BOOTPARAM */ + process_uboot_commandline(&m68k_command_line[0], CL_SIZE); *cmdline_p = m68k_command_line; memcpy(boot_command_line, *cmdline_p, CL_SIZE); diff --git a/arch/m68k/kernel/setup_no.c b/arch/m68k/kernel/setup_no.c index 9309789215a8..4bde2c1c8289 100644 --- a/arch/m68k/kernel/setup_no.c +++ b/arch/m68k/kernel/setup_no.c @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -82,69 +83,6 @@ void (*mach_power_off)(void); #define CPU_INSTR_PER_JIFFY 16 #endif -#if defined(CONFIG_UBOOT) -/* - * parse_uboot_commandline - * - * Copies u-boot commandline arguments and store them in the proper linux - * variables. - * - * Assumes: - * _init_sp global contains the address in the stack pointer when the - * kernel starts (see head.S::_start) - * - * U-Boot calling convention: - * (*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end); - * - * _init_sp can be parsed as such - * - * _init_sp+00 = u-boot cmd after jsr into kernel (skip) - * _init_sp+04 = &kernel board_info (residual data) - * _init_sp+08 = &initrd_start - * _init_sp+12 = &initrd_end - * _init_sp+16 = &cmd_start - * _init_sp+20 = &cmd_end - * - * This also assumes that the memory locations pointed to are still - * unmodified. U-boot places them near the end of external SDRAM. - * - * Argument(s): - * commandp = the linux commandline arg container to fill. - * size = the sizeof commandp. - * - * Returns: - */ -static void __init parse_uboot_commandline(char *commandp, int size) -{ - extern unsigned long _init_sp; - unsigned long *sp; - unsigned long uboot_kbd; - unsigned long uboot_initrd_start, uboot_initrd_end; - unsigned long uboot_cmd_start, uboot_cmd_end; - - - sp = (unsigned long *)_init_sp; - uboot_kbd = sp[1]; - uboot_initrd_start = sp[2]; - uboot_initrd_end = sp[3]; - uboot_cmd_start = sp[4]; - uboot_cmd_end = sp[5]; - - if (uboot_cmd_start && uboot_cmd_end) - strncpy(commandp, (const char *)uboot_cmd_start, size); -#if defined(CONFIG_BLK_DEV_INITRD) - if (uboot_initrd_start && uboot_initrd_end && - (uboot_initrd_end > uboot_initrd_start)) { - initrd_start = uboot_initrd_start; - initrd_end = uboot_initrd_end; - ROOT_DEV = Root_RAM0; - printk(KERN_INFO "initrd at 0x%lx:0x%lx\n", - initrd_start, initrd_end); - } -#endif /* if defined(CONFIG_BLK_DEV_INITRD) */ -} -#endif /* #if defined(CONFIG_UBOOT) */ - void __init setup_arch(char **cmdline_p) { int bootmap_size; @@ -164,22 +102,7 @@ void __init setup_arch(char **cmdline_p) command_line[sizeof(command_line) - 1] = 0; #endif /* CONFIG_BOOTPARAM */ -#if defined(CONFIG_UBOOT) - /* CONFIG_UBOOT and CONFIG_BOOTPARAM defined, concatenate cmdline */ - #if defined(CONFIG_BOOTPARAM) - /* Add the whitespace separator */ - command_line[strlen(CONFIG_BOOTPARAM_STRING)] = ' '; - /* Parse uboot command line into the rest of the buffer */ - parse_uboot_commandline( - &command_line[(strlen(CONFIG_BOOTPARAM_STRING)+1)], - (sizeof(command_line) - - (strlen(CONFIG_BOOTPARAM_STRING)+1))); - /* Only CONFIG_UBOOT defined, create cmdline */ - #else - parse_uboot_commandline(&command_line[0], sizeof(command_line)); - #endif /* CONFIG_BOOTPARAM */ - command_line[sizeof(command_line) - 1] = 0; -#endif /* CONFIG_UBOOT */ + process_uboot_commandline(&command_line[0], sizeof(command_line)); printk(KERN_INFO "\x0F\r\n\nuClinux/" CPU_NAME "\n"); diff --git a/arch/m68k/kernel/uboot.c b/arch/m68k/kernel/uboot.c new file mode 100644 index 000000000000..b3536a82a262 --- /dev/null +++ b/arch/m68k/kernel/uboot.c @@ -0,0 +1,107 @@ +/* + * uboot.c -- uboot arguments support + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of this archive + * for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +/* + * parse_uboot_commandline + * + * Copies u-boot commandline arguments and store them in the proper linux + * variables. + * + * Assumes: + * _init_sp global contains the address in the stack pointer when the + * kernel starts (see head.S::_start) + * + * U-Boot calling convention: + * (*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end); + * + * _init_sp can be parsed as such + * + * _init_sp+00 = u-boot cmd after jsr into kernel (skip) + * _init_sp+04 = &kernel board_info (residual data) + * _init_sp+08 = &initrd_start + * _init_sp+12 = &initrd_end + * _init_sp+16 = &cmd_start + * _init_sp+20 = &cmd_end + * + * This also assumes that the memory locations pointed to are still + * unmodified. U-boot places them near the end of external SDRAM. + * + * Argument(s): + * commandp = the linux commandline arg container to fill. + * size = the sizeof commandp. + * + * Returns: + */ +static void __init parse_uboot_commandline(char *commandp, int size) +{ + extern unsigned long _init_sp; + unsigned long *sp; + unsigned long uboot_kbd; + unsigned long uboot_initrd_start, uboot_initrd_end; + unsigned long uboot_cmd_start, uboot_cmd_end; + + sp = (unsigned long *)_init_sp; + uboot_kbd = sp[1]; + uboot_initrd_start = sp[2]; + uboot_initrd_end = sp[3]; + uboot_cmd_start = sp[4]; + uboot_cmd_end = sp[5]; + + if (uboot_cmd_start && uboot_cmd_end) + strncpy(commandp, (const char *)uboot_cmd_start, size); +#if defined(CONFIG_BLK_DEV_INITRD) + if (uboot_initrd_start && uboot_initrd_end && + (uboot_initrd_end > uboot_initrd_start)) { + initrd_start = uboot_initrd_start; + initrd_end = uboot_initrd_end; + ROOT_DEV = Root_RAM0; + printk(KERN_INFO "initrd at 0x%lx:0x%lx\n", + initrd_start, initrd_end); + } +#endif /* if defined(CONFIG_BLK_DEV_INITRD) */ +} + +__init void process_uboot_commandline(char *commandp, int size) +{ + int len, n; + + n = strnlen(commandp, size); + commandp += n; + len = size - n; + if (len) { + /* Add the whitespace separator */ + *commandp++ = ' '; + len--; + } + + parse_uboot_commandline(commandp, len); + commandp[size - 1] = 0; +} -- cgit v1.2.3-55-g7522 From 150cefbbee2996d9c9c8557d137cef5d974f009f Mon Sep 17 00:00:00 2001 From: Greg Ungerer Date: Mon, 5 Sep 2016 15:33:50 +1000 Subject: m68knommu: clean up uClinux boot log output During the arch setup phase of kernel boot we print out in the boot banner that we are uClinux configured. The printk currently contains a bunch of useless newlines and carriage returns - producing wastefull empty lines. Remove these. Signed-off-by: Greg Ungerer --- arch/m68k/kernel/setup_no.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/m68k/kernel') diff --git a/arch/m68k/kernel/setup_no.c b/arch/m68k/kernel/setup_no.c index 4bde2c1c8289..0329e7dc7d8a 100644 --- a/arch/m68k/kernel/setup_no.c +++ b/arch/m68k/kernel/setup_no.c @@ -104,7 +104,7 @@ void __init setup_arch(char **cmdline_p) process_uboot_commandline(&command_line[0], sizeof(command_line)); - printk(KERN_INFO "\x0F\r\n\nuClinux/" CPU_NAME "\n"); + printk(KERN_INFO "uClinux with CPU " CPU_NAME "\n"); #ifdef CONFIG_UCDIMM printk(KERN_INFO "uCdimm by Lineo, Inc. \n"); -- cgit v1.2.3-55-g7522 From 3ec53d6fceedbe0a5af0bb7dcb42e82dabd795d3 Mon Sep 17 00:00:00 2001 From: Greg Ungerer Date: Fri, 9 Sep 2016 17:01:06 +1000 Subject: m68knommu: convert printk(KERN_INFO) to pr_info() The old style use of printk(KERN_INFO) is depracated. Convert use of it in setup_no.c to the modern pr_info(). Signed-off-by: Greg Ungerer --- arch/m68k/kernel/setup_no.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'arch/m68k/kernel') diff --git a/arch/m68k/kernel/setup_no.c b/arch/m68k/kernel/setup_no.c index 0329e7dc7d8a..8afe6f651c1c 100644 --- a/arch/m68k/kernel/setup_no.c +++ b/arch/m68k/kernel/setup_no.c @@ -104,36 +104,36 @@ void __init setup_arch(char **cmdline_p) process_uboot_commandline(&command_line[0], sizeof(command_line)); - printk(KERN_INFO "uClinux with CPU " CPU_NAME "\n"); + pr_info("uClinux with CPU " CPU_NAME "\n"); #ifdef CONFIG_UCDIMM - printk(KERN_INFO "uCdimm by Lineo, Inc. \n"); + pr_info("uCdimm by Lineo, Inc. \n"); #endif #ifdef CONFIG_M68VZ328 - printk(KERN_INFO "M68VZ328 support by Evan Stawnyczy \n"); + pr_info("M68VZ328 support by Evan Stawnyczy \n"); #endif #ifdef CONFIG_COLDFIRE - printk(KERN_INFO "COLDFIRE port done by Greg Ungerer, gerg@snapgear.com\n"); + pr_info("COLDFIRE port done by Greg Ungerer, gerg@snapgear.com\n"); #ifdef CONFIG_M5307 - printk(KERN_INFO "Modified for M5307 by Dave Miller, dmiller@intellistor.com\n"); + pr_info("Modified for M5307 by Dave Miller, dmiller@intellistor.com\n"); #endif #ifdef CONFIG_ELITE - printk(KERN_INFO "Modified for M5206eLITE by Rob Scott, rscott@mtrob.fdns.net\n"); + pr_info("Modified for M5206eLITE by Rob Scott, rscott@mtrob.fdns.net\n"); #endif #endif - printk(KERN_INFO "Flat model support (C) 1998,1999 Kenneth Albanowski, D. Jeff Dionne\n"); + pr_info("Flat model support (C) 1998,1999 Kenneth Albanowski, D. Jeff Dionne\n"); #if defined( CONFIG_PILOT ) && defined( CONFIG_M68328 ) - printk(KERN_INFO "TRG SuperPilot FLASH card support \n"); + pr_info("TRG SuperPilot FLASH card support \n"); #endif #if defined( CONFIG_PILOT ) && defined( CONFIG_M68EZ328 ) - printk(KERN_INFO "PalmV support by Lineo Inc. \n"); + pr_info("PalmV support by Lineo Inc. \n"); #endif #ifdef CONFIG_DRAGEN2 - printk(KERN_INFO "DragonEngine II board support by Georges Menie\n"); + pr_info("DragonEngine II board support by Georges Menie\n"); #endif #ifdef CONFIG_M5235EVB - printk(KERN_INFO "Motorola M5235EVB support (C)2005 Syn-tech Systems, Inc. (Jate Sujjavanich)\n"); + pr_info("Motorola M5235EVB support (C)2005 Syn-tech Systems, Inc. (Jate Sujjavanich)\n"); #endif pr_debug("KERNEL -> TEXT=0x%p-0x%p DATA=0x%p-0x%p BSS=0x%p-0x%p\n", -- cgit v1.2.3-55-g7522