All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bin Meng <bmeng.cn@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 6/6] riscv: ax25: use CCTL to flush d-cache
Date: Tue, 4 Jun 2019 10:48:50 +0800	[thread overview]
Message-ID: <CAEUhbmUbwD8zX8ThgnxiWmFv3z0VRg2kRg9CmWK74XzQazFTHg@mail.gmail.com> (raw)
In-Reply-To: <20190528093914.4672-7-uboot@andestech.com>

Hi Rick,

On Tue, May 28, 2019 at 5:45 PM Andes <uboot@andestech.com> wrote:
>
> From: Rick Chen <rick@andestech.com>
>
> Use CCTL command to do d-cache write back and invalidate
> instead of fence.
>
> Signed-off-by: Rick Chen <rick@andestech.com>
> Cc: Greentime Hu <greentime@andestech.com>
> ---
>  arch/riscv/cpu/ax25/cache.c | 22 +++++++++++++---------
>  1 file changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/arch/riscv/cpu/ax25/cache.c b/arch/riscv/cpu/ax25/cache.c
> index 228fc55..d30071e 100644
> --- a/arch/riscv/cpu/ax25/cache.c
> +++ b/arch/riscv/cpu/ax25/cache.c
> @@ -5,17 +5,21 @@
>   */
>
>  #include <common.h>
> +#include <asm/csr.h>
> +
> +#ifdef CONFIG_RISCV_NDS_CACHE
> +/* mcctlcommand */
> +#define CCTL_REG_MCCTLCOMMAND_NUM      0x7cc
> +
> +/* D-cache operation */
> +#define CCTL_L1D_WBINVAL_ALL   6
> +#endif
>
>  void flush_dcache_all(void)
>  {
> -       /*
> -        * Andes' AX25 does not have a coherence agent. U-Boot must use data
> -        * cache flush and invalidate functions to keep data in the system
> -        * coherent.
> -        * The implementation of the fence instruction in the AX25 flushes the
> -        * data cache and is used for this purpose.
> -        */
> -       asm volatile ("fence" ::: "memory");
> +#ifdef CONFIG_RISCV_NDS_CACHE
> +       csr_write(CCTL_REG_MCCTLCOMMAND_NUM, CCTL_L1D_WBINVAL_ALL);

I think CCTL_REG_MCCTLCOMMAND_NUM is a vendor specific CSR. Does
upstream GCC support this CSR?

> +#endif
>  }
>
>  void flush_dcache_range(unsigned long start, unsigned long end)
> @@ -72,8 +76,8 @@ void dcache_disable(void)
>  {
>  #ifndef CONFIG_SYS_DCACHE_OFF
>  #ifdef CONFIG_RISCV_NDS_CACHE
> +       csr_write(CCTL_REG_MCCTLCOMMAND_NUM, CCTL_L1D_WBINVAL_ALL);
>         asm volatile (
> -               "fence\n\t"
>                 "csrr t1, mcache_ctl\n\t"
>                 "andi t0, t1, ~0x2\n\t"
>                 "csrw mcache_ctl, t0\n\t"
> --

Regards,
Bin

  reply	other threads:[~2019-06-04  2:48 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-28  9:39 [U-Boot] [PATCH 0/6] Support Andes RISC-V l2cache on AE350 platform Andes
2019-05-28  9:39 ` [U-Boot] [PATCH 1/6] dm: cache: add v5l2 cache controller driver Andes
2019-06-04  2:48   ` Bin Meng
2019-06-05  8:58     ` Rick Chen
2019-06-09 17:56       ` Auer, Lukas
2019-06-10  2:26         ` Rick Chen
2019-06-10  2:32           ` Bin Meng
2019-06-12  6:32             ` Rick Chen
2019-05-28  9:39 ` [U-Boot] [PATCH 2/6] riscv: ae350: use the v5l2 driver to configure the cache Andes
2019-06-04  2:48   ` Bin Meng
2019-06-05  9:02     ` Rick Chen
2019-06-05  9:04     ` Rick Chen
2019-05-28  9:39 ` [U-Boot] [PATCH 3/6] riscv: ae350: add imply v5l2 cache controller Andes
2019-06-04  2:48   ` Bin Meng
2019-06-05  9:25     ` Rick Chen
2019-05-28  9:39 ` [U-Boot] [PATCH 4/6] riscv: cache: Flush L2 cache before jump to linux Andes
2019-06-04  2:48   ` Bin Meng
2019-06-05  9:24     ` Rick Chen
2019-05-28  9:39 ` [U-Boot] [PATCH 5/6] riscv: dts: move out AE350 L2 node from cpus node Andes
2019-06-04  2:48   ` Bin Meng
2019-06-05  9:33     ` Rick Chen
2019-05-28  9:39 ` [U-Boot] [PATCH 6/6] riscv: ax25: use CCTL to flush d-cache Andes
2019-06-04  2:48   ` Bin Meng [this message]
2019-06-05  9:38     ` Rick Chen
2019-06-05  9:39       ` Bin Meng
2019-06-09 17:57         ` Auer, Lukas

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=CAEUhbmUbwD8zX8ThgnxiWmFv3z0VRg2kRg9CmWK74XzQazFTHg@mail.gmail.com \
    --to=bmeng.cn@gmail.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.