[U-Boot] [PATCH 0/5] 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.
Paul Burton (5): MIPS: stub interrupt_init function MIPS: move mips_io_port_base out of board.c MIPS: define __init_end in u-boot.lds 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 ++++++++++++ board/imgtec/malta/malta.c | 9 ++++----- doc/README.generic-board | 1 + include/configs/malta.h | 3 +++ 11 files changed, 46 insertions(+), 11 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 --- 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 --- 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 --- 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 = .;

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 --- 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 --- board/imgtec/malta/malta.c | 9 ++++----- include/configs/malta.h | 3 +++ 2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/board/imgtec/malta/malta.c b/board/imgtec/malta/malta.c index d363e49..0f16b74 100644 --- a/board/imgtec/malta/malta.c +++ b/board/imgtec/malta/malta.c @@ -19,6 +19,8 @@
#include "superio.h"
+DECLARE_GLOBAL_DATA_PTR; + enum core_card { CORE_UNKNOWN, CORE_LV, @@ -82,11 +84,6 @@ static enum sys_con malta_sys_con(void) } }
-phys_size_t initdram(int board_type) -{ - return CONFIG_SYS_MEM_SIZE; -} - int checkboard(void) { enum core_card core; @@ -129,6 +126,8 @@ int board_early_init_f(void) { void *io_base;
+ gd->ram_size = CONFIG_SYS_MEM_SIZE; + /* choose correct PCI I/O base */ switch (malta_sys_con()) { case SYSCON_GT64120: 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

2014-04-04 13:20 GMT+02:00 Paul Burton paul.burton@imgtec.com:
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
board/imgtec/malta/malta.c | 9 ++++----- include/configs/malta.h | 3 +++ 2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/board/imgtec/malta/malta.c b/board/imgtec/malta/malta.c index d363e49..0f16b74 100644 --- a/board/imgtec/malta/malta.c +++ b/board/imgtec/malta/malta.c @@ -19,6 +19,8 @@
#include "superio.h"
+DECLARE_GLOBAL_DATA_PTR;
enum core_card { CORE_UNKNOWN, CORE_LV, @@ -82,11 +84,6 @@ static enum sys_con malta_sys_con(void) } }
-phys_size_t initdram(int board_type) -{
return CONFIG_SYS_MEM_SIZE;
-}
int checkboard(void) { enum core_card core; @@ -129,6 +126,8 @@ int board_early_init_f(void) { void *io_base;
gd->ram_size = CONFIG_SYS_MEM_SIZE;
/* choose correct PCI I/O base */ switch (malta_sys_con()) { case SYSCON_GT64120:
I would prefer to enable the according init funtions in board_f,c for MIPS, so that all MIPS boards can be converted without changing such code.
--- 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_PPC) || defined(CONFIG_MIPS) 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_PPC) || defined(CONFIG_MIPS) init_func_ram, #endif #ifdef CONFIG_POST
BTW: there are other canditates too, which are implemented in the same way as PowerPC or ARM and which should be also enabled for MIPS, e.g. init_timer

On Sun, Apr 06, 2014 at 08:58:16PM +0200, Daniel Schwierzeck wrote:
2014-04-04 13:20 GMT+02:00 Paul Burton paul.burton@imgtec.com:
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
board/imgtec/malta/malta.c | 9 ++++----- include/configs/malta.h | 3 +++ 2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/board/imgtec/malta/malta.c b/board/imgtec/malta/malta.c index d363e49..0f16b74 100644 --- a/board/imgtec/malta/malta.c +++ b/board/imgtec/malta/malta.c @@ -19,6 +19,8 @@
#include "superio.h"
+DECLARE_GLOBAL_DATA_PTR;
enum core_card { CORE_UNKNOWN, CORE_LV, @@ -82,11 +84,6 @@ static enum sys_con malta_sys_con(void) } }
-phys_size_t initdram(int board_type) -{
return CONFIG_SYS_MEM_SIZE;
-}
int checkboard(void) { enum core_card core; @@ -129,6 +126,8 @@ int board_early_init_f(void) { void *io_base;
gd->ram_size = CONFIG_SYS_MEM_SIZE;
/* choose correct PCI I/O base */ switch (malta_sys_con()) { case SYSCON_GT64120:
I would prefer to enable the according init funtions in board_f,c for MIPS, so that all MIPS boards can be converted without changing such code.
Sure, v2 coming shortly.
--- 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_PPC) || defined(CONFIG_MIPS) 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_PPC) || defined(CONFIG_MIPS) init_func_ram, #endif #ifdef CONFIG_POST
BTW: there are other canditates too, which are implemented in the same way as PowerPC or ARM and which should be also enabled for MIPS, e.g. init_timer
--
- Daniel
Thanks for pointing that out! I can't spot anything besides init_timer, except for the board-specific incapi_set_cpuclk call which I guess will probably just need to be added to common/board_f.c if & when that board is converted.
Paul

2014-04-04 13:19 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.
thanks for doing this. I only have some comments in patch 5/5
participants (2)
-
Daniel Schwierzeck
-
Paul Burton