Commit c9e1f58818c2e6ac13296406125e43775c4daa55

Authored by Ying Zhang
Committed by York Sun
1 parent 27585bd357

powerpc: p1010rdb: Enable p1010rdb to start from NAND/SD/SPI flash with SPL

In the previous patches, we introduced the SPL/TPL fraamework.
For SD/SPI flash booting way, we introduce the SPL to enable a loader stub. The
SPL was loaded by the code from the internal on-chip ROM. The SPL initializes
the DDR according to the SPD and loads the final uboot image into DDR, then
jump to the DDR to begin execution.

For NAND booting way, the nand SPL has size limitation on some board(e.g.
P1010RDB), it can not be more than 8KB, we can call it "minimal SPL", So the
dynamic DDR driver doesn't fit into this minimum SPL. We added the TPL that is
loaded by the the minimal SPL. The TPL initializes the DDR according to the SPD
and loads the final uboot image into DDR,then jump to the DDR to begin execution.

This patch enabled SPL/TPL for P1010RDB to support starting from NAND/SD/SPI
flash with SPL framework and initializing the DDR according to SPD in the SPL/TPL.
Because the minimal SPL load the TPL to L2 SRAM and the jump to the L2 SRAM to
execute, so the section .resetvec is no longer needed.

Signed-off-by: Ying Zhang <b40530@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

Showing 5 changed files with 275 additions and 81 deletions Side-by-side Diff

board/freescale/p1010rdb/Makefile
... ... @@ -18,6 +18,10 @@
18 18  
19 19 else
20 20  
  21 +ifdef CONFIG_SPL_BUILD
  22 +obj-y += spl.o
  23 +endif
  24 +
21 25 obj-y += p1010rdb.o
22 26 obj-y += ddr.o
23 27 obj-y += law.o
board/freescale/p1010rdb/spl.c
  1 +/* Copyright 2013 Freescale Semiconductor, Inc.
  2 + *
  3 + * SPDX-License-Identifier: GPL-2.0+
  4 + */
  5 +
  6 +#include <common.h>
  7 +#include <ns16550.h>
  8 +#include <malloc.h>
  9 +#include <mmc.h>
  10 +#include <nand.h>
  11 +#include <i2c.h>
  12 +#include <fsl_esdhc.h>
  13 +#include <spi_flash.h>
  14 +
  15 +DECLARE_GLOBAL_DATA_PTR;
  16 +
  17 +ulong get_effective_memsize(void)
  18 +{
  19 + return CONFIG_SYS_L2_SIZE;
  20 +}
  21 +
  22 +void board_init_f(ulong bootflag)
  23 +{
  24 + u32 plat_ratio;
  25 + ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
  26 + struct fsl_ifc *ifc = (void *)CONFIG_SYS_IFC_ADDR;
  27 +
  28 + console_init_f();
  29 +
  30 + /* Clock configuration to access CPLD using IFC(GPCM) */
  31 + setbits_be32(&ifc->ifc_gcr, 1 << IFC_GCR_TBCTL_TRN_TIME_SHIFT);
  32 +
  33 +#ifdef CONFIG_P1010RDB_PB
  34 + setbits_be32(&gur->pmuxcr2, MPC85xx_PMUXCR2_GPIO01_DRVVBUS);
  35 +#endif
  36 +
  37 + /* initialize selected port with appropriate baud rate */
  38 + plat_ratio = in_be32(&gur->porpllsr) & MPC85xx_PORPLLSR_PLAT_RATIO;
  39 + plat_ratio >>= 1;
  40 + gd->bus_clk = CONFIG_SYS_CLK_FREQ * plat_ratio;
  41 +
  42 + NS16550_init((NS16550_t)CONFIG_SYS_NS16550_COM1,
  43 + gd->bus_clk / 16 / CONFIG_BAUDRATE);
  44 +
  45 +#ifdef CONFIG_SPL_MMC_BOOT
  46 + puts("\nSD boot...\n");
  47 +#elif defined(CONFIG_SPL_SPI_BOOT)
  48 + puts("\nSPI Flash boot...\n");
  49 +#endif
  50 + /* copy code to RAM and jump to it - this should not return */
  51 + /* NOTE - code has to be copied out of NAND buffer before
  52 + * other blocks can be read.
  53 + */
  54 + relocate_code(CONFIG_SPL_RELOC_STACK, 0, CONFIG_SPL_RELOC_TEXT_BASE);
  55 +}
  56 +
  57 +void board_init_r(gd_t *gd, ulong dest_addr)
  58 +{
  59 + /* Pointer is writable since we allocated a register for it */
  60 + gd = (gd_t *)CONFIG_SPL_GD_ADDR;
  61 + bd_t *bd;
  62 +
  63 + memset(gd, 0, sizeof(gd_t));
  64 + bd = (bd_t *)(CONFIG_SPL_GD_ADDR + sizeof(gd_t));
  65 + memset(bd, 0, sizeof(bd_t));
  66 + gd->bd = bd;
  67 + bd->bi_memstart = CONFIG_SYS_INIT_L2_ADDR;
  68 + bd->bi_memsize = CONFIG_SYS_L2_SIZE;
  69 +
  70 + probecpu();
  71 + get_clocks();
  72 + mem_malloc_init(CONFIG_SPL_RELOC_MALLOC_ADDR,
  73 + CONFIG_SPL_RELOC_MALLOC_SIZE);
  74 +
  75 +#ifndef CONFIG_SPL_NAND_BOOT
  76 + env_init();
  77 +#endif
  78 +#ifdef CONFIG_SPL_MMC_BOOT
  79 + mmc_initialize(bd);
  80 +#endif
  81 +
  82 + /* relocate environment function pointers etc. */
  83 +#ifdef CONFIG_SPL_NAND_BOOT
  84 + nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
  85 + (uchar *)CONFIG_ENV_ADDR);
  86 + gd->env_addr = (ulong)(CONFIG_ENV_ADDR);
  87 + gd->env_valid = 1;
  88 +#else
  89 + env_relocate();
  90 +#endif
  91 +
  92 + i2c_init_all();
  93 +
  94 + gd->ram_size = initdram(0);
  95 +#ifdef CONFIG_SPL_NAND_BOOT
  96 + puts("\nTertiary program loader running in sram...");
  97 +#else
  98 + puts("\nSecond program loader running in sram...");
  99 +#endif
  100 +
  101 +#ifdef CONFIG_SPL_MMC_BOOT
  102 + mmc_boot();
  103 +#elif defined(CONFIG_SPL_SPI_BOOT)
  104 + spi_boot();
  105 +#elif defined(CONFIG_SPL_NAND_BOOT)
  106 + nand_boot();
  107 +#endif
  108 +}
board/freescale/p1010rdb/spl_minimal.c
... ... @@ -16,78 +16,16 @@
16 16  
17 17 DECLARE_GLOBAL_DATA_PTR;
18 18  
19   -
20   -void sdram_init(void)
21   -{
22   - struct ccsr_ddr __iomem *ddr =
23   - (struct ccsr_ddr __iomem *)CONFIG_SYS_FSL_DDR_ADDR;
24   - ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
25   - u32 ddr_ratio;
26   - unsigned long ddr_freq_mhz;
27   -
28   - ddr_ratio = in_be32(&gur->porpllsr) & MPC85xx_PORPLLSR_DDR_RATIO;
29   - ddr_ratio = ddr_ratio >> MPC85xx_PORPLLSR_DDR_RATIO_SHIFT;
30   - ddr_freq_mhz = (CONFIG_SYS_CLK_FREQ * ddr_ratio) / 1000000;
31   -
32   - /* mask off E bit */
33   - u32 svr = SVR_SOC_VER(mfspr(SPRN_SVR));
34   -
35   - __raw_writel(CONFIG_SYS_DDR_CONTROL | SDRAM_CFG_32_BE, &ddr->sdram_cfg);
36   - __raw_writel(CONFIG_SYS_DDR_CS0_BNDS, &ddr->cs0_bnds);
37   - __raw_writel(CONFIG_SYS_DDR_CS0_CONFIG, &ddr->cs0_config);
38   - __raw_writel(CONFIG_SYS_DDR_CONTROL_2, &ddr->sdram_cfg_2);
39   - __raw_writel(CONFIG_SYS_DDR_DATA_INIT, &ddr->sdram_data_init);
40   -
41   - if (ddr_freq_mhz < 700) {
42   - __raw_writel(CONFIG_SYS_DDR_TIMING_3_667, &ddr->timing_cfg_3);
43   - __raw_writel(CONFIG_SYS_DDR_TIMING_0_667, &ddr->timing_cfg_0);
44   - __raw_writel(CONFIG_SYS_DDR_TIMING_1_667, &ddr->timing_cfg_1);
45   - __raw_writel(CONFIG_SYS_DDR_TIMING_2_667, &ddr->timing_cfg_2);
46   - __raw_writel(CONFIG_SYS_DDR_MODE_1_667, &ddr->sdram_mode);
47   - __raw_writel(CONFIG_SYS_DDR_MODE_2_667, &ddr->sdram_mode_2);
48   - __raw_writel(CONFIG_SYS_DDR_INTERVAL_667, &ddr->sdram_interval);
49   - __raw_writel(CONFIG_SYS_DDR_CLK_CTRL_667, &ddr->sdram_clk_cntl);
50   - __raw_writel(CONFIG_SYS_DDR_WRLVL_CONTROL_667, &ddr->ddr_wrlvl_cntl);
51   - } else {
52   - __raw_writel(CONFIG_SYS_DDR_TIMING_3_800, &ddr->timing_cfg_3);
53   - __raw_writel(CONFIG_SYS_DDR_TIMING_0_800, &ddr->timing_cfg_0);
54   - __raw_writel(CONFIG_SYS_DDR_TIMING_1_800, &ddr->timing_cfg_1);
55   - __raw_writel(CONFIG_SYS_DDR_TIMING_2_800, &ddr->timing_cfg_2);
56   - __raw_writel(CONFIG_SYS_DDR_MODE_1_800, &ddr->sdram_mode);
57   - __raw_writel(CONFIG_SYS_DDR_MODE_2_800, &ddr->sdram_mode_2);
58   - __raw_writel(CONFIG_SYS_DDR_INTERVAL_800, &ddr->sdram_interval);
59   - __raw_writel(CONFIG_SYS_DDR_CLK_CTRL_800, &ddr->sdram_clk_cntl);
60   - __raw_writel(CONFIG_SYS_DDR_WRLVL_CONTROL_800, &ddr->ddr_wrlvl_cntl);
61   - }
62   -
63   - __raw_writel(CONFIG_SYS_DDR_TIMING_4, &ddr->timing_cfg_4);
64   - __raw_writel(CONFIG_SYS_DDR_TIMING_5, &ddr->timing_cfg_5);
65   - __raw_writel(CONFIG_SYS_DDR_ZQ_CONTROL, &ddr->ddr_zq_cntl);
66   -
67   - /* P1014 and it's derivatives support max 16bit DDR width */
68   - if (svr == SVR_P1014) {
69   - __raw_writel(ddr->sdram_cfg & ~SDRAM_CFG_DBW_MASK, &ddr->sdram_cfg);
70   - __raw_writel(ddr->sdram_cfg | SDRAM_CFG_16_BE, &ddr->sdram_cfg);
71   - /* For CS0_BNDS we divide the start and end address by 2, so we can just
72   - * shift the entire register to achieve the desired result and the mask
73   - * the value so we don't write reserved fields */
74   - __raw_writel((CONFIG_SYS_DDR_CS0_BNDS >> 1) & 0x0fff0fff, &ddr->cs0_bnds);
75   - }
76   -
77   - asm volatile("sync;isync");
78   - udelay(500);
79   -
80   - /* Let the controller go */
81   - out_be32(&ddr->sdram_cfg, in_be32(&ddr->sdram_cfg) | SDRAM_CFG_MEM_EN);
82   -
83   - set_next_law(CONFIG_SYS_NAND_DDR_LAW, LAW_SIZE_1G, LAW_TRGT_IF_DDR_1);
84   -}
85   -
86 19 void board_init_f(ulong bootflag)
87 20 {
88 21 u32 plat_ratio;
89 22 ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
90 23  
  24 +#if defined(CONFIG_SYS_NAND_BR_PRELIM) && defined(CONFIG_SYS_NAND_OR_PRELIM)
  25 + set_lbc_br(0, CONFIG_SYS_NAND_BR_PRELIM);
  26 + set_lbc_or(0, CONFIG_SYS_NAND_OR_PRELIM);
  27 +#endif
  28 +
91 29 /* initialize selected port with appropriate baud rate */
92 30 plat_ratio = in_be32(&gur->porpllsr) & MPC85xx_PORPLLSR_PLAT_RATIO;
93 31 plat_ratio >>= 1;
... ... @@ -98,9 +36,6 @@
98 36  
99 37 puts("\nNAND boot... ");
100 38  
101   - /* Initialize the DDR3 */
102   - sdram_init();
103   -
104 39 /* copy code to RAM and jump to it - this should not return */
105 40 /* NOTE - code has to be copied out of NAND buffer before
106 41 * other blocks can be read.
... ... @@ -111,6 +46,7 @@
111 46  
112 47 void board_init_r(gd_t *gd, ulong dest_addr)
113 48 {
  49 + puts("\nSecond program loader running in sram...");
114 50 nand_boot();
115 51 }
116 52  
board/freescale/p1010rdb/tlb.c
... ... @@ -73,10 +73,18 @@
73 73 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
74 74 0, 7, BOOKE_PAGESZ_1M, 1),
75 75  
76   -#if defined(CONFIG_SYS_RAMBOOT) || defined(CONFIG_SPL)
  76 +#if defined(CONFIG_SYS_RAMBOOT) || \
  77 + (defined(CONFIG_SPL) && !defined(CONFIG_SPL_COMMON_INIT_DDR))
77 78 SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE, CONFIG_SYS_DDR_SDRAM_BASE,
78 79 MAS3_SX|MAS3_SW|MAS3_SR, 0,
79   - 0, 8, BOOKE_PAGESZ_1G, 1)
  80 + 0, 8, BOOKE_PAGESZ_1G, 1),
  81 +#endif
  82 +
  83 +#ifdef CONFIG_SYS_INIT_L2_ADDR
  84 + /* *I*G - L2SRAM */
  85 + SET_TLB_ENTRY(1, CONFIG_SYS_INIT_L2_ADDR, CONFIG_SYS_INIT_L2_ADDR_PHYS,
  86 + MAS3_SX|MAS3_SW|MAS3_SR, MAS2_G,
  87 + 0, 11, BOOKE_PAGESZ_256K, 1)
80 88 #endif
81 89 };
82 90  
include/configs/P1010RDB.h
... ... @@ -21,19 +21,75 @@
21 21 #define CONFIG_NAND_FSL_IFC
22 22  
23 23 #ifdef CONFIG_SDCARD
24   -#define CONFIG_RAMBOOT_SDCARD
25   -#define CONFIG_SYS_TEXT_BASE 0x11000000
26   -#define CONFIG_RESET_VECTOR_ADDRESS 0x110bfffc
  24 +#define CONFIG_SPL
  25 +#define CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT
  26 +#define CONFIG_SPL_DRIVERS_MISC_SUPPORT
  27 +#define CONFIG_SPL_ENV_SUPPORT
  28 +#define CONFIG_SPL_SERIAL_SUPPORT
  29 +#define CONFIG_SPL_MMC_SUPPORT
  30 +#define CONFIG_SPL_MMC_MINIMAL
  31 +#define CONFIG_SPL_FLUSH_IMAGE
  32 +#define CONFIG_SPL_TARGET "u-boot-with-spl.bin"
  33 +#define CONFIG_SPL_LIBGENERIC_SUPPORT
  34 +#define CONFIG_SPL_LIBCOMMON_SUPPORT
  35 +#define CONFIG_SPL_I2C_SUPPORT
  36 +#define CONFIG_FSL_LAW /* Use common FSL init code */
  37 +#define CONFIG_SYS_TEXT_BASE 0x11001000
  38 +#define CONFIG_SPL_TEXT_BASE 0xD0001000
  39 +#define CONFIG_SPL_PAD_TO 0x18000
  40 +#define CONFIG_SPL_MAX_SIZE (96 * 1024)
  41 +#define CONFIG_SYS_MMC_U_BOOT_SIZE (512 << 10)
  42 +#define CONFIG_SYS_MMC_U_BOOT_DST (0x11000000)
  43 +#define CONFIG_SYS_MMC_U_BOOT_START (0x11000000)
  44 +#define CONFIG_SYS_MMC_U_BOOT_OFFS (96 << 10)
  45 +#define CONFIG_SYS_MPC85XX_NO_RESETVEC
  46 +#define CONFIG_SYS_LDSCRIPT "arch/powerpc/cpu/mpc85xx/u-boot.lds"
  47 +#define CONFIG_SPL_MMC_BOOT
  48 +#ifdef CONFIG_SPL_BUILD
  49 +#define CONFIG_SPL_COMMON_INIT_DDR
27 50 #endif
  51 +#endif
28 52  
29 53 #ifdef CONFIG_SPIFLASH
  54 +#ifdef CONFIG_SECURE_BOOT
30 55 #define CONFIG_RAMBOOT_SPIFLASH
31 56 #define CONFIG_SYS_TEXT_BASE 0x11000000
32   -#define CONFIG_RESET_VECTOR_ADDRESS 0x110bfffc
  57 +#define CONFIG_RESET_VECTOR_ADDRESS 0x1107fffc
  58 +#else
  59 +#define CONFIG_SPL
  60 +#define CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT
  61 +#define CONFIG_SPL_DRIVERS_MISC_SUPPORT
  62 +#define CONFIG_SPL_ENV_SUPPORT
  63 +#define CONFIG_SPL_SERIAL_SUPPORT
  64 +#define CONFIG_SPL_SPI_SUPPORT
  65 +#define CONFIG_SPL_SPI_FLASH_SUPPORT
  66 +#define CONFIG_SPL_SPI_FLASH_MINIMAL
  67 +#define CONFIG_SPL_FLUSH_IMAGE
  68 +#define CONFIG_SPL_TARGET "u-boot-with-spl.bin"
  69 +#define CONFIG_SPL_LIBGENERIC_SUPPORT
  70 +#define CONFIG_SPL_LIBCOMMON_SUPPORT
  71 +#define CONFIG_SPL_I2C_SUPPORT
  72 +#define CONFIG_FSL_LAW /* Use common FSL init code */
  73 +#define CONFIG_SYS_TEXT_BASE 0x11001000
  74 +#define CONFIG_SPL_TEXT_BASE 0xD0001000
  75 +#define CONFIG_SPL_PAD_TO 0x18000
  76 +#define CONFIG_SPL_MAX_SIZE (96 * 1024)
  77 +#define CONFIG_SYS_SPI_FLASH_U_BOOT_SIZE (512 << 10)
  78 +#define CONFIG_SYS_SPI_FLASH_U_BOOT_DST (0x11000000)
  79 +#define CONFIG_SYS_SPI_FLASH_U_BOOT_START (0x11000000)
  80 +#define CONFIG_SYS_SPI_FLASH_U_BOOT_OFFS (96 << 10)
  81 +#define CONFIG_SYS_MPC85XX_NO_RESETVEC
  82 +#define CONFIG_SYS_LDSCRIPT "arch/powerpc/cpu/mpc85xx/u-boot.lds"
  83 +#define CONFIG_SPL_SPI_BOOT
  84 +#ifdef CONFIG_SPL_BUILD
  85 +#define CONFIG_SPL_COMMON_INIT_DDR
