Skip to contentSkip to conversation

sandbox: Switch over to generic board

PATCH New Simon Glass 2 participants 2 messages Apr 26, 2013 – Apr 30, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v4 3/15 sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

---
Changes in v4:
- Squash three generic board commits into one

Changes in v3: None
Changes in v2: None

 arch/sandbox/config.mk            |   5 +-
 arch/sandbox/include/asm/io.h     |   5 +
 arch/sandbox/include/asm/u-boot.h |  22 +--
 arch/sandbox/lib/Makefile         |   1 -
 arch/sandbox/lib/board.c          | 285 --------------------------------------
 board/sandbox/sandbox/sandbox.c   |   2 +-
 common/board_f.c                  |  51 +++++--
 common/board_r.c                  |   8 +-
 include/asm-generic/sections.h    |   2 +-
 include/configs/sandbox.h         |   7 +-
 lib/fdtdec.c                      |   2 +-
 11 files changed, 66 insertions(+), 324 deletions(-)
 delete mode 100644 arch/sandbox/lib/board.c
arch/sandbox/config.mk +4 -1
index 4fd0d4e..988b52c 100644
@@ -18,5 +18,8 @@
 # MA 02111-1307 USA
 
 PLATFORM_CPPFLAGS += -DCONFIG_SANDBOX -D__SANDBOX__ -U_FORTIFY_SOURCE
-PLATFORM_CPPFLAGS += -DCONFIG_ARCH_MAP_SYSMEM
+PLATFORM_CPPFLAGS += -DCONFIG_ARCH_MAP_SYSMEM -DCONFIG_SYS_GENERIC_BOARD
 PLATFORM_LIBS += -lrt
+
+# Support generic board on sandbox
+__HAVE_ARCH_GENERIC_BOARD := y
arch/sandbox/include/asm/io.h +5 -0
index 54051a3..0c022f1 100644
@@ -20,6 +20,9 @@
  * MA 02111-1307 USA
  */
 
+#ifndef __SANDBOX_ASM_IO_H
+#define __SANDBOX_ASM_IO_H
+
 /*
  * Given a physical address and a length, return a virtual address
  * that can be used to access the memory range with the caching
@@ -52,3 +55,5 @@ static inline void unmap_sysmem(const void *vaddr)
 
 /* Map from a pointer to our RAM buffer */
 phys_addr_t map_to_sysmem(void *ptr);
+
+#endif
arch/sandbox/include/asm/u-boot.h +2 -20
index de8120a..5bea1f2 100644
@@ -36,26 +36,8 @@
 #ifndef _U_BOOT_H_
 #define _U_BOOT_H_	1
 
-typedef struct bd_info {
-	unsigned long	bi_memstart;	/* start of DRAM memory */
-	phys_size_t	bi_memsize;	/* size	 of DRAM memory in bytes */
-	unsigned long	bi_flashstart;	/* start of FLASH memory */
-	unsigned long	bi_flashsize;	/* size	 of FLASH memory */
-	unsigned long	bi_flashoffset; /* reserved area for startup monitor */
-	unsigned long	bi_sramstart;	/* start of SRAM memory */
-	unsigned long	bi_sramsize;	/* size	 of SRAM memory */
-	unsigned long	bi_bootflags;	/* boot / reboot flag (for LynxOS) */
-	unsigned short	bi_ethspeed;	/* Ethernet speed in Mbps */
-	unsigned long	bi_intfreq;	/* Internal Freq, in MHz */
-	unsigned long	bi_busfreq;	/* Bus Freq, in MHz */
-	unsigned int	bi_baudrate;	/* Console Baudrate */
-	unsigned long   bi_boot_params;	/* where this board expects params */
-	struct				/* RAM configuration */
-	{
-		ulong start;
-		ulong size;
-	} bi_dram[CONFIG_NR_DRAM_BANKS];
-} bd_t;
+/* Use the generic board which requires a unified bd_info */
+#include <asm-generic/u-boot.h>
 
 /* For image.h:image_check_target_arch() */
 #define IH_ARCH_DEFAULT IH_ARCH_SANDBOX
arch/sandbox/lib/Makefile +0 -1
index fbe579b..3aad574 100644
@@ -27,7 +27,6 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(ARCH).o
 
