Skip to contentSkip to conversation

avr32: add generic board

RFC PATCH New Andreas Bießmann 4 participants 12 messages Jan 19, 2015 – Jan 27, 2015 Generic include/asm header files

lore
Share & tools
lore
#0 lore raw

cover avr32: add generic board

This is the first attempt to add generic board support to avr32 architecture. It has at least one relevant part for other manual reloc architectures.

This series is currently runtime tested on grasshhopper only. I expect some changes regarding LCD support when testing the code on atstk1002. The DMA stuff is not tested yet but I expect no serios things here.
The code is not run through checkpatch nor buildman at the time of writing.

Comments welcome!

Especially for the TLB stuff placed in board_init_r.

Andreas Bie?mann

Andreas Bie?mann (5):
avr32: use dlmalloc for DMA buffers
avr32: rename cpu_init() -> arch_cpu_init()
common/board_r: manual relocation for cmd table
avr32: add generic board support
grasshopper: enable generic board

 arch/avr32/config.mk                 |    3 ++
 arch/avr32/cpu/cpu.c                 |    2 +-
 arch/avr32/cpu/u-boot.lds            |    2 ++
 arch/avr32/include/asm/config.h      |    1 +
 arch/avr32/include/asm/dma-mapping.h |    7 ++++-
 arch/avr32/include/asm/u-boot.h      |    9 ++++++
 arch/avr32/lib/Makefile              |    2 ++
 arch/avr32/lib/board.c               |   53 +---------------------------------
 arch/avr32/lib/interrupts.c          |    5 ++++
 common/board_f.c                     |   13 +++++++--
 common/board_r.c                     |   34 ++++++++++++++++++++--
 include/asm-generic/u-boot.h         |    4 +++
 include/configs/atngw100.h           |    1 -
 include/configs/atngw100mkii.h       |    1 -
 include/configs/atstk1002.h          |    1 -
 include/configs/atstk1006.h          |    1 -
 include/configs/favr-32-ezkit.h      |    1 -
 include/configs/grasshopper.h        |    5 +++-
 include/configs/hammerhead.h         |    1 -
 include/configs/mimc200.h            |    1 -
 20 files changed, 80 insertions(+), 67 deletions(-)
Signature · 1 line
1.7.10.4
#1 lore raw

RFC PATCH 1/5 avr32: use dlmalloc for DMA buffers

---

 arch/avr32/include/asm/dma-mapping.h |    7 ++++-
 arch/avr32/lib/board.c               |   51 ----------------------------------
 include/configs/atngw100.h           |    1 -
 include/configs/atngw100mkii.h       |    1 -
 include/configs/atstk1002.h          |    1 -
 include/configs/atstk1006.h          |    1 -
 include/configs/favr-32-ezkit.h      |    1 -
 include/configs/grasshopper.h        |    1 -
 include/configs/hammerhead.h         |    1 -
 include/configs/mimc200.h            |    1 -
 10 files changed, 6 insertions(+), 60 deletions(-)
arch/avr32/include/asm/dma-mapping.h +6 -1
index dbdd2fe..1cde827 100644
@@ -14,7 +14,12 @@ enum dma_data_direction {
 	DMA_TO_DEVICE		= 1,
 	DMA_FROM_DEVICE		= 2,
 };
-extern void *dma_alloc_coherent(size_t len, unsigned long *handle);
+
+static inline void *dma_alloc_coherent(size_t len, unsigned long *handle)
+{
+	*handle = (unsigned long)memalign(ARCH_DMA_MINALIGN, len);
+	return (void *)*handle;
+}
 
 static inline unsigned long dma_map_single(volatile void *vaddr, size_t len,
 					   enum dma_data_direction dir)
arch/avr32/lib/board.c +0 -51

69 lines not on this page · raw message

include/configs/atngw100.h +0 -1
index 9c81e31..540e86a 100644
@@ -143,7 +143,6 @@
 #define CONFIG_SYS_INIT_SP_ADDR		(CONFIG_SYS_INTRAM_BASE + CONFIG_SYS_INTRAM_SIZE)
 
 #define CONFIG_SYS_MALLOC_LEN			(256*1024)
