From: Antony Pavlov <antonynpavlov@gmail.com>
To: barebox@lists.infradead.org
Cc: Peter Mamonov <pmamonov@gmail.com>
Subject: [RFC v2 2/8] MIPS: c-r4k: add support for secondary cache
Date: Mon, 5 Dec 2016 12:40:27 +0300 [thread overview]
Message-ID: <20161205094033.31569-3-antonynpavlov@gmail.com> (raw)
In-Reply-To: <20161205094033.31569-1-antonynpavlov@gmail.com>
From: Peter Mamonov <pmamonov@gmail.com>
Signed-off-by: Peter Mamonov <pmamonov@gmail.com>
---
arch/mips/include/asm/cacheops.h | 10 ++++++++++
arch/mips/lib/c-r4k.c | 19 +++++++++++++------
2 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/arch/mips/include/asm/cacheops.h b/arch/mips/include/asm/cacheops.h
index 3bc5852..104e9d0 100644
--- a/arch/mips/include/asm/cacheops.h
+++ b/arch/mips/include/asm/cacheops.h
@@ -33,4 +33,14 @@
#define Hit_Invalidate_D (Cache_D | Hit_Invalidate)
#define Hit_Writeback_Inv_D (Cache_D | Hit_Writeback_Inv)
+/*
+ * R4000SC and R4400SC-specific cacheops
+ */
+#define Cache_SD 0x03
+
+#define Index_Writeback_Inv_SD (Cache_SD | Index_Writeback_Inv)
+#define Index_Store_Tag_SD (Cache_SD | Index_Store_Tag)
+#define Hit_Invalidate_SD (Cache_SD | Hit_Invalidate)
+#define Hit_Writeback_Inv_SD (Cache_SD | Hit_Writeback_Inv)
+
#endif /* __ASM_CACHEOPS_H */
diff --git a/arch/mips/lib/c-r4k.c b/arch/mips/lib/c-r4k.c
index 1502058..c70a665 100644
--- a/arch/mips/lib/c-r4k.c
+++ b/arch/mips/lib/c-r4k.c
@@ -46,7 +46,9 @@ static inline void blast_##pfx##cache##_range(unsigned long start, \
}
__BUILD_BLAST_CACHE_RANGE(d, dcache, Hit_Writeback_Inv_D)
+__BUILD_BLAST_CACHE_RANGE(s, scache, Hit_Writeback_Inv_SD)
__BUILD_BLAST_CACHE_RANGE(inv_d, dcache, Hit_Invalidate_D)
+__BUILD_BLAST_CACHE_RANGE(inv_s, scache, Hit_Invalidate_SD)
void flush_cache_all(void)
{
@@ -54,7 +56,7 @@ void flush_cache_all(void)
unsigned long lsize;
unsigned long addr;
unsigned long aend;
- unsigned int icache_size, dcache_size;
+ unsigned int icache_size, dcache_size, scache_size;
dcache_size = c->dcache.waysize * c->dcache.ways;
lsize = c->dcache.linesz;
@@ -68,21 +70,26 @@ void flush_cache_all(void)
for (addr = KSEG0; addr <= aend; addr += lsize)
cache_op(Index_Invalidate_I, addr);
- /* secondatory cache skipped */
+ if (c->scache.flags & MIPS_CACHE_NOT_PRESENT)
+ return;
+
+ scache_size = c->scache.waysize * c->scache.ways;
+ lsize = c->scache.linesz;
+ aend = (KSEG0 + scache_size - 1) & ~(lsize - 1);
+ for (addr = KSEG0; addr <= aend; addr += lsize)
+ cache_op(Index_Writeback_Inv_SD, addr);
}
void dma_flush_range(unsigned long start, unsigned long end)
{
blast_dcache_range(start, end);
-
- /* secondatory cache skipped */
+ blast_scache_range(start, end);
}
void dma_inv_range(unsigned long start, unsigned long end)
{
blast_inv_dcache_range(start, end);
-
- /* secondatory cache skipped */
+ blast_inv_scache_range(start, end);
}
void r4k_cache_init(void);
--
2.10.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2016-12-05 9:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-05 9:40 [RFC v2 0/8] MIPS: use kexec to load ELF linux images Antony Pavlov
2016-12-05 9:40 ` [RFC v2 1/8] MIPS: add virt_to_phys() and phys_to_virt() Antony Pavlov
2016-12-05 9:40 ` Antony Pavlov [this message]
2016-12-05 9:40 ` [RFC v2 3/8] resource: add create_resource() helper function Antony Pavlov
2016-12-05 9:40 ` [RFC v2 4/8] import initial kexec stuff Antony Pavlov
2016-12-07 19:47 ` Sascha Hauer
2016-12-08 7:24 ` Antony Pavlov
2016-12-05 9:40 ` [RFC v2 5/8] filetype: add ELF type Antony Pavlov
2016-12-05 9:40 ` [RFC v2 6/8] bootm: add kexec ELF support Antony Pavlov
2016-12-07 19:59 ` Sascha Hauer
2016-12-08 7:29 ` Antony Pavlov
2016-12-05 9:40 ` [RFC v2 7/8] MIPS: add kexec ELF loading support Antony Pavlov
2016-12-05 9:40 ` [RFC v2 8/8] MIPS: malta: enable kexec Antony Pavlov
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=20161205094033.31569-3-antonynpavlov@gmail.com \
--to=antonynpavlov@gmail.com \
--cc=barebox@lists.infradead.org \
--cc=pmamonov@gmail.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