blob: 683f005994b208a88eb08cf0c8457d8a8141f0bf [file] [log] [blame]
wdenk5c952cf2004-10-10 21:27:30 +00001/*
2 * (C) Copyright 2004, Psyent Corporation <www.psyent.com>
3 * Scott McNutt <smcnutt@psyent.com>
4 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
wdenk5c952cf2004-10-10 21:27:30 +00006 */
7
8#include <config.h>
9
10 .text
11
12 .global flush_dcache
13
14flush_dcache:
15 add r5, r5, r4
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020016 movhi r8, %hi(CONFIG_SYS_DCACHELINE_SIZE)
17 ori r8, r8, %lo(CONFIG_SYS_DCACHELINE_SIZE)
wdenk5c952cf2004-10-10 21:27:30 +0000180: flushd 0(r4)
19 add r4, r4, r8
20 bltu r4, r5, 0b
21 ret
22
23
24 .global flush_icache
25
26flush_icache:
27 add r5, r5, r4
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020028 movhi r8, %hi(CONFIG_SYS_ICACHELINE_SIZE)
29 ori r8, r8, %lo(CONFIG_SYS_ICACHELINE_SIZE)
wdenk5c952cf2004-10-10 21:27:30 +0000301: flushi r4
31 add r4, r4, r8
32 bltu r4, r5, 1b
33 ret
34
Stefan Kristiansson88758332011-11-04 14:38:08 +020035 .global flush_dcache_range
36
37flush_dcache_range:
38 movhi r8, %hi(CONFIG_SYS_DCACHELINE_SIZE)
39 ori r8, r8, %lo(CONFIG_SYS_DCACHELINE_SIZE)
400: flushd 0(r4)
41 add r4, r4, r8
42 bltu r4, r5, 0b
43 ret
44
wdenk5c952cf2004-10-10 21:27:30 +000045 .global flush_cache
46
47flush_cache:
48 add r5, r5, r4
49 mov r9, r4
50 mov r10, r5
51
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020052 movhi r8, %hi(CONFIG_SYS_DCACHELINE_SIZE)
53 ori r8, r8, %lo(CONFIG_SYS_DCACHELINE_SIZE)
wdenk5c952cf2004-10-10 21:27:30 +0000540: flushd 0(r4)
55 add r4, r4, r8
56 bltu r4, r5, 0b
57
58 mov r4, r9
59 mov r5, r10
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020060 movhi r8, %hi(CONFIG_SYS_ICACHELINE_SIZE)
61 ori r8, r8, %lo(CONFIG_SYS_ICACHELINE_SIZE)
wdenk5c952cf2004-10-10 21:27:30 +0000621: flushi r4
63 add r4, r4, r8
64 bltu r4, r5, 1b
65
66 sync
67 flushp
68 ret