diff mbox

[U-Boot,2/2] at91sam9261ek: make operational again

Message ID 1296168378-8399-2-git-send-email-linux@bohmer.net
State Superseded
Delegated to: Reinhard Meyer
Headers show

Commit Message

Remy Bohmer Jan. 27, 2011, 10:46 p.m. UTC
Since U-boot v2010.12 the at91sam9261ek board is broken.
This is solved and tested on this board.

Note: It requires that the 1st stage bootloader (like Atmel at91-bootstrap)
to load U-boot at a different address compared to previous releases of
U-boot due to conflicts in the BSS area during relocation.
(0x23f00000 -> -0x23e00000)

Derived from a patch of: Alexander Stein <alexander.stein@systec-electronic.com>

Signed-off-by: Remy Bohmer <linux@bohmer.net>
---
 board/atmel/at91sam9261ek/Makefile        |   10 +++++-----
 board/atmel/at91sam9261ek/at91sam9261ek.c |    7 ++++---
 board/atmel/at91sam9261ek/config.mk       |    1 -
 include/configs/at91sam9261ek.h           |   25 +++++++++++++++++++++----
 4 files changed, 30 insertions(+), 13 deletions(-)
 delete mode 100644 board/atmel/at91sam9261ek/config.mk

Comments

Remy Bohmer Jan. 27, 2011, 10:49 p.m. UTC | #1
Hi All,

2011/1/27 Remy Bohmer <linux@bohmer.net>:
> Since U-boot v2010.12 the at91sam9261ek board is broken.
> This is solved and tested on this board.
>
> Note: It requires that the 1st stage bootloader (like Atmel at91-bootstrap)
> to load U-boot at a different address compared to previous releases of
> U-boot due to conflicts in the BSS area during relocation.
> (0x23f00000 -> -0x23e00000)
>
> Derived from a patch of: Alexander Stein <alexander.stein@systec-electronic.com>
>
> Signed-off-by: Remy Bohmer <linux@bohmer.net>

For your information: This patch requires this patch applied to the
tree first to make it work:
http://permalink.gmane.org/gmane.comp.boot-loaders.u-boot/93537

Kind regards,

Remy
Albert ARIBAUD Jan. 27, 2011, 11:11 p.m. UTC | #2
Hi Remy,

Le 27/01/2011 23:46, Remy Bohmer a écrit :
> Since U-boot v2010.12 the at91sam9261ek board is broken.
> This is solved and tested on this board.
>
> Note: It requires that the 1st stage bootloader (like Atmel at91-bootstrap)
> to load U-boot at a different address compared to previous releases of
> U-boot due to conflicts in the BSS area during relocation.
> (0x23f00000 ->  -0x23e00000)
>
> Derived from a patch of: Alexander Stein<alexander.stein@systec-electronic.com>
>
> Signed-off-by: Remy Bohmer<linux@bohmer.net>
> ---
>   board/atmel/at91sam9261ek/Makefile        |   10 +++++-----
>   board/atmel/at91sam9261ek/at91sam9261ek.c |    7 ++++---
>   board/atmel/at91sam9261ek/config.mk       |    1 -
>   include/configs/at91sam9261ek.h           |   25 +++++++++++++++++++++----
>   4 files changed, 30 insertions(+), 13 deletions(-)
>   delete mode 100644 board/atmel/at91sam9261ek/config.mk
>
> diff --git a/board/atmel/at91sam9261ek/Makefile b/board/atmel/at91sam9261ek/Makefile
> index 9d20ba0..1da810f 100644
> --- a/board/atmel/at91sam9261ek/Makefile
> +++ b/board/atmel/at91sam9261ek/Makefile
> @@ -29,16 +29,16 @@ include $(TOPDIR)/config.mk
>
>   LIB	= $(obj)lib$(BOARD).o
>
> -COBJS-y += at91sam9261ek.o
> +COBJS-y += $(BOARD).o
>   COBJS-y += led.o
>   COBJS-$(CONFIG_HAS_DATAFLASH) += partition.o
>
> -SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
> -OBJS	:= $(addprefix $(obj),$(COBJS-y))
> -SOBJS	:= $(addprefix $(obj),$(SOBJS))
> +SRCS	:= $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
> +OBJS	:= $(addprefix $(obj),$(COBJS-y) $(SOBJS-y))
> +SOBJS	:= $(addprefix $(obj),$(SOBJS-y))

