Skip to contentSkip to conversation

Fix timer usage of the Atmel SPI dataflash driver

PATCH New Remy Bohmer 4 participants 12 messages Jan 27, 2011 – Apr 18, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Fix timer usage of the Atmel SPI dataflash driver

---
 drivers/spi/atmel_dataflash_spi.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/spi/atmel_dataflash_spi.c +4 -4
index 4a5c4aa..2f23f54 100644
@@ -133,7 +133,7 @@ unsigned int AT91F_SpiWrite1(AT91PS_DataflashDesc pDesc);
 
 unsigned int AT91F_SpiWrite(AT91PS_DataflashDesc pDesc)
 {
-	unsigned int timeout;
+	u32 time_start, timeout;
 
 	pDesc->state = BUSY;
 
@@ -158,12 +158,12 @@ unsigned int AT91F_SpiWrite(AT91PS_DataflashDesc pDesc)
 	}
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked();
-	timeout = 0;
+	time_start = get_timer(0);
 
 	writel(AT91_SPI_TXTEN + AT91_SPI_RXTEN, AT91_BASE_SPI + AT91_SPI_PTCR);
 	while (!(readl(AT91_BASE_SPI + AT91_SPI_SR) & AT91_SPI_RXBUFF) &&
-		((timeout = get_timer_masked()) < CONFIG_SYS_SPI_WRITE_TOUT));
+		((timeout = get_timer(time_start)) < CONFIG_SYS_SPI_WRITE_TOUT));
+
 	writel(AT91_SPI_TXTDIS + AT91_SPI_RXTDIS, AT91_BASE_SPI + AT91_SPI_PTCR);
 	pDesc->state = IDLE;
 
Signature · 1 line
1.7.1
#1 lore raw

PATCH 2/2 at91sam9261ek: make operational again

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 <[email protected]>

---
 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
board/atmel/at91sam9261ek/Makefile +5 -5
index 9d20ba0..1da810f 100644
@@ -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)
board/atmel/at91sam9261ek/at91sam9261ek.c +4 -3
index de5cfae..25c181e 100644
@@ -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;
 }
 
board/atmel/at91sam9261ek/config.mk deleted +0 -1
deleted file mode 100644
index e554a45..0000000
@@ -1 +0,0 @@
-CONFIG_SYS_TEXT_BASE = 0x23f00000
include/configs/at91sam9261ek.h +21 -4
index 401478b..0cffd94 100644
@@ -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
Signature · 1 line
1.7.1
#2 lore raw

PATCH 2/2 at91sam9261ek: make operational again

Hi All,

2011/1/27 Remy Bohmer <[email protected]>:

Quoted 11 lines

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 <[email protected]>

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

#3 lore raw

PATCH 2/2 at91sam9261ek: make operational again

In reply to Remy Bohmer

Hi Remy,

Le 27/01/2011 23:46, Remy Bohmer a ?crit :

Quoted 28 lines

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<[email protected]>

---
  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

board/atmel/at91sam9261ek/Makefile +0 -1
index 9d20ba0..1da810f 100644
@@ -29,16 +29,16 @@ include $(TOPDIR)/config.mk
 
  LIB	= $(obj)lib$(BOARD).o
 
-COBJS-y += at91sam9261ek.o

board/atmel/at91sam9261ek/Makefile include $(TOPDIR)/config.mk · line 38

Quoted 10 lines
board/atmel/at91sam9261ek/Makefile +4 -3
+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?

board/atmel/at91sam9261ek/Makefile include $(TOPDIR)/config.mk · line 41

Quoted 3 lines
board/atmel/at91sam9261ek/Makefile +1 -1
  $(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...)'.

Quoted 89 lines
board/atmel/at91sam9261ek/Makefile +0 -0
  clean:
  	rm -f $(SOBJS) $(OBJS)
board/atmel/at91sam9261ek/at91sam9261ek.c +4 -3
index de5cfae..25c181e 100644
@@ -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;
  }
 
board/atmel/at91sam9261ek/config.mk deleted +0 -1
deleted file mode 100644
index e554a45..0000000
@@ -1 +0,0 @@
-CONFIG_SYS_TEXT_BASE = 0x23f00000
include/configs/at91sam9261ek.h +16 -3
index 401478b..0cffd94 100644
@@ -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

include/configs/at91sam9261ek.h line 251

Quoted 10 lines
include/configs/at91sam9261ek.h +5 -1
@@ -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.

include/configs/at91sam9261ek.h line 254

Quoted 2 lines
include/configs/at91sam9261ek.h +0 -0
  #ifdef CONFIG_USE_IRQ
  #error CONFIG_USE_IRQ not supported

Amicalement,

Signature · 1 line
Albert.
#4 lore raw

PATCH 2/2 at91sam9261ek: make operational again

Hi,

Quoted 5 lines
Quoted 5 lines
board/atmel/at91sam9261ek/Makefile +1 -1
-COBJS-y += at91sam9261ek.o
+COBJS-y += $(BOARD).o

? COBJS-y += led.o
? COBJS-$(CONFIG_HAS_DATAFLASH) += partition.o

Quoted 9 lines

board/atmel/at91sam9261ek/Makefile include $(TOPDIR)/config.mk

Quoted 6 lines
board/atmel/at91sam9261ek/Makefile +3 -3
-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

Quoted 5 lines

Review

Quoted 3 lines
(quoted diff) +1 -1
-#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

#5 lore raw

PATCH 2/2 at91sam9261ek: make operational again

In reply to Remy Bohmer

Dear Remy

Quoted 11 lines · Remy Bohmer

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 <[email protected]>

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

Quoted 134 lines
---
 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
board/atmel/at91sam9261ek/Makefile +5 -5
index 9d20ba0..1da810f 100644
@@ -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)
board/atmel/at91sam9261ek/at91sam9261ek.c +4 -3
index de5cfae..25c181e 100644
@@ -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;
 }
 
board/atmel/at91sam9261ek/config.mk deleted +0 -1
deleted file mode 100644
index e554a45..0000000
@@ -1 +0,0 @@
-CONFIG_SYS_TEXT_BASE = 0x23f00000
include/configs/at91sam9261ek.h +21 -4
index 401478b..0cffd94 100644
@@ -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
#6 lore raw

PATCH 2/2 at91sam9261ek: make operational again

Le 01/02/2011 11:45, Michael Trimarchi a ?crit :

Quoted 8 lines

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,

Signature · 1 line
Albert.
#7 lore raw

PATCH 2/2 at91sam9261ek: make operational again

Hi

Quoted 7 lines · Albert ARIBAUD

Le 01/02/2011 11:45, Michael Trimarchi a ?crit :

Quoted 5 lines

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

Quoted 8 lines
Quoted 3 lines

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,

I see, but I see but I have other little problem. I have fixed the compilation, but I have a segmentation fault.

