Commit 6609916efb74724e53db368dd48bfb290d4d9f4c
Committed by
York Sun
1 parent
76356eb57c
Exists in
master
and in
49 other branches
powerpc:mpc85xx: Add ifc nand boot support for TPL/SPL
Using the TPL method for nand boot by sram was already supported. Here add some code for mpc85xx ifc nand boot. - For ifc, elbc, esdhc, espi, all need the SPL without section .resetvec. - Use a clear function name for nand spl boot. - Add CONFIG_SPL_DRIVERS_MISC_SUPPORT to compile the fsl_ifc.c in spl/Makefile; Signed-off-by: Po Liu <Po.Liu@freescale.com> Acked-by: Scott Wood <scottwood@freescale.com> Reviewed-by: York Sun <yorksun@freescale.com>
Showing 4 changed files with 34 additions and 14 deletions Side-by-side Diff
arch/powerpc/cpu/mpc85xx/u-boot-spl.lds
... | ... | @@ -57,7 +57,14 @@ |
57 | 57 | . = ALIGN(8); |
58 | 58 | __init_begin = .; |
59 | 59 | __init_end = .; |
60 | -/* FIXME for non-NAND SPL */ | |
60 | + | |
61 | +/* For ifc, elbc, esdhc, espi, all need the SPL without section .resetvec */ | |
62 | +#ifdef CONFIG_SYS_MPC85XX_NO_RESETVEC | |
63 | + .bootpg ADDR(.text) - 0x1000 : | |
64 | + { | |
65 | + KEEP(*(.bootpg)) | |
66 | + } :text = 0xffff | |
67 | +#else | |
61 | 68 | #if defined(CONFIG_FSL_IFC) /* Restrict bootpg at 4K boundry for IFC */ |
62 | 69 | .bootpg ADDR(.text) + 0x1000 : |
63 | 70 | { |
... | ... | @@ -69,12 +76,6 @@ |
69 | 76 | #else |
70 | 77 | #error unknown NAND controller |
71 | 78 | #endif |
72 | -#ifdef CONFIG_SYS_MPC85XX_NO_RESETVEC | |
73 | - .bootpg ADDR(.text) - 0x1000 : | |
74 | - { | |
75 | - KEEP(*(.bootpg)) | |
76 | - } :text = 0xffff | |
77 | -#else | |
78 | 79 | .resetvec ADDR(.text) + RESET_VECTOR_OFFSET : { |
79 | 80 | KEEP(*(.resetvec)) |
80 | 81 | } = 0xffff |
doc/README.SPL
... | ... | @@ -62,6 +62,7 @@ |
62 | 62 | CONFIG_SPL_LIBGENERIC_SUPPORT (lib/libgeneric.o) |
63 | 63 | CONFIG_SPL_POWER_SUPPORT (drivers/power/libpower.o) |
64 | 64 | CONFIG_SPL_NAND_SUPPORT (drivers/mtd/nand/libnand.o) |
65 | +CONFIG_SPL_DRIVERS_MISC_SUPPORT (drivers/misc) | |
65 | 66 | CONFIG_SPL_DMA_SUPPORT (drivers/dma/libdma.o) |
66 | 67 | CONFIG_SPL_POST_MEM_SUPPORT (post/drivers/memory.o) |
67 | 68 | CONFIG_SPL_NAND_LOAD (drivers/mtd/nand/nand_spl_load.o) |
drivers/mtd/nand/fsl_ifc_spl.c
... | ... | @@ -88,7 +88,11 @@ |
88 | 88 | return __raw_readw((u16 *)marker) != 0xffff; |
89 | 89 | } |
90 | 90 | |
91 | -static void nand_load(unsigned int offs, int uboot_size, uchar *dst) | |
91 | +#ifdef CONFIG_TPL_BUILD | |
92 | +int nand_spl_load_image(uint32_t offs, unsigned int uboot_size, void *vdst) | |
93 | +#else | |
94 | +static int nand_load(uint32_t offs, unsigned int uboot_size, void *vdst) | |
95 | +#endif | |
92 | 96 | { |
93 | 97 | struct fsl_ifc *ifc = IFC_BASE_ADDR; |
94 | 98 | uchar *buf = (uchar *)CONFIG_SYS_NAND_BASE; |
... | ... | @@ -105,6 +109,7 @@ |
105 | 109 | |
106 | 110 | int sram_addr; |
107 | 111 | int pg_no; |
112 | + uchar *dst = vdst; | |
108 | 113 | |
109 | 114 | /* Get NAND Flash configuration */ |
110 | 115 | csor = CONFIG_SYS_NAND_CSOR; |
111 | 116 | |
... | ... | @@ -208,9 +213,20 @@ |
208 | 213 | offs += page_size; |
209 | 214 | } while ((offs & (blk_size - 1)) && (pos < uboot_size)); |
210 | 215 | } |
216 | + | |
217 | + return 0; | |
211 | 218 | } |
212 | 219 | |
213 | 220 | /* |
221 | + * Defines a static function nand_load_image() here, because non-static makes | |
222 | + * the code too large for certain SPLs(minimal SPL, maximum size <= 4Kbytes) | |
223 | + */ | |
224 | +#ifndef CONFIG_TPL_BUILD | |
225 | +#define nand_spl_load_image(offs, uboot_size, vdst) \ | |
226 | + nand_load(offs, uboot_size, vdst) | |
227 | +#endif | |
228 | + | |
229 | +/* | |
214 | 230 | * Main entrypoint for NAND Boot. It's necessary that SDRAM is already |
215 | 231 | * configured and available since this code loads the main U-boot image |
216 | 232 | * from NAND into SDRAM and starts from there. |
217 | 233 | |
218 | 234 | |
... | ... | @@ -221,16 +237,17 @@ |
221 | 237 | /* |
222 | 238 | * Load U-Boot image from NAND into RAM |
223 | 239 | */ |
224 | - nand_load(CONFIG_SYS_NAND_U_BOOT_OFFS, CONFIG_SYS_NAND_U_BOOT_SIZE, | |
225 | - (uchar *)CONFIG_SYS_NAND_U_BOOT_DST); | |
240 | + nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS, | |
241 | + CONFIG_SYS_NAND_U_BOOT_SIZE, | |
242 | + (uchar *)CONFIG_SYS_NAND_U_BOOT_DST); | |
226 | 243 | |
227 | 244 | #ifdef CONFIG_NAND_ENV_DST |
228 | - nand_load(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE, | |
229 | - (uchar *)CONFIG_NAND_ENV_DST); | |
245 | + nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE, | |
246 | + (uchar *)CONFIG_NAND_ENV_DST); | |
230 | 247 | |
231 | 248 | #ifdef CONFIG_ENV_OFFSET_REDUND |
232 | - nand_load(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE, | |
233 | - (uchar *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE); | |
249 | + nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE, | |
250 | + (uchar *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE); | |
234 | 251 | #endif |
235 | 252 | #endif |
236 | 253 | /* |
spl/Makefile
... | ... | @@ -72,6 +72,7 @@ |
72 | 72 | LIBS-$(CONFIG_SPL_POWER_SUPPORT) += drivers/power/ \ |
73 | 73 | drivers/power/pmic/ |
74 | 74 | LIBS-$(if $(CONFIG_CMD_NAND),$(CONFIG_SPL_NAND_SUPPORT)) += drivers/mtd/nand/ |
75 | +LIBS-$(CONFIG_SPL_DRIVERS_MISC_SUPPORT) += drivers/misc/ | |
75 | 76 | LIBS-$(CONFIG_SPL_ONENAND_SUPPORT) += drivers/mtd/onenand/ |
76 | 77 | LIBS-$(CONFIG_SPL_DMA_SUPPORT) += drivers/dma/ |
77 | 78 | LIBS-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/ |