What is the rationale for putting both C *and* assembly language objects 
in OBJS?

>   $(LIB):	$(obj).depend $(OBJS) $(SOBJS)
> -	$(call cmd_link_o_target, $(OBJS) $(SOBJS))
> +	$(call cmd_link_o_target, $(OBJS))

If there is a rationale for putting all objects in OBJS, then SOBJS 
should be removed from the dependencies of LIB. If there is not, then 
SOBJS should remain in the '$(call...)'.

>   clean:
>   	rm -f $(SOBJS) $(OBJS)
> diff --git a/board/atmel/at91sam9261ek/at91sam9261ek.c b/board/atmel/at91sam9261ek/at91sam9261ek.c
> index de5cfae..25c181e 100644
> --- a/board/atmel/at91sam9261ek/at91sam9261ek.c
> +++ b/board/atmel/at91sam9261ek/at91sam9261ek.c
> @@ -246,7 +246,7 @@ int board_init(void)
>   	gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9261EK;
>   #endif
>   	/* adress of boot parameters */
> -	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
> +	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
>
>   	at91_serial_hw_init();
>   #ifdef CONFIG_CMD_NAND
> @@ -273,8 +273,9 @@ 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;
> +	/* dram_init must store complete ramsize in gd->ram_size */
> +	gd->ram_size = get_ram_size((volatile long *)CONFIG_SYS_SDRAM_BASE,
> +			CONFIG_SYS_SDRAM_SIZE);
>   	return 0;
>   }
>
> diff --git a/board/atmel/at91sam9261ek/config.mk b/board/atmel/at91sam9261ek/config.mk
> deleted file mode 100644
> index e554a45..0000000
> --- a/board/atmel/at91sam9261ek/config.mk
> +++ /dev/null
> @@ -1 +0,0 @@
> -CONFIG_SYS_TEXT_BASE = 0x23f00000
> diff --git a/include/configs/at91sam9261ek.h b/include/configs/at91sam9261ek.h
> index 401478b..0cffd94 100644
> --- a/include/configs/at91sam9261ek.h
> +++ b/include/configs/at91sam9261ek.h
> @@ -27,6 +27,8 @@
>   #ifndef __CONFIG_H
>   #define __CONFIG_H
>
> +#include<asm/sizes.h>
> +
>   #define CONFIG_AT91_LEGACY
>
>   /* ARM asynchronous clock */
> @@ -39,6 +41,7 @@
>   #else
>   #define CONFIG_AT91SAM9261	1	/* It's an Atmel AT91SAM9261 SoC*/
>   #endif
> +#define CONFIG_AT91FAMILY
>   #define CONFIG_ARCH_CPU_INIT
>   #undef CONFIG_USE_IRQ			/* we don't need IRQ/FIQ stuff	*/
>
> @@ -105,11 +108,21 @@
>   #define CONFIG_CMD_DHCP		1
>   #define CONFIG_CMD_NAND		1
>   #define CONFIG_CMD_USB		1
> +#define CONFIG_CMD_CACHE	1
>
>   /* SDRAM */
>   #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_SDRAM_SIZE		SZ_64M	/* 64 megs */
> +
> +/*
> + * AT91-bootstrap expects that U-boot needs to be loaded at 0x23f00000
> + * but since U-boot is now being relocated to the end of RAM which is
> + * almost in the same area, there will be an overlap in the BSS segment
> + * resulting in a lockup during boot. So, we need to tell the
> + * AT91-bootstrap code to load it at a lower address, namely 0x23e00000
> + */
> +#define CONFIG_SYS_TEXT_BASE			0x23e00000
>
>   /* DataFlash */
>   #define CONFIG_ATMEL_DATAFLASH_SPI
> @@ -168,7 +181,7 @@
>
>   #define CONFIG_SYS_LOAD_ADDR			0x22000000	/* load address */
>
> -#define CONFIG_SYS_MEMTEST_START		PHYS_SDRAM
> +#define CONFIG_SYS_MEMTEST_START		CONFIG_SYS_SDRAM_BASE
>   #define CONFIG_SYS_MEMTEST_END			0x23e00000
>
>   #ifdef CONFIG_SYS_USE_DATAFLASH_CS0
> @@ -230,8 +243,12 @@
>    * Size of malloc() pool
>    */
>   #define CONFIG_SYS_MALLOC_LEN		ROUND(3 * CONFIG_ENV_SIZE + 128*1024, 0x1000)
> +/* size in bytes reserved for initial data */
> +
> +#define CONFIG_SYS_INIT_SP_ADDR		(CONFIG_SYS_SDRAM_BASE + SZ_4K \
> +					- GENERATED_GBL_DATA_SIZE)
>
> -#define CONFIG_STACKSIZE	(32*1024)	/* regular stack */
> +#define CONFIG_STACKSIZE	(SZ_32K)	/* regular stack */

Do not use SZ_ constants -- several instances in this patch.

>   #ifdef CONFIG_USE_IRQ
>   #error CONFIG_USE_IRQ not supported

Amicalement,
Remy Bohmer Jan. 28, 2011, 8:38 p.m. UTC | #3
Hi,

>> -COBJS-y += at91sam9261ek.o
>> +COBJS-y += $(BOARD).o
>>   COBJS-y += led.o
>>   COBJS-$(CONFIG_HAS_DATAFLASH) += partition.o
>>
>> -SRCS := $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
>> -OBJS := $(addprefix $(obj),$(COBJS-y))
>> -SOBJS        := $(addprefix $(obj),$(SOBJS))
>> +SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
>> +OBJS := $(addprefix $(obj),$(COBJS-y) $(SOBJS-y))
>> +SOBJS        := $(addprefix $(obj),$(SOBJS-y))
>
> What is the rationale for putting both C *and* assembly language objects
> in OBJS?

No rationale, except made this Makefile more in line with another board.
Reworked, will be in patch-v2

>>
>> -#define CONFIG_STACKSIZE     (32*1024)       /* regular stack */
>> +#define CONFIG_STACKSIZE     (SZ_32K)        /* regular stack */
>
> Do not use SZ_ constants -- several instances in this patch.

Reverted these changes in patch-v2.
Thanks.

Kind regards,

Remy
michael Feb. 1, 2011, 10:45 a.m. UTC | #4
Dear Remy

On 01/27/2011 11:46 PM, Remy Bohmer wrote:
> Since U-boot v2010.12 the at91sam9261ek board is broken.
> This is solved and tested on this board.
>
> Note: It requires that the 1st stage bootloader (like Atmel at91-bootstrap)
> to load U-boot at a different address compared to previous releases of
> U-boot due to conflicts in the BSS area during relocation.
> (0x23f00000 -> -0x23e00000)
>
> Derived from a patch of: Alexander Stein <alexander.stein@systec-electronic.com>
>
> Signed-off-by: Remy Bohmer <linux@bohmer.net>
Hi

/home/toolchain/bin/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld  -pie -r -o libat91.o  lowlevel_init.o clock.o cpu.o reset.o timer.o
/home/toolchain/bin/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld: -r and -shared may not be used together

I have tried this patch but this a problem releated to linking option. Do you have this problem?

Michael

> ---
>  board/atmel/at91sam9261ek/Makefile        |   10 +++++-----
>  board/atmel/at91sam9261ek/at91sam9261ek.c |    7 ++++---
>  board/atmel/at91sam9261ek/config.mk       |    1 -
>  include/configs/at91sam9261ek.h           |   25 +++++++++++++++++++++----
>  4 files changed, 30 insertions(+), 13 deletions(-)
>  delete mode 100644 board/atmel/at91sam9261ek/config.mk
>
> diff --git a/board/atmel/at91sam9261ek/Makefile b/board/atmel/at91sam9261ek/Makefile
> index 9d20ba0..1da810f 100644
> --- a/board/atmel/at91sam9261ek/Makefile
> +++ b/board/atmel/at91sam9261ek/Makefile
> @@ -29,16 +29,16 @@ include $(TOPDIR)/config.mk
>  
>  LIB	= $(obj)lib$(BOARD).o
>  
> -COBJS-y += at91sam9261ek.o
> +COBJS-y += $(BOARD).o
>  COBJS-y += led.o
>  COBJS-$(CONFIG_HAS_DATAFLASH) += partition.o
>  
> -SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
> -OBJS	:= $(addprefix $(obj),$(COBJS-y))
> -SOBJS	:= $(addprefix $(obj),$(SOBJS))
> +SRCS	:= $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
> +OBJS	:= $(addprefix $(obj),$(COBJS-y) $(SOBJS-y))
> +SOBJS	:= $(addprefix $(obj),$(SOBJS-y))
>  
>  $(LIB):	$(obj).depend $(OBJS) $(SOBJS)
> -	$(call cmd_link_o_target, $(OBJS) $(SOBJS))
> +	$(call cmd_link_o_target, $(OBJS))
>  
>  clean:
>  	rm -f $(SOBJS) $(OBJS)
> diff --git a/board/atmel/at91sam9261ek/at91sam9261ek.c b/board/atmel/at91sam9261ek/at91sam9261ek.c
> index de5cfae..25c181e 100644
> --- a/board/atmel/at91sam9261ek/at91sam9261ek.c
> +++ b/board/atmel/at91sam9261ek/at91sam9261ek.c
> @@ -246,7 +246,7 @@ int board_init(void)
>  	gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9261EK;
>  #endif
>  	/* adress of boot parameters */
> -	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
> +	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
>  
>  	at91_serial_hw_init();
>  #ifdef CONFIG_CMD_NAND
> @@ -273,8 +273,9 @@ 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;
> +	/* dram_init must store complete ramsize in gd->ram_size */
> +	gd->ram_size = get_ram_size((volatile long *)CONFIG_SYS_SDRAM_BASE,
> +			CONFIG_SYS_SDRAM_SIZE);
>  	return 0;
>  }
>  
> diff --git a/board/atmel/at91sam9261ek/config.mk b/board/atmel/at91sam9261ek/config.mk
> deleted file mode 100644
> index e554a45..0000000
> --- a/board/atmel/at91sam9261ek/config.mk
> +++ /dev/null
> @@ -1 +0,0 @@
> -CONFIG_SYS_TEXT_BASE = 0x23f00000
> diff --git a/include/configs/at91sam9261ek.h b/include/configs/at91sam9261ek.h
> index 401478b..0cffd94 100644
> --- a/include/configs/at91sam9261ek.h
> +++ b/include/configs/at91sam9261ek.h
> @@ -27,6 +27,8 @@
>  #ifndef __CONFIG_H
>  #define __CONFIG_H
>  
> +#include <asm/sizes.h>
> +
>  #define CONFIG_AT91_LEGACY
>  
>  /* ARM asynchronous clock */
> @@ -39,6 +41,7 @@
>  #else
>  #define CONFIG_AT91SAM9261	1	/* It's an Atmel AT91SAM9261 SoC*/
>  #endif
> +#define CONFIG_AT91FAMILY
>  #define CONFIG_ARCH_CPU_INIT
>  #undef CONFIG_USE_IRQ			/* we don't need IRQ/FIQ stuff	*/
>  
> @@ -105,11 +108,21 @@
>  #define CONFIG_CMD_DHCP		1
>  #define CONFIG_CMD_NAND		1
>  #define CONFIG_CMD_USB		1
> +#define CONFIG_CMD_CACHE	1
>  
>  /* SDRAM */
>  #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_SDRAM_SIZE		SZ_64M	/* 64 megs */
> +
> +/*
> + * AT91-bootstrap expects that U-boot needs to be loaded at 0x23f00000
> + * but since U-boot is now being relocated to the end of RAM which is
> + * almost in the same area, there will be an overlap in the BSS segment
> + * resulting in a lockup during boot. So, we need to tell the
> + * AT91-bootstrap code to load it at a lower address, namely 0x23e00000
> + */
> +#define CONFIG_SYS_TEXT_BASE			0x23e00000
>  
>  /* DataFlash */
>  #define CONFIG_ATMEL_DATAFLASH_SPI
> @@ -168,7 +181,7 @@
>  
>  #define CONFIG_SYS_LOAD_ADDR			0x22000000	/* load address */
>  
> -#define CONFIG_SYS_MEMTEST_START		PHYS_SDRAM
> +#define CONFIG_SYS_MEMTEST_START		CONFIG_SYS_SDRAM_BASE
>  #define CONFIG_SYS_MEMTEST_END			0x23e00000
>  
>  #ifdef CONFIG_SYS_USE_DATAFLASH_CS0
> @@ -230,8 +243,12 @@
>   * Size of malloc() pool
>   */
>  #define CONFIG_SYS_MALLOC_LEN		ROUND(3 * CONFIG_ENV_SIZE + 128*1024, 0x1000)
> +/* size in bytes reserved for initial data */
> +
> +#define CONFIG_SYS_INIT_SP_ADDR		(CONFIG_SYS_SDRAM_BASE + SZ_4K \
> +					- GENERATED_GBL_DATA_SIZE)
>  
> -#define CONFIG_STACKSIZE	(32*1024)	/* regular stack */
> +#define CONFIG_STACKSIZE	(SZ_32K)	/* regular stack */
>  
>  #ifdef CONFIG_USE_IRQ
>  #error CONFIG_USE_IRQ not supported
Albert ARIBAUD Feb. 1, 2011, 12:16 p.m. UTC | #5
Le 01/02/2011 11:45, Michael Trimarchi a écrit :

