All of lore.kernel.org
 help / color / mirror / Atom feed
From: Minkyu Kang <mk7.kang@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 08/11] Exynos542x: add L2 control register configuration
Date: Tue, 17 Feb 2015 20:50:37 +0900	[thread overview]
Message-ID: <54E32B0D.8020302@samsung.com> (raw)
In-Reply-To: <1422951540-11962-9-git-send-email-akshay.s@samsung.com>

Hi,

On 03/02/15 17:18, Akshay Saraswat wrote:
> This patch does 3 things:
> 1. Enables ECC by setting 21st bit of L2CTLR.
> 2. Restore data and tag RAM latencies to 3 cycles because iROM sets
>    0x3000400 L2CTLR value during switching.
> 3. Disable clean/evict push to external by setting 3rd bit of L2ACTLR.
>    We need to restore this here due to switching.
> 
> Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
> Signed-off-by: Akshay Saraswat <akshay.s@samsung.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Tested-by: Simon Glass <sjg@chromium.org>
> ---
> Changes since v1:
> 	- Added Reviewed-by & Tested-by.
> 
>  arch/arm/cpu/armv7/exynos/lowlevel_init.c | 53 +++++++++++++++++++++++--------
>  arch/arm/cpu/armv7/exynos/soc.c           |  7 ++++
>  2 files changed, 46 insertions(+), 14 deletions(-)
> 
> diff --git a/arch/arm/cpu/armv7/exynos/lowlevel_init.c b/arch/arm/cpu/armv7/exynos/lowlevel_init.c
> index 1c70e54..9892e6b 100644
> --- a/arch/arm/cpu/armv7/exynos/lowlevel_init.c
> +++ b/arch/arm/cpu/armv7/exynos/lowlevel_init.c
> @@ -68,24 +68,40 @@ static void enable_smp(void)
>  }
>  
>  /*
> + * Enable ECC by setting L2CTLR[21].
> + * Set L2CTLR[7] to make tag ram latency 3 cycles and
> + * set L2CTLR[1] to make data ram latency 3 cycles.
> + * We need to make RAM latency of 3 cycles here because cores
> + * power ON and OFF while switching. And everytime a core powers
> + * ON, iROM provides it a default L2CTLR value 0x400 which stands
> + * for TAG RAM setup of 1 cycle. Hence, we face a need of
> + * restoring data and tag latency values.
> + */
> +static void configure_l2_ctlr(void)
> +{
> +	uint32_t val;
> +
> +	mrc_l2_ctlr(val);
> +	val |= (1 << 21);
> +	val |= (1 << 7);
> +	val |= (1 << 1);
> +	mcr_l2_ctlr(val);
> +}
> +
> +/*
>   * Set L2ACTLR[7] to reissue any memory transaction in the L2 that has been
>   * stalled for 1024 cycles to verify that its hazard condition still exists.
> + * Disable clean/evict push to external by setting L2ACTLR[3].
>   */
> -static void configure_l2actlr(void)
> +static void configure_l2_actlr(void)
>  {
>  	uint32_t val;
>  
> -	/* Read MIDR for Primary Part Number */
> -	mrc_midr(val);
> -	val = (val >> 4);
> -	val &= 0xf;
> -
> -	/* L2ACTLR[7]: Enable hazard detect timeout for A15 */
> -	if (val == 0xf) {
> -		mrc_l2_aux_ctlr(val);
> -		val |= (1 << 7);
> -		mcr_l2_aux_ctlr(val);
> -	}
> +	mrc_l2_aux_ctlr(val);
> +	val |= (1 << 27);
> +	val |= (1 << 7);
> +	val |= (1 << 3);
> +	mcr_l2_aux_ctlr(val);
>  }
>  
>  /*
> @@ -122,7 +138,16 @@ static void low_power_start(void)
>  
>  	/* Set the CPU to SVC32 mode */
>  	svc32_mode_en();
> -	configure_l2actlr();
> +
> +	/* Read MIDR for Primary Part Number */
> +	mrc_midr(val);
> +	val = (val >> 4);
> +	val &= 0xf;
> +
> +	if (val == 0xf) {
> +		configure_l2_ctlr();
> +		configure_l2_actlr();
> +	}
>  
>  	/* Invalidate L1 & TLB */
>  	val = 0x0;
> @@ -175,7 +200,7 @@ static void power_down_core(void)
>  static void secondary_cores_configure(void)
>  {
>  	/* Setup L2 cache */
> -	configure_l2actlr();
> +	configure_l2_ctlr();
>  
>  	/* Clear secondary boot iRAM base */
>  	writel(0x0, (CONFIG_EXYNOS_RELOCATE_CODE_BASE + 0x1C));
> diff --git a/arch/arm/cpu/armv7/exynos/soc.c b/arch/arm/cpu/armv7/exynos/soc.c
> index 7268b9b..ea201e7 100644
> --- a/arch/arm/cpu/armv7/exynos/soc.c
> +++ b/arch/arm/cpu/armv7/exynos/soc.c
> @@ -10,8 +10,10 @@
>  #include <asm/system.h>
>  
>  enum l2_cache_params {
> +#ifndef CONFIG_EXYNOS5420

Please don't use ifdef.

>  	CACHE_TAG_RAM_SETUP = (1 << 9),
>  	CACHE_DATA_RAM_SETUP = (1 << 5),
> +#endif
>  	CACHE_TAG_RAM_LATENCY = (2 << 6),
>  	CACHE_DATA_RAM_LATENCY = (2 << 0)
>  };
> @@ -39,10 +41,15 @@ static void exynos5_set_l2cache_params(void)
>  
>  	asm volatile("mrc p15, 1, %0, c9, c0, 2\n" : "=r"(val));
>  
> +#ifndef CONFIG_EXYNOS5420
>  	val |= CACHE_TAG_RAM_SETUP |
>  		CACHE_DATA_RAM_SETUP |
>  		CACHE_TAG_RAM_LATENCY |
>  		CACHE_DATA_RAM_LATENCY;
> +#else
> +	val |= CACHE_TAG_RAM_LATENCY |
> +		CACHE_DATA_RAM_LATENCY;
> +#endif
>  
>  	asm volatile("mcr p15, 1, %0, c9, c0, 2\n" : : "r"(val));
>  
> 

Thanks,
Minkyu Kang.

  reply	other threads:[~2015-02-17 11:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-03  8:18 [U-Boot] [PATCH v2 00/11] Add support for booting multiple cores Akshay Saraswat
2015-02-03  8:18 ` [U-Boot] [PATCH v2 01/11] Exynos542x: Config: Add various configs Akshay Saraswat
2015-02-03  8:18 ` [U-Boot] [PATCH v2 02/11] Exynos542x: CPU: Power down all secondary cores Akshay Saraswat
2015-02-04 15:00   ` Simon Glass
2015-02-03  8:18 ` [U-Boot] [PATCH v2 03/11] Exynos542x: Add workaround for ARM errata 798870 Akshay Saraswat
2015-02-03  8:18 ` [U-Boot] [PATCH v2 04/11] Exynos542x: Add workaround for ARM errata 799270 Akshay Saraswat
2015-02-03  8:18 ` [U-Boot] [PATCH v2 05/11] Exynos542x: Add workaround for exynos iROM errata Akshay Saraswat
2015-02-03  8:18 ` [U-Boot] [PATCH v2 06/11] Exynos542x: Change ambiguous function name set_l2cache Akshay Saraswat
2015-02-03  8:18 ` [U-Boot] [PATCH v2 07/11] Exynos542x: cache: Disable clean/evict push to external Akshay Saraswat
2015-02-17 11:50   ` Minkyu Kang
2015-02-03  8:18 ` [U-Boot] [PATCH v2 08/11] Exynos542x: add L2 control register configuration Akshay Saraswat
2015-02-17 11:50   ` Minkyu Kang [this message]
2015-02-03  8:18 ` [U-Boot] [PATCH v2 09/11] Exynos542x: Fix secondary core booting for thumb Akshay Saraswat
2015-02-03  8:18 ` [U-Boot] [PATCH v2 10/11] Exynos542x: Make A7s boot with thumb-mode U-Boot on warm reset Akshay Saraswat
2015-02-03  8:19 ` [U-Boot] [PATCH v2 11/11] Exynos: Fix L2 cache timings on Exynos5420 and Exynos5800 Akshay Saraswat
2015-02-04 15:01   ` Simon Glass

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=54E32B0D.8020302@samsung.com \
    --to=mk7.kang@samsung.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.