[U-Boot] [PATCH v2 0/7] MIPS: Malta generic board conversion

This series adds generic board support for the MIPS architecture, and then converts the MIPS Malta development board to use it.
Changes since v1: - Call init_func_ram/initdram to preserve the existing behaviour for boards, as requested by Daniel.
- Call timer_init, which I'd missed as pointed out by Daniel.
Note that I've only submitted the whole series again because patch numbers changed; the content of patches 1-3,6 is unchanged from v1.
Paul Burton (7): MIPS: stub interrupt_init function MIPS: move mips_io_port_base out of board.c MIPS: define __init_end in u-boot.lds board_f: call init_func_ram on MIPS board_f: call timer_init on MIPS MIPS: allow use of generic board MIPS: Malta: convert to generic board
arch/mips/config.mk | 2 ++ arch/mips/cpu/mips32/interrupts.c | 5 +++++ arch/mips/cpu/mips64/interrupts.c | 5 +++++ arch/mips/cpu/u-boot.lds | 1 + arch/mips/include/asm/u-boot.h | 9 +++++++++ arch/mips/lib/Makefile | 4 ++++ arch/mips/lib/board.c | 6 ------ arch/mips/lib/io.c | 12 ++++++++++++ common/board_f.c | 6 +++--- doc/README.generic-board | 1 + include/configs/malta.h | 3 +++ 11 files changed, 45 insertions(+), 9 deletions(-) create mode 100644 arch/mips/lib/io.c

interrupt_init is called unconditionally by the generic board code. Define a stub for it on MIPS like the enable & disable functions.
Signed-off-by: Paul Burton paul.burton@imgtec.com --- Changes since v1: - None --- arch/mips/cpu/mips32/interrupts.c | 5 +++++ arch/mips/cpu/mips64/interrupts.c | 5 +++++ 2 files changed, 10 insertions(+)
diff --git a/arch/mips/cpu/mips32/interrupts.c b/arch/mips/cpu/mips32/interrupts.c index a7e2ed0..275fcf5 100644 --- a/arch/mips/cpu/mips32/interrupts.c +++ b/arch/mips/cpu/mips32/interrupts.c @@ -7,6 +7,11 @@
#include <common.h>
+int interrupt_init(void) +{ + return 0; +} + void enable_interrupts(void) { } diff --git a/arch/mips/cpu/mips64/interrupts.c b/arch/mips/cpu/mips64/interrupts.c index a7e2ed0..275fcf5 100644 --- a/arch/mips/cpu/mips64/interrupts.c +++ b/arch/mips/cpu/mips64/interrupts.c @@ -7,6 +7,11 @@
#include <common.h>
+int interrupt_init(void) +{ + return 0; +} + void enable_interrupts(void) { }