> Hi
>
> /home/toolchain/bin/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld  -pie -r -o libat91.o  lowlevel_init.o clock.o cpu.o reset.o timer.o
> /home/toolchain/bin/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld: -r and -shared may not be used together
>
> I have tried this patch but this a problem releated to linking option. Do you have this problem?
>
> Michael

Read up recent posts on the list: this was detected and is fixed in the 
master branch of the u-boot-arm repository.

Amicalement,
Reinhard Meyer Feb. 1, 2011, 7:54 p.m. UTC | #6
Dear all,
>> /home/toolchain/bin/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld  -pie -r -o libat91.o  lowlevel_init.o clock.o cpu.o reset.o timer.o
>> /home/toolchain/bin/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld: -r and -shared may not be used together
>>
>> I have tried this patch but this a problem releated to linking option. Do you have this problem?
>>
>> Michael
>
> Read up recent posts on the list: this was detected and is fixed in the
> master branch of the u-boot-arm repository.
I'll rebase u-boot-atmel on u-boot-arm/master then. Please rebase at91 related patches on
u-boot-atmel/rework then (my time permitting, that branch will exist somewhere tomorrow)

Best Regards,
Reinhard
diff mbox

Patch

diff --git a/board/atmel/at91sam9261ek/Makefile b/board/atmel/at91sam9261ek/Makefile
index 9d20ba0..1da810f 100644
--- a/board/atmel/at91sam9261ek/Makefile
+++ b/board/atmel/at91sam9261ek/Makefile
@@ -29,16 +29,16 @@  include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).o
 
-COBJS-y += at91sam9261ek.o
+COBJS-y += $(BOARD).o
 COBJS-y += led.o
 COBJS-$(CONFIG_HAS_DATAFLASH) += partition.o
 
-SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
-OBJS	:= $(addprefix $(obj),$(COBJS-y))
-SOBJS	:= $(addprefix $(obj),$(SOBJS))
+SRCS	:= $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS-y) $(SOBJS-y))
+SOBJS	:= $(addprefix $(obj),$(SOBJS-y))
 
 $(LIB):	$(obj).depend $(OBJS) $(SOBJS)
-	$(call cmd_link_o_target, $(OBJS) $(SOBJS))
+	$(call cmd_link_o_target, $(OBJS))
 
 clean:
 	rm -f $(SOBJS) $(OBJS)
