Re: [U-Boot] [PATCH v5 8/8] nand: mxc: Switch NAND SPL to generic SPL
Hi Stefano, On Saturday, February 9, 2013 5:38:26 PM, Benoît Thébaudeau wrote: On Saturday, February 9, 2013 2:53:44 PM, Benoît Thébaudeau wrote: On Saturday, February 9, 2013 12:47:25 AM, Benoît Thébaudeau wrote: On Friday, February 8, 2013 11:49:27 PM, Benoît Thébaudeau wrote: Subject: [PATCH v5 8/8] nand: mxc: Switch NAND SPL to generic SPL Signed-off-by: Benoît Thébaudeau benoit.thebaud...@advansee.com --- Changes in v5: - Remove spaces between function name and open parenthesis. - Fix mx31pdk and tx25 Makefile-s and SPL linker scripts. - Remove the useless definition of CONFIG_SPL_LDSCRIPT. - Fix the call to nand_boot(). Changes in v4: - New patch. Changes in v3: None Changes in v2: None This is now supposed to be working and compile-tested. Custodians, please review and advise. Board maintainers, please test. Tell me if I should split away some stuff. Should doc/README.arm-relocation be updated, and how since tx25 no longer uses NAND SPL, which is also deprecated? Note that mx31pdk and tx25 had been broken by commit e05e5de7fae5bec79617e113916dac6631251156. After this commit, for those boards, _main called board_init_f, which called relocate_code, which unexpectedly (for their users) returned to nowhere in ctr0.S instead of calling nand_boot. Also, crt0.S calls nand_boot if CONFIG_SPL_BUILD is not defined but CONFIG_NAND_SPL is, which is not normal for NAND SPL. Other NAND SPL boards may be broken too, but that's not too much of an issue since they are supposed to migrate to generic SPL. I am also wondering if board_init_f should not be moved out of mxc_nand_spl.c to either board/lowlevel_init.S or board/board.c. That would make mxc_nand_spl.c more generic if for some reason a board needs to do specific things. Any opinion? For the start.S files, since it's not possible to know from CONFIG_SPL_BUILD and CONFIG_NAND_SPL if relocate_code is needed or not, I see the following choices: 1) Let it defined in all cases. It's quite small, so it won't hurt much. 2) Create a specific SPL #define (e.g. CONFIG_SPL_RELOCATE_CODE) to define it for generic SPL only if needed. 3) Just create a specific linker section for it so that it's automatically garbage-collected if unneeded. Any opinion? I'm also considering to factorize relocate_code to crt0.S. There's not really a good reason for it to be depending on each ARM processor. Any opinion? FYI, I will post soon a v6 with a lot of cleanup. Best regards, Benoît ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v5 8/8] nand: mxc: Switch NAND SPL to generic SPL
On 12/02/2013 14:45, Benoît Thébaudeau wrote: Hi Stefano, I'm also considering to factorize relocate_code to crt0.S. There's not really a good reason for it to be depending on each ARM processor. Any opinion? FYI, I will post soon a v6 with a lot of cleanup. Ok, thanks. Stefano -- = DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de = ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v5 8/8] nand: mxc: Switch NAND SPL to generic SPL
On Sunday, February 10, 2013 1:02:58 AM, Benoît Thébaudeau wrote: Dear Marek Vasut, On Sunday, February 10, 2013 12:24:04 AM, Marek Vasut wrote: Dear Benoît Thébaudeau, On Saturday, February 9, 2013 2:53:44 PM, Benoît Thébaudeau wrote: On Saturday, February 9, 2013 12:47:25 AM, Benoît Thébaudeau wrote: On Friday, February 8, 2013 11:49:27 PM, Benoît Thébaudeau wrote: Subject: [PATCH v5 8/8] nand: mxc: Switch NAND SPL to generic SPL Signed-off-by: Benoît Thébaudeau benoit.thebaud...@advansee.com --- Changes in v5: - Remove spaces between function name and open parenthesis. - Fix mx31pdk and tx25 Makefile-s and SPL linker scripts. - Remove the useless definition of CONFIG_SPL_LDSCRIPT. - Fix the call to nand_boot(). Changes in v4: - New patch. Changes in v3: None Changes in v2: None This is now supposed to be working and compile-tested. Custodians, please review and advise. Board maintainers, please test. Tell me if I should split away some stuff. Should doc/README.arm-relocation be updated, and how since tx25 no longer uses NAND SPL, which is also deprecated? Note that mx31pdk and tx25 had been broken by commit e05e5de7fae5bec79617e113916dac6631251156. After this commit, for those boards, _main called board_init_f, which called relocate_code, which unexpectedly (for their users) returned to nowhere in ctr0.S instead of calling nand_boot. Also, crt0.S calls nand_boot if CONFIG_SPL_BUILD is not defined but CONFIG_NAND_SPL is, which is not normal for NAND SPL. Other NAND SPL boards may be broken too, but that's not too much of an issue since they are supposed to migrate to generic SPL. I am also wondering if board_init_f should not be moved out of mxc_nand_spl.c to either board/lowlevel_init.S or board/board.c. That would make mxc_nand_spl.c more generic if for some reason a board needs to do specific things. Any opinion? For the start.S files, since it's not possible to know from CONFIG_SPL_BUILD and CONFIG_NAND_SPL if relocate_code is needed or not, I see the following choices: 1) Let it defined in all cases. It's quite small, so it won't hurt much. 2) Create a specific SPL #define (e.g. CONFIG_SPL_RELOCATE_CODE) to define it for generic SPL only if needed. 3) Just create a specific linker section for it so that it's automatically garbage-collected if unneeded. Any opinion? How much of start.S can be actually rewritten in pure-C ? I would say only relocate_code(). Apart from this function, start.S only deals with preprocessor register accesses and IRQ / exception handling that require assembly. s/preprocessor/coprocessor/ As to relocate_code(), it would still be tricky in pure C because it mixes absolute addresses with position-independent code and data accesses, so one would have to be very careful about the C coding of this function in order to avoid a dependency on compiler choices. Having it written in assembly guarantees a correct result and emphasizes the absolute/relative access constraints for easier maintenance. But this is only my opinion. Best regards, Benoît ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v5 8/8] nand: mxc: Switch NAND SPL to generic SPL
On Saturday, February 9, 2013 12:47:25 AM, Benoît Thébaudeau wrote: On Friday, February 8, 2013 11:49:27 PM, Benoît Thébaudeau wrote: Subject: [PATCH v5 8/8] nand: mxc: Switch NAND SPL to generic SPL Signed-off-by: Benoît Thébaudeau benoit.thebaud...@advansee.com --- Changes in v5: - Remove spaces between function name and open parenthesis. - Fix mx31pdk and tx25 Makefile-s and SPL linker scripts. - Remove the useless definition of CONFIG_SPL_LDSCRIPT. - Fix the call to nand_boot(). Changes in v4: - New patch. Changes in v3: None Changes in v2: None This is now supposed to be working and compile-tested. Custodians, please review and advise. Board maintainers, please test. Tell me if I should split away some stuff. Should doc/README.arm-relocation be updated, and how since tx25 no longer uses NAND SPL, which is also deprecated? Note that mx31pdk and tx25 had been broken by commit e05e5de7fae5bec79617e113916dac6631251156. After this commit, for those boards, _main called board_init_f, which called relocate_code, which unexpectedly (for their users) returned to nowhere in ctr0.S instead of calling nand_boot. Also, crt0.S calls nand_boot if CONFIG_SPL_BUILD is not defined but CONFIG_NAND_SPL is, which is not normal for NAND SPL. Other NAND SPL boards may be broken too, but that's not too much of an issue since they are supposed to migrate to generic SPL. I am also wondering if board_init_f should not be moved out of mxc_nand_spl.c to either board/lowlevel_init.S or board/board.c. That would make mxc_nand_spl.c more generic if for some reason a board needs to do specific things. Any opinion? For the start.S files, since it's not possible to know from CONFIG_SPL_BUILD and CONFIG_NAND_SPL if relocate_code is needed or not, I see the following choices: 1) Let it defined in all cases. It's quite small, so it won't hurt much. 2) Create a specific SPL #define (e.g. CONFIG_SPL_RELOCATE_CODE) to define it for generic SPL only if needed. 3) Just create a specific linker section for it so that it's automatically garbage-collected if unneeded. Any opinion? Best regards, Benoît ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v5 8/8] nand: mxc: Switch NAND SPL to generic SPL
On Saturday, February 9, 2013 2:53:44 PM, Benoît Thébaudeau wrote: On Saturday, February 9, 2013 12:47:25 AM, Benoît Thébaudeau wrote: On Friday, February 8, 2013 11:49:27 PM, Benoît Thébaudeau wrote: Subject: [PATCH v5 8/8] nand: mxc: Switch NAND SPL to generic SPL Signed-off-by: Benoît Thébaudeau benoit.thebaud...@advansee.com --- Changes in v5: - Remove spaces between function name and open parenthesis. - Fix mx31pdk and tx25 Makefile-s and SPL linker scripts. - Remove the useless definition of CONFIG_SPL_LDSCRIPT. - Fix the call to nand_boot(). Changes in v4: - New patch. Changes in v3: None Changes in v2: None This is now supposed to be working and compile-tested. Custodians, please review and advise. Board maintainers, please test. Tell me if I should split away some stuff. Should doc/README.arm-relocation be updated, and how since tx25 no longer uses NAND SPL, which is also deprecated? Note that mx31pdk and tx25 had been broken by commit e05e5de7fae5bec79617e113916dac6631251156. After this commit, for those boards, _main called board_init_f, which called relocate_code, which unexpectedly (for their users) returned to nowhere in ctr0.S instead of calling nand_boot. Also, crt0.S calls nand_boot if CONFIG_SPL_BUILD is not defined but CONFIG_NAND_SPL is, which is not normal for NAND SPL. Other NAND SPL boards may be broken too, but that's not too much of an issue since they are supposed to migrate to generic SPL. I am also wondering if board_init_f should not be moved out of mxc_nand_spl.c to either board/lowlevel_init.S or board/board.c. That would make mxc_nand_spl.c more generic if for some reason a board needs to do specific things. Any opinion? For the start.S files, since it's not possible to know from CONFIG_SPL_BUILD and CONFIG_NAND_SPL if relocate_code is needed or not, I see the following choices: 1) Let it defined in all cases. It's quite small, so it won't hurt much. 2) Create a specific SPL #define (e.g. CONFIG_SPL_RELOCATE_CODE) to define it for generic SPL only if needed. 3) Just create a specific linker section for it so that it's automatically garbage-collected if unneeded. Any opinion? I'm also considering to factorize relocate_code to crt0.S. There's not really a good reason for it to be depending on each ARM processor. Any opinion? Best regards, Benoît ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v5 8/8] nand: mxc: Switch NAND SPL to generic SPL
Dear Benoît Thébaudeau, On Saturday, February 9, 2013 2:53:44 PM, Benoît Thébaudeau wrote: On Saturday, February 9, 2013 12:47:25 AM, Benoît Thébaudeau wrote: On Friday, February 8, 2013 11:49:27 PM, Benoît Thébaudeau wrote: Subject: [PATCH v5 8/8] nand: mxc: Switch NAND SPL to generic SPL Signed-off-by: Benoît Thébaudeau benoit.thebaud...@advansee.com --- Changes in v5: - Remove spaces between function name and open parenthesis. - Fix mx31pdk and tx25 Makefile-s and SPL linker scripts. - Remove the useless definition of CONFIG_SPL_LDSCRIPT. - Fix the call to nand_boot(). Changes in v4: - New patch. Changes in v3: None Changes in v2: None This is now supposed to be working and compile-tested. Custodians, please review and advise. Board maintainers, please test. Tell me if I should split away some stuff. Should doc/README.arm-relocation be updated, and how since tx25 no longer uses NAND SPL, which is also deprecated? Note that mx31pdk and tx25 had been broken by commit e05e5de7fae5bec79617e113916dac6631251156. After this commit, for those boards, _main called board_init_f, which called relocate_code, which unexpectedly (for their users) returned to nowhere in ctr0.S instead of calling nand_boot. Also, crt0.S calls nand_boot if CONFIG_SPL_BUILD is not defined but CONFIG_NAND_SPL is, which is not normal for NAND SPL. Other NAND SPL boards may be broken too, but that's not too much of an issue since they are supposed to migrate to generic SPL. I am also wondering if board_init_f should not be moved out of mxc_nand_spl.c to either board/lowlevel_init.S or board/board.c. That would make mxc_nand_spl.c more generic if for some reason a board needs to do specific things. Any opinion? For the start.S files, since it's not possible to know from CONFIG_SPL_BUILD and CONFIG_NAND_SPL if relocate_code is needed or not, I see the following choices: 1) Let it defined in all cases. It's quite small, so it won't hurt much. 2) Create a specific SPL #define (e.g. CONFIG_SPL_RELOCATE_CODE) to define it for generic SPL only if needed. 3) Just create a specific linker section for it so that it's automatically garbage-collected if unneeded. Any opinion? How much of start.S can be actually rewritten in pure-C ? Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v5 8/8] nand: mxc: Switch NAND SPL to generic SPL
Dear Marek Vasut, On Sunday, February 10, 2013 12:24:04 AM, Marek Vasut wrote: Dear Benoît Thébaudeau, On Saturday, February 9, 2013 2:53:44 PM, Benoît Thébaudeau wrote: On Saturday, February 9, 2013 12:47:25 AM, Benoît Thébaudeau wrote: On Friday, February 8, 2013 11:49:27 PM, Benoît Thébaudeau wrote: Subject: [PATCH v5 8/8] nand: mxc: Switch NAND SPL to generic SPL Signed-off-by: Benoît Thébaudeau benoit.thebaud...@advansee.com --- Changes in v5: - Remove spaces between function name and open parenthesis. - Fix mx31pdk and tx25 Makefile-s and SPL linker scripts. - Remove the useless definition of CONFIG_SPL_LDSCRIPT. - Fix the call to nand_boot(). Changes in v4: - New patch. Changes in v3: None Changes in v2: None This is now supposed to be working and compile-tested. Custodians, please review and advise. Board maintainers, please test. Tell me if I should split away some stuff. Should doc/README.arm-relocation be updated, and how since tx25 no longer uses NAND SPL, which is also deprecated? Note that mx31pdk and tx25 had been broken by commit e05e5de7fae5bec79617e113916dac6631251156. After this commit, for those boards, _main called board_init_f, which called relocate_code, which unexpectedly (for their users) returned to nowhere in ctr0.S instead of calling nand_boot. Also, crt0.S calls nand_boot if CONFIG_SPL_BUILD is not defined but CONFIG_NAND_SPL is, which is not normal for NAND SPL. Other NAND SPL boards may be broken too, but that's not too much of an issue since they are supposed to migrate to generic SPL. I am also wondering if board_init_f should not be moved out of mxc_nand_spl.c to either board/lowlevel_init.S or board/board.c. That would make mxc_nand_spl.c more generic if for some reason a board needs to do specific things. Any opinion? For the start.S files, since it's not possible to know from CONFIG_SPL_BUILD and CONFIG_NAND_SPL if relocate_code is needed or not, I see the following choices: 1) Let it defined in all cases. It's quite small, so it won't hurt much. 2) Create a specific SPL #define (e.g. CONFIG_SPL_RELOCATE_CODE) to define it for generic SPL only if needed. 3) Just create a specific linker section for it so that it's automatically garbage-collected if unneeded. Any opinion? How much of start.S can be actually rewritten in pure-C ? I would say only relocate_code(). Apart from this function, start.S only deals with preprocessor register accesses and IRQ / exception handling that require assembly. As to relocate_code(), it would still be tricky in pure C because it mixes absolute addresses with position-independent code and data accesses, so one would have to be very careful about the C coding of this function in order to avoid a dependency on compiler choices. Having it written in assembly guarantees a correct result and emphasizes the absolute/relative access constraints for easier maintenance. But this is only my opinion. Best regards, Benoît ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v5 8/8] nand: mxc: Switch NAND SPL to generic SPL
Signed-off-by: Benoît Thébaudeau benoit.thebaud...@advansee.com --- Changes in v5: - Remove spaces between function name and open parenthesis. - Fix mx31pdk and tx25 Makefile-s and SPL linker scripts. - Remove the useless definition of CONFIG_SPL_LDSCRIPT. - Fix the call to nand_boot(). Changes in v4: - New patch. Changes in v3: None Changes in v2: None Makefile |3 + arch/arm/cpu/arm1136/config.mk |3 - arch/arm/cpu/arm1136/start.S |2 - arch/arm/cpu/arm926ejs/start.S |9 +- board/freescale/mx31pdk/Makefile |4 + board/freescale/mx31pdk/config.mk |5 -- .../freescale/mx31pdk/u-boot-spl.lds | 20 +++-- board/karo/tx25/Makefile |5 +- board/karo/tx25/config.mk |5 -- .../u-boot.lds = board/karo/tx25/u-boot-spl.lds | 16 ++-- boards.cfg |2 +- drivers/mtd/nand/Makefile |1 + drivers/mtd/nand/mxc_nand.c| 10 +-- include/fsl_nfc.h = drivers/mtd/nand/mxc_nand.h | 10 +-- .../mtd/nand/mxc_nand_spl.c| 26 +++--- include/common.h |6 +- include/configs/mx31pdk.h | 10 ++- include/configs/tx25.h | 13 ++- include/configs/woodburn_sd.h |1 + nand_spl/board/freescale/mx31pdk/Makefile | 68 --- nand_spl/board/karo/tx25/Makefile | 89 nand_spl/board/karo/tx25/config.mk |1 - 22 files changed, 87 insertions(+), 222 deletions(-) delete mode 100644 board/freescale/mx31pdk/config.mk rename nand_spl/board/karo/tx25/u-boot.lds = board/freescale/mx31pdk/u-boot-spl.lds (86%) delete mode 100644 board/karo/tx25/config.mk rename nand_spl/board/freescale/mx31pdk/u-boot.lds = board/karo/tx25/u-boot-spl.lds (89%) rename include/fsl_nfc.h = drivers/mtd/nand/mxc_nand.h (98%) rename nand_spl/nand_boot_fsl_nfc.c = drivers/mtd/nand/mxc_nand_spl.c (92%) delete mode 100644 nand_spl/board/freescale/mx31pdk/Makefile delete mode 100644 nand_spl/board/karo/tx25/Makefile delete mode 100644 nand_spl/board/karo/tx25/config.mk diff --git a/Makefile b/Makefile index d28e608..cc2298a 100644 --- a/Makefile +++ b/Makefile @@ -470,6 +470,9 @@ $(obj)u-boot.img: $(obj)u-boot.bin $(OBJTREE)/u-boot.imx : $(obj)u-boot.bin $(SUBDIR_TOOLS) depend $(MAKE) -C $(SRCTREE)/arch/arm/imx-common $@ +$(OBJTREE)/SPL : $(obj)spl/u-boot-spl.bin depend + $(MAKE) -C $(SRCTREE)/arch/arm/imx-common $@ + $(obj)u-boot.kwb: $(obj)u-boot.bin $(obj)tools/mkimage -n $(CONFIG_SYS_KWD_CONFIG) -T kwbimage \ -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) -d $ $@ diff --git a/arch/arm/cpu/arm1136/config.mk b/arch/arm/cpu/arm1136/config.mk index 9092d91..efee0d1 100644 --- a/arch/arm/cpu/arm1136/config.mk +++ b/arch/arm/cpu/arm1136/config.mk @@ -31,6 +31,3 @@ PLATFORM_CPPFLAGS += -march=armv5 # = PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT) -ifdef CONFIG_SPL_BUILD -ALL-y += $(OBJTREE)/SPL -endif diff --git a/arch/arm/cpu/arm1136/start.S b/arch/arm/cpu/arm1136/start.S index a067b8a..3818768 100644 --- a/arch/arm/cpu/arm1136/start.S +++ b/arch/arm/cpu/arm1136/start.S @@ -235,8 +235,6 @@ fixnext: add r2, r2, #8 /* each rel.dyn entry is 8 bytes */ cmp r2, r3 blo fixloop - bx lr - #endif relocate_done: diff --git a/arch/arm/cpu/arm926ejs/start.S b/arch/arm/cpu/arm926ejs/start.S index 66a8b65..dee45f7 100644 --- a/arch/arm/cpu/arm926ejs/start.S +++ b/arch/arm/cpu/arm926ejs/start.S @@ -140,6 +140,10 @@ _TEXT_BASE: _bss_start_ofs: .word __bss_start - _start +.global_image_copy_end_ofs +_image_copy_end_ofs: + .word __image_copy_end - _start + .globl _bss_end_ofs _bss_end_ofs: .word __bss_end__ - _start @@ -196,7 +200,6 @@ reset: /*--*/ -#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_NAND_SPL) /* * void relocate_code (addr_sp, gd, addr_moni) * @@ -216,7 +219,7 @@ relocate_code: moveq r9, #0 /* no relocation. offset(r9) = 0 */ beq relocate_done /* skip relocation */ mov r1, r6 /* r1 - scratch for copy loop */ - ldr r3, _bss_start_ofs + ldr r3, _image_copy_end_ofs add r2, r0, r3 /* r2 - source end address */ copy_loop: @@ -270,6 +273,8 @@
Re: [U-Boot] [PATCH v5 8/8] nand: mxc: Switch NAND SPL to generic SPL
On Friday, February 8, 2013 11:49:27 PM, Benoît Thébaudeau wrote: Subject: [PATCH v5 8/8] nand: mxc: Switch NAND SPL to generic SPL Signed-off-by: Benoît Thébaudeau benoit.thebaud...@advansee.com --- Changes in v5: - Remove spaces between function name and open parenthesis. - Fix mx31pdk and tx25 Makefile-s and SPL linker scripts. - Remove the useless definition of CONFIG_SPL_LDSCRIPT. - Fix the call to nand_boot(). Changes in v4: - New patch. Changes in v3: None Changes in v2: None This is now supposed to be working and compile-tested. Custodians, please review and advise. Board maintainers, please test. Tell me if I should split away some stuff. Should doc/README.arm-relocation be updated, and how since tx25 no longer uses NAND SPL, which is also deprecated? Note that mx31pdk and tx25 had been broken by commit e05e5de7fae5bec79617e113916dac6631251156. After this commit, for those boards, _main called board_init_f, which called relocate_code, which unexpectedly (for their users) returned to nowhere in ctr0.S instead of calling nand_boot. Also, crt0.S calls nand_boot if CONFIG_SPL_BUILD is not defined but CONFIG_NAND_SPL is, which is not normal for NAND SPL. Other NAND SPL boards may be broken too, but that's not too much of an issue since they are supposed to migrate to generic SPL. Best regards, Benoît ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot