ARM: atmel: at91sam9m10g45ek: enable SPL
PATCH 1/1 ARM: atmel: at91sam9m10g45ek: enable SPL
Supports boot up from NAND flash with software ECC eanbled. And supports boot up from SD/MMC card with FAT file system.
As the boot from SD/MMC card with FAT file system, the BSS segment is too big to fit into SRAM, so, use the lds to put it into SDRAM. So, we need to initialize the SDRAM as soon as possible. Borrow the low level init code from <arm/arm/cpu/armv7/lowlevel_init.S> for this purpose.
As there is a little change, which need lowlevel init, so also change taurus board based on at91sam9260, corvus board based on at91sam9g45.
(CONFIG_SPL_STACK is replaced by CONFIG_SYS_INIT_SP_ADDR)
---
arch/arm/Kconfig | 1 + arch/arm/cpu/arm926ejs/at91/Makefile | 4 ++ arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S | 37 ++++++++++++ arch/arm/cpu/at91-common/spl_at91.c | 7 +-- arch/arm/cpu/at91-common/u-boot-spl-arm9.lds | 48 +++++++++++++++ board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c | 80 +++++++++++++++++++++++++ configs/at91sam9m10g45ek_mmc_defconfig | 5 +- configs/at91sam9m10g45ek_nandflash_defconfig | 5 +- include/configs/at91sam9m10g45ek.h | 65 ++++++++++++++++++++ include/configs/corvus.h | 7 ++- include/configs/taurus.h | 7 ++- 11 files changed, 256 insertions(+), 10 deletions(-) create mode 100644 arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S create mode 100644 arch/arm/cpu/at91-common/u-boot-spl-arm9.lds
arch/arm/Kconfig +1 -0
@@ -141,6 +141,7 @@ config TARGET_AT91SAM9263EK config TARGET_AT91SAM9M10G45EK bool "Support at91sam9m10g45ek" select CPU_ARM926EJS + select SUPPORT_SPL config TARGET_AT91SAM9N12EK bool "Support at91sam9n12ek"
arch/arm/cpu/arm926ejs/at91/Makefile +4 -0
@@ -25,5 +25,9 @@ obj-y += reset.o obj-y += timer.o ifndef CONFIG_SKIP_LOWLEVEL_INIT +ifdef CONFIG_SPL_BUILD +obj-y += spl_lowlevel_init.o +else obj-y += lowlevel_init.o endif +endif
arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S new file +37 -0
@@ -0,0 +1,37 @@ +/* + * A lowlevel_init function that sets up the stack to call a C function to + * perform further init. + * + * (C) Copyright 2010 + * Texas Instruments, <www.ti.com> + * + * Author : + * Aneesh V <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <asm-offsets.h> +#include <config.h> +#include <linux/linkage.h> + +ENTRY(lowlevel_init) + /* + * Setup a temporary stack + */ + ldr sp, =CONFIG_SYS_INIT_SP_ADDR + bic sp, sp, #7 /* 8-byte alignment for ABI compliance */ + + ldr r9, =gdata + + /* + * Save the old lr(passed in ip) and the current lr to stack + */ + push {ip, lr} + + /* + * go setup pll, mux, memory + */ + bl s_init + pop {ip, pc} +ENDPROC(lowlevel_init)
arch/arm/cpu/at91-common/spl_at91.c +3 -4
@@ -67,11 +67,12 @@ void __weak matrix_init(void) { } -void __weak at91_spl_board_init (void ) +void spl_board_init (void ) { +at91_spl_board_init (); } -void spl_board_init (void ) +void s_init (void ) {struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC ;
@@ -119,6 +120,4 @@ void spl_board_init(void)preloader_console_init ();mem_init (); - -at91_spl_board_init (); }
arch/arm/cpu/at91-common/u-boot-spl-arm9.lds new file +48 -0
48 lines not on this page · raw message
board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c +80 -0
98 lines not on this page · raw message
configs/at91sam9m10g45ek_mmc_defconfig +3 -2
@@ -1,3 +1,4 @@ +CONFIG_SPL=y CONFIG_SYS_EXTRA_OPTIONS="AT91SAM9M10G45,SYS_USE_MMC" -CONFIG_ARM=y -CONFIG_TARGET_AT91SAM9M10G45EK=y ++S:CONFIG_ARM=y ++S:CONFIG_TARGET_AT91SAM9M10G45EK=y
configs/at91sam9m10g45ek_nandflash_defconfig +3 -2
@@ -1,3 +1,4 @@ +CONFIG_SPL=y CONFIG_SYS_EXTRA_OPTIONS="AT91SAM9M10G45,SYS_USE_NANDFLASH" -CONFIG_ARM=y -CONFIG_TARGET_AT91SAM9M10G45EK=y ++S:CONFIG_ARM=y ++S:CONFIG_TARGET_AT91SAM9M10G45EK=y
include/configs/at91sam9m10g45ek.h +65 -0
84 lines not on this page · raw message
include/configs/corvus.h +6 -1
@@ -37,7 +37,9 @@#define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */ #define CONFIG_SETUP_MEMORY_TAGS #define CONFIG_INITRD_TAG +#ifndef CONFIG_SPL_BUILD #define CONFIG_SKIP_LOWLEVEL_INIT +#endif #define CONFIG_BOARD_EARLY_INIT_F #define CONFIG_DISPLAY_CPUINFO
@@ -89,8 +91,12 @@#define CONFIG_SYS_SDRAM_BASE ATMEL_BASE_CS6#define CONFIG_SYS_SDRAM_SIZE 0x08000000 +#ifdef CONFIG_SPL_BUILD +#define CONFIG_SYS_INIT_SP_ADDR 0x310000 +#else #define CONFIG_SYS_INIT_SP_ADDR \ (CONFIG_SYS_SDRAM_BASE + 4 * 1024 - GENERATED_GBL_DATA_SIZE) +#endif /* No NOR flash */ #define CONFIG_SYS_NO_FLASH
@@ -160,7 +166,6 @@#define CONFIG_SPL_FRAMEWORK #define CONFIG_SPL_TEXT_BASE 0x300000#define CONFIG_SPL_MAX_SIZE (12 * 1024) -#define CONFIG_SPL_STACK (16 * 1024)#define CONFIG_SPL_BSS_START_ADDR CONFIG_SPL_MAX_SIZE#define CONFIG_SPL_BSS_MAX_SIZE (2 * 1024)
include/configs/taurus.h +6 -1
@@ -45,7 +45,9 @@#define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */ #define CONFIG_SETUP_MEMORY_TAGS #define CONFIG_INITRD_TAG +#ifndef CONFIG_SPL_BUILD #define CONFIG_SKIP_LOWLEVEL_INIT +#endif #define CONFIG_BOARD_EARLY_INIT_F #define CONFIG_DISPLAY_CPUINFO
@@ -93,8 +95,12 @@* leaving the correct space for initial global data structure above * that address while providing maximum stack area below. */ +#ifdef CONFIG_SPL_BUILD +#define CONFIG_SYS_INIT_SP_ADDR (16 * 1024) +#else # define CONFIG_SYS_INIT_SP_ADDR \ (ATMEL_BASE_SRAM1 + 0x1000 - GENERATED_GBL_DATA_SIZE) +#endif /* NAND flash */ #ifdef CONFIG_CMD_NAND
@@ -172,7 +178,6 @@#define CONFIG_SPL_FRAMEWORK #define CONFIG_SPL_TEXT_BASE 0x0#define CONFIG_SPL_MAX_SIZE (11 * 1024) -#define CONFIG_SPL_STACK (16 * 1024)#define CONFIG_SPL_BSS_START_ADDR CONFIG_SPL_MAX_SIZE#define CONFIG_SPL_BSS_MAX_SIZE (3 * 1024)
Signature · 1 line
2.3.0.rc0
PATCH 1/1 ARM: atmel: at91sam9m10g45ek: enable SPL
Hi Bo,
just a short review, more will follow this weekend.
Quoted 49 lines · Bo Shen
Supports boot up from NAND flash with software ECC eanbled. And supports boot up from SD/MMC card with FAT file system.
As the boot from SD/MMC card with FAT file system, the BSS segment is too big to fit into SRAM, so, use the lds to put it into SDRAM. So, we need to initialize the SDRAM as soon as possible. Borrow the low level init code from <
arm/arm/cpu/armv7/lowlevel_init.S> for this purpose.As there is a little change, which need lowlevel init, so also change taurus board based on at91sam9260, corvus board based on at91sam9g45.
(CONFIG_SPL_STACKis replaced byCONFIG_SYS_INIT_SP_ADDR)Signed-off-by Bo Shen <[email protected]>---
arch/arm/Kconfig | 1 + arch/arm/cpu/arm926ejs/at91/Makefile | 4 ++ arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S | 37 ++++++++++++ arch/arm/cpu/at91-common/spl_at91.c | 7 +-- arch/arm/cpu/at91-common/u-boot-spl-arm9.lds | 48 +++++++++++++++ board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c | 80 +++++++++++++++++++++++++ configs/at91sam9m10g45ek_mmc_defconfig | 5 +- configs/at91sam9m10g45ek_nandflash_defconfig | 5 +- include/configs/at91sam9m10g45ek.h | 65 ++++++++++++++++++++ include/configs/corvus.h | 7 ++- include/configs/taurus.h | 7 ++- 11 files changed, 256 insertions(+), 10 deletions(-) create mode 100644 arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S create mode 100644 arch/arm/cpu/at91-common/u-boot-spl-arm9.ldsarch/arm/Kconfig +1
-0@@ -141,6 +141,7 @@ config TARGET_AT91SAM9263EK config TARGET_AT91SAM9M10G45EK bool "Support at91sam9m10g45ek" select CPU_ARM926EJS + select SUPPORT_SPL config TARGET_AT91SAM9N12EK bool "Support at91sam9n12ek"arch/arm/cpu/arm926ejs/at91/Makefile +0
-0
arch/arm/cpu/arm926ejs/at91/Makefile obj-y += reset.o · line 33
Quoted 9 lines
arch/arm/cpu/arm926ejs/at91/Makefile +4
-0@@ -25,5 +25,9 @@ obj-y += reset.o obj-y += timer.o ifndef CONFIG_SKIP_LOWLEVEL_INIT +ifdef CONFIG_SPL_BUILD +obj-y += spl_lowlevel_init.o +else obj-y += lowlevel_init.o endif +endif
I'm fine with having two variants of lowlevel_init for a time, but we should consolidate this and use C-style initialisation of SDRAM and stuff for the other armv5 at91 devices in future. AFAIK the a/a/c/arm926ejs/at91/lowlevel_init.S is mainly used for NOR Flash boots, so using the SPL code (but not necessarily the two binary mechanism) for the NOR Flash boots in future is appreciated.
Quoted 21 lines
arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S new file +15
-0@@ -0,0 +1,37 @@ +/* + * A lowlevel_init function that sets up the stack to call a C function to + * perform further init. + * + * (C) Copyright 2010 + * Texas Instruments, <www.ti.com> + * + * Author : + * Aneesh V <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <asm-offsets.h> +#include <config.h>
arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S line 25
Quoted 10 lines
arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S new file +10
-0+#include <linux/linkage.h> + +ENTRY(lowlevel_init) + /* + * Setup a temporary stack + */ + ldr sp, =CONFIG_SYS_INIT_SP_ADDR + bic sp, sp, #7 /* 8-byte alignment for ABI compliance */ + + ldr r9, =gdata
I remember some patches removing the SPL gdata stuff, is that true?
arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S line 37
Quoted 12 lines
arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S new file +12
-0+ + /* + * Save the old lr(passed in ip) and the current lr to stack + */ + push {ip, lr} + + /* + * go setup pll, mux, memory + */ + bl s_init + pop {ip, pc} +ENDPROC(lowlevel_init)
Rest of this patch will be reviewed later.
Best regards
Andreas Bie?mann
PATCH 1/1 ARM: atmel: at91sam9m10g45ek: enable SPL
Hi Andreas,
Quoted 56 lines · Andreas Bie?mann
Hi Bo,
just a short review, more will follow this weekend.
Quoted 51 lines · Bo Shen
Supports boot up from NAND flash with software ECC eanbled. And supports boot up from SD/MMC card with FAT file system.
As the boot from SD/MMC card with FAT file system, the BSS segment is too big to fit into SRAM, so, use the lds to put it into SDRAM. So, we need to initialize the SDRAM as soon as possible. Borrow the low level init code from <
arm/arm/cpu/armv7/lowlevel_init.S> for this purpose.As there is a little change, which need lowlevel init, so also change taurus board based on at91sam9260, corvus board based on at91sam9g45.
(CONFIG_SPL_STACKis replaced byCONFIG_SYS_INIT_SP_ADDR)Signed-off-by Bo Shen <[email protected]>---
arch/arm/Kconfig | 1 + arch/arm/cpu/arm926ejs/at91/Makefile | 4 ++ arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S | 37 ++++++++++++ arch/arm/cpu/at91-common/spl_at91.c | 7 +-- arch/arm/cpu/at91-common/u-boot-spl-arm9.lds | 48 +++++++++++++++ board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c | 80 +++++++++++++++++++++++++ configs/at91sam9m10g45ek_mmc_defconfig | 5 +- configs/at91sam9m10g45ek_nandflash_defconfig | 5 +- include/configs/at91sam9m10g45ek.h | 65 ++++++++++++++++++++ include/configs/corvus.h | 7 ++- include/configs/taurus.h | 7 ++- 11 files changed, 256 insertions(+), 10 deletions(-)create mode 100644
arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.Screate mode 100644arch/arm/cpu/at91-common/u-boot-spl-arm9.ldsarch/arm/Kconfig +1
-0@@ -141,6 +141,7 @@ config TARGET_AT91SAM9263EK config TARGET_AT91SAM9M10G45EK bool "Support at91sam9m10g45ek" select CPU_ARM926EJS + select SUPPORT_SPL config TARGET_AT91SAM9N12EK bool "Support at91sam9n12ek"arch/arm/cpu/arm926ejs/at91/Makefile +0
-0@@ -25,5 +25,9 @@ obj-y += reset.o obj-y += timer.o
Quoted 14 lines
arch/arm/cpu/arm926ejs/at91/Makefile obj-y += reset.o · line 33
Quoted 7 lines
arch/arm/cpu/arm926ejs/at91/Makefile +4
-0ifndef CONFIG_SKIP_LOWLEVEL_INIT +ifdef CONFIG_SPL_BUILD +obj-y += spl_lowlevel_init.o +else obj-y += lowlevel_init.o endif +endifI'm fine with having two variants of
lowlevel_initfor a time, but we should consolidate this and use C-style initialisation of SDRAM and stuff for the other armv5 at91 devices in future. AFAIK thea/a/c/arm926ejs/at91/lowlevel_init.Sis mainly used for NOR Flash boots, so using the SPL code (but not necessarily the two binary mechanism) for the NOR Flash boots in future is appreciated.
OK, when all the arm9 at91 related board has SPL support, then I will do this.
Quoted 25 lines
Quoted 25 lines
arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S new file +19
-0@@ -0,0 +1,37 @@ +/* + * A lowlevel_init function that sets up the stack to call a C function to + * perform further init. + * + * (C) Copyright 2010 + * Texas Instruments, <www.ti.com> + * + * Author : + * Aneesh V <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <asm-offsets.h> +#include <config.h> +#include <linux/linkage.h> + +ENTRY(lowlevel_init) + /*
Quoted 8 lines
arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S line 25
Quoted 6 lines
arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S new file +6
-0+ * Setup a temporary stack + */ + ldr sp, =CONFIG_SYS_INIT_SP_ADDR + bic sp, sp, #7 /* 8-byte alignment for ABI compliance */ + + ldr r9, =gdataI remember some patches removing the SPL gdata stuff, is that true?
Thanks.
Yes, just search for it, the following patch do this.
http://patchwork.ozlabs.org/patch/423789/ (arm: Reduce the scope of lowlevel_init())
Quoted 6 lines
Quoted 6 lines
arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S new file +6
-0+ + /* + * Save the old lr(passed in ip) and the current lr to stack + */ + push {ip, lr} +
Quoted 8 lines
arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S line 37
Quoted 6 lines
arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S new file +6
-0+ /* + * go setup pll, mux, memory + */ + bl s_init + pop {ip, pc} +ENDPROC(lowlevel_init)Rest of this patch will be reviewed later.
Thanks.
Quoted 4 lines
Best regards
Andreas Bie?mann
Best Regards,
Bo Shen
PATCH 1/1 ARM: atmel: at91sam9m10g45ek: enable SPL
Hi Bo,
Quoted 23 lines · Bo Shen
Quoted 7 lines · Andreas Bie?mann
Quoted 5 lines · Bo Shen
arch/arm/cpu/arm926ejs/at91/Makefile +0
-0@@ -25,5 +25,9 @@ obj-y += reset.o obj-y += timer.oQuoted 14 lines
arch/arm/cpu/arm926ejs/at91/Makefile obj-y += reset.o · line 33
Quoted 7 lines
arch/arm/cpu/arm926ejs/at91/Makefile +4
-0ifndef CONFIG_SKIP_LOWLEVEL_INIT +ifdef CONFIG_SPL_BUILD +obj-y += spl_lowlevel_init.o +else obj-y += lowlevel_init.o endif +endifI'm fine with having two variants of
lowlevel_initfor a time, but we should consolidate this and use C-style initialisation of SDRAM and stuff for the other armv5 at91 devices in future. AFAIK thea/a/c/arm926ejs/at91/lowlevel_init.Sis mainly used for NOR Flash boots, so using the SPL code (but not necessarily the two binary mechanism) for the NOR Flash boots in future is appreciated.
Quoted 2 lines
OK, when all the arm9 at91 related board has SPL support, then I will do this.
Can we achieve this in this MW?
Quoted 11 lines
Quoted 10 lines
arch/arm/cpu/arm926ejs/at91/Makefile
Quoted 8 lines
arch/arm/cpu/arm926ejs/at91/Makefile +8
-0+ENTRY(lowlevel_init) + /* + * Setup a temporary stack + */ + ldr sp, =CONFIG_SYS_INIT_SP_ADDR + bic sp, sp, #7 /* 8-byte alignment for ABI compliance */ + + ldr r9, =gdataI remember some patches removing the SPL gdata stuff, is that true?
Quoted 5 lines
Thanks.
Yes, just search for it, the following patch do this.
http://patchwork.ozlabs.org/patch/423789/ (arm: Reduce the scope oflowlevel_init())
I think we should use the function provided there. What do you think?
Best regards
Andreas Bie?mann
PATCH 1/1 ARM: atmel: at91sam9m10g45ek: enable SPL
Hi Andreas,
Quoted 26 lines · Andreas Bie?mann
Hi Bo,
Quoted 23 lines · Bo Shen
Quoted 21 lines · Andreas Bie?mann
arch/arm/cpu/arm926ejs/at91/Makefile obj-y += reset.o · line 33
Quoted 12 lines · Bo Shen
arch/arm/cpu/arm926ejs/at91/Makefile +4
-0@@ -25,5 +25,9 @@ obj-y += reset.o obj-y += timer.o ifndef CONFIG_SKIP_LOWLEVEL_INIT +ifdef CONFIG_SPL_BUILD +obj-y += spl_lowlevel_init.o +else obj-y += lowlevel_init.o endif +endifI'm fine with having two variants of
lowlevel_initfor a time, but we should consolidate this and use C-style initialisation of SDRAM and stuff for the other armv5 at91 devices in future. AFAIK thea/a/c/arm926ejs/at91/lowlevel_init.Sis mainly used for NOR Flash boots, so using the SPL code (but not necessarily the two binary mechanism) for the NOR Flash boots in future is appreciated.
Quoted 4 lines
Quoted 2 lines
OK, when all the arm9 at91 related board has SPL support, then I will do this.
Can we achieve this in this MW?
I will try, but not sure. As I don't have this kind of board :( I need to check whether we still have this kind of board.
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
arch/arm/cpu/arm926ejs/at91/Makefile
Quoted 8 lines
arch/arm/cpu/arm926ejs/at91/Makefile +8
-0+ENTRY(lowlevel_init) + /* + * Setup a temporary stack + */ + ldr sp, =CONFIG_SYS_INIT_SP_ADDR + bic sp, sp, #7 /* 8-byte alignment for ABI compliance */ + + ldr r9, =gdataI remember some patches removing the SPL gdata stuff, is that true?
Quoted 7 lines
Quoted 5 lines
Thanks.
Yes, just search for it, the following patch do this.
http://patchwork.ozlabs.org/patch/423789/ (arm: Reduce the scope oflowlevel_init())I think we should use the function provided there. What do you think?
OK. I will do it in next version.
Thanks.
Quoted 4 lines
Best regards
Andreas Bie?mann
Best Regards,
Bo Shen
PATCH 1/1 ARM: atmel: at91sam9m10g45ek: enable SPL
Hello Bo,
added Simon to cc ...
Am 19.01.2015 02:41, schrieb Bo Shen:
Quoted 50 lines
Hi Andreas,
Quoted 26 lines · Andreas Bie?mann
Hi Bo,
Quoted 23 lines · Bo Shen
Quoted 21 lines · Andreas Bie?mann
arch/arm/cpu/arm926ejs/at91/Makefile obj-y += reset.o · line 33
Quoted 12 lines · Bo Shen
arch/arm/cpu/arm926ejs/at91/Makefile +4
-0@@ -25,5 +25,9 @@ obj-y += reset.o obj-y += timer.o ifndef CONFIG_SKIP_LOWLEVEL_INIT +ifdef CONFIG_SPL_BUILD +obj-y += spl_lowlevel_init.o +else obj-y += lowlevel_init.o endif +endifI'm fine with having two variants of
lowlevel_initfor a time, but we should consolidate this and use C-style initialisation of SDRAM and stuff for the other armv5 at91 devices in future. AFAIK thea/a/c/arm926ejs/at91/lowlevel_init.Sis mainly used for NOR Flash boots, so using the SPL code (but not necessarily the two binary mechanism) for the NOR Flash boots in future is appreciated.Quoted 4 lines
Quoted 2 lines
OK, when all the arm9 at91 related board has SPL support, then I will do this.
Can we achieve this in this MW?
I will try, but not sure. As I don't have this kind of board :( I need to check whether we still have this kind of board.
Quoted 13 lines
Quoted 13 lines
Quoted 10 lines
arch/arm/cpu/arm926ejs/at91/Makefile
Quoted 8 lines
arch/arm/cpu/arm926ejs/at91/Makefile +8
-0+ENTRY(lowlevel_init) + /* + * Setup a temporary stack + */ + ldr sp, =CONFIG_SYS_INIT_SP_ADDR + bic sp, sp, #7 /* 8-byte alignment for ABI compliance */ + + ldr r9, =gdataI remember some patches removing the SPL gdata stuff, is that true?
Thanks.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Yes, just search for it, the following patch do this.
http://patchwork.ozlabs.org/patch/423789/ (arm: Reduce the scope oflowlevel_init())I think we should use the function provided there. What do you think?
OK. I will do it in next version.
Thanks.
Hmm... looking into this patch [1] ... it says:
+ * Call the very early init function. This should do only the
+ * absolute bare minimum to get started. It should not:
+ *
+ * - set up DRAM
+ * - use global_data
+ * - clear BSS
+ * - try to start a console
but if we have small init ram for SPL (like on the sam9260 with 4k sram) we should init here SDRAM, so we could set bss and stack into RAM in board_init_f, which is called after this function.
So we should rework the comment here ... or?
bye,
Heiko
[1] http://patchwork.ozlabs.org/patch/423789/
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 1/1 ARM: atmel: at91sam9m10g45ek: enable SPL
Hi Heiko,
Quoted 53 lines · Heiko Schocher
Hello Bo,
added Simon to cc ...
Am 19.01.2015 02:41, schrieb Bo Shen:
Quoted 47 lines
Hi Andreas,
Quoted 34 lines · Andreas Bie?mann
Hi Bo,
Quoted 30 lines · Bo Shen
Quoted 26 lines · Andreas Bie?mann
arch/arm/cpu/arm926ejs/at91/Makefile obj-y += reset.o · line 33
Quoted 12 lines · Bo Shen
arch/arm/cpu/arm926ejs/at91/Makefile +4
-0@@ -25,5 +25,9 @@ obj-y += reset.o obj-y += timer.o ifndef CONFIG_SKIP_LOWLEVEL_INIT +ifdef CONFIG_SPL_BUILD +obj-y += spl_lowlevel_init.o +else obj-y += lowlevel_init.o endif +endifI'm fine with having two variants of
lowlevel_initfor a time, but we should consolidate this and use C-style initialisation of SDRAM and stuff for the other armv5 at91 devices in future. AFAIK thea/a/c/arm926ejs/at91/lowlevel_init.Sis mainly used for NOR Flash boots,
so using the SPL code (but not necessarily the two binary mechanism) for
the NOR Flash boots in future is appreciated.Quoted 5 lines
Quoted 2 lines
OK, when all the arm9 at91 related board has SPL support, then I will do this.
Can we achieve this in this MW?
I will try, but not sure. As I don't have this kind of board :( I need to check whether we still have this kind of board.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
arch/arm/cpu/arm926ejs/at91/Makefile
Quoted 8 lines
arch/arm/cpu/arm926ejs/at91/Makefile +8
-0+ENTRY(lowlevel_init) + /* + * Setup a temporary stack + */ + ldr sp, =CONFIG_SYS_INIT_SP_ADDR + bic sp, sp, #7 /* 8-byte alignment for ABI compliance */ + + ldr r9, =gdata
Please don't use 'gdata', we are trying to get rid of it throughout U-Boot in the next week or so. The global_data pointer is managed by crt0.S. You cannot use it in lowlevel_init.
Quoted 29 lines
Quoted 12 lines
Quoted 12 lines
Quoted 10 lines
Quoted 3 lines
I remember some patches removing the SPL gdata stuff, is that true?
Thanks.
Yes, just search for it, the following patch do this.
http://patchwork.ozlabs.org/patch/423789/ (arm: Reduce the scope oflowlevel_init())Quoted 5 lines
Quoted 1 line
I think we should use the function provided there. What do you think?
OK. I will do it in next version.
Thanks.Hmm... looking into this patch [1] ... it says:
(quoted diff) +7
-0+ * Call the very early init function. This should do only the + * absolute bare minimum to get started. It should not: + * + * - set up DRAM + * - use global_data + * - clear BSS + * - try to start a console
Quoted 3 lines
but if we have small init ram for SPL (like on the sam9260 with 4k sram) we should init here SDRAM, so we could set bss and stack into RAM in
board_init_f, which is called after this function.
I don't see any need to init DRAM before board_init_f(). What is needed here?
Also I believe board_init_f() should not touch BSS in SPL (as with U-Boot proper).
Quoted 6 lines
So we should rework the comment here ... or?
bye,
Heiko
[1] http://patchwork.ozlabs.org/patch/423789/
Regards,
Simon
PATCH 1/1 ARM: atmel: at91sam9m10g45ek: enable SPL
In reply to Bo ShenHello Bo
Am 16.01.2015 03:53, schrieb Bo Shen:
Quoted 29 lines
Supports boot up from NAND flash with software ECC eanbled. And supports boot up from SD/MMC card with FAT file system.
As the boot from SD/MMC card with FAT file system, the BSS segment is too big to fit into SRAM, so, use the lds to put it into SDRAM. So, we need to initialize the SDRAM as soon as possible. Borrow the low level init code from <
arm/arm/cpu/armv7/lowlevel_init.S> for this purpose.As there is a little change, which need lowlevel init, so also change taurus board based on at91sam9260, corvus board based on at91sam9g45.
(CONFIG_SPL_STACKis replaced byCONFIG_SYS_INIT_SP_ADDR)Signed-off-by Bo Shen <[email protected]>---
arch/arm/Kconfig | 1 + arch/arm/cpu/arm926ejs/at91/Makefile | 4 ++ arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S | 37 ++++++++++++ arch/arm/cpu/at91-common/spl_at91.c | 7 +-- arch/arm/cpu/at91-common/u-boot-spl-arm9.lds | 48 +++++++++++++++ board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c | 80 +++++++++++++++++++++++++ configs/at91sam9m10g45ek_mmc_defconfig | 5 +- configs/at91sam9m10g45ek_nandflash_defconfig | 5 +- include/configs/at91sam9m10g45ek.h | 65 ++++++++++++++++++++ include/configs/corvus.h | 7 ++- include/configs/taurus.h | 7 ++- 11 files changed, 256 insertions(+), 10 deletions(-)
Quoted 2 lines
create mode 100644
arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.Screate mode 100644arch/arm/cpu/at91-common/u-boot-spl-arm9.lds
but it does not boot on the corvus board ... please add this fix to your patch:
include/configs/corvus.h +1 -1
@@ -90,7 +90,7 @@#define CONFIG_SYS_SDRAM_SIZE 0x08000000#ifdef CONFIG_SPL_BUILD -#define CONFIG_SYS_INIT_SP_ADDR 0x310000 +#define CONFIG_SYS_INIT_SP_ADDR (16 * 1024)#else #define CONFIG_SYS_INIT_SP_ADDR \ (CONFIG_SYS_SDRAM_BASE + 4 * 1024 - GENERATED_GBL_DATA_SIZE)
Tested your patch also on the taurus board, there it boots fine!
so, after you fixed the corvus board, you can add my:
Thanks! And one question ...
[...]
Quoted 18 lines
arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S new file +12
-0@@ -0,0 +1,37 @@ +/* + * A lowlevel_init function that sets up the stack to call a C function to + * perform further init. + * + * (C) Copyright 2010 + * Texas Instruments, <www.ti.com> + * + * Author : + * Aneesh V <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + */
arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S line 22
Quoted 10 lines
arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S new file +10
-0+ +#include <asm-offsets.h> +#include <config.h> +#include <linux/linkage.h> + +ENTRY(lowlevel_init) + /* + * Setup a temporary stack + */ + ldr sp, =CONFIG_SYS_INIT_SP_ADDR
Could we use here a new define (saying CONFIG_SYS_INIT_SP_LOWLEVEL)?
Benefit would be, we can setup first the stack in sram, and after RAM init, which is done with your patch very early, we can set the stack with CONFIG_SYS_INIT_SP_ADDR into RAM!
With using CONFIG_SYS_INIT_SP_ADDR here, the stack gets set twice to CONFIG_SYS_INIT_SP_ADDR ... I just try to get SPL on an atsam9260 based board working with only 4k sram ... so it would be nice to have stack also optionally in RAM ... but we have problems with the debugger adapter on the board ... so I have to wait some more days to try this part ...
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 1/1 ARM: atmel: at91sam9m10g45ek: enable SPL
Hi Heiko,
Quoted 37 lines · Heiko Schocher
Hello Bo
Am 16.01.2015 03:53, schrieb Bo Shen:
Quoted 31 lines
Supports boot up from NAND flash with software ECC eanbled. And supports boot up from SD/MMC card with FAT file system.
As the boot from SD/MMC card with FAT file system, the BSS segment is too big to fit into SRAM, so, use the lds to put it into SDRAM. So, we need to initialize the SDRAM as soon as possible. Borrow the low level init code from <
arm/arm/cpu/armv7/lowlevel_init.S> for this purpose.As there is a little change, which need lowlevel init, so also change taurus board based on at91sam9260, corvus board based on at91sam9g45.
(CONFIG_SPL_STACKis replaced byCONFIG_SYS_INIT_SP_ADDR)Signed-off-by Bo Shen <[email protected]>---
arch/arm/Kconfig | 1 + arch/arm/cpu/arm926ejs/at91/Makefile | 4 ++ arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S | 37 ++++++++++++ arch/arm/cpu/at91-common/spl_at91.c | 7 +-- arch/arm/cpu/at91-common/u-boot-spl-arm9.lds | 48 +++++++++++++++ board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c | 80 +++++++++++++++++++++++++ configs/at91sam9m10g45ek_mmc_defconfig | 5 +- configs/at91sam9m10g45ek_nandflash_defconfig | 5 +- include/configs/at91sam9m10g45ek.h | 65 ++++++++++++++++++++ include/configs/corvus.h | 7 ++- include/configs/taurus.h | 7 ++- 11 files changed, 256 insertions(+), 10 deletions(-)Quoted 2 lines
create mode 100644
arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.Screate mode 100644arch/arm/cpu/at91-common/u-boot-spl-arm9.lds
Quoted 1 line
Acked-by Heiko Schocher <[email protected]>
Thanks.
Quoted 18 lines
but it does not boot on the corvus board ... please add this fix to your patch:
include/configs/corvus.h +1
-1@@ -90,7 +90,7 @@#define CONFIG_SYS_SDRAM_SIZE 0x08000000#ifdef CONFIG_SPL_BUILD -#define CONFIG_SYS_INIT_SP_ADDR 0x310000 +#define CONFIG_SYS_INIT_SP_ADDR (16 * 1024)#else #define CONFIG_SYS_INIT_SP_ADDR \ (CONFIG_SYS_SDRAM_BASE + 4 * 1024 - GENERATED_GBL_DATA_SIZE)
Quoted 4 lines
Tested your patch also on the taurus board, there it boots fine!
so, after you fixed the corvus board, you can add my:
Tested-by Heiko Schocher <[email protected]>
Thanks, I will add this fix into next version.
Quoted 40 lines
Thanks! And one question ...
[...]
Quoted 20 lines
arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S new file +2
-0@@ -0,0 +1,37 @@ +/* + * A lowlevel_init function that sets up the stack to call a Cfunction to
+ * perform further init.
+ *
+ * (C) Copyright 2010
+ * Texas Instruments, <www.ti.com>
+ *
+ * Author :
+ * Aneesh V <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S
Quoted 10 lines
arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S new file +10
-0+ +#include <asm-offsets.h> +#include <config.h> +#include <linux/linkage.h> + +ENTRY(lowlevel_init) + /* + * Setup a temporary stack + */ + ldr sp, =CONFIG_SYS_INIT_SP_ADDRCould we use here a new define (saying
CONFIG_SYS_INIT_SP_LOWLEVEL)?Benefit would be, we can setup first the stack in sram, and after RAM init, which is done with your patch very early, we can set the stack with
CONFIG_SYS_INIT_SP_ADDRinto RAM!
Quoted 6 lines
With using
CONFIG_SYS_INIT_SP_ADDRhere, the stack gets set twice toCONFIG_SYS_INIT_SP_ADDR... I just try to get SPL on an atsam9260 based board working with only 4k sram ... so it would be nice to have stack also optionally in RAM ... but we have problems with the debugger adapter on the board ... so I have to wait some more days to try this part ...
This just for the at91sam9260 based boards, not for others. Or else,
we also need to add this definition for other boards. Can you do the following check?
#ifdef CONFIG_SYS_INIT_SP_LOWLEVEL
ldr sp, =CONFIG_SYS_INIT_SP_LOWLEVEL
#else
ldr sp, =CONFIG_SYS_INIT_SP_ADDR
#endif
If it is acceptable, can you add through your patches, as I my patch
nowhere will use it.
Quoted 2 lines
bye,
Heiko
Best Regards,
Bo Shen
PATCH 1/1 ARM: atmel: at91sam9m10g45ek: enable SPL
Hello Bo,
Am 19.01.2015 02:38, schrieb Bo Shen:
Quoted 62 lines
Hi Heiko,
Quoted 37 lines · Heiko Schocher
Hello Bo
Am 16.01.2015 03:53, schrieb Bo Shen:
Quoted 31 lines
Supports boot up from NAND flash with software ECC eanbled. And supports boot up from SD/MMC card with FAT file system.
As the boot from SD/MMC card with FAT file system, the BSS segment is too big to fit into SRAM, so, use the lds to put it into SDRAM. So, we need to initialize the SDRAM as soon as possible. Borrow the low level init code from <
arm/arm/cpu/armv7/lowlevel_init.S> for this purpose.As there is a little change, which need lowlevel init, so also change taurus board based on at91sam9260, corvus board based on at91sam9g45.
(CONFIG_SPL_STACKis replaced byCONFIG_SYS_INIT_SP_ADDR)Signed-off-by Bo Shen <[email protected]>---
arch/arm/Kconfig | 1 + arch/arm/cpu/arm926ejs/at91/Makefile | 4 ++ arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S | 37 ++++++++++++ arch/arm/cpu/at91-common/spl_at91.c | 7 +-- arch/arm/cpu/at91-common/u-boot-spl-arm9.lds | 48 +++++++++++++++ board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c | 80 +++++++++++++++++++++++++ configs/at91sam9m10g45ek_mmc_defconfig | 5 +- configs/at91sam9m10g45ek_nandflash_defconfig | 5 +- include/configs/at91sam9m10g45ek.h | 65 ++++++++++++++++++++ include/configs/corvus.h | 7 ++- include/configs/taurus.h | 7 ++- 11 files changed, 256 insertions(+), 10 deletions(-)Quoted 2 lines
create mode 100644
arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.Screate mode 100644arch/arm/cpu/at91-common/u-boot-spl-arm9.ldsQuoted 1 line
Acked-by Heiko Schocher <[email protected]>Thanks.
Quoted 18 lines
but it does not boot on the corvus board ... please add this fix to your patch:
include/configs/corvus.h +1
-1@@ -90,7 +90,7 @@#define CONFIG_SYS_SDRAM_SIZE 0x08000000#ifdef CONFIG_SPL_BUILD -#define CONFIG_SYS_INIT_SP_ADDR 0x310000 +#define CONFIG_SYS_INIT_SP_ADDR (16 * 1024)#else #define CONFIG_SYS_INIT_SP_ADDR \ (CONFIG_SYS_SDRAM_BASE + 4 * 1024 - GENERATED_GBL_DATA_SIZE)
Quoted 6 lines
Quoted 4 lines
Tested your patch also on the taurus board, there it boots fine!
so, after you fixed the corvus board, you can add my:
Tested-by Heiko Schocher <[email protected]>Thanks, I will add this fix into next version.
Thanks!
Quoted 49 lines
Quoted 40 lines
Thanks! And one question ...
[...]
Quoted 20 lines
arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S new file +2
-0@@ -0,0 +1,37 @@ +/* + * A lowlevel_init function that sets up the stack to call a Cfunction to
+ * perform further init.
+ *
+ * (C) Copyright 2010
+ * Texas Instruments, <www.ti.com>
+ *
+ * Author :
+ * Aneesh V <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S
Quoted 10 lines
arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S new file +10
-0+ +#include <asm-offsets.h> +#include <config.h> +#include <linux/linkage.h> + +ENTRY(lowlevel_init) + /* + * Setup a temporary stack + */ + ldr sp, =CONFIG_SYS_INIT_SP_ADDRCould we use here a new define (saying
CONFIG_SYS_INIT_SP_LOWLEVEL)?Benefit would be, we can setup first the stack in sram, and after RAM init, which is done with your patch very early, we can set the stack with
CONFIG_SYS_INIT_SP_ADDRinto RAM!Quoted 6 lines
With using
CONFIG_SYS_INIT_SP_ADDRhere, the stack gets set twice toCONFIG_SYS_INIT_SP_ADDR... I just try to get SPL on an atsam9260 based board working with only 4k sram ... so it would be nice to have stack also optionally in RAM ... but we have problems with the debugger adapter on the board ... so I have to wait some more days to try this part ...This just for the at91sam9260 based boards, not for others. Or else, we also need to add this definition for other boards. Can you do the following check?
Quoted 7 lines
#ifdef
CONFIG_SYS_INIT_SP_LOWLEVEL
ldr sp, =CONFIG_SYS_INIT_SP_LOWLEVEL
#else
ldr sp, =CONFIG_SYS_INIT_SP_ADDR
#endifIf it is acceptable, can you add through your patches, as I my patch nowhere will use it.
Or we check if "CONFIG_SYS_INIT_SP_LOWLEVEL" is defined, if not we set default to:
#define CONFIG_SYS_INIT_SP_LOWLEVEL CONFIG_SYS_INIT_SP_ADDR
so, something like:
arch/arm/cpu/arm926ejs/at91/spl_lowlevel_init.S +5 -1
@@ -15,11 +15,15 @@ #include <config.h> #include <linux/linkage.h> +#ifndef CONFIG_SYS_INIT_SP_ADDR_LOWLEVEL +#define CONFIG_SYS_INIT_SP_ADDR_LOWLEVEL CONFIG_SYS_INIT_SP_ADDR +#endif + ENTRY(lowlevel_init) /* * Setup a temporary stack */ - ldr sp, =CONFIG_SYS_INIT_SP_ADDR + ldr sp, =CONFIG_SYS_INIT_SP_ADDR_LOWLEVEL bic sp, sp, #7 /* 8-byte alignment for ABI compliance */ ldr r9, =gdata
so we do not need to adapt existing boards, just add an entry in README, that we have such a possibility now for at91 boards ...
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany