diff options
author | Marcin Bukat <marcin.bukat@gmail.com> | 2013-01-12 21:57:37 +0100 |
---|---|---|
committer | Marcin Bukat <marcin.bukat@gmail.com> | 2013-01-12 21:57:37 +0100 |
commit | 29e51a17775df5040b12d93834c45b3f1171ed9d (patch) | |
tree | ed8acf1ed71979be83f0717589e88314efc4d27b /firmware | |
parent | e2be0e75ab91ff9a29496a375386297bdb184716 (diff) |
rk27xx: slightly optimize commit_discard_dcache_range()
Change-Id: I13ce643d4ba26db5de9ffa083070d7f40b0e7b1f
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/target/arm/rk27xx/system-rk27xx.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/firmware/target/arm/rk27xx/system-rk27xx.c b/firmware/target/arm/rk27xx/system-rk27xx.c index 20d0226892..712c7d6549 100644 --- a/firmware/target/arm/rk27xx/system-rk27xx.c +++ b/firmware/target/arm/rk27xx/system-rk27xx.c @@ -218,18 +218,17 @@ void commit_discard_dcache (void) __attribute__((alias("commit_discard_idcache") void commit_discard_dcache_range (const void *base, unsigned int size) { - int cnt = size + ((unsigned long)base & 0x1f); - unsigned long opcode = ((unsigned long)base & 0xffffffe0) | 0x01; + /* 0x01 is opcode for cache line commit discard */ + uint32_t end_opcode = (uint32_t)((uintptr_t)base + size) | 0x01; + uint32_t opcode = (uint32_t)((uintptr_t)base & 0xffffffe0) | 0x01; int old_irq = disable_irq_save(); - while (cnt > 0) + while (opcode <= end_opcode) { - CACHEOP = opcode; - while (CACHEOP & 0x03); - cnt -= 32; + CACHEOP = opcode; opcode += 32; } |