33 86 #endif
  87 +#endif
  88 +#endif
34 89  
35 90 #ifdef CONFIG_NAND
36 91 #define CONFIG_SPL
  92 +#ifdef CONFIG_SECURE_BOOT
37 93 #define CONFIG_SPL_INIT_MINIMAL
38 94 #define CONFIG_SPL_SERIAL_SUPPORT
39 95 #define CONFIG_SPL_NAND_SUPPORT
40 96  
41 97  
... ... @@ -51,9 +107,49 @@
51 107 #define CONFIG_SYS_NAND_U_BOOT_START 0x00200000
52 108 #define CONFIG_SYS_NAND_U_BOOT_OFFS 0
53 109 #define CONFIG_SYS_LDSCRIPT "arch/powerpc/cpu/mpc85xx/u-boot-nand.lds"
  110 +#else
  111 +#define CONFIG_TPL
  112 +#ifdef CONFIG_TPL_BUILD
  113 +#define CONFIG_SPL_NAND_BOOT
  114 +#define CONFIG_SPL_FLUSH_IMAGE
  115 +#define CONFIG_SPL_ENV_SUPPORT
  116 +#define CONFIG_SPL_NAND_INIT
  117 +#define CONFIG_SPL_SERIAL_SUPPORT
  118 +#define CONFIG_SPL_LIBGENERIC_SUPPORT
  119 +#define CONFIG_SPL_LIBCOMMON_SUPPORT
  120 +#define CONFIG_SPL_I2C_SUPPORT
  121 +#define CONFIG_SPL_NAND_SUPPORT
  122 +#define CONFIG_SPL_DRIVERS_MISC_SUPPORT
  123 +#define CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT
  124 +#define CONFIG_SPL_COMMON_INIT_DDR
  125 +#define CONFIG_SPL_MAX_SIZE (128 << 10)
  126 +#define CONFIG_SPL_TEXT_BASE 0xD0001000
  127 +#define CONFIG_SYS_MPC85XX_NO_RESETVEC
  128 +#define CONFIG_SYS_NAND_U_BOOT_SIZE (576 << 10)
  129 +#define CONFIG_SYS_NAND_U_BOOT_DST (0x11000000)
  130 +#define CONFIG_SYS_NAND_U_BOOT_START (0x11000000)
  131 +#define CONFIG_SYS_NAND_U_BOOT_OFFS ((128 + 128) << 10)
  132 +#elif defined(CONFIG_SPL_BUILD)
  133 +#define CONFIG_SPL_INIT_MINIMAL
  134 +#define CONFIG_SPL_SERIAL_SUPPORT
  135 +#define CONFIG_SPL_NAND_SUPPORT
  136 +#define CONFIG_SPL_NAND_MINIMAL
  137 +#define CONFIG_SPL_FLUSH_IMAGE
  138 +#define CONFIG_SPL_TEXT_BASE 0xff800000
  139 +#define CONFIG_SPL_MAX_SIZE 8192
  140 +#define CONFIG_SYS_NAND_U_BOOT_SIZE (128 << 10)
  141 +#define CONFIG_SYS_NAND_U_BOOT_DST 0xD0000000
  142 +#define CONFIG_SYS_NAND_U_BOOT_START 0xD0000000
  143 +#define CONFIG_SYS_NAND_U_BOOT_OFFS (128 << 10)
