"boards.cfg"
P5020DS_NAND powerpc mpc85xx corenet_ds freescale - P5020DS:RAMBOOT_PBL,NAND,SYS_TEXT_BASE=0xFFF80000
"include/configs/corenet_ds.h"
#ifdef CONFIG_RAMBOOT_PBL
#define CONFIG_RAMBOOT_TEXT_BASE CONFIG_SYS_TEXT_BASE
#define CONFIG_RESET_VECTOR_ADDRESS 0xfffffffc
#endif
#define CONFIG_SYS_INIT_L3_ADDR 0xfff80000
#define CONFIG_SYS_INIT_L3_ADDR_PHYS CONFIG_SYS_INIT_L3_ADDR
#define CONFIG_SYS_L3_SIZE (1024 << 10)
#define CONFIG_SYS_INIT_L3_END (CONFIG_SYS_INIT_L3_ADDR + CONFIG_SYS_L3_SIZE)
配置CPC SRAM需要的TLB表项
[cpp] view plaincopy
"board/freescale/common/p_corenet/tlb.c"
struct fsl_e_tlb_entry tlb_table[] = {
#if defined(CONFIG_SYS_RAMBOOT) && defined(CONFIG_SYS_INIT_L3_ADDR)
SET_TLB_ENTRY(1, CONFIG_SYS_INIT_L3_ADDR, CONFIG_SYS_INIT_L3_ADDR, MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
0, 0, BOOKE_PAGESZ_1M, 1),
#else
SET_TLB_ENTRY(1, 0xfffff000, 0xfffff000, MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, 0, 0, BOOKE_PAGESZ_4K, 1),
#endif
会对齐到1M,即0xfff80000 -> 0xfff00000,目的是在跳转到AS0时, 还有TLB entry覆盖对L3 SRAM,因为此时代码是在L3中存放的,还没有relocate到DDR。
init_tlbs会执行上面的TLB entry
_start-> cpu_init_early_f –> init_tlbs run in AS=1
在invalidate CPC cache的时候,判断是否作为SRAM,若为SRAM则不invalidate, 因为代码还是在L3 SRAM中,若此时invalidateCPC SRAM,则执行的U-Boot代码也会被清掉。
[cpp] view plaincopy
"arch/powerpc/cpu/mpc85xx/cpu_init.c"
_start_cont -> cpu_init_f -> invalidate_cpc
void invalidate_cpc(void)
{
int i;
cpc_corenet_t *cpc = (cpc_corenet_t *)CONFIG_SYS_FSL_CPC_ADDR;
for (i = 0; i < CONFIG_SYS_NUM_CPC; i++, cpc++) {
if (in_be32(&cpc->cpcsrcr0) & CPC_SRCR0_SRAMEN)
continue;
out_be32(&cpc->cpccsr0, CPC_CSR0_FI | CPC_CSR0_LFC);
while (in_be32(&cpc->cpccsr0) & (CPC_CSR0_FI | CPC_CSR0_LFC)) ;
}
}
在使能CPC cache时,disable PBI command为CPC SRAM配置的LAW16
[cpp] view plaincopy
"arch/powerpc/cpu/mpc85xx/cpu_init.c"
Relocate to RAM -> board_init_r -> cpu_init_r -> enable_cpc
static void enable_cpc(void)
{
cpc_corenet_t *cpc = (cpc_corenet_t *)CONFIG_SYS_FSL_CPC_ADDR;
for (i = 0; i < CONFIG_SYS_NUM_CPC; i++, cpc++) {
u32 cpccfg0 = in_be32(&cpc->cpccfg0);
size += CPC_CFG0_SZ_K(cpccfg0);
#ifdef CONFIG_RAMBOOT_PBL
if (in_be32(&cpc->cpcsrcr0) & CPC_SRCR0_SRAMEN) {
struct law_entry law = find_law(CONFIG_SYS_INIT_L3_ADDR);
if (law.index == -1) {
printf("
Fatal error happened
");
return;
}
disable_law(law.index);
clrbits_be32(&cpc->cpchdbcr0, CPC_HDBCR0_CDQ_SPEC_DIS);
out_be32(&cpc->cpccsr0, 0);
out_be32(&cpc->cpcsrcr0, 0);
}
#endif
out_be32(&cpc->cpccsr0, CPC_CSR0_CE | CPC_CSR0_PE);
in_be32(&cpc->cpccsr0);
}
}
3.2 启动image的制作
Freescale的SDK release中用相应的步骤,请参见下面的链接,这里不赘述。