diff --git a/board/atmel/at91sam9261ek/at91sam9261ek.c b/board/atmel/at91sam9261ek/at91sam9261ek.c
index de5cfae..25c181e 100644
--- a/board/atmel/at91sam9261ek/at91sam9261ek.c
+++ b/board/atmel/at91sam9261ek/at91sam9261ek.c
@@ -246,7 +246,7 @@  int board_init(void)
 	gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9261EK;
 #endif
 	/* adress of boot parameters */
-	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
+	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
 
 	at91_serial_hw_init();
 #ifdef CONFIG_CMD_NAND
@@ -273,8 +273,9 @@  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;
+	/* dram_init must store complete ramsize in gd->ram_size */
+	gd->ram_size = get_ram_size((volatile long *)CONFIG_SYS_SDRAM_BASE,
+			CONFIG_SYS_SDRAM_SIZE);
 	return 0;
 }
 
diff --git a/board/atmel/at91sam9261ek/config.mk b/board/atmel/at91sam9261ek/config.mk
deleted file mode 100644
index e554a45..0000000
--- a/board/atmel/at91sam9261ek/config.mk
+++ /dev/null
@@ -1 +0,0 @@ 
-CONFIG_SYS_TEXT_BASE = 0x23f00000
diff --git a/include/configs/at91sam9261ek.h b/include/configs/at91sam9261ek.h
index 401478b..0cffd94 100644
--- a/include/configs/at91sam9261ek.h
+++ b/include/configs/at91sam9261ek.h
@@ -27,6 +27,8 @@ 
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <asm/sizes.h>
+
 #define CONFIG_AT91_LEGACY
 
 /* ARM asynchronous clock */
@@ -39,6 +41,7 @@ 
 #else
 #define CONFIG_AT91SAM9261	1	/* It's an Atmel AT91SAM9261 SoC*/
 #endif
+#define CONFIG_AT91FAMILY
 #define CONFIG_ARCH_CPU_INIT
 #undef CONFIG_USE_IRQ			/* we don't need IRQ/FIQ stuff	*/
 
@@ -105,11 +108,21 @@ 
 #define CONFIG_CMD_DHCP		1
 #define CONFIG_CMD_NAND		1
 #define CONFIG_CMD_USB		1
+#define CONFIG_CMD_CACHE	1
 
 /* SDRAM */
 #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_SDRAM_SIZE		SZ_64M	/* 64 megs */
+
+/*
+ * AT91-bootstrap expects that U-boot needs to be loaded at 0x23f00000
+ * but since U-boot is now being relocated to the end of RAM which is
+ * almost in the same area, there will be an overlap in the BSS segment
+ * resulting in a lockup during boot. So, we need to tell the
+ * AT91-bootstrap code to load it at a lower address, namely 0x23e00000
+ */
+#define CONFIG_SYS_TEXT_BASE			0x23e00000
 
 /* DataFlash */
 #define CONFIG_ATMEL_DATAFLASH_SPI
@@ -168,7 +181,7 @@ 
 
 #define CONFIG_SYS_LOAD_ADDR			0x22000000	/* load address */
 
-#define CONFIG_SYS_MEMTEST_START		PHYS_SDRAM
+#define CONFIG_SYS_MEMTEST_START		CONFIG_SYS_SDRAM_BASE
 #define CONFIG_SYS_MEMTEST_END			0x23e00000
 
 #ifdef CONFIG_SYS_USE_DATAFLASH_CS0
@@ -230,8 +243,12 @@ 
  * Size of malloc() pool
  */
 #define CONFIG_SYS_MALLOC_LEN		ROUND(3 * CONFIG_ENV_SIZE + 128*1024, 0x1000)
+/* size in bytes reserved for initial data */
+
+#define CONFIG_SYS_INIT_SP_ADDR		(CONFIG_SYS_SDRAM_BASE + SZ_4K \
+					- GENERATED_GBL_DATA_SIZE)
 
-#define CONFIG_STACKSIZE	(32*1024)	/* regular stack */
+#define CONFIG_STACKSIZE	(SZ_32K)	/* regular stack */
 
 #ifdef CONFIG_USE_IRQ
 #error CONFIG_USE_IRQ not supported