54 144 #endif
  145 +#define CONFIG_SPL_PAD_TO 0x20000
  146 +#define CONFIG_TPL_PAD_TO 0x20000
  147 +#define CONFIG_SPL_TARGET "u-boot-with-spl.bin"
  148 +#define CONFIG_SYS_TEXT_BASE 0x11001000
  149 +#define CONFIG_SYS_LDSCRIPT "arch/powerpc/cpu/mpc85xx/u-boot-nand.lds"
  150 +#endif
  151 +#endif
55 152  
56   -
57 153 #ifdef CONFIG_NAND_SECBOOT /* NAND Boot */
58 154 #define CONFIG_RAMBOOT_NAND
59 155 #define CONFIG_SYS_TEXT_BASE 0x11000000
... ... @@ -473,6 +569,43 @@
473 569 #define CONFIG_SYS_MONITOR_LEN (256 * 1024) /* Reserve 256 kB for Mon*/
474 570 #define CONFIG_SYS_MALLOC_LEN (1024 * 1024) /* Reserved for malloc*/
475 571  
  572 +/*
  573 + * Config the L2 Cache as L2 SRAM
  574 + */
  575 +#if defined(CONFIG_SPL_BUILD)
  576 +#if defined(CONFIG_SDCARD) || defined(CONFIG_SPIFLASH)
  577 +#define CONFIG_SYS_INIT_L2_ADDR 0xD0000000
  578 +#define CONFIG_SYS_INIT_L2_ADDR_PHYS CONFIG_SYS_INIT_L2_ADDR
  579 +#define CONFIG_SYS_L2_SIZE (256 << 10)
  580 +#define CONFIG_SYS_INIT_L2_END (CONFIG_SYS_INIT_L2_ADDR + CONFIG_SYS_L2_SIZE)
  581 +#define CONFIG_SPL_RELOC_TEXT_BASE 0xD0001000
  582 +#define CONFIG_SPL_RELOC_STACK (CONFIG_SYS_INIT_L2_ADDR + 112 * 1024)
  583 +#define CONFIG_SPL_RELOC_STACK_SIZE (16 << 10)
  584 +#define CONFIG_SPL_RELOC_MALLOC_ADDR (CONFIG_SYS_INIT_L2_ADDR + 128 * 1024)
  585 +#define CONFIG_SPL_RELOC_MALLOC_SIZE (128 << 10)
  586 +#define CONFIG_SPL_GD_ADDR (CONFIG_SYS_INIT_L2_ADDR + 96 * 1024)
  587 +#elif defined(CONFIG_NAND)
  588 +#ifdef CONFIG_TPL_BUILD
  589 +#define CONFIG_SYS_INIT_L2_ADDR 0xD0000000
  590 +#define CONFIG_SYS_INIT_L2_ADDR_PHYS CONFIG_SYS_INIT_L2_ADDR
  591 +#define CONFIG_SYS_L2_SIZE (256 << 10)
  592 +#define CONFIG_SYS_INIT_L2_END (CONFIG_SYS_INIT_L2_ADDR + CONFIG_SYS_L2_SIZE)
  593 +#define CONFIG_SPL_RELOC_TEXT_BASE 0xD0001000
  594 +#define CONFIG_SPL_RELOC_STACK (CONFIG_SYS_INIT_L2_ADDR + 192 * 1024)
  595 +#define CONFIG_SPL_RELOC_MALLOC_ADDR (CONFIG_SYS_INIT_L2_ADDR + 208 * 1024)
  596 +#define CONFIG_SPL_RELOC_MALLOC_SIZE (48 << 10)
  597 +#define CONFIG_SPL_GD_ADDR (CONFIG_SYS_INIT_L2_ADDR + 176 * 1024)
  598 +#else
  599 +#define CONFIG_SYS_INIT_L2_ADDR 0xD0000000
  600 +#define CONFIG_SYS_INIT_L2_ADDR_PHYS CONFIG_SYS_INIT_L2_ADDR
  601 +#define CONFIG_SYS_L2_SIZE (256 << 10)
  602 +#define CONFIG_SYS_INIT_L2_END (CONFIG_SYS_INIT_L2_ADDR + CONFIG_SYS_L2_SIZE)
  603 +#define CONFIG_SPL_RELOC_TEXT_BASE (CONFIG_SYS_INIT_L2_END - 0x3000)
  604 +#define CONFIG_SPL_RELOC_STACK ((CONFIG_SYS_INIT_L2_END - 1) & ~0xF)
  605 +#endif
  606 +#endif
  607 +#endif
  608 +
