B4860QDS: Add support of 2 stage NAND boot loader
RFC 5/5 B4860QDS: Add support of 2 stage NAND boot loader
Add support of 2 stage NAND boot loader using SPL framework.
here, PBL initialise the internal SRAM and copy SPL(96K). This further initialise DDR using SPD and environment and copy u-boot(512 kb) from NAND to DDR. Finally SPL transer control to u-boot.
Initialise/create followings required for SPL framework
- Add spl.c which defines board_init_f, board_init_r
- update tlb and ddr accordingly
---
This is a prototype done on B4860.It has 512K internal RAM. We only configured SRAM as 256K and made sure only 128KB is used throught SPL execution.
board/freescale/b4860qds/Makefile | 7 +- board/freescale/b4860qds/ddr.c | 6 +- board/freescale/b4860qds/spl.c | 128 +++++++++++++++++++++++++++++++++++++ board/freescale/b4860qds/tlb.c | 10 +++ boards.cfg | 2 +- include/configs/B4860QDS.h | 58 +++++++++++++++-- 6 files changed, 203 insertions(+), 8 deletions(-) create mode 100644 board/freescale/b4860qds/spl.c
board/freescale/b4860qds/Makefile +6 -1
@@ -8,10 +8,15 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).o +ifdef CONFIG_SPL_BUILD +COBJS-y += spl.o +endif +ifndef CONFIG_SPL_BUILD COBJS-y += $(BOARD).o -COBJS-y += ddr.o COBJS-$(CONFIG_B4860QDS)+= eth_b4860qds.o COBJS-$(CONFIG_PCI) += pci.o +endif +COBJS-y += ddr.o COBJS-y += law.o COBJS-y += tlb.o
board/freescale/b4860qds/ddr.c +5 -1
@@ -181,12 +181,16 @@ phys_size_t initdram(int board_type)puts ("Initializing....using SPD\n" ); +#ifdef CONFIG_SPL_BUILD dram_size =fsl_ddr_sdram (); dram_size =setup_ddr_tlbs (dram_size /0x100000 ); dram_size *=0x100000 ; -puts (" DDR: " ); +#else +puts ("DDR has been initialised by pre loader\n" ); + dram_size =0x80000000 ; +#endif return dram_size; }
board/freescale/b4860qds/spl.c new file +128 -0
128 lines not on this page · raw message
board/freescale/b4860qds/tlb.c +10 -0
@@ -62,6 +62,7 @@ struct fsl_e_tlb_entry tlb_table[] = { MAS3_SX|MAS3_SR, MAS2_W|MAS2_G, 0, 2, BOOKE_PAGESZ_256M, 1), +#ifndef CONFIG_SPL_BUILD /* *I*G* - PCI */ SET_TLB_ENTRY(1, CONFIG_SYS_PCIE1_MEM_VIRT, CONFIG_SYS_PCIE1_MEM_PHYS, MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
@@ -96,6 +97,7 @@ struct fsl_e_tlb_entry tlb_table[] = { MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, 0, 9, BOOKE_PAGESZ_16M, 1),#endif +#endif #ifdef CONFIG_SYS_DCSRBAR_PHYS SET_TLB_ENTRY(1, CONFIG_SYS_DCSRBAR, CONFIG_SYS_DCSRBAR_PHYS, MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
@@ -118,6 +120,7 @@ struct fsl_e_tlb_entry tlb_table[] = {* entry 14 and 15 has been used hard coded, they will be disabled * in cpu_init_f, so we use entry 16 for SRIO2. */ +#ifndef CONFIG_SPL_BUILD #ifdef CONFIG_SYS_SRIO1_MEM_PHYS /* *I*G* - SRIO1 */ SET_TLB_ENTRY(1, CONFIG_SYS_SRIO1_MEM_VIRT, CONFIG_SYS_SRIO1_MEM_PHYS,
@@ -140,6 +143,13 @@ struct fsl_e_tlb_entry tlb_table[] = { MAS3_SX|MAS3_SW|MAS3_SR, MAS2_G, 0, 17, BOOKE_PAGESZ_1M, 1),#endif +#endif + +#if defined(CONFIG_RAMBOOT_PBL ) && !defined(CONFIG_SPL_BUILD ) +SET_TLB_ENTRY (1 ,CONFIG_SYS_DDR_SDRAM_BASE ,CONFIG_SYS_DDR_SDRAM_BASE , +MAS3_SX |MAS3_SW |MAS3_SR ,0 , + 0, 17, BOOKE_PAGESZ_2G, 1) +#endif };int num_tlb_entries =ARRAY_SIZE (tlb_table);
boards.cfg +1 -1
@@ -950,7 +950,7 @@ T4160QDS powerpc mpc85xx t4qds freesca T4160QDS_SDCARD powerpc mpc85xx t4qds freescale - T4240QDS:PPC_T4160,RAMBOOT_PBL,SDCARD,SYS_TEXT_BASE=0xFFF80000 T4160QDS_SPIFLASH powerpc mpc85xx t4qds freescale - T4240QDS:PPC_T4160,RAMBOOT_PBL,SPIFLASH,SYS_TEXT_BASE=0xFFF80000 B4860QDS powerpc mpc85xx b4860qds freescale - B4860QDS:PPC_B4860 -B4860QDS_NAND powerpc mpc85xx b4860qds freescale - B4860QDS:PPC_B4860,RAMBOOT_PBL,NAND,SYS_TEXT_BASE=0xFFF80000 +B4860QDS_NAND powerpc mpc85xx b4860qds freescale - B4860QDS:PPC_B4860,RAMBOOT_PBL,NAND B4860QDS_SPIFLASH powerpc mpc85xx b4860qds freescale - B4860QDS:PPC_B4860,RAMBOOT_PBL,SPIFLASH,SYS_TEXT_BASE=0xFFF80000 B4860QDS_SRIO_PCIE_BOOT powerpc mpc85xx b4860qds freescale - B4860QDS:PPC_B4860,SRIO_PCIE_BOOT_SLAVE,SYS_TEXT_BASE=0xFFF80000 B4420QDS powerpc mpc85xx b4860qds freescale - B4860QDS:PPC_B4420
include/configs/B4860QDS.h +53 -5
104 lines not on this page · raw message
Signature · 1 line
1.7.9.5
RFC 5/5 B4860QDS: Add support of 2 stage NAND boot loader
Dear Prabhakar Kushwaha,
Quoted 4 lines · Prabhakar Kushwaha <prabhakar <at> freescale.com> writes:
Add support of 2 stage NAND boot loader using SPL framework. here, PBL initialise the internal SRAM and copy SPL(96K). This further initialise DDR using SPD and environment and copy u-boot(512 kb) from NAND
to DDR.
Quoted 1 line
Finally SPL transer control to u-boot.
These are just some quick comments after a build test and a quick code review.
The environment is latest with some patches from patchworks.
1) Your code does not build with
http://patchwork.ozlabs.org/patch/274193/
powerpc-linux-objcopy --gap-fill=0xff -O binary /export/home/git.denx.de/local/obj-B4860QDS_NAND/u-boot /export/home/git.denx.de/local/obj-B4860QDS_NAND/u-boot.bin
/export/home/git.denx.de/local/obj-B4860QDS_NAND/tools/mkimage -n \
-R -T pblimage \
-d /export/home/git.denx.de/local/obj-B4860QDS_NAND/u-boot.bin /export/home//git.denx.de/local/obj-B4860QDS_NAND/u-boot.pbl Error:-R - Can't open
make: *** [/export/home/git.denx.de/local/obj-B4860QDS_NAND/u-boot.pbl] Error 1
You mention you use the PBL... but probably not a pblimage. The patch correctly fixes RAMBOOT_PBL as a trigger to generate the pblimage (u- boot.pbl) but there seems to be no RCW or PBI file defined.
2) Use the new SPDX identifiers
http://patchwork.ozlabs.org/patch/261356/
This was mainlined a few revisions ago.
3) Watch out for the new boards.cfg layout
I have one question, can this scenario be implemented on a P5040? i.e. simulate that CPC is around 128Kb and load u-boot via SPL? Now all corenet processors seem to only support pblimage booting.
All the best,
Rommel
RFC 5/5 B4860QDS: Add support of 2 stage NAND boot loader
Thanks Rommel for checking this patch.
Please find my reply in-lined
Quoted 23 lines · Rommel Custodio
Dear Prabhakar Kushwaha,
Quoted 3 lines · Prabhakar Kushwaha <prabhakar <at> freescale.com> writes:
Add support of 2 stage NAND boot loader using SPL framework. here, PBL initialise the internal SRAM and copy SPL(96K). This further initialise DDR using SPD and environment and copy u-boot(512 kb) from NAND
to DDR.
Quoted 1 line
Finally SPL transer control to u-boot.
These are just some quick comments after a build test and a quick code review.
The environment is latest with some patches from patchworks.1) Your code does not build with
http://patchwork.ozlabs.org/patch/274193/powerpc-linux-objcopy --gap-fill=0xff -O binary /export/home/git.denx.de/local/obj-B4860QDS_NAND/u-boot /export/home/git.denx.de/local/obj-B4860QDS_NAND/u-boot.bin
/export/home/git.denx.de/local/obj-B4860QDS_NAND/tools/mkimage -n \ -R -T pblimage \ -d /export/home/git.denx.de/local/obj-B4860QDS_NAND/u-
Quoted 8 lines
boot.bin /export/home//git.denx.de/local/obj-B4860QDS_NAND/u-boot.pbl Error:-R - Can't open
make: *** [/export/home/git.denx.de/local/obj-B4860QDS_NAND/u-boot.pbl] Error 1You mention you use the PBL... but probably not a pblimage. The patch correctly fixes
RAMBOOT_PBLas a trigger to generate the pblimage (u- boot.pbl) but there seems to be no RCW or PBI file defined.
B4860 does support PBL based NAND boot.
but I have yet to integrate u-boot-spl.bin to generated u-boot-spl.pbl. This is in my TODO list
Quoted 3 lines
2) Use the new SPDX identifiers
http://patchwork.ozlabs.org/patch/261356/
Sure
Quoted 6 lines
This was mainlined a few revisions ago.
3) Watch out for the new boards.cfg layout
I will take care of it while providing the patch.
Quoted 4 lines
I have one question, can this scenario be implemented on a P5040? i.e. simulate that CPC is around 128Kb and load u-boot via SPL? Now all corenet processors seem to only support pblimage booting.
yes. This scenario can be implemented for P5040. Only need to create spl.c file + define constants.
Thanks,
Prabhakar
RFC 5/5 B4860QDS: Add support of 2 stage NAND boot loader
Dear Prabhakar Kushwaha,
Quoted 2 lines · Prabhakar Kushwaha <prabhakar <at> freescale.com> writes:
Quoted 2 lines
<snipped>
Thank you for the replies.
Quoted 7 lines
Quoted 3 lines
You mention you use the PBL... but probably not a pblimage. The patch correctly fixes
RAMBOOT_PBLas a trigger to generate the pblimage (u- boot.pbl) but there seems to be no RCW or PBI file defined.B4860 does support PBL based NAND boot.
but I have yet to integrate u-boot-spl.bin to generated u-boot-spl.pbl. This is in my TODO list
This is my understanding (if need be, take it with a grain of salt)
The Makefiles need to be modified so that SPL build will create a pblimage. The "mkimage pblimage" needs to be executed only on the SPL binary. Then the top-level Makefile proceeds in concatenating the u-boot-spl.bin (now a pblimage) and u-boot.bin.
Quoted 2 lines
Quoted 2 lines
I have one question, can this scenario be implemented on a P5040? i.e. simulate that CPC is around 128Kb and load u-boot via SPL? Now all
corenet
Quoted 5 lines
Quoted 2 lines
processors seem to only support pblimage booting.
yes. This scenario can be implemented for P5040. Only need to create
spl.cfile + define constants.
Seems easy enough :-) though I probably don't have the resources to actually implement it.
Just a note. The pblimage booting is not very flexible now. Currently it assumes that u-boot.pbl will fit into CPC (configured as SRAM). This is OK for most processors (i.e P5040 with 1Mb CPC) but it will not work for others (i.e T1040/1042 with only 256Kb CPC). So there is a need to have SPL in this case.
All the best,
Rommel
RFC 5/5 B4860QDS: Add support of 2 stage NAND boot loader
Quoted 14 lines · Rommel Custodio
Dear Prabhakar Kushwaha,
Quoted 1 line · Prabhakar Kushwaha <prabhakar <at> freescale.com> writes:
Quoted 1 line
<snipped>
Thank you for the replies.
Quoted 6 lines
Quoted 3 lines
You mention you use the PBL... but probably not a pblimage. The patch correctly fixes
RAMBOOT_PBLas a trigger to generate the pblimage (u- boot.pbl) but there seems to be no RCW or PBI file defined.B4860 does support PBL based NAND boot.
but I have yet to integrate u-boot-spl.bin to generated u-boot-spl.pbl. This is in my TODO list
Quoted 7 lines
This is my understanding (if need be, take it with a grain of salt)
The Makefiles need to be modified so that SPL build will create a pblimage. The "mkimage pblimage" needs to be executed only on the SPL binary. Then the top-level
Makefileproceeds in concatenating the u-boot-spl.bin (now a pblimage) and u-boot.bin.
yes. This is my next plan.
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
I have one question, can this scenario be implemented on a P5040? i.e. simulate that CPC is around 128Kb and load u-boot via SPL? Now all
corenet
Quoted 4 lines
Quoted 2 lines
processors seem to only support pblimage booting.
yes. This scenario can be implemented for P5040. Only need to create
spl.cfile + define constants.
Quoted 10 lines
Seems easy enough :-) though I probably don't have the resources to actually implement it.
Just a note. The pblimage booting is not very flexible now. Currently it assumes that u-boot.pbl will fit into CPC (configured as SRAM). This is OK for most processors (i.e P5040 with 1Mb CPC) but it will not work for others (i.e T1040/1042 with only 256Kb CPC). So there is a need to have SPL in this case.
Me along with others are owner of T1040 platform. This whole exercise is done for T1040 & future soc which may have < 512K CPC. Once base patch of T1040QDS has been accepted(already in review state). I will send a patch set to add support of 2 Stage boot loader.
Regards,
Prabhakar