blob: b952d0c901aefa80f9fe1517fa88a1cece9f5972 [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 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
22 */
23
24#include <config.h>
25
26 .text
27
28 .global flush_dcache
29
30flush_dcache:
31 add r5, r5, r4
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020032 movhi r8, %hi(CONFIG_SYS_DCACHELINE_SIZE)
33 ori r8, r8, %lo(CONFIG_SYS_DCACHELINE_SIZE)
wdenk5c952cf2004-10-10 21:27:30 +0000340: flushd 0(r4)
35 add r4, r4, r8
36 bltu r4, r5, 0b
37 ret
38
39
40 .global flush_icache
41
42flush_icache:
43 add r5, r5, r4
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020044 movhi r8, %hi(CONFIG_SYS_ICACHELINE_SIZE)
45 ori r8, r8, %lo(CONFIG_SYS_ICACHELINE_SIZE)
wdenk5c952cf2004-10-10 21:27:30 +0000461: flushi r4
47 add r4, r4, r8
48 bltu r4, r5, 1b
49 ret
50
Stefan Kristiansson88758332011-11-04 14:38:08 +020051 .global flush_dcache_range
52
53flush_dcache_range:
54 movhi r8, %hi(CONFIG_SYS_DCACHELINE_SIZE)
55 ori r8, r8, %lo(CONFIG_SYS_DCACHELINE_SIZE)
560: flushd 0(r4)
57 add r4, r4, r8
58 bltu r4, r5, 0b
59 ret
60
wdenk5c952cf2004-10-10 21:27:30 +000061 .global flush_cache
62
63flush_cache:
64 add r5, r5, r4
65 mov r9, r4
66 mov r10, r5
67
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020068 movhi r8, %hi(CONFIG_SYS_DCACHELINE_SIZE)
69 ori r8, r8, %lo(CONFIG_SYS_DCACHELINE_SIZE)
wdenk5c952cf2004-10-10 21:27:30 +0000700: flushd 0(r4)
71 add r4, r4, r8
72 bltu r4, r5, 0b
73
74 mov r4, r9
75 mov r5, r10
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020076 movhi r8, %hi(CONFIG_SYS_ICACHELINE_SIZE)
77 ori r8, r8, %lo(CONFIG_SYS_ICACHELINE_SIZE)
wdenk5c952cf2004-10-10 21:27:30 +0000781: flushi r4
79 add r4, r4, r8
80 bltu r4, r5, 1b
81
82 sync
83 flushp
84 ret