476 609 /* Serial Port */
477 610 #define CONFIG_CONS_INDEX 1
478 611 #undef CONFIG_SERIAL_SOFTWARE_FIFO
... ... @@ -480,7 +613,7 @@
480 613 #define CONFIG_SYS_NS16550_SERIAL
481 614 #define CONFIG_SYS_NS16550_REG_SIZE 1
482 615 #define CONFIG_SYS_NS16550_CLK get_bus_freq(0)
483   -#ifdef CONFIG_SPL_BUILD
  616 +#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_INIT_MINIMAL)
484 617 #define CONFIG_NS16550_MIN_FUNCTIONS
485 618 #endif
486 619  
487 620  
... ... @@ -637,12 +770,12 @@
637 770 /*
638 771 * Environment
639 772 */
640   -#if defined(CONFIG_RAMBOOT_SDCARD)
  773 +#if defined(CONFIG_SDCARD)
641 774 #define CONFIG_ENV_IS_IN_MMC
642 775 #define CONFIG_FSL_FIXED_MMC_LOCATION
643 776 #define CONFIG_SYS_MMC_ENV_DEV 0
644 777 #define CONFIG_ENV_SIZE 0x2000
645   -#elif defined(CONFIG_RAMBOOT_SPIFLASH)
  778 +#elif defined(CONFIG_SPIFLASH)
