U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yu-Chien Peter Lin <peterlin@andestech.com>
To: Leo Yu-Chi Liang <ycliang@andestech.com>
Cc: <u-boot@lists.denx.de>, <randolph@andestech.com>
Subject: Re: [PATCH v2 3/6] andes: cpu: Enable memboost feature
Date: Tue, 26 Dec 2023 15:42:16 +0800	[thread overview]
Message-ID: <ZYqD2J4XWRHslKcT@APC323> (raw)
In-Reply-To: <20231226061736.482416-3-ycliang@andestech.com>

On Tue, Dec 26, 2023 at 02:17:34PM +0800, Leo Yu-Chi Liang wrote:
> Andes CPU has memboost feature including prefetch,
> write-around and non-blocking load. Enable them by default.
> 
> Signed-off-by: Leo Yu-Chi Liang <ycliang@andestech.com>

Reviewed-by: Yu Chien Peter Lin <peterlin@andestech.com>

> ---
>  arch/riscv/cpu/andesv5/cpu.c            | 9 ++++++++-
>  arch/riscv/include/asm/arch-andes/csr.h | 6 ++++++
>  2 files changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/riscv/cpu/andesv5/cpu.c b/arch/riscv/cpu/andesv5/cpu.c
> index e764f6c5c0..a23b7948d9 100644
> --- a/arch/riscv/cpu/andesv5/cpu.c
> +++ b/arch/riscv/cpu/andesv5/cpu.c
> @@ -31,8 +31,11 @@ void harts_early_init(void)
>  	/* Enable I/D-cache in SPL */
>  	if (CONFIG_IS_ENABLED(RISCV_MMODE)) {
>  		unsigned long mcache_ctl_val = csr_read(CSR_MCACHE_CTL);
> +		unsigned long mmisc_ctl_val = csr_read(CSR_MMISC_CTL);
>  
> -		mcache_ctl_val |= MCACHE_CTL_CCTL_SUEN;
> +		mcache_ctl_val |= (MCACHE_CTL_CCTL_SUEN | \
> +				MCACHE_CTL_IC_PREFETCH_EN | MCACHE_CTL_DC_PREFETCH_EN | \
> +				MCACHE_CTL_DC_WAROUND_EN | MCACHE_CTL_L2C_WAROUND_EN);
>  
>  		if (!CONFIG_IS_ENABLED(SYS_ICACHE_OFF))
>  			mcache_ctl_val |= MCACHE_CTL_IC_EN;
> @@ -52,5 +55,9 @@ void harts_early_init(void)
>  				while (!(csr_read(CSR_MCACHE_CTL) & MCACHE_CTL_DC_COHSTA));
>  			}
>  		}
> +
> +		mmisc_ctl_val |= MMISC_CTL_NON_BLOCKING_EN;
> +
> +		csr_write(CSR_MMISC_CTL, mmisc_ctl_val);
>  	}
>  }
> diff --git a/arch/riscv/include/asm/arch-andes/csr.h b/arch/riscv/include/asm/arch-andes/csr.h
> index 12d5eb6f6c..3f3f05b348 100644
> --- a/arch/riscv/include/asm/arch-andes/csr.h
> +++ b/arch/riscv/include/asm/arch-andes/csr.h
> @@ -19,9 +19,15 @@
>  #define MCACHE_CTL_IC_EN		BIT(0)
>  #define MCACHE_CTL_DC_EN		BIT(1)
>  #define MCACHE_CTL_CCTL_SUEN		BIT(8)
> +#define MCACHE_CTL_IC_PREFETCH_EN	BIT(9)
> +#define MCACHE_CTL_DC_PREFETCH_EN	BIT(10)
> +#define MCACHE_CTL_DC_WAROUND_EN	BIT(13)
> +#define MCACHE_CTL_L2C_WAROUND_EN	BIT(15)
>  #define MCACHE_CTL_DC_COHEN		BIT(19)
>  #define MCACHE_CTL_DC_COHSTA		BIT(20)
>  
> +/* mmisc_ctl register */
> +#define MMISC_CTL_NON_BLOCKING_EN	BIT(8)
>  
>  #define CCTL_L1D_WBINVAL_ALL 6
>  
> -- 
> 2.34.1
> 

  reply	other threads:[~2023-12-26  7:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-26  6:17 [PATCH v2 1/6] andes: csr.h: Clean up CSR definition Leo Yu-Chi Liang
2023-12-26  6:17 ` [PATCH v2 2/6] andes: ae350: Implement cache switch via Kconfig Leo Yu-Chi Liang
2023-12-26  7:34   ` Yu-Chien Peter Lin
2023-12-26  6:17 ` [PATCH v2 3/6] andes: cpu: Enable memboost feature Leo Yu-Chi Liang
2023-12-26  7:42   ` Yu-Chien Peter Lin [this message]
2023-12-26  6:17 ` [PATCH v2 4/6] andes: cpu: Enable cache and TLB ECC support Leo Yu-Chi Liang
2023-12-26  7:43   ` Yu-Chien Peter Lin
2023-12-26  7:33 ` [PATCH v2 1/6] andes: csr.h: Clean up CSR definition Yu-Chien Peter Lin

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=ZYqD2J4XWRHslKcT@APC323 \
    --to=peterlin@andestech.com \
    --cc=randolph@andestech.com \
    --cc=u-boot@lists.denx.de \
    --cc=ycliang@andestech.com \
    /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