-#define CONFIG_SYS_DMA_ALLOC_LEN		(16384)
 
 /* Allow 4MB for the kernel run-time image */
 #define CONFIG_SYS_LOAD_ADDR			(EBI_SDRAM_BASE + 0x00400000)
include/configs/atngw100mkii.h +0 -1
index 7b4f9cf..35eae76 100644
@@ -164,7 +164,6 @@
 #define CONFIG_SYS_INIT_SP_ADDR		(CONFIG_SYS_INTRAM_BASE + CONFIG_SYS_INTRAM_SIZE)
 
 #define CONFIG_SYS_MALLOC_LEN		(256*1024)
-#define CONFIG_SYS_DMA_ALLOC_LEN	(16384)
 
 /* Allow 4MB for the kernel run-time image */
 #define CONFIG_SYS_LOAD_ADDR		(EBI_SDRAM_BASE + 0x00400000)
include/configs/atstk1002.h +0 -1
index 8f3fd0b..9e58238 100644
@@ -158,7 +158,6 @@
 #define CONFIG_SYS_INIT_SP_ADDR		(CONFIG_SYS_INTRAM_BASE + CONFIG_SYS_INTRAM_SIZE)
 
 #define CONFIG_SYS_MALLOC_LEN			(256*1024)
-#define CONFIG_SYS_DMA_ALLOC_LEN		(16384)
 
 /* Allow 4MB for the kernel run-time image */
 #define CONFIG_SYS_LOAD_ADDR			(EBI_SDRAM_BASE + 0x00400000)
include/configs/atstk1006.h +0 -1
index bbe0aea..25090a6 100644
@@ -159,7 +159,6 @@
 #define CONFIG_SYS_INIT_SP_ADDR		(CONFIG_SYS_INTRAM_BASE + CONFIG_SYS_INTRAM_SIZE)
 
 #define CONFIG_SYS_MALLOC_LEN			(256*1024)
-#define CONFIG_SYS_DMA_ALLOC_LEN		(16384)
 
 /* Allow 4MB for the kernel run-time image */
 #define CONFIG_SYS_LOAD_ADDR			(EBI_SDRAM_BASE + 0x00400000)
include/configs/favr-32-ezkit.h +0 -1
index 338d3dc..75bff4c 100644
@@ -162,7 +162,6 @@
 #define CONFIG_SYS_INIT_SP_ADDR		(CONFIG_SYS_INTRAM_BASE + CONFIG_SYS_INTRAM_SIZE)
 
 #define CONFIG_SYS_MALLOC_LEN			(256*1024)
-#define CONFIG_SYS_DMA_ALLOC_LEN		(16384)
 
 /* Allow 4MB for the kernel run-time image */
 #define CONFIG_SYS_LOAD_ADDR			(EBI_SDRAM_BASE + 0x00400000)
include/configs/grasshopper.h +0 -1
index 73534ad..83f0ed2 100644
@@ -151,7 +151,6 @@
 					 CONFIG_SYS_INTRAM_SIZE)
 
 #define CONFIG_SYS_MALLOC_LEN		(256*1024)
-#define CONFIG_SYS_DMA_ALLOC_LEN	(16384)
 
 /* Allow 4MB for the kernel run-time image */
 #define CONFIG_SYS_LOAD_ADDR		(EBI_SDRAM_BASE + 0x00400000)
include/configs/hammerhead.h +0 -1
index 4f0603a..0bc42f1 100644
@@ -137,7 +137,6 @@
 
 #define CONFIG_SYS_MALLOC_LEN			(256*1024)
 
-#define CONFIG_SYS_DMA_ALLOC_LEN		(16384)
 
 /* Allow 4MB for the kernel run-time image */
 #define CONFIG_SYS_LOAD_ADDR			(CONFIG_SYS_SDRAM_BASE + 0x00400000)
