Re: [U-Boot] [PATCH 1/2] P4080/PBL: add support for boot from SPI flash.

2011-04-09 Thread Kumar Gala

On Mar 15, 2011, at 9:10 PM, Shaohui Xie wrote:

> PBL(pre-boot loader): SPI flash used as RCW(Reset Configuration Word) and
> PBI(pre-boot initialization) source, CPC(CoreNet Platform Cache) used as 1M 
> SRAM
> where PBL will copy whole U-BOOT image to, U-boot can boot from CPC after PBL
> completes RCW and PBI phases.
> 
> Signed-off-by: Chunhe Lan 
> Signed-off-by: Mingkai Hu 
> Signed-off-by: Shaohui Xie 
> Signed-off-by: Roy Zang 
> ---
> arch/powerpc/cpu/mpc85xx/cpu_init.c |   19 +++
> board/freescale/corenet_ds/tlb.c|   12 +++-
> boards.cfg  |1 +
> include/configs/corenet_ds.h|   27 ++-
> 4 files changed, 57 insertions(+), 2 deletions(-)

applied to 85xx

- k


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/2] P4080/PBL: add support for boot from SPI flash.

2011-03-15 Thread Shaohui Xie
PBL(pre-boot loader): SPI flash used as RCW(Reset Configuration Word) and
PBI(pre-boot initialization) source, CPC(CoreNet Platform Cache) used as 1M SRAM
where PBL will copy whole U-BOOT image to, U-boot can boot from CPC after PBL
completes RCW and PBI phases.

Signed-off-by: Chunhe Lan 
Signed-off-by: Mingkai Hu 
Signed-off-by: Shaohui Xie 
Signed-off-by: Roy Zang 
---
 arch/powerpc/cpu/mpc85xx/cpu_init.c |   19 +++
 board/freescale/corenet_ds/tlb.c|   12 +++-
 boards.cfg  |1 +
 include/configs/corenet_ds.h|   27 ++-
 4 files changed, 57 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c 
b/arch/powerpc/cpu/mpc85xx/cpu_init.c
index 8ece970..a977000 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c
@@ -141,6 +141,22 @@ static void enable_cpc(void)
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) {
+   /* find and disable LAW of SRAM */
+   struct law_entry law = 
find_law(CONFIG_SYS_INIT_L3_ADDR);
+
+   if (law.index == -1) {
+   printf("\nFatal error happened\n");
+   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
 
 #ifdef CONFIG_SYS_FSL_ERRATUM_CPC_A002
setbits_be32(&cpc->cpchdbcr0, CPC_HDBCR0_TAG_ECC_SCRUB_DIS);
@@ -164,6 +180,9 @@ void invalidate_cpc(void)
cpc_corenet_t *cpc = (cpc_corenet_t *)CONFIG_SYS_FSL_CPC_ADDR;
 
for (i = 0; i < CONFIG_SYS_NUM_CPC; i++, cpc++) {
+   /* skip CPC when it used as all SRAM */
+   if (in_be32(&cpc->cpcsrcr0) & CPC_SRCR0_SRAMEN)
+   continue;
/* Flash invalidate the CPC and clear all the locks */
out_be32(&cpc->cpccsr0, CPC_CSR0_FI | CPC_CSR0_LFC);
while (in_be32(&cpc->cpccsr0) & (CPC_CSR0_FI | CPC_CSR0_LFC))
diff --git a/board/freescale/corenet_ds/tlb.c b/board/freescale/corenet_ds/tlb.c
index 1ae0416..fe77e79 100644
--- a/board/freescale/corenet_ds/tlb.c
+++ b/board/freescale/corenet_ds/tlb.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008-2010 Freescale Semiconductor, Inc.
+ * Copyright 2008-2011 Freescale Semiconductor, Inc.
  *
  * (C) Copyright 2000
  * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
@@ -51,9 +51,19 @@ struct fsl_e_tlb_entry tlb_table[] = {
 
/* TLB 1 */
/* *I*** - Covers boot page */
+#if defined(CONFIG_SYS_RAMBOOT) && defined(CONFIG_SYS_INIT_L3_ADDR)
+   /*
+* *I*G - L3SRAM. When L3 is used as 1M SRAM, the address of the
+* SRAM is at 0xfff0, it covered the 0xf000.
+*/
+   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, 0xf000, 0xf000,
  MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
  0, 0, BOOKE_PAGESZ_4K, 1),
+#endif
 
/* *I*G* - CCSRBAR */
SET_TLB_ENTRY(1, CONFIG_SYS_CCSRBAR, CONFIG_SYS_CCSRBAR_PHYS,
diff --git a/boards.cfg b/boards.cfg
index 45c3102..f19cc34 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -529,6 +529,7 @@ P2020RDB_NANDpowerpc mpc85xx 
p1_p2_rdb   freesca
 P2020RDB_SDCARD  powerpc mpc85xx p1_p2_rdb   
freescale  -   P1_P2_RDB:P2020RDB,SDCARD
 P2020RDB_SPIFLASHpowerpc mpc85xx p1_p2_rdb   
freescale  -   P1_P2_RDB:P2020RDB,SPIFLASH
 P4080DS  powerpc mpc85xx corenet_ds  
freescale
+P4080DS_RAMBOOT_PBL  powerpc mpc85xx corenet_ds  
freescale  -   P4080DS:RAMBOOT_PBL,SYS_TEXT_BASE=0xFFF8
 mpq101   powerpc mpc85xx mpq101  
mercury-   mpq101
 stxgp3   powerpc mpc85xx stxgp3  stx
 stxssa   powerpc mpc85xx stxssa  stx   
 -   stxssa
diff --git a/include/configs/corenet_ds.h b/include/configs/corenet_ds.h
index bff212e..8d10862 100644
--- a/include/configs/corenet_ds.h
+++ b/include/configs/corenet_ds.h
@@ -28,6 +28,11 @@
 
 #include "../board/freescale/common/ics307_clk.h"
 
+#ifdef CONFIG_RAMBOOT_PBL
+#define CONFIG_RAMBOOT_TEXT_BASE   CONFIG_SYS_TEXT_BASE
+#define CONFIG_RESET_VECTOR_ADDRE