From 0100f67c46c04628ff4ce81d1f2f04924b83b14e Mon Sep 17 00:00:00 2001 From: Greg Ungerer Date: Wed, 13 Sep 2023 21:58:22 +1000 Subject: m68knommu: improve config ROM setting defaults The ROM region configuration settings used on some nommu m68k systems (historically mostly 68328 (Dragonball) CPUs) default to an address of 0. That can easily clash with default RAM address settings which also default to 0. Of course that is invalid and those ranges overlap, but if you make no value selection that is what you end up with. Those default values produce a valid configuration but will fail compilation like this: m68k-linux-ld: section .rodata VMA [0000000000001000,0000000000262227] overlaps section .text VMA [0000000000000400,0000000000455e7f] Looking at the platforms that use the ROM region configuration settings it is clear that we can choose much better defaults than 0. By far the most common ROM region settings are these: CONFIG_ROMVEC=0x10c10000 CONFIG_ROMSTART=0x10c10400 So lets make these the default values. It is still possible to configure overlapping ROM and RAM regions, but at least the default selections are now valid. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202305301407.z33zOjcG-lkp@intel.com/ Signed-off-by: Greg Ungerer --- arch/m68k/Kconfig.machine | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'arch/m68k') diff --git a/arch/m68k/Kconfig.machine b/arch/m68k/Kconfig.machine index 1f3574aef638..d06b1c5d9b0c 100644 --- a/arch/m68k/Kconfig.machine +++ b/arch/m68k/Kconfig.machine @@ -441,7 +441,7 @@ config ROM config ROMVEC hex "Address of the base of the ROM vectors" - default "0" + default "0x10c10000" depends on ROM help This is almost always the same as the base of the ROM. Since on all @@ -450,7 +450,7 @@ config ROMVEC config ROMSTART hex "Address of the base of system image in ROM" - default "0x400" + default "0x10c10400" depends on ROM help Define the start address of the system image in ROM. Commonly this -- cgit v1.2.3 From 7bc3db03e3dd344c3dc93c1dfe684d53d2a5ffbf Mon Sep 17 00:00:00 2001 From: Greg Ungerer Date: Wed, 13 Sep 2023 22:41:51 +1000 Subject: m68knommu: fix compilation for ColdFire/Cleopatra boards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ColdFire based Cleopatra family of boards use mostly the same external pin arrangements as the NETtel board family. The build uses the NETtel specific code as needed, but not all the conditional defines allow for this. If you have the CONFIG_NETtel config option set everything compiles as expected, but if you only select the CONFIG_CLEOPATRA board type then you will get compile failures: arch/m68k/coldfire/nettel.c: In function ‘nettel_smc91x_init’: arch/m68k/coldfire/nettel.c:126:2: error: implicit declaration of function ‘mcf_setppdata’; did you mean ‘xas_set_update’? [-Werror=implicit-function-declaration] mcf_setppdata(0, 0x0080); ^~~~~~~~~~~~~ xas_set_update Fix the nettel.h include conditional checks to cover all board types. This also means some code paths need to check for the 5407 SoC - since one of the Cleopatra board types is based on that. It is very similar to the 5307 specific code, and it can use that "as-is". Signed-off-by: Greg Ungerer --- arch/m68k/include/asm/nettel.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'arch/m68k') diff --git a/arch/m68k/include/asm/nettel.h b/arch/m68k/include/asm/nettel.h index 45716ead7b9d..3bd4b7a4613f 100644 --- a/arch/m68k/include/asm/nettel.h +++ b/arch/m68k/include/asm/nettel.h @@ -14,9 +14,8 @@ #define nettel_h /****************************************************************************/ - /****************************************************************************/ -#ifdef CONFIG_NETtel +#if defined(CONFIG_NETtel) || defined(CONFIG_CLEOPATRA) /****************************************************************************/ #ifdef CONFIG_COLDFIRE @@ -26,7 +25,7 @@ #endif /*---------------------------------------------------------------------------*/ -#if defined(CONFIG_M5307) +#if defined(CONFIG_M5307) || defined(CONFIG_M5407) /* * NETtel/5307 based hardware first. DTR/DCD lines are wired to * GPIO lines. Most of the LED's are driver through a latch -- cgit v1.2.3 From b6880019ff3ed72b0813b6bcb5c23afdf8b8e75c Mon Sep 17 00:00:00 2001 From: Greg Ungerer Date: Tue, 12 Sep 2023 00:05:04 +1000 Subject: m68k: coldfire: add and use "vectors.h" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When building with W=1: arch/m68k/coldfire/vectors.c:43:13: warning: no previous prototype for ‘trap_init’ [-Wmissing-prototypes] void __init trap_init(void) ^~~~~~~~~ Fix this by introducing a new header file "vectors.h" for holding the prototypes of functions implemented in arch/m68k/coldfire/vectors.c. Signed-off-by: Greg Ungerer --- arch/m68k/coldfire/vectors.c | 2 ++ arch/m68k/coldfire/vectors.h | 3 +++ 2 files changed, 5 insertions(+) create mode 100644 arch/m68k/coldfire/vectors.h (limited to 'arch/m68k') diff --git a/arch/m68k/coldfire/vectors.c b/arch/m68k/coldfire/vectors.c index 3bf0d69eec9e..c26c255b530d 100644 --- a/arch/m68k/coldfire/vectors.c +++ b/arch/m68k/coldfire/vectors.c @@ -18,6 +18,8 @@ #include #include +#include "vectors.h" + /***************************************************************************/ #ifdef TRAP_DBG_INTERRUPT diff --git a/arch/m68k/coldfire/vectors.h b/arch/m68k/coldfire/vectors.h new file mode 100644 index 000000000000..0b01450a4353 --- /dev/null +++ b/arch/m68k/coldfire/vectors.h @@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +void trap_init(void); -- cgit v1.2.3 From 863dafa74eceaa7dc45c781566efc5395085f178 Mon Sep 17 00:00:00 2001 From: Greg Ungerer Date: Tue, 12 Sep 2023 12:07:42 +1000 Subject: m68k: coldfire: ensure gpio prototypes visible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When building with W=1: CC arch/m68k/coldfire/gpio.o arch/m68k/coldfire/gpio.c:19:5: warning: no previous prototype for ‘__mcfgpio_get_value’ [-Wmissing-prototypes] int __mcfgpio_get_value(unsigned gpio) ^~~~~~~~~~~~~~~~~~~ arch/m68k/coldfire/gpio.c:25:6: warning: no previous prototype for ‘__mcfgpio_set_value’ [-Wmissing-prototypes] void __mcfgpio_set_value(unsigned gpio, int value) ^~~~~~~~~~~~~~~~~~~ arch/m68k/coldfire/gpio.c:50:5: warning: no previous prototype for ‘__mcfgpio_direction_input’ [-Wmissing-prototypes] int __mcfgpio_direction_input(unsigned gpio) ^~~~~~~~~~~~~~~~~~~~~~~~~ arch/m68k/coldfire/gpio.c:65:5: warning: no previous prototype for ‘__mcfgpio_direction_output’ [-Wmissing-prototypes] int __mcfgpio_direction_output(unsigned gpio, int value) ^~~~~~~~~~~~~~~~~~~~~~~~~~ arch/m68k/coldfire/gpio.c:96:5: warning: no previous prototype for ‘__mcfgpio_request’ [-Wmissing-prototypes] int __mcfgpio_request(unsigned gpio) ^~~~~~~~~~~~~~~~~ arch/m68k/coldfire/gpio.c:102:6: warning: no previous prototype for ‘__mcfgpio_free’ [-Wmissing-prototypes] void __mcfgpio_free(unsigned gpio) ^~~~~~~~~~~~~~ The local m68k asm version of gpio.h has prototypes for all of these, but they are not always visible depending on the config options enabled. Move the prototypes so they are always visible. Signed-off-by: Greg Ungerer --- arch/m68k/include/asm/mcfgpio.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'arch/m68k') diff --git a/arch/m68k/include/asm/mcfgpio.h b/arch/m68k/include/asm/mcfgpio.h index 7abd322c019f..019f24439546 100644 --- a/arch/m68k/include/asm/mcfgpio.h +++ b/arch/m68k/include/asm/mcfgpio.h @@ -8,10 +8,6 @@ #ifndef mcfgpio_h #define mcfgpio_h -#ifdef CONFIG_GPIOLIB -#include -#else - int __mcfgpio_get_value(unsigned gpio); void __mcfgpio_set_value(unsigned gpio, int value); int __mcfgpio_direction_input(unsigned gpio); @@ -19,6 +15,10 @@ int __mcfgpio_direction_output(unsigned gpio, int value); int __mcfgpio_request(unsigned gpio); void __mcfgpio_free(unsigned gpio); +#ifdef CONFIG_GPIOLIB +#include +#else + /* our alternate 'gpiolib' functions */ static inline int __gpio_get_value(unsigned gpio) { -- cgit v1.2.3 From 7c2aa8d195cd34ec47ac26994adac43bfd5037b8 Mon Sep 17 00:00:00 2001 From: Greg Ungerer Date: Tue, 12 Sep 2023 13:58:06 +1000 Subject: m68k: coldfire: make mcf_maskimr() static MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When building with W=1: CC arch/m68k/coldfire/intc.o arch/m68k/coldfire/intc.c:83:6: warning: no previous prototype for ‘mcf_maskimr’ [-Wmissing-prototypes] void mcf_maskimr(unsigned int mask) ^~~~~~~~~~~ The mcf_maskimr() function is only used within this file, make it static to reduce name space pollution and fix warning. Signed-off-by: Greg Ungerer --- arch/m68k/coldfire/intc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'arch/m68k') diff --git a/arch/m68k/coldfire/intc.c b/arch/m68k/coldfire/intc.c index 20c084e932c8..b434371e2b99 100644 --- a/arch/m68k/coldfire/intc.c +++ b/arch/m68k/coldfire/intc.c @@ -56,7 +56,7 @@ void mcf_clrimr(int index) __raw_writew(imr & ~(0x1 << index), MCFSIM_IMR); } -void mcf_maskimr(unsigned int mask) +static void mcf_maskimr(unsigned int mask) { u16 imr; imr = __raw_readw(MCFSIM_IMR); @@ -80,7 +80,7 @@ void mcf_clrimr(int index) __raw_writel(imr & ~(0x1 << index), MCFSIM_IMR); } -void mcf_maskimr(unsigned int mask) +static void mcf_maskimr(unsigned int mask) { u32 imr; imr = __raw_readl(MCFSIM_IMR); -- cgit v1.2.3 From 3b4497668f721513eb7287f6bb0c4d651759c7c4 Mon Sep 17 00:00:00 2001 From: Greg Ungerer Date: Tue, 12 Sep 2023 22:29:23 +1000 Subject: m68k: coldfire: fix warnings in uboot argument processing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When building with W=1: CC arch/m68k/kernel/uboot.o arch/m68k/kernel/uboot.c: In function ‘parse_uboot_commandline’: arch/m68k/kernel/uboot.c:68:36: warning: variable ‘uboot_initrd_end’ set but not used [-Wunused-but-set-variable] unsigned long uboot_initrd_start, uboot_initrd_end; ^~~~~~~~~~~~~~~~ arch/m68k/kernel/uboot.c:68:16: warning: variable ‘uboot_initrd_start’ set but not used [-Wunused-but-set-variable] unsigned long uboot_initrd_start, uboot_initrd_end; ^~~~~~~~~~~~~~~~~~ arch/m68k/kernel/uboot.c:66:16: warning: variable ‘uboot_kbd’ set but not used [-Wunused-but-set-variable] unsigned long uboot_kbd; ^~~~~~~~~ arch/m68k/kernel/uboot.c: At top level: arch/m68k/kernel/uboot.c:90:13: warning: no previous prototype for ‘process_uboot_commandline’ [-Wmissing-prototypes] __init void process_uboot_commandline(char *commandp, int size) ^~~~~~~~~~~~~~~~~~~~~~~~~ A couple of issues here. Firstly we already have a bootinfo.h that has a prototype for process_uboot_commandline(), we should include that. Secondly uboot_kbd is not used at all and can be removed. Thirdly the conditional code based on CONFIG_BLK_DEV_INITRD means that sometimes uboot_initrd_start and uboot_initrd_end are not needed. Make their declaration and asignment conditional on CONFIG_BLK_DEV_INITRD same as the code that uses them. Signed-off-by: Greg Ungerer --- arch/m68k/kernel/uboot.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'arch/m68k') diff --git a/arch/m68k/kernel/uboot.c b/arch/m68k/kernel/uboot.c index 928dbd33fc4a..8bb1cb3a7490 100644 --- a/arch/m68k/kernel/uboot.c +++ b/arch/m68k/kernel/uboot.c @@ -27,6 +27,7 @@ #include #include #include +#include /* * parse_uboot_commandline @@ -63,20 +64,22 @@ 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; +#if defined(CONFIG_BLK_DEV_INITRD) + unsigned long uboot_initrd_start, uboot_initrd_end; +#endif /* if defined(CONFIG_BLK_DEV_INITRD) */ 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) + uboot_initrd_start = sp[2]; + uboot_initrd_end = sp[3]; + if (uboot_initrd_start && uboot_initrd_end && (uboot_initrd_end > uboot_initrd_start)) { initrd_start = uboot_initrd_start; -- cgit v1.2.3 From 0a49a430e6dee8aa036df81898d17ce8abc397fa Mon Sep 17 00:00:00 2001 From: Greg Ungerer Date: Tue, 12 Sep 2023 23:31:39 +1000 Subject: m68k: coldfire: remove unused variable in MMU code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When building with W=1: CC arch/m68k/mm/mcfmmu.o arch/m68k/mm/mcfmmu.c: In function ‘paging_init’: arch/m68k/mm/mcfmmu.c:41:30: warning: variable ‘bootmem_end’ set but not used [-Wunused-but-set-variable] unsigned long next_pgtable, bootmem_end; ^~~~~~~~~~~ Remove variable bootmem_end and its unused setting. Signed-off-by: Greg Ungerer --- arch/m68k/mm/mcfmmu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'arch/m68k') diff --git a/arch/m68k/mm/mcfmmu.c b/arch/m68k/mm/mcfmmu.c index a6efaa7cacde..9a6fa342e872 100644 --- a/arch/m68k/mm/mcfmmu.c +++ b/arch/m68k/mm/mcfmmu.c @@ -38,7 +38,7 @@ void __init paging_init(void) pgd_t *pg_dir; pte_t *pg_table; unsigned long address, size; - unsigned long next_pgtable, bootmem_end; + unsigned long next_pgtable; unsigned long max_zone_pfn[MAX_NR_ZONES] = { 0 }; int i; @@ -57,7 +57,6 @@ void __init paging_init(void) panic("%s: Failed to allocate %lu bytes align=0x%lx\n", __func__, size, PAGE_SIZE); - bootmem_end = (next_pgtable + size + PAGE_SIZE) & PAGE_MASK; pg_dir += PAGE_OFFSET >> PGDIR_SHIFT; address = PAGE_OFFSET; -- cgit v1.2.3 From 19f144f43f4cf5d56409a8908125405e5cf6c3e0 Mon Sep 17 00:00:00 2001 From: Greg Ungerer Date: Wed, 13 Sep 2023 00:02:53 +1000 Subject: m68k: 68000: fix warnings in 68000 interrupt handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When building with W=1: CC arch/m68k/68000/ints.o arch/m68k/68000/ints.c:77:6: warning: no previous prototype for ‘process_int’ [-Wmissing-prototypes] void process_int(int vec, struct pt_regs *fp) ^~~~~~~~~~~ arch/m68k/68000/ints.c:153:13: warning: no previous prototype for ‘trap_init’ [-Wmissing-prototypes] void __init trap_init(void) ^~~~~~~~~ Include linux/cpu.h to get the prototype for taps_init(). Create a local ints.h for prototype of process_int(). Also mark process_int() as asmlinkage, since it is called from the first level interrupt assembly handler. Signed-off-by: Greg Ungerer --- arch/m68k/68000/ints.c | 5 ++++- arch/m68k/68000/ints.h | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 arch/m68k/68000/ints.h (limited to 'arch/m68k') diff --git a/arch/m68k/68000/ints.c b/arch/m68k/68000/ints.c index f9a5ec781408..2ba9926e91ae 100644 --- a/arch/m68k/68000/ints.c +++ b/arch/m68k/68000/ints.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -26,6 +27,8 @@ #include #endif +#include "ints.h" + /* assembler routines */ asmlinkage void system_call(void); asmlinkage void buserr(void); @@ -74,7 +77,7 @@ asmlinkage irqreturn_t inthandler7(void); * into one vector and look in the blasted mask register... * This code is designed to be fast, almost constant time, not clean! */ -void process_int(int vec, struct pt_regs *fp) +asmlinkage void process_int(int vec, struct pt_regs *fp) { int irq; int mask; diff --git a/arch/m68k/68000/ints.h b/arch/m68k/68000/ints.h new file mode 100644 index 000000000000..d9cfd0eb9ffe --- /dev/null +++ b/arch/m68k/68000/ints.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include + +struct pt_regs; + +asmlinkage void process_int(int vec, struct pt_regs *fp); -- cgit v1.2.3 From 2508b608f4028c6fe0d63698f64a9bfc3eb6b780 Mon Sep 17 00:00:00 2001 From: Greg Ungerer Date: Wed, 13 Sep 2023 00:09:22 +1000 Subject: m68k: 68000: fix warning in timer code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When building with W=1: CC arch/m68k/68000/timers.o arch/m68k/68000/timers.c:120:5: warning: no previous prototype for ‘m68328_hwclk’ [-Wmissing-prototypes] int m68328_hwclk(int set, struct rtc_time *t) ^~~~~~~~~~~~ Include m68328.h to get prototype for m68328_hwclk(). Signed-off-by: Greg Ungerer --- arch/m68k/68000/timers.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'arch/m68k') diff --git a/arch/m68k/68000/timers.c b/arch/m68k/68000/timers.c index 0d0417cebc7f..00fb0dd12faa 100644 --- a/arch/m68k/68000/timers.c +++ b/arch/m68k/68000/timers.c @@ -25,6 +25,8 @@ #include #include +#include "m68328.h" + /***************************************************************************/ #if defined(CONFIG_DRAGEN2) -- cgit v1.2.3