include/configs/mimc200.h +0 -1
index fc7ecfa..2fd3add 100644
@@ -157,7 +157,6 @@
 #define CONFIG_SYS_INIT_SP_ADDR		(CONFIG_SYS_INTRAM_BASE + CONFIG_SYS_INTRAM_SIZE)
 
 #define CONFIG_SYS_MALLOC_LEN			(1024*1024)
-#define CONFIG_SYS_DMA_ALLOC_LEN		(16384)
 
 /* Allow 4MB for the kernel run-time image */
 #define CONFIG_SYS_LOAD_ADDR			(EBI_SDRAM_BASE + 0x00400000)
Signature · 1 line
1.7.10.4
#2 lore raw

RFC PATCH 2/5 avr32: rename cpu_init() -> arch_cpu_init()

In reply to Andreas Bießmann

---

 arch/avr32/cpu/cpu.c            |    2 +-
 arch/avr32/include/asm/u-boot.h |    2 ++
 arch/avr32/lib/board.c          |    2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)
arch/avr32/cpu/cpu.c +1 -1
index cef630e..cd226a6 100644
@@ -27,7 +27,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-int cpu_init(void)
+int arch_cpu_init(void)
 {
 	extern void _evba(void);
 
arch/avr32/include/asm/u-boot.h +2 -0
index 6aef808..2387f8a 100644
@@ -25,4 +25,6 @@ typedef struct bd_info {
 /* For image.h:image_check_target_arch() */
 #define IH_ARCH_DEFAULT IH_ARCH_AVR32
 
+int arch_cpu_init(void);
+
 #endif /* __ASM_U_BOOT_H__ */
arch/avr32/lib/board.c +1 -1
index 7d13ac5..95f9526 100644
@@ -98,7 +98,7 @@ void board_init_f(ulong board_type)
 
 	/* Perform initialization sequence */
 	board_early_init_f();
-	cpu_init();
+	arch_cpu_init();
 	board_postclk_init();
 	env_init();
 	init_baudrate();
Signature · 1 line
1.7.10.4
#3 lore raw

RFC PATCH 3/5 common/board_r: manual relocation for cmd table

In reply to Andreas Bießmann

This is required for architectures still need manual relocation like avr32, mk68 and others.

---

 common/board_r.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)
common/board_r.c +12 -0
index a301cc2..e712902 100644
@@ -294,6 +294,15 @@ static int initr_announce(void)
 	return 0;
 }
 
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
+static int initr_manual_reloc_cmdtable(void)
+{
+	fixup_cmdtable(ll_entry_start(cmd_tbl_t, cmd),
+		       ll_entry_count(cmd_tbl_t, cmd));
+	return 0;
+}
+#endif
+
 #if !defined(CONFIG_SYS_NO_FLASH)
 static int initr_flash(void)
 {
@@ -718,6 +727,9 @@ init_fnc_t init_sequence_r[] = {
 	initr_serial,
 	initr_announce,
 	INIT_FUNC_WATCHDOG_RESET
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
+	initr_manual_reloc_cmdtable,
+#endif
 #ifdef CONFIG_PPC
 	initr_trap,
 #endif
Signature · 1 line
1.7.10.4
#4 lore raw

RFC PATCH 3/5 common/board_r: manual relocation for cmd table

Hi Andreas,

Quoted 30 lines · Andreas Bie?mann

This is required for architectures still need manual relocation like avr32, mk68 and others.

---

 common/board_r.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)
common/board_r.c +9 -0
index a301cc2..e712902 100644
@@ -294,6 +294,15 @@ static int initr_announce(void)
        return 0;
 }
 
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
+static int initr_manual_reloc_cmdtable(void)
+{
+       fixup_cmdtable(ll_entry_start(cmd_tbl_t, cmd),
+                      ll_entry_count(cmd_tbl_t, cmd));
+       return 0;
+}
+#endif
+
 #if !defined(CONFIG_SYS_NO_FLASH)
 static int initr_flash(void)
 {

common/board_r.c init_fnc_t init_sequence_r[] = {

Quoted 10 lines
common/board_r.c +3 -1
@@ -718,6 +727,9 @@ init_fnc_t init_sequence_r[] = {
        initr_serial,
        initr_announce,
        INIT_FUNC_WATCHDOG_RESET
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
+       initr_manual_reloc_cmdtable,
+#endif
 #ifdef CONFIG_PPC
        initr_trap,
 #endif
--

Why do you need manual reloc? Is this a toolchain bug?

Regards,
Simon

#5 lore raw

RFC PATCH 3/5 common/board_r: manual relocation for cmd table

Hi Simon,

Quoted 47 lines · Simon Glass

Hi Andreas,

Quoted 30 lines · Andreas Bie?mann

This is required for architectures still need manual relocation like avr32, mk68 and others.

---

 common/board_r.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)
common/board_r.c +9 -0
index a301cc2..e712902 100644
@@ -294,6 +294,15 @@ static int initr_announce(void)
        return 0;
 }
 
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
+static int initr_manual_reloc_cmdtable(void)
+{
+       fixup_cmdtable(ll_entry_start(cmd_tbl_t, cmd),
+                      ll_entry_count(cmd_tbl_t, cmd));
+       return 0;
+}
+#endif
+
 #if !defined(CONFIG_SYS_NO_FLASH)
 static int initr_flash(void)
 {

common/board_r.c init_fnc_t init_sequence_r[] = {

Quoted 10 lines
common/board_r.c +3 -1
@@ -718,6 +727,9 @@ init_fnc_t init_sequence_r[] = {
        initr_serial,
        initr_announce,
        INIT_FUNC_WATCHDOG_RESET
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
+       initr_manual_reloc_cmdtable,
+#endif
 #ifdef CONFIG_PPC
        initr_trap,
 #endif
--
Quoted 1 line

Why do you need manual reloc? Is this a toolchain bug?

Just not implemented yet for avr32. It is on my list, but avr32 has not my highest priority ;)
As long as there are other arches which need this also I think it is some more time to shift ... the generic board deadline end of 2014 was a bit stricter, I don't want to kick avr32 out of u-boot now. So let's get generic board working for avr32 in the next release ;)

Best regards

Andreas Bie?mann

#6 lore raw

RFC PATCH 3/5 common/board_r: manual relocation for cmd table

Hi Andreas,

Quoted 50 lines · Andreas Bie?mann

Hi Simon,

Quoted 47 lines · Simon Glass

Hi Andreas,

Quoted 30 lines · Andreas Bie?mann

This is required for architectures still need manual relocation like avr32, mk68 and others.

---

 common/board_r.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)
common/board_r.c +9 -0
index a301cc2..e712902 100644
@@ -294,6 +294,15 @@ static int initr_announce(void)
        return 0;
 }
 
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
+static int initr_manual_reloc_cmdtable(void)
+{
+       fixup_cmdtable(ll_entry_start(cmd_tbl_t, cmd),
+                      ll_entry_count(cmd_tbl_t, cmd));
+       return 0;
+}
+#endif
+
 #if !defined(CONFIG_SYS_NO_FLASH)
 static int initr_flash(void)
 {

common/board_r.c init_fnc_t init_sequence_r[] = {

Quoted 10 lines
common/board_r.c +3 -1
@@ -718,6 +727,9 @@ init_fnc_t init_sequence_r[] = {
        initr_serial,
        initr_announce,
        INIT_FUNC_WATCHDOG_RESET
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
+       initr_manual_reloc_cmdtable,
+#endif
 #ifdef CONFIG_PPC
        initr_trap,
 #endif
--
Quoted 8 lines
Quoted 1 line

Why do you need manual reloc? Is this a toolchain bug?

Just not implemented yet for avr32. It is on my list, but avr32 has not my highest priority ;)
As long as there are other arches which need this also I think it is some more time to shift ... the generic board deadline end of 2014 was a bit stricter, I don't want to kick avr32 out of u-boot now. So let's get generic board working for avr32 in the next release ;)

OK - it would be good to tidy this up.

Regards,
Simon

#7 lore raw

RFC PATCH 3/5 common/board_r: manual relocation for cmd table

In reply to Simon Glass

Hi Simon,

Quoted 3 lines · Simon Glass

Hi Andreas,

Why do you need manual reloc? Is this a toolchain bug?

From my experience the only way to escape manual relocation is to use PIE (Position Independent Executable), but this might not be supported in a toolchain for AVR (or it doesn't actually work good enough - this I understood from this message
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=574716)

-Alexey

#8 lore raw

RFC PATCH 3/5 common/board_r: manual relocation for cmd table

In reply to Simon Glass

2015-01-20 0:34 GMT+01:00 Simon Glass <[email protected]>:

Quoted 39 lines

Hi Andreas,

Quoted 1 line · Andreas Bie?mann

This is required for architectures still need manual relocation like

avr32, mk68

Quoted 33 lines

and others.

---

 common/board_r.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)
