Skip to contentSkip to conversation

MIPS: Malta generic board conversion

PATCH New Paul Burton 3 participants 10 messages Apr 7, 2014 – May 19, 2014 MIPS

lore
Share & tools
lore
#0 lore raw

v2 cover 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
Signature · 1 line
1.8.5.3
#1 lore raw

PATCH v2 1/7 MIPS: stub interrupt_init function

interrupt_init is called unconditionally by the generic board code. Define a stub for it on MIPS like the enable & disable functions.

---
Changes since v1:
- None

---
 arch/mips/cpu/mips32/interrupts.c | 5 +++++
 arch/mips/cpu/mips64/interrupts.c | 5 +++++
 2 files changed, 10 insertions(+)
arch/mips/cpu/mips32/interrupts.c +5 -0
index a7e2ed0..275fcf5 100644
@@ -7,6 +7,11 @@
 
 #include <common.h>
 
+int interrupt_init(void)
+{
+	return 0;
+}
+
 void enable_interrupts(void)
 {
 }
arch/mips/cpu/mips64/interrupts.c +5 -0
index a7e2ed0..275fcf5 100644
@@ -7,6 +7,11 @@
 
 #include <common.h>
 
+int interrupt_init(void)
+{
+	return 0;
+}
+
 void enable_interrupts(void)
 {
 }
Signature · 1 line
1.8.5.3
#2 lore raw

PATCH v2 2/7 MIPS: move mips_io_port_base out of board.c

In reply to Paul Burton

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.

---
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
arch/mips/lib/Makefile +2 -0
index fabeb83..88ef1c5 100644
@@ -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
arch/mips/lib/board.c +0 -6
index 9e6ba15..317c825 100644
@@ -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)
 {
 	/*
arch/mips/lib/io.c new file +12 -0
new file mode 100644
index 0000000..b2d4a09
@@ -0,0 +1,12 @@
+/*
+ * (C) Copyright 2003
+ * Wolfgang Denk, DENX Software Engineering, wd at 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;
Signature · 1 line
1.8.5.3
#3 lore raw

PATCH v2 3/7 MIPS: define __init_end in u-boot.lds

In reply to Paul Burton

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.

---
Changes since v1:
- None

---
 arch/mips/cpu/u-boot.lds | 1 +
 1 file changed, 1 insertion(+)
arch/mips/cpu/u-boot.lds +1 -0
index 16a9d6a..488ef76 100644
@@ -53,6 +53,7 @@ SECTIONS
 
 	. = ALIGN(4);
 	__image_copy_end = .;
+	__init_end = .;
 
 	.rel.dyn : {
 		__rel_dyn_start = .;
Signature · 1 line
1.8.5.3
#4 lore raw

PATCH v2 4/7 board_f: call init_func_ram on MIPS

In reply to Paul Burton

Assigning gd->ram_size the return value of initdram matches the existing MIPS board behaviour.

---
Changes since v1:
- New patch

---
 common/board_f.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/board_f.c +2 -2
index f285bad..2ece9e2 100644
@@ -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
Signature · 1 line
1.8.5.3
#5 lore raw

PATCH v2 5/7 board_f: call timer_init on MIPS

In reply to Paul Burton

MIPS needs a call to timer_init to preserve its current behaviour ensuring that the cop0 compare register is initialised appropriately.

---
Changes since v1:
- New patch

---
 common/board_f.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/board_f.c +1 -1
index 2ece9e2..cbdf06f 100644
@@ -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
Signature · 1 line
1.8.5.3
#6 lore raw

PATCH v2 6/7 MIPS: allow use of generic board

In reply to Paul Burton

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.

---
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(+)
arch/mips/config.mk +2 -0
index 1899f51..ac95a63 100644
@@ -27,6 +27,8 @@ ENDIANNESS ?= -EB
 
 PLATFORM_CPPFLAGS += -DCONFIG_MIPS -D__MIPS__
 
+__HAVE_ARCH_GENERIC_BOARD := y
+
 #
 # From Linux arch/mips/Makefile
 #
arch/mips/include/asm/u-boot.h +9 -0
index 985d7d8..0eb170d 100644
@@ -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
 
arch/mips/lib/Makefile +2 -0
index 88ef1c5..e483e86 100644
@@ -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
doc/README.generic-board +1 -0
index 50d3a26..fdec30e 100644
@@ -44,6 +44,7 @@ The following architectures are supported at the time of writing:
 
    arc
    arm
+   mips
    powerpc
    sandbox
    x86
Signature · 1 line
1.8.5.3
#7 lore raw

PATCH v2 7/7 MIPS: Malta: convert to generic board

In reply to Paul Burton

This patch converts the MIPS Malta development board to make use of the generic board code now that it is supported on MIPS.

---
Changes since v1:
- Drop the now unnecessary initdram/ram_size changes.

---
 include/configs/malta.h | 3 +++
 1 file changed, 3 insertions(+)
include/configs/malta.h +3 -0
index cc574ed..a29b86b 100644
@@ -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
 
Signature · 1 line
1.8.5.3
#9 lore raw

v2 cover MIPS: Malta generic board conversion

In reply to Paul Burton

2014-04-07 11:11 GMT+02:00 Paul Burton <[email protected]>:

Quoted 12 lines

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

Signature · 1 line
- Daniel