Starting program: /opt/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld -pie -Bstatic -T u-boot.lds -Ttext 0x23e00000 arch/arm/cpu/arm926ejs/start.o --start-group api/libapi.o arch/arm/cpu/arm926ejs/at91/libat91.o arch/arm/cpu/arm926ejs/libarm926ejs.o arch/arm/lib/libarm.o common/libcommon.o disk/libdisk.o drivers/bios_emulator/libatibiosemu.o drivers/block/libblock.o drivers/dma/libdma.o drivers/fpga/libfpga.o drivers/gpio/libgpio.o drivers/hwmon/libhwmon.o drivers/i2c/libi2c.o drivers/input/libinput.o drivers/misc/libmisc.o drivers/mmc/libmmc.o drivers/mtd/libmtd.o drivers/mtd/nand/libnand.o drivers/mtd/onenand/libonenand.o drivers/mtd/spi/libspi_flash.o drivers/mtd/ubi/libubi.o drivers/net/libnet.o drivers/net/phy/libphy.o drivers/pci/libpci.o drivers/pcmcia/libpcmcia.o drivers/power/libpower.o drivers/rtc/librtc.o drivers/serial/libserial.o drivers/spi/libspi.o drivers/twserial/libtws.o drivers/usb/gadget/libusb_gadget.o drivers/usb/host/libusb_host.o drivers/usb/musb/libusb_musb.o drivers/usb/phy/libusb_phy.o drivers/video/libvideo.o drivers/watchdog/libwatchdog.o fs/cramfs/libcramfs.o fs/ext2/libext2fs.o fs/fat/libfat.o fs/fdos/libfdos.o fs/jffs2/libjffs2.o fs/reiserfs/libreiserfs.o fs/ubifs/libubifs.o fs/yaffs2/libyaffs2.o lib/libfdt/libfdt.o lib/libgeneric.o lib/lzma/liblzma.o lib/lzo/liblzo.o net/libnet.o post/libpost.o board/atmel/at91sam9261ek/libat91sam9261ek.o --end-group /home/michael/u-boot/arch/arm/lib/eabi_compat.o -L /opt/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.1.2 -lgcc -Map u-boot.map -o u-boot
/opt/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld: u-boot: warning: allocated section `.bss' not in segment

Program received signal SIGSEGV, Segmentation fault. 0x08081ebd in elf32_arm_finish_dynamic_sections () (gdb) bt

#0  0x08081ebd in elf32_arm_finish_dynamic_sections ()
#1  0x0809cc2b in bfd_elf_final_link ()
#2  0x0807b525 in elf32_arm_bfd_final_link ()
#3  0x0805bfce in ldwrite ()
#4  0x0805a0be in main ()

Michael

-------------- next part --------------
A non-text attachment was scrubbed...
Name: timer.patch
Type: text/x-patch
Size: 673 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110201/f1326848/attachment.bin

#8 lore raw

PATCH 2/2 at91sam9261ek: make operational again

Hi,

2011/2/1 Michael Trimarchi <[email protected]>:

Quoted 16 lines

Hi

Quoted 13 lines · Albert ARIBAUD

Le 01/02/2011 11:45, Michael Trimarchi a ?crit :

Quoted 8 lines

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.

I mentioned this as well directly after posting this patch for the first time. But anyway, if you look at 'cdc-at91' branch of u-boot-usb you can see all the other patches that are required to make it compile properly. Including the timer fix for the at91 family.

Quoted 17 lines
Quoted 2 lines

Amicalement,

I see, but I see but I have other little problem. I have fixed the compilation, but I have a segmentation fault.

Starting program: /opt/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld -pie -Bstatic -T u-boot.lds -Ttext 0x23e00000 arch/arm/cpu/arm926ejs/start.o --start-group api/libapi.o arch/arm/cpu/arm926ejs/at91/libat91.o arch/arm/cpu/arm926ejs/libarm926ejs.o arch/arm/lib/libarm.o common/libcommon.o disk/libdisk.o drivers/bios_emulator/libatibiosemu.o drivers/block/libblock.o drivers/dma/libdma.o drivers/fpga/libfpga.o drivers/gpio/libgpio.o drivers/hwmon/libhwmon.o drivers/i2c/libi2c.o drivers/input/libinput.o drivers/misc/libmisc.o drivers/mmc/libmmc.o drivers/mtd/libmtd.o drivers/mtd/nand/libnand.o drivers/mtd/onenand/libonenand.o drivers/mtd/spi/libspi_flash.o drivers/mtd/ubi/libubi.o drivers/net/libnet.o drivers/net/phy/libphy.o drivers/pci/libpci.o drivers/pcmcia/libpcmcia.o drivers/power/libpower.o drivers/rtc/librtc.o drivers/serial/libserial.o drivers/spi/libspi.o drivers/twserial/libtws.o drivers/usb/gadget/libusb_gadget.o drivers/usb/host/libusb_host.o drivers/usb/musb/libusb_musb.o drivers/usb/phy/libusb_phy.o drivers/video/libvideo.o drivers/watchdog/libwatchdog.o fs/cramfs/libcramfs.o fs/ext2/libext2fs.o fs/fat/libfat.o fs/fdos/libfdos.o fs/jffs2/libjffs2.o fs/reiserfs/libreiserfs.o fs/ubifs/libubifs.o fs/yaffs2/libyaffs2.o lib/libfdt/libfdt.o lib/libgeneric.o lib/lzma/liblzma.o lib/lzo/liblzo.o net/libnet.o post/libpost.o board/atmel/at91sam9261ek/libat91sam9261ek.o --end-group /home/michael/u-boot/arch/arm/lib/eabi_compat.o -L /opt/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.1.2 -lgcc -Map u-boot.map -o u-boot
/opt/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld: u-boot: warning: allocated section `.bss' not in segment

Program received signal SIGSEGV, Segmentation fault. 0x08081ebd in elf32_arm_finish_dynamic_sections () (gdb) bt
#0 ?0x08081ebd in elf32_arm_finish_dynamic_sections () #1 ?0x0809cc2b in bfd_elf_final_link ()
#2 ?0x0807b525 in elf32_arm_bfd_final_link () #3 ?0x0805bfce in ldwrite ()
#4 ?0x0805a0be in main ()

Quoted 1 line

Michael

I see you use a rather old compiler.
I tested with a GCC 4.3.4 (CodeSourcery 2009q1) compiler which works okay. I also noticed that the current make structure of U-boot is more picky on linker usage, and even unresolved externals result in crashing linkers. This has nothing to do with this patch though.