Move the definition of this variable out of arch/mips/lib/board.c in preparation for allowing use of generic board on MIPS, which will lead to this file not being compiled.
Signed-off-by: Paul Burton paul.burton@imgtec.com --- Changes since v1: - None --- arch/mips/lib/Makefile | 2 ++ arch/mips/lib/board.c | 6 ------ arch/mips/lib/io.c | 12 ++++++++++++ 3 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 arch/mips/lib/io.c
diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile index fabeb83..88ef1c5 100644 --- a/arch/mips/lib/Makefile +++ b/arch/mips/lib/Makefile @@ -6,6 +6,8 @@ #
obj-y += board.o +obj-y += io.o + obj-$(CONFIG_CMD_BOOTM) += bootm.o
lib-$(CONFIG_USE_PRIVATE_LIBGCC) += ashldi3.o ashrdi3.o lshrdi3.o diff --git a/arch/mips/lib/board.c b/arch/mips/lib/board.c index 9e6ba15..317c825 100644 --- a/arch/mips/lib/board.c +++ b/arch/mips/lib/board.c @@ -27,12 +27,6 @@ ulong monitor_flash_len;
static char *failed = "*** failed ***\n";
-/* - * mips_io_port_base is the begin of the address space to which x86 style - * I/O ports are mapped. - */ -const unsigned long mips_io_port_base = -1; - int __board_early_init_f(void) { /* diff --git a/arch/mips/lib/io.c b/arch/mips/lib/io.c new file mode 100644 index 0000000..b2d4a09 --- /dev/null +++ b/arch/mips/lib/io.c @@ -0,0 +1,12 @@ +/* + * (C) Copyright 2003 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +/* + * mips_io_port_base is the begin of the address space to which x86 style + * I/O ports are mapped. + */ +const unsigned long mips_io_port_base = -1;

The generic board code uses the __init_end symbol to calculate monitor_flash_len. Define said symbol for MIPS, equivalent to __image_copy_end which is used for the same purpose in arch/mips/lib/board.c.
Signed-off-by: Paul Burton paul.burton@imgtec.com --- Changes since v1: - None --- arch/mips/cpu/u-boot.lds | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/mips/cpu/u-boot.lds b/arch/mips/cpu/u-boot.lds index 16a9d6a..488ef76 100644 --- a/arch/mips/cpu/u-boot.lds +++ b/arch/mips/cpu/u-boot.lds @@ -53,6 +53,7 @@ SECTIONS
. = ALIGN(4); __image_copy_end = .; + __init_end = .;
.rel.dyn : { __rel_dyn_start = .;

Assigning gd->ram_size the return value of initdram matches the existing MIPS board behaviour.
Suggested-by: Daniel Schwierzeck daniel.schwierzeck@gmail.com Signed-off-by: Paul Burton paul.burton@imgtec.com --- Changes since v1: - New patch --- common/board_f.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/common/board_f.c b/common/board_f.c index f285bad..2ece9e2 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -173,7 +173,7 @@ static int announce_dram_init(void) return 0; }
-#ifdef CONFIG_PPC +#if defined(CONFIG_MIPS) || defined(CONFIG_PPC) static int init_func_ram(void) { #ifdef CONFIG_BOARD_TYPES @@ -889,7 +889,7 @@ static init_fnc_t init_sequence_f[] = { #ifdef CONFIG_ARM dram_init, /* configure available RAM banks */ #endif -#ifdef CONFIG_PPC +#if defined(CONFIG_MIPS) || defined(CONFIG_PPC) init_func_ram, #endif #ifdef CONFIG_POST

MIPS needs a call to timer_init to preserve its current behaviour ensuring that the cop0 compare register is initialised appropriately.
Reported-by: Daniel Schwierzeck daniel.schwierzeck@gmail.com Signed-off-by: Paul Burton paul.burton@imgtec.com --- Changes since v1: - New patch --- common/board_f.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/board_f.c b/common/board_f.c index 2ece9e2..cbdf06f 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -819,7 +819,7 @@ static init_fnc_t init_sequence_f[] = { /* TODO: can we rename this to timer_init()? */ init_timebase, #endif -#ifdef CONFIG_ARM +#if defined(CONFIG_ARM) || defined(CONFIG_MIPS) timer_init, /* initialize timer */ #endif #ifdef CONFIG_SYS_ALLOC_DPRAM

This patch allows MIPS boards to make use of generic board, replacing arch/mips/lib/board.c with common/board_{f,r}.c and struct bd_info with the asm-generic version.
Signed-off-by: Paul Burton paul.burton@imgtec.com --- Changes since v1: - None --- arch/mips/config.mk | 2 ++ arch/mips/include/asm/u-boot.h | 9 +++++++++ arch/mips/lib/Makefile | 2 ++ doc/README.generic-board | 1 + 4 files changed, 14 insertions(+)
diff --git a/arch/mips/config.mk b/arch/mips/config.mk index 1899f51..ac95a63 100644 --- a/arch/mips/config.mk +++ b/arch/mips/config.mk @@ -27,6 +27,8 @@ ENDIANNESS ?= -EB
PLATFORM_CPPFLAGS += -DCONFIG_MIPS -D__MIPS__
+__HAVE_ARCH_GENERIC_BOARD := y + # # From Linux arch/mips/Makefile # diff --git a/arch/mips/include/asm/u-boot.h b/arch/mips/include/asm/u-boot.h index 985d7d8..0eb170d 100644 --- a/arch/mips/include/asm/u-boot.h +++ b/arch/mips/include/asm/u-boot.h @@ -15,6 +15,13 @@ #ifndef _U_BOOT_H_ #define _U_BOOT_H_ 1
+#ifdef CONFIG_SYS_GENERIC_BOARD + +/* Use the generic board which requires a unified bd_info */ +#include <asm-generic/u-boot.h> + +#else /* !CONFIG_SYS_GENERIC_BOARD */ + typedef struct bd_info { unsigned int bi_baudrate; /* serial console baudrate */ unsigned long bi_arch_number; /* unique id for this board */ @@ -26,6 +33,8 @@ typedef struct bd_info { unsigned long bi_flashoffset; /* reserved area for startup monitor */ } bd_t;
+#endif /* !CONFIG_SYS_GENERIC_BOARD */ + /* For image.h:image_check_target_arch() */ #define IH_ARCH_DEFAULT IH_ARCH_MIPS
diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile index 88ef1c5..e483e86 100644 --- a/arch/mips/lib/Makefile +++ b/arch/mips/lib/Makefile @@ -5,7 +5,9 @@ # SPDX-License-Identifier: GPL-2.0+ #
+ifndef CONFIG_SYS_GENERIC_BOARD obj-y += board.o +endif obj-y += io.o
obj-$(CONFIG_CMD_BOOTM) += bootm.o diff --git a/doc/README.generic-board b/doc/README.generic-board index 50d3a26..fdec30e 100644 --- a/doc/README.generic-board +++ b/doc/README.generic-board @@ -44,6 +44,7 @@ The following architectures are supported at the time of writing:
arc arm + mips powerpc sandbox x86

This patch converts the MIPS Malta development board to make use of the generic board code now that it is supported on MIPS.
Signed-off-by: Paul Burton paul.burton@imgtec.com --- Changes since v1: - Drop the now unnecessary initdram/ram_size changes. --- include/configs/malta.h | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/include/configs/malta.h b/include/configs/malta.h index cc574ed..a29b86b 100644 --- a/include/configs/malta.h +++ b/include/configs/malta.h @@ -14,6 +14,9 @@ * System configuration */ #define CONFIG_MALTA +#define CONFIG_SYS_GENERIC_BOARD +#define CONFIG_BOARD_EARLY_INIT_F +#define CONFIG_DISPLAY_BOARDINFO
#define CONFIG_MEMSIZE_IN_BYTES

Can you tell me what you did to support the setting of the bi_boot_params for Malta? I can't seem to find that in the generic board support files, nor does it appear to be located in board/imgtec/malta
-- View this message in context: http://u-boot.10912.n7.nabble.com/PATCH-v2-0-7-MIPS-Malta-generic-board-conv... Sent from the U-Boot mailing list archive at Nabble.com.

2014-04-07 11:11 GMT+02:00 Paul Burton paul.burton@imgtec.com:
This series adds generic board support for the MIPS architecture, and then converts the MIPS Malta development board to use it.
Changes since v1:
Call init_func_ram/initdram to preserve the existing behaviour for boards, as requested by Daniel.
Call timer_init, which I'd missed as pointed out by Daniel.
Note that I've only submitted the whole series again because patch numbers changed; the content of patches 1-3,6 is unchanged from v1.
applied to u-boot-mips/next, thanks
participants (3)
-
Daniel Schwierzeck
-
Paul Burton
-
Stephen Scott