Commit a752a8b4c49d67daa4ea9f9ebac3972bb1c2328b

Authored by Andreas Bießmann
1 parent c722f0b026

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

Showing 10 changed files with 37 additions and 6 deletions Side-by-side Diff

arch/avr32/config.mk
... ... @@ -9,6 +9,9 @@
9 9 CROSS_COMPILE := avr32-linux-
10 10 endif
11 11  
  12 +# avr32 has generic board support
  13 +__HAVE_ARCH_GENERIC_BOARD := y
  14 +
12 15 CONFIG_STANDALONE_LOAD_ADDR ?= 0x00000000
13 16  
14 17 PLATFORM_RELFLAGS += -ffixed-r5 -fPIC -mno-init-got -mrelax
arch/avr32/cpu/u-boot.lds
... ... @@ -48,10 +48,12 @@
48 48 _edata = .;
49 49  
50 50 .bss (NOLOAD) : {
  51 + __bss_start = .;
51 52 *(.bss)
52 53 *(.bss.*)
53 54 }
54 55 . = ALIGN(8);
55 56 __bss_end = .;
  57 + __init_end = .;
56 58 }
arch/avr32/include/asm/config.h
... ... @@ -8,6 +8,7 @@
8 8 #define _ASM_CONFIG_H_
9 9  
10 10 #define CONFIG_NEEDS_MANUAL_RELOC
  11 +#define CONFIG_SYS_GENERIC_GLOBAL_DATA
11 12  
12 13 #endif
arch/avr32/include/asm/u-boot.h
... ... @@ -6,6 +6,11 @@
6 6 #ifndef __ASM_U_BOOT_H__
7 7 #define __ASM_U_BOOT_H__ 1
8 8  
  9 +#ifdef CONFIG_SYS_GENERIC_BOARD
  10 +/* Use the generic board which requires a unified bd_info */
  11 +#include <asm-generic/u-boot.h>
  12 +#else
  13 +
9 14 typedef struct bd_info {
10 15 unsigned char bi_phy_id[4];
11 16 unsigned long bi_board_number;
... ... @@ -21,6 +26,8 @@
21 26  
22 27 #define bi_memstart bi_dram[0].start
23 28 #define bi_memsize bi_dram[0].size
  29 +
  30 +#endif
24 31  
25 32 /* For image.h:image_check_target_arch() */
26 33 #define IH_ARCH_DEFAULT IH_ARCH_AVR32
arch/avr32/lib/Makefile
... ... @@ -8,7 +8,9 @@
8 8 #
9 9  
10 10 obj-y += memset.o
  11 +ifndef CONFIG_SYS_GENERIC_BOARD
11 12 obj-y += board.o
  13 +endif
12 14 obj-$(CONFIG_CMD_BOOTM) += bootm.o
13 15 obj-y += interrupts.o
14 16 obj-y += dram_init.o
arch/avr32/lib/interrupts.c
... ... @@ -7,6 +7,11 @@
7 7  
8 8 #include <asm/sysreg.h>
9 9  
  10 +int interrupt_init(void)
  11 +{
  12 + return 0;
  13 +}
  14 +
10 15 void enable_interrupts(void)
11 16 {
12 17 asm volatile("csrf %0" : : "n"(SYSREG_GM_OFFSET));
... ... @@ -883,7 +883,7 @@
883 883 #endif
884 884 announce_dram_init,
885 885 /* TODO: unify all these dram functions? */
886   -#if defined(CONFIG_ARM) || defined(CONFIG_X86) || defined(CONFIG_MICROBLAZE)
  886 +#if defined(CONFIG_ARM) || defined(CONFIG_X86) || defined(CONFIG_MICROBLAZE) || defined(CONFIG_AVR32)
887 887 dram_init, /* configure available RAM banks */
888 888 #endif
889 889 #if defined(CONFIG_MIPS) || defined(CONFIG_PPC)
... ... @@ -55,6 +55,9 @@
55 55 #include <dm/root.h>
56 56 #include <linux/compiler.h>
57 57 #include <linux/err.h>
  58 +#ifdef CONFIG_AVR32
  59 +#include <asm/arch/mmu.h>
  60 +#endif
58 61  
59 62 DECLARE_GLOBAL_DATA_PTR;
60 63  
... ... @@ -498,7 +501,7 @@
498 501 #endif
499 502  
500 503 /* enable exceptions */
501   -#ifdef CONFIG_ARM
  504 +#if defined(CONFIG_ARM) || defined(CONFIG_AVR32)
502 505 static int initr_enable_interrupts(void)
503 506 {
504 507 enable_interrupts();
505 508  
... ... @@ -825,10 +828,10 @@
825 828 initr_kgdb,
826 829 #endif
827 830 interrupt_init,
828   -#if defined(CONFIG_ARM)
  831 +#if defined(CONFIG_ARM) || defined(CONFIG_AVR32)
829 832 initr_enable_interrupts,
830 833 #endif
831   -#if defined(CONFIG_X86) || defined(CONFIG_MICROBLAZE)
  834 +#if defined(CONFIG_X86) || defined(CONFIG_MICROBLAZE) || defined(CONFIG_AVR32)
832 835 timer_init, /* initialize timer */
833 836 #endif
834 837 #if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
... ... @@ -891,6 +894,10 @@
891 894 {
892 895 #ifdef CONFIG_NEEDS_MANUAL_RELOC
893 896 int i;
  897 +#endif
  898 +
  899 +#ifdef CONFIG_AVR32
  900 + mmu_init_r(dest_addr);
894 901 #endif
895 902  
896 903 #if !defined(CONFIG_X86) && !defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
... ... @@ -345,8 +345,8 @@
345 345 bd_t *bd = gd->bd;
346 346  
347 347 print_num("boot_params", (ulong)bd->bi_boot_params);
348   - print_num("memstart", (ulong)bd->bi_memstart);
349   - print_lnum("memsize", (u64)bd->bi_memsize);
  348 + print_num("memstart", (ulong)bd->bi_dram[0].start);
  349 + print_lnum("memsize", (u64)bd->bi_dram[0].size);
350 350 print_num("flashstart", (ulong)bd->bi_flashstart);
351 351 print_num("flashsize", (ulong)bd->bi_flashsize);
352 352 print_num("flashoffset", (ulong)bd->bi_flashoffset);
include/asm-generic/u-boot.h
... ... @@ -32,6 +32,10 @@
32 32 unsigned long bi_flashoffset; /* reserved area for startup monitor */
33 33 unsigned long bi_sramstart; /* start of SRAM memory */
34 34 unsigned long bi_sramsize; /* size of SRAM memory */
  35 +#ifdef CONFIG_AVR32
  36 + unsigned char bi_phy_id[4]; /* PHY address for ATAG_ETHERNET */
  37 + unsigned long bi_board_number;/* ATAG_BOARDINFO */
  38 +#endif
35 39 #ifdef CONFIG_ARM
36 40 unsigned long bi_arm_freq; /* arm frequency */
37 41 unsigned long bi_dsp_freq; /* dsp core frequency */