common/board_r.c +10 -0
index a301cc2..e712902 100644
@@ -294,6 +294,15 @@ static int initr_announce(void)
        return 0;
 }
 
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
+static int initr_manual_reloc_cmdtable(void)
+{
+       fixup_cmdtable(ll_entry_start(cmd_tbl_t, cmd),
+                      ll_entry_count(cmd_tbl_t, cmd));
+       return 0;
+}
+#endif
+
 #if !defined(CONFIG_SYS_NO_FLASH)
 static int initr_flash(void)
 {
@@ -718,6 +727,9 @@ init_fnc_t init_sequence_r[] = {
        initr_serial,
        initr_announce,
        INIT_FUNC_WATCHDOG_RESET
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
Quoted 9 lines

common/board_r.c init_fnc_t init_sequence_r[] = {

Quoted 6 lines
common/board_r.c +2 -1
+       initr_manual_reloc_cmdtable,
+#endif
 #ifdef CONFIG_PPC
        initr_trap,
 #endif
--

I need this patch for microblaze generic-board support.

Thanks,
Michal

Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
#9 lore raw

RFC PATCH 4/5 avr32: add generic board support

In reply to Andreas Bießmann

---

 arch/avr32/config.mk            |    3 +++
 arch/avr32/cpu/u-boot.lds       |    2 ++
 arch/avr32/include/asm/config.h |    1 +
 arch/avr32/include/asm/u-boot.h |    7 +++++++
 arch/avr32/lib/Makefile         |    2 ++
 arch/avr32/lib/interrupts.c     |    5 +++++
 common/board_f.c                |   13 ++++++++++---
 common/board_r.c                |   22 ++++++++++++++++++++--
 include/asm-generic/u-boot.h    |    4 ++++
 9 files changed, 54 insertions(+), 5 deletions(-)
arch/avr32/config.mk +3 -0
index 469185e..8252f59 100644
@@ -9,6 +9,9 @@ ifeq ($(CROSS_COMPILE),)
 CROSS_COMPILE := avr32-linux-
 endif
 
+# avr32 has generic board support
+__HAVE_ARCH_GENERIC_BOARD := y
+
 CONFIG_STANDALONE_LOAD_ADDR ?= 0x00000000
 
 PLATFORM_RELFLAGS	+= -ffixed-r5 -fPIC -mno-init-got -mrelax
arch/avr32/cpu/u-boot.lds +2 -0
index cb29a22..b0180e3 100644
@@ -48,9 +48,11 @@ SECTIONS
 	_edata = .;
 
 	.bss (NOLOAD) : {
+		__bss_start = .;
 		*(.bss)
 		*(.bss.*)
 	}
 	. = ALIGN(8);
 	__bss_end = .;
+	__init_end = .;
 }
arch/avr32/include/asm/config.h +1 -0
index 63056a4..529fe22 100644
@@ -8,5 +8,6 @@
 #define _ASM_CONFIG_H_
 
 #define CONFIG_NEEDS_MANUAL_RELOC
+#define CONFIG_SYS_GENERIC_GLOBAL_DATA
 
 #endif
arch/avr32/include/asm/u-boot.h +7 -0
index 2387f8a..0f7dddd 100644
@@ -6,6 +6,11 @@
 #ifndef __ASM_U_BOOT_H__
 #define __ASM_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
+
 typedef struct bd_info {
 	unsigned char		bi_phy_id[4];
 	unsigned long		bi_board_number;
@@ -22,6 +27,8 @@ typedef struct bd_info {
 #define bi_memstart bi_dram[0].start
 #define bi_memsize bi_dram[0].size
 
+#endif
+
 /* For image.h:image_check_target_arch() */
 #define IH_ARCH_DEFAULT IH_ARCH_AVR32
 
arch/avr32/lib/Makefile +2 -0
index bb45cbe..d5cb8b2 100644
@@ -8,6 +8,8 @@
 #
 
 obj-y	+= memset.o
+ifndef CONFIG_SYS_GENERIC_BOARD
 obj-y	+= board.o
+endif
 obj-$(CONFIG_CMD_BOOTM) += bootm.o
 obj-y	+= interrupts.o
arch/avr32/lib/interrupts.c +5 -0
index bacb2d1..5f3a49e 100644
@@ -7,6 +7,11 @@
 
 #include <asm/sysreg.h>
 
+int interrupt_init(void)
+{
+	return 0;
+}
+
 void enable_interrupts(void)
 {
 	asm volatile("csrf	%0" : : "n"(SYSREG_GM_OFFSET));
common/board_f.c +10 -3
index 3a4b32c..b5eb81e 100644
@@ -174,7 +174,7 @@ static int announce_dram_init(void)
 	return 0;
 }
 
-#if defined(CONFIG_MIPS) || defined(CONFIG_PPC)
+#if defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_AVR32)
 static int init_func_ram(void)
 {
 #ifdef	CONFIG_BOARD_TYPES
@@ -268,6 +268,8 @@ static int setup_mon_len(void)
 	gd->mon_len = (ulong)&_end - (ulong)_init;
 #elif defined(CONFIG_BLACKFIN) || defined(CONFIG_NIOS2)
 	gd->mon_len = CONFIG_SYS_MONITOR_LEN;
+#elif defined(CONFIG_AVR32)
+	gd->mon_len = (ulong)&__bss_end - (ulong)&_text;
 #else
 	/* TODO: use (ulong)&__bss_end - (ulong)&__text_start; ? */
 	gd->mon_len = (ulong)&__bss_end - CONFIG_SYS_MONITOR_BASE;
@@ -581,7 +583,7 @@ static int reserve_stacks(void)
 	gd->irq_sp = gd->start_addr_sp;
 # endif
 #else
-# ifdef CONFIG_PPC
+# if defined(CONFIG_PPC) || defined(CONFIG_AVR32)
 	ulong *s;
 # endif
 
@@ -611,6 +613,11 @@ static int reserve_stacks(void)
 	s = (ulong *) gd->start_addr_sp;
 	*s = 0; /* Terminate back chain */
 	*++s = 0; /* NULL return address */
+# elif defined(CONFIG_AVR32)
+	gd->arch.stack_end = gd->start_addr_sp;
+	s = (ulong *)gd->start_addr_sp;
+	*s = 0;
+	*--s = 0;
 # endif /* Architecture specific code */
 
 	return 0;
@@ -906,7 +913,7 @@ static init_fnc_t init_sequence_f[] = {
 #if defined(CONFIG_ARM) || defined(CONFIG_X86)
 	dram_init,		/* configure available RAM banks */
 #endif
-#if defined(CONFIG_MIPS) || defined(CONFIG_PPC)
+#if defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_AVR32)
 	init_func_ram,
 #endif
 #ifdef CONFIG_POST
common/board_r.c +20 -2
index e712902..4d2000d 100644
@@ -459,6 +459,16 @@ static int initr_env(void)
 	return 0;
 }
 
+#ifdef CONFIG_SYS_BOOTPARAMS_LEN
+static int initr_malloc_bootparams(void)
+{
+	gd->bd->bi_boot_params = (ulong)malloc(CONFIG_SYS_BOOTPARAMS_LEN);
+	if (!gd->bd->bi_boot_params)
+		puts("WARNING: Cannot allocate space for boot parameters\n");
+	return 0;
+}
+#endif
+
 #ifdef CONFIG_SC3
 /* TODO: with new initcalls, move this into the driver */
 extern void sc3_read_eeprom(void);
@@ -502,7 +512,7 @@ static int show_model_r(void)
 #endif
 
 /* enable exceptions */
-#ifdef CONFIG_ARM
+#if defined(CONFIG_ARM) || defined(CONFIG_AVR32)
 static int initr_enable_interrupts(void)
 {
 	enable_interrupts();
@@ -791,6 +801,9 @@ init_fnc_t init_sequence_r[] = {
 	initr_dataflash,
 #endif
 	initr_env,
+#ifdef CONFIG_SYS_BOOTPARAMS_LEN
+	initr_malloc_bootparams,
+#endif
 	INIT_FUNC_WATCHDOG_RESET
 	initr_secondary_cpu,
 #ifdef CONFIG_SC3
@@ -826,7 +839,7 @@ init_fnc_t init_sequence_r[] = {
 	initr_kgdb,
 #endif
 	interrupt_init,
-#if defined(CONFIG_ARM)
+#if defined(CONFIG_ARM) || defined(CONFIG_AVR32)
 	initr_enable_interrupts,
 #endif
 #ifdef CONFIG_X86
@@ -894,6 +907,11 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
 	int i;
 #endif
 
+#ifdef CONFIG_AVR32
+	extern void mmu_init_r(unsigned long);
+	mmu_init_r(dest_addr);
+#endif
+
 #if !defined(CONFIG_X86) && !defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
 	gd = new_gd;
 #endif
include/asm-generic/u-boot.h +4 -0
index aef39d7..a63a87a 100644
@@ -32,6 +32,10 @@ typedef struct bd_info {
 	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 */
+#ifdef CONFIG_AVR32
+	unsigned char   bi_phy_id[4];   /* PHY address for ATAG_ETHERNET */
+	unsigned long   bi_board_number;/* ATAG_BOARDINFO */
+#endif
 #ifdef CONFIG_ARM
 	unsigned long	bi_arm_freq; /* arm frequency */
 	unsigned long	bi_dsp_freq; /* dsp core frequency */
Signature · 1 line
1.7.10.4
#10 lore raw

RFC PATCH 5/5 grasshopper: enable generic board

In reply to Andreas Bießmann

---

 include/configs/grasshopper.h |    4 ++++
 1 file changed, 4 insertions(+)
include/configs/grasshopper.h +4 -0
index 83f0ed2..54eb977 100644
@@ -62,6 +62,10 @@
 #define CONFIG_USART_BASE		ATMEL_BASE_USART1
 #define CONFIG_USART_ID			1
 
+#define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_BOARD_EARLY_INIT_F
+#define CONFIG_BOARD_EARLY_INIT_R
+
 /* User serviceable stuff */
 #define CONFIG_CMDLINE_TAG
 #define CONFIG_SETUP_MEMORY_TAGS
Signature · 1 line
1.7.10.4
#11 lore raw

cover avr32: add generic board

In reply to Andreas Bießmann
Quoted 7 lines · Andreas Bie?mann

This is the first attempt to add generic board support to avr32 architecture. It has at least one relevant part for other manual reloc architectures.

This series is currently runtime tested on grasshhopper only. I expect some changes regarding LCD support when testing the code on atstk1002. The DMA stuff is not tested yet but I expect no serios things here.
The code is not run through checkpatch nor buildman at the time of writing.

It seems MMC is not working properly yet!