From: Scott Wood <scottwood@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 01/11] powerpc/mpc85xx: Enable L2 at the beginning of U-boot for E6500
Date: Fri, 24 Aug 2012 17:53:31 -0500 [thread overview]
Message-ID: <503805EB.3040403@freescale.com> (raw)
In-Reply-To: <1345228043-30277-1-git-send-email-yorksun@freescale.com>
On 08/17/2012 01:27 PM, York Sun wrote:
> Using E6500 L1 cache as initram requires L2 cache enabled.
> Add l2-cache cluster enabling.
>
> Signed-off-by: York Sun <yorksun@freescale.com>
> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
> ---
> arch/powerpc/cpu/mpc85xx/cpu_init.c | 39 ++++++++++++++++++++++-
> arch/powerpc/cpu/mpc85xx/start.S | 57 +++++++++++++++++++++++++++++++++
> arch/powerpc/include/asm/immap_85xx.h | 43 +++++++++++++++++++++++++
> 3 files changed, 138 insertions(+), 1 deletions(-)
>
> diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c b/arch/powerpc/cpu/mpc85xx/cpu_init.c
> index 2c78905..1a2858a 100644
> --- a/arch/powerpc/cpu/mpc85xx/cpu_init.c
> +++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c
> @@ -309,6 +309,34 @@ static void __fsl_serdes__init(void)
> }
> __attribute__((weak, alias("__fsl_serdes__init"))) void fsl_serdes_init(void);
>
> +#ifdef CONFIG_E6500
> +int enable_cluster_l2(void)
If enabling L2 is required for the stack, how are we enabling it in C
code? Is this just for non-boot clusters?
> +{
> + int i = 0;
> + u32 cluster;
> + ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
> + struct ccsr_cluster_l2 *l2cache;
> +
> + cluster = in_be32(&gur->tp_cluster[i++].lower);
> + if (cluster & TP_CLUSTER_EOC)
> + return 0;
> +
> + do {
> + l2cache = (void *)(CONFIG_SYS_FSL_CLUSTER_1_L2 + i * 0x40000);
> + cluster = in_be32(&gur->tp_cluster[i++].lower);
> +
> + printf("enable l2 for cluster %d %p\n", i, l2cache);
This should be a debug message (or removed), not a normal printf.
> +
> + out_be32(&l2cache->l2csr0, L2CSR0_L2FI|L2CSR0_L2LFC);
> + while ((in_be32(&l2cache->l2csr0) & (L2CSR0_L2FI|L2CSR0_L2LFC)) != 0)
> + ;
Timeout?
> @@ -322,6 +350,11 @@ int cpu_init_r(void)
> #ifdef CONFIG_SYS_LBC_LCRR
> volatile fsl_lbc_t *lbc = LBC_BASE_ADDR;
> #endif
> +#ifdef CONFIG_L2_CACHE
> + volatile ccsr_l2cache_t *l2cache = (void *)CONFIG_SYS_MPC85xx_L2_ADDR;
> +#elif defined(CONFIG_E6500)
> + struct ccsr_cluster_l2 * l2cache = (void *)CONFIG_SYS_FSL_CLUSTER_1_L2;
> +#endif
If CONFIG_L2_CACHE doesn't apply to e6500, then CONFIG_L2_CACHE is misnamed.
> diff --git a/arch/powerpc/cpu/mpc85xx/start.S b/arch/powerpc/cpu/mpc85xx/start.S
> index 2e1d265..739127f 100644
> --- a/arch/powerpc/cpu/mpc85xx/start.S
> +++ b/arch/powerpc/cpu/mpc85xx/start.S
> @@ -762,6 +762,63 @@ delete_temp_tlbs:
> tlbwe
> #endif /* #if (CONFIG_SYS_CCSRBAR_DEFAULT != CONFIG_SYS_CCSRBAR_PHYS) */
>
> +#ifdef CONFIG_E6500
> +create_ccsr_l2_tlb:
> + /*
> + * Create a TLB for the MMR location of CCSR
> + * to access L2CSR0 register
> + */
> + lis r0, FSL_BOOKE_MAS0(0, 0, 0)@h
> + ori r0, r0, FSL_BOOKE_MAS0(0, 0, 0)@l
> +
> + lis r1, FSL_BOOKE_MAS1(1, 0, 0, 0, BOOKE_PAGESZ_4K)@h
> + ori r1, r1, FSL_BOOKE_MAS1(1, 0, 0, 0, BOOKE_PAGESZ_4K)@l
> + lis r2, FSL_BOOKE_MAS2(CONFIG_SYS_CCSRBAR + 0xC20000, (MAS2_I|MAS2_G))@h
> + ori r2, r2, FSL_BOOKE_MAS2(CONFIG_SYS_CCSRBAR + 0xC20000, (MAS2_I|MAS2_G))@l
> + lis r3, FSL_BOOKE_MAS3(CONFIG_SYS_CCSRBAR_PHYS_LOW + 0xC20000, 0, (MAS3_SW|MAS3_SR))@h
> + ori r3, r3, FSL_BOOKE_MAS3(CONFIG_SYS_CCSRBAR_PHYS_LOW + 0xC20000, 0, (MAS3_SW|MAS3_SR))@l
> + lis r7, CONFIG_SYS_CCSRBAR_PHYS_HIGH at h
> + ori r7, r7, CONFIG_SYS_CCSRBAR_PHYS_HIGH at l
> + mtspr MAS0, r0
> + mtspr MAS1, r1
> + mtspr MAS2, r2
> + mtspr MAS3, r3
> + mtspr MAS7, r7
> + isync
> + msync
> + tlbwe
Let's make a macro (asm, not cpp) out of this instead of copy and
pasting all over the place. And stop misusing r1/r2.
-Scott
next prev parent reply other threads:[~2012-08-24 22:53 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-17 18:27 [U-Boot] [PATCH 01/11] powerpc/mpc85xx: Enable L2 at the beginning of U-boot for E6500 York Sun
2012-08-17 18:27 ` [U-Boot] [PATCH 02/11] powerpc/mpc85xx: setup stash id for L1 and L2 cache York Sun
2012-08-17 18:27 ` [U-Boot] [PATCH 03/11] powerpc/mpc85xx: change RCW MEM_PLL_PLAT for Chassis generation 2 York Sun
2012-08-17 18:27 ` [U-Boot] [PATCH 04/11] powerpc/mpc85xx: check number of cores York Sun
2012-08-17 18:27 ` [U-Boot] [PATCH 05/11] powerpc/mpc85xx: use boot page translation for spin table address York Sun
2012-08-24 22:55 ` Scott Wood
2012-08-24 23:06 ` York Sun
2012-08-24 23:11 ` Scott Wood
2012-08-17 18:27 ` [U-Boot] [PATCH 06/11] powerpc/mpc85xx: Fix core cluster PLL calculation for Chassis generation 2 York Sun
2012-08-17 18:27 ` [U-Boot] [PATCH 07/11] powerpc/mpc85xx: expand SERDES reference clock select bit York Sun
2012-08-17 18:27 ` [U-Boot] [PATCH 08/11] powerpc/e6500: Move QCSP registers for QMan v3 York Sun
2012-08-22 16:18 ` Andy Fleming
2012-08-22 18:43 ` York Sun
2012-08-17 18:27 ` [U-Boot] [PATCH 09/11] powerpc/mpc85xx: Add RCW bits and registers for SerDes for corenet2 York Sun
2012-08-17 18:27 ` [U-Boot] [PATCH 10/11] powerpc/corenet2: Add " York Sun
2012-08-17 18:27 ` [U-Boot] [PATCH 11/11] powerpc/corenet2: fix mismatch DDR sync bit from RCW York Sun
2012-08-24 22:53 ` Scott Wood [this message]
2012-08-24 23:02 ` [U-Boot] [PATCH 01/11] powerpc/mpc85xx: Enable L2 at the beginning of U-boot for E6500 York Sun
2012-08-24 23:14 ` Scott Wood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=503805EB.3040403@freescale.com \
--to=scottwood@freescale.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox