Patchwork [U-Boot,3/4] at91sam9261/g10: support relocation

login
register
mail settings
Submitter Alessandro Rubini
Date April 18, 2011, 9:21 a.m.
Message ID <479c17df224bd1f1d8e5c1e19fa428f6cb802137.1303118067.git.rubini@gnudd.com>
Download mbox | patch
Permalink /patch/91705/
State Changes Requested
Delegated to: Reinhard Meyer
Headers show

Comments

Alessandro Rubini - April 18, 2011, 9:21 a.m.
This adds support for relocation, but won't work for the default
settings whereas AT91Boot loads u-boot to the last meg and it then
tries to relocate slightly later, thus overwriting itself.

Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
---
 board/atmel/at91sam9261ek/at91sam9261ek.c |    3 +--
 include/configs/at91sam9261ek.h           |    4 ++++
 2 files changed, 5 insertions(+), 2 deletions(-)
Andreas Bießmann - April 18, 2011, 9:32 a.m.
Dear Alessandro Rubini,

Am 18.04.2011 11:21, schrieb Alessandro Rubini:
> This adds support for relocation, but won't work for the default
> settings whereas AT91Boot loads u-boot to the last meg and it then
> tries to relocate slightly later, thus overwriting itself.
> 
> Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
> ---
>  board/atmel/at91sam9261ek/at91sam9261ek.c |    3 +--
>  include/configs/at91sam9261ek.h           |    4 ++++
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/board/atmel/at91sam9261ek/at91sam9261ek.c b/board/atmel/at91sam9261ek/at91sam9261ek.c
> index de5cfae..ec1d2a3 100644
> --- a/board/atmel/at91sam9261ek/at91sam9261ek.c
> +++ b/board/atmel/at91sam9261ek/at91sam9261ek.c
> @@ -273,8 +273,7 @@ int board_eth_init(bd_t *bis)
>  
>  int dram_init(void)
>  {
> -	gd->bd->bi_dram[0].start = PHYS_SDRAM;
> -	gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE;
> +	gd->ram_size = get_ram_size(PHYS_SDRAM, PHYS_SDRAM_SIZE);

please stop using this PHYS_SDRAM macros. They where replaced by
CONFIG_SYS_SDRAM_(BASE|SIZE).

>  	return 0;
>  }
>  
> diff --git a/include/configs/at91sam9261ek.h b/include/configs/at91sam9261ek.h
> index 401478b..71a4357 100644
> --- a/include/configs/at91sam9261ek.h
> +++ b/include/configs/at91sam9261ek.h
> @@ -30,6 +30,7 @@
>  #define CONFIG_AT91_LEGACY
>  
>  /* ARM asynchronous clock */
> +#define CONFIG_AT91FAMILY

CONFIG_AT91FAMILY is defined in some asm/arch/hardware.h files. You will
get 'double definition' errors here. The best solution is currently to
include asm/hardware.h in board config right after the correct SoC
define. I have started a discussion on that problem yesterday evening ->
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/97903

>  #define CONFIG_SYS_AT91_MAIN_CLOCK	18432000	/* 18.432 MHz crystal */

I guess SLOW_CLOCK is missing here ...

>  #define CONFIG_SYS_HZ		1000
>  
> @@ -110,6 +111,9 @@
>  #define CONFIG_NR_DRAM_BANKS		1
>  #define PHYS_SDRAM			0x20000000
>  #define PHYS_SDRAM_SIZE			0x04000000	/* 64 megs */
> +#define CONFIG_SYS_SDRAM_BASE		0x20000000

just replace the PHYS_SDRAM defines by CONFIG_SYS_SDRAM defines.

> +#define CONFIG_SYS_INIT_SP_ADDR		0x20100000	/* within RAM is ok */
> +

I recommend to use SRAM here, see top900(0) header for example.


>  
>  /* DataFlash */
>  #define CONFIG_ATMEL_DATAFLASH_SPI

regards

Andreas Bießmann

Patch

diff --git a/board/atmel/at91sam9261ek/at91sam9261ek.c b/board/atmel/at91sam9261ek/at91sam9261ek.c
index de5cfae..ec1d2a3 100644
--- a/board/atmel/at91sam9261ek/at91sam9261ek.c
+++ b/board/atmel/at91sam9261ek/at91sam9261ek.c
@@ -273,8 +273,7 @@  int board_eth_init(bd_t *bis)
 
 int dram_init(void)
 {
-	gd->bd->bi_dram[0].start = PHYS_SDRAM;
-	gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE;
+	gd->ram_size = get_ram_size(PHYS_SDRAM, PHYS_SDRAM_SIZE);
 	return 0;
 }
 
diff --git a/include/configs/at91sam9261ek.h b/include/configs/at91sam9261ek.h
index 401478b..71a4357 100644
--- a/include/configs/at91sam9261ek.h
+++ b/include/configs/at91sam9261ek.h
@@ -30,6 +30,7 @@ 
 #define CONFIG_AT91_LEGACY
 
 /* ARM asynchronous clock */
+#define CONFIG_AT91FAMILY
 #define CONFIG_SYS_AT91_MAIN_CLOCK	18432000	/* 18.432 MHz crystal */
 #define CONFIG_SYS_HZ		1000
 
@@ -110,6 +111,9 @@ 
 #define CONFIG_NR_DRAM_BANKS		1
 #define PHYS_SDRAM			0x20000000
 #define PHYS_SDRAM_SIZE			0x04000000	/* 64 megs */
+#define CONFIG_SYS_SDRAM_BASE		0x20000000
+#define CONFIG_SYS_INIT_SP_ADDR		0x20100000	/* within RAM is ok */
+
 
 /* DataFlash */
 #define CONFIG_ATMEL_DATAFLASH_SPI