-COBJS-y	+= board.o
 COBJS-y	+= interrupts.o
 
 SRCS	:= $(COBJS-y:.o=.c)
arch/sandbox/lib/board.c deleted +0 -285

285 lines not on this page · raw message

board/sandbox/sandbox/sandbox.c +1 -1
index 9883013..8bdba92 100644
@@ -56,6 +56,6 @@ int timer_init(void)
 
 int dram_init(void)
 {
-	gd->ram_size = CONFIG_DRAM_SIZE;
+	gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
 	return 0;
 }
common/board_f.c +42 -9

137 lines not on this page · raw message

common/board_r.c +6 -2
index 2b17fa6..f801e41 100644
@@ -136,7 +136,7 @@ static int initr_reloc_global_data(void)
 {
 #ifdef CONFIG_SYS_SYM_OFFSETS
 	monitor_flash_len = _end_ofs;
-#else
+#elif !defined(CONFIG_SANDBOX)
 	monitor_flash_len = (ulong)&__init_end - gd->dest_addr;
 #endif
 #if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
@@ -264,7 +264,8 @@ static int initr_malloc(void)
 
 	/* The malloc area is immediately below the monitor copy in DRAM */
 	malloc_start = gd->dest_addr - TOTAL_MALLOC_LEN;
-	mem_malloc_init(malloc_start, TOTAL_MALLOC_LEN);
+	mem_malloc_init((ulong)map_sysmem(malloc_start, TOTAL_MALLOC_LEN),
+			TOTAL_MALLOC_LEN);
 	return 0;
 }
 
@@ -691,6 +692,9 @@ static int initr_modem(void)
 
 static int run_main_loop(void)
 {
+#ifdef CONFIG_SANDBOX
+	sandbox_main_loop_init();
+#endif
 	/* main_loop() can return to retry autoboot, if so just run it again */
 	for (;;)
 		main_loop();
include/asm-generic/sections.h +1 -1
index cca1edb..4b39844 100644
@@ -29,7 +29,7 @@ extern char _data[], _sdata[], _edata[];
 extern char __bss_start[], __bss_stop[];
 extern char __init_begin[], __init_end[];
 extern char _sinittext[], _einittext[];
-extern char _end[];
+extern char _end[], _init[];
 extern char __per_cpu_load[], __per_cpu_start[], __per_cpu_end[];
 extern char __kprobes_text_start[], __kprobes_text_end[];
 extern char __entry_text_start[], __entry_text_end[];
include/configs/sandbox.h +4 -3
index 406da43..da7cc9a 100644
@@ -22,9 +22,6 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
-#define CONFIG_NR_DRAM_BANKS	1
-#define CONFIG_DRAM_SIZE	(128 << 20)
-
 /* Number of bits in a C 'long' on this architecture */
 #define CONFIG_SANDBOX_BITS_PER_LONG	64
 
@@ -76,7 +73,11 @@
 #define CONFIG_PHYS_64BIT
 
 /* Size of our emulated memory */
+#define CONFIG_SYS_SDRAM_BASE		0
 #define CONFIG_SYS_SDRAM_SIZE		(128 << 20)
+#define CONFIG_SYS_TEXT_BASE		0
+#define CONFIG_SYS_MONITOR_BASE	0
+#define CONFIG_NR_DRAM_BANKS		1
 
 #define CONFIG_BAUDRATE			115200
 #define CONFIG_SYS_BAUDRATE_TABLE	{4800, 9600, 19200, 38400, 57600,\
lib/fdtdec.c +1 -1
index 92fbefe..60369fb 100644
@@ -357,7 +357,7 @@ int fdtdec_prepare_fdt(void)
 	if (((uintptr_t)gd->fdt_blob & 3) || fdt_check_header(gd->fdt_blob)) {
 		printf("No valid FDT found - please append one to U-Boot "
 			"binary, use u-boot-dtb.bin or define "
-			"CONFIG_OF_EMBED\n");
+			"CONFIG_OF_EMBED. For sandbox, use -d <file.dtb>\n");
 		return -1;
 	}
 	return 0;
Signature · 1 line
1.8.2.1
#1 lore raw

PATCH v4 3/15 sandbox: Switch over to generic board

Quoted 5 lines · Simon Glass

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130430/323b68f7/attachment.pgp>