blob: ee3b4b79bf1a3d96810e4b9d65bdbf4605656534 [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
51 .global flush_cache
52
53flush_cache:
54 add r5, r5, r4
55 mov r9, r4
56 mov r10, r5
57
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020058 movhi r8, %hi(CONFIG_SYS_DCACHELINE_SIZE)
59 ori r8, r8, %lo(CONFIG_SYS_DCACHELINE_SIZE)
wdenk5c952cf2004-10-10 21:27:30 +0000600: flushd 0(r4)
61 add r4, r4, r8
62 bltu r4, r5, 0b
63
64 mov r4, r9
65 mov r5, r10
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020066 movhi r8, %hi(CONFIG_SYS_ICACHELINE_SIZE)
67 ori r8, r8, %lo(CONFIG_SYS_ICACHELINE_SIZE)
wdenk5c952cf2004-10-10 21:27:30 +0000681: flushi r4
69 add r4, r4, r8
70 bltu r4, r5, 1b
71
72 sync
73 flushp
74 ret