646 779 #define CONFIG_ENV_IS_IN_SPI_FLASH
647 780 #define CONFIG_ENV_SPI_BUS 0
648 781 #define CONFIG_ENV_SPI_CS 0
... ... @@ -653,6 +786,10 @@
653 786 #define CONFIG_ENV_SIZE 0x2000
654 787 #elif defined(CONFIG_NAND)
655 788 #define CONFIG_ENV_IS_IN_NAND
  789 +#ifdef CONFIG_TPL_BUILD
  790 +#define CONFIG_ENV_SIZE 0x2000
  791 +#define CONFIG_ENV_ADDR (CONFIG_SYS_INIT_L2_ADDR + (160 << 10))
  792 +#else
656 793 #if defined(CONFIG_P1010RDB_PA)
657 794 #define CONFIG_ENV_SIZE CONFIG_SYS_NAND_BLOCK_SIZE
658 795 #define CONFIG_ENV_RANGE (3 * CONFIG_ENV_SIZE) /* 3*16=48K for env */
... ... @@ -660,7 +797,8 @@
660 797 #define CONFIG_ENV_SIZE (16 * 1024)
661 798 #define CONFIG_ENV_RANGE (32 * CONFIG_ENV_SIZE) /* new block size 512K */
662 799 #endif
663   -#define CONFIG_ENV_OFFSET ((768 * 1024) + CONFIG_SYS_NAND_BLOCK_SIZE)
  800 +#endif
  801 +#define CONFIG_ENV_OFFSET (1024 * 1024)
664 802 #elif defined(CONFIG_SYS_RAMBOOT)
665 803 #define CONFIG_ENV_IS_NOWHERE /* Store ENV in memory only */
666 804 #define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE - 0x1000)