提交 424d6b14 编写于 作者: S Santosh Shilimkar 提交者: Russell King

ARM: 5916/1: ARM: L2 : Add maintainace by line helper functions

This patch adds the cache maintainance by line helper functions.
Signed-off-by: NSantosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: NCatalin Marinas <catalin.marinas@arm.com>
Acked-by: NTony Lindgren <tony@atomide.com>
Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
上级 ad187f95
...@@ -42,6 +42,27 @@ static inline void cache_sync(void) ...@@ -42,6 +42,27 @@ static inline void cache_sync(void)
cache_wait(base + L2X0_CACHE_SYNC, 1); cache_wait(base + L2X0_CACHE_SYNC, 1);
} }
static inline void l2x0_clean_line(unsigned long addr)
{
void __iomem *base = l2x0_base;
cache_wait(base + L2X0_CLEAN_LINE_PA, 1);
writel(addr, base + L2X0_CLEAN_LINE_PA);
}
static inline void l2x0_inv_line(unsigned long addr)
{
void __iomem *base = l2x0_base;
cache_wait(base + L2X0_INV_LINE_PA, 1);
writel(addr, base + L2X0_INV_LINE_PA);
}
static inline void l2x0_flush_line(unsigned long addr)
{
void __iomem *base = l2x0_base;
cache_wait(base + L2X0_CLEAN_INV_LINE_PA, 1);
writel(addr, base + L2X0_CLEAN_INV_LINE_PA);
}
static inline void l2x0_inv_all(void) static inline void l2x0_inv_all(void)
{ {
unsigned long flags; unsigned long flags;
...@@ -62,23 +83,20 @@ static void l2x0_inv_range(unsigned long start, unsigned long end) ...@@ -62,23 +83,20 @@ static void l2x0_inv_range(unsigned long start, unsigned long end)
spin_lock_irqsave(&l2x0_lock, flags); spin_lock_irqsave(&l2x0_lock, flags);
if (start & (CACHE_LINE_SIZE - 1)) { if (start & (CACHE_LINE_SIZE - 1)) {
start &= ~(CACHE_LINE_SIZE - 1); start &= ~(CACHE_LINE_SIZE - 1);
cache_wait(base + L2X0_CLEAN_INV_LINE_PA, 1); l2x0_flush_line(start);
writel(start, base + L2X0_CLEAN_INV_LINE_PA);
start += CACHE_LINE_SIZE; start += CACHE_LINE_SIZE;
} }
if (end & (CACHE_LINE_SIZE - 1)) { if (end & (CACHE_LINE_SIZE - 1)) {
end &= ~(CACHE_LINE_SIZE - 1); end &= ~(CACHE_LINE_SIZE - 1);
cache_wait(base + L2X0_CLEAN_INV_LINE_PA, 1); l2x0_flush_line(end);
writel(end, base + L2X0_CLEAN_INV_LINE_PA);
} }
while (start < end) { while (start < end) {
unsigned long blk_end = start + min(end - start, 4096UL); unsigned long blk_end = start + min(end - start, 4096UL);
while (start < blk_end) { while (start < blk_end) {
cache_wait(base + L2X0_INV_LINE_PA, 1); l2x0_inv_line(start);
writel(start, base + L2X0_INV_LINE_PA);
start += CACHE_LINE_SIZE; start += CACHE_LINE_SIZE;
} }
...@@ -103,8 +121,7 @@ static void l2x0_clean_range(unsigned long start, unsigned long end) ...@@ -103,8 +121,7 @@ static void l2x0_clean_range(unsigned long start, unsigned long end)
unsigned long blk_end = start + min(end - start, 4096UL); unsigned long blk_end = start + min(end - start, 4096UL);
while (start < blk_end) { while (start < blk_end) {
cache_wait(base + L2X0_CLEAN_LINE_PA, 1); l2x0_clean_line(start);
writel(start, base + L2X0_CLEAN_LINE_PA);
start += CACHE_LINE_SIZE; start += CACHE_LINE_SIZE;
} }
...@@ -129,8 +146,7 @@ static void l2x0_flush_range(unsigned long start, unsigned long end) ...@@ -129,8 +146,7 @@ static void l2x0_flush_range(unsigned long start, unsigned long end)
unsigned long blk_end = start + min(end - start, 4096UL); unsigned long blk_end = start + min(end - start, 4096UL);
while (start < blk_end) { while (start < blk_end) {
cache_wait(base + L2X0_CLEAN_INV_LINE_PA, 1); l2x0_flush_line(start);
writel(start, base + L2X0_CLEAN_INV_LINE_PA);
start += CACHE_LINE_SIZE; start += CACHE_LINE_SIZE;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册