From 36d375faf5cff98e8dca32aabbbb1ec6036437dd Mon Sep 17 00:00:00 2001 From: Haavard Skinnemoen Date: Sun, 31 Aug 2008 18:24:24 +0200 Subject: avr32: Use board_postclk_init instead of gclk_init Replace the avr32-specific gclk_init() board hook with the standard board_postclk_init() hook which is supposed to run at the same point during initialization. Provide a dummy weak alias for boards not implementing this hook. The cost of this is: - 2 bytes for the dummy function (retal 0) - 2 bytes for each unnecessary function call (short rcall) which is a pretty small price to pay for avoiding lots of #ifdef clutter. In this particular case, all boards probably end up slightly smaller because we avoid the conditional checking if the gclk_init symbol is NULL. Signed-off-by: Haavard Skinnemoen --- lib_avr32/board.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib_avr32') diff --git a/lib_avr32/board.c b/lib_avr32/board.c index d6423d4..19d76d2 100644 --- a/lib_avr32/board.c +++ b/lib_avr32/board.c @@ -47,6 +47,13 @@ static unsigned long mem_malloc_start = 0; static unsigned long mem_malloc_end = 0; static unsigned long mem_malloc_brk = 0; +/* Weak aliases for optional board functions */ +static int __do_nothing(void) +{ + return 0; +} +int board_postclk_init(void) __attribute__((weak, alias("__do_nothing"))); + /* The malloc area is right below the monitor image in RAM */ static void mem_malloc_init(void) { @@ -187,6 +194,7 @@ void board_init_f(ulong board_type) /* Perform initialization sequence */ board_early_init_f(); cpu_init(); + board_postclk_init(); env_init(); init_baudrate(); serial_init(); -- cgit v1.1 From 25e6854d42c11046a468576179b5494f850311b2 Mon Sep 17 00:00:00 2001 From: Haavard Skinnemoen Date: Sun, 31 Aug 2008 18:46:35 +0200 Subject: avr32: use board_early_init_r instead of board_init_info Replace the avr32-specific board_init_info hook by the standard board_early_init_r hook and make it optional. board_early_init_r() runs somewhat earlier than board_init_info used to do, but this isn't a problem for any of the in-tree boards. Signed-off-by: Haavard Skinnemoen --- lib_avr32/board.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib_avr32') diff --git a/lib_avr32/board.c b/lib_avr32/board.c index 19d76d2..4ed6c96 100644 --- a/lib_avr32/board.c +++ b/lib_avr32/board.c @@ -53,6 +53,7 @@ static int __do_nothing(void) return 0; } int board_postclk_init(void) __attribute__((weak, alias("__do_nothing"))); +int board_early_init_r(void) __attribute__((weak, alias("__do_nothing"))); /* The malloc area is right below the monitor image in RAM */ static void mem_malloc_init(void) @@ -282,6 +283,8 @@ void board_init_r(gd_t *new_gd, ulong dest_addr) gd->flags |= GD_FLG_RELOC; gd->reloc_off = dest_addr - CFG_MONITOR_BASE; + board_early_init_r(); + monitor_flash_len = _edata - _text; /* @@ -318,7 +321,6 @@ void board_init_r(gd_t *new_gd, ulong dest_addr) mem_malloc_init(); malloc_bin_reloc(); dma_alloc_init(); - board_init_info(); enable_interrupts(); -- cgit v1.1 From d8f2aa3298610b44127dbc4796d8038aa5847e0b Mon Sep 17 00:00:00 2001 From: Olav Morken Date: Fri, 23 Jan 2009 12:56:27 +0100 Subject: AVR32: Make cacheflush cpu-dependent The AT32UC3A series of processors doesn't contain any cache, and issuing cache control instructions on those will cause an exception. This commit makes cacheflush.h arch-dependent in preparation for the AT32UC3A-support. Signed-off-by: Gunnar Rangoy Signed-off-by: Paul Driveklepp Signed-off-by: Olav Morken Signed-off-by: Haavard Skinnemoen --- lib_avr32/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib_avr32') diff --git a/lib_avr32/board.c b/lib_avr32/board.c index 959375a..57115df 100644 --- a/lib_avr32/board.c +++ b/lib_avr32/board.c @@ -86,7 +86,7 @@ void *sbrk(ptrdiff_t increment) } #ifdef CONFIG_SYS_DMA_ALLOC_LEN -#include +#include #include static unsigned long dma_alloc_start; -- cgit v1.1 From a38de083d2979db3680f0d0978c509a172c8fa00 Mon Sep 17 00:00:00 2001 From: Olav Morken Date: Fri, 23 Jan 2009 12:56:28 +0100 Subject: AVR32: Move addrspace.h to arch-directory, and move some functions from io.h to addrspace.h The AVR32A architecture (which AT32UC3A-series is based on) has a different memory layout than the AVR32B-architecture. This patch moves addrspace.h to an arch-dependent directory in preparation for AT32UC3A-support. It also moves some address-space manipulation functions from io.h to addrspace.h. Signed-off-by: Gunnar Rangoy Signed-off-by: Paul Driveklepp Signed-off-by: Olav Morken Signed-off-by: Haavard Skinnemoen --- lib_avr32/bootm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib_avr32') diff --git a/lib_avr32/bootm.c b/lib_avr32/bootm.c index 03ab8d1..0ca4718 100644 --- a/lib_avr32/bootm.c +++ b/lib_avr32/bootm.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include -- cgit v1.1 From b423f94063bf04e92047ff85c7e53441eb3b712b Mon Sep 17 00:00:00 2001 From: Olav Morken Date: Fri, 23 Jan 2009 12:56:32 +0100 Subject: AVR32: Must add NOPs after disabling interrupts for AT32UC3A0512ES The AT32UC3A0512ES chip has a bug when disabling interrupts. As a workaround, two NOPs can be inserted. Signed-off-by: Gunnar Rangoy Signed-off-by: Paul Driveklepp Signed-off-by: Olav Morken Signed-off-by: Haavard Skinnemoen --- lib_avr32/interrupts.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib_avr32') diff --git a/lib_avr32/interrupts.c b/lib_avr32/interrupts.c index 28df20d..bbbc490 100644 --- a/lib_avr32/interrupts.c +++ b/lib_avr32/interrupts.c @@ -35,5 +35,12 @@ int disable_interrupts(void) sr = sysreg_read(SR); asm volatile("ssrf %0" : : "n"(SYSREG_GM_OFFSET)); +#ifdef CONFIG_AT32UC3A0xxx + /* Two NOPs are required after masking interrupts on the + * AT32UC3A0512ES. See errata 41.4.5.5. */ + asm("nop"); + asm("nop"); +#endif + return !SYSREG_BFEXT(GM, sr); } -- cgit v1.1