Kind regards,

Remy

#9 lore raw

PATCH 2/2 at91sam9261ek: make operational again

In reply to Albert ARIBAUD

Dear all,

Quoted 9 lines
Quoted 6 lines

/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

#10 lore raw

PATCH 2/2 at91sam9261ek: make operational again

Hi,

2011/2/1 Reinhard Meyer <[email protected]>:

Quoted 4 lines

Dear all,

Quoted 3 lines
Quoted 3 lines

/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

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

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)

I just posted a rework of these patch series, based on your latest rework branch It removes a lot of legacy code and makes the boards compile and operational again. It has been tested on real hardware.

To make it easier for you: You can pull the series here or from the ML. :-))
-------------------------
The following changes since commit 137f4defd8f8d8d2198b4981d25614a1cbcf4587:

AT91: enable MMC on at91sam(9260/9g20/0xe)ek (2011-02-02 10:11:07 +0100)

are available in the git repository at:
git://git.denx.de/u-boot-usb.git fix-at91sam9261ek

Remy Bohmer (2):
at91sam9261ek: make operational again
Make at91sam9261ek and at91sam9g10ek work on current u-boot-atmel.git

 Makefile                                           |   23 ---
 arch/arm/cpu/arm926ejs/at91/at91sam9261_devices.c  |   31 ++--
 arch/arm/cpu/arm926ejs/at91/led.c                  |    1 -
 arch/arm/include/asm/arch-at91/at91_matrix.h       |   17 ++-
 arch/arm/include/asm/arch-at91/at91sam9261.h       |    1 +
 .../arm/include/asm/arch-at91/at91sam9261_matrix.h |   64 ---------
 board/atmel/at91sam9261ek/Makefile                 |    6 +-
 board/atmel/at91sam9261ek/at91sam9261ek.c          |  147 +++++++++++---------
 board/atmel/at91sam9261ek/config.mk                |    1 -
 board/atmel/at91sam9261ek/led.c                    |    8 +-
 boards.cfg                                         |    6 +
 doc/README.at91                                    |    3 +-
 include/configs/at91sam9261ek.h                    |  142 +++++++++++--------
 13 files changed, 201 insertions(+), 249 deletions(-)
 delete mode 100644 arch/arm/include/asm/arch-at91/at91sam9261_matrix.h
 delete mode 100644 board/atmel/at91sam9261ek/config.mk

-------------------------

Kind regards,

Remy

#11 lore raw

PATCH 1/2 Fix timer usage of the Atmel SPI dataflash driver

In reply to Remy Bohmer

Dear Remy Bohmer,

Quoted 23 lines
---
 drivers/spi/atmel_dataflash_spi.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/spi/atmel_dataflash_spi.c +1 -2
index 4a5c4aa..2f23f54 100644
@@ -133,7 +133,7 @@ unsigned int AT91F_SpiWrite1(AT91PS_DataflashDesc pDesc);
 
 unsigned int AT91F_SpiWrite(AT91PS_DataflashDesc pDesc)
 {
-	unsigned int timeout;
+	u32 time_start, timeout;
 
 	pDesc->state = BUSY;
 
@@ -158,12 +158,12 @@ unsigned int AT91F_SpiWrite(AT91PS_DataflashDesc pDesc)
 	}
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked();

drivers/spi/atmel_dataflash_spi.c unsigned int AT91F_SpiWrite(AT91PS_DataflashDesc pDesc) · line 168

Quoted 10 lines
drivers/spi/atmel_dataflash_spi.c +3 -2
-	timeout = 0;
+	time_start = get_timer(0);
 
 	writel(AT91_SPI_TXTEN + AT91_SPI_RXTEN, AT91_BASE_SPI + AT91_SPI_PTCR);
 	while (!(readl(AT91_BASE_SPI + AT91_SPI_SR) & AT91_SPI_RXBUFF) &&
-		((timeout = get_timer_masked()) < CONFIG_SYS_SPI_WRITE_TOUT));
+		((timeout = get_timer(time_start)) < CONFIG_SYS_SPI_WRITE_TOUT));
+
 	writel(AT91_SPI_TXTDIS + AT91_SPI_RXTDIS, AT91_BASE_SPI + AT91_SPI_PTCR);
 	pDesc->state = IDLE;

This issue had already been fixed by the ATMEL rework.

But you are welcome to further "fix" this driver to use structure SoC access ;)

Best Regards, Reinhard