wdenk | ef3386f | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 1 | /* |
| 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 | |
| 30 | flush_dcache: |
| 31 | add r5, r5, r4 |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 32 | movhi r8, %hi(CONFIG_SYS_DCACHELINE_SIZE) |
| 33 | ori r8, r8, %lo(CONFIG_SYS_DCACHELINE_SIZE) |
wdenk | ef3386f | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 34 | 0: flushd 0(r4) |
| 35 | add r4, r4, r8 |
| 36 | bltu r4, r5, 0b |
| 37 | ret |
| 38 | |
| 39 | |
| 40 | .global flush_icache |
| 41 | |
| 42 | flush_icache: |
| 43 | add r5, r5, r4 |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 44 | movhi r8, %hi(CONFIG_SYS_ICACHELINE_SIZE) |
| 45 | ori r8, r8, %lo(CONFIG_SYS_ICACHELINE_SIZE) |
wdenk | ef3386f | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 46 | 1: flushi r4 |
| 47 | add r4, r4, r8 |
| 48 | bltu r4, r5, 1b |
| 49 | ret |
| 50 | |
Stefan Kristiansson | 8bbcefe | 2011-11-04 14:38:08 +0200 | [diff] [blame] | 51 | .global flush_dcache_range |
| 52 | |
| 53 | flush_dcache_range: |
| 54 | movhi r8, %hi(CONFIG_SYS_DCACHELINE_SIZE) |
| 55 | ori r8, r8, %lo(CONFIG_SYS_DCACHELINE_SIZE) |
| 56 | 0: flushd 0(r4) |
| 57 | add r4, r4, r8 |
| 58 | bltu r4, r5, 0b |
| 59 | ret |
| 60 | |
wdenk | ef3386f | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 61 | .global flush_cache |
| 62 | |
| 63 | flush_cache: |
| 64 | add r5, r5, r4 |
| 65 | mov r9, r4 |
| 66 | mov r10, r5 |
| 67 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 68 | movhi r8, %hi(CONFIG_SYS_DCACHELINE_SIZE) |
| 69 | ori r8, r8, %lo(CONFIG_SYS_DCACHELINE_SIZE) |
wdenk | ef3386f | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 70 | 0: 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-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 76 | movhi r8, %hi(CONFIG_SYS_ICACHELINE_SIZE) |
| 77 | ori r8, r8, %lo(CONFIG_SYS_ICACHELINE_SIZE) |
wdenk | ef3386f | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 78 | 1: flushi r4 |
| 79 | add r4, r4, r8 |
| 80 | bltu r4, r5, 1b |
| 81 | |
| 82 | sync |
| 83 | flushp |
| 84 | ret |