Wolfgang Denk | 97caf67 | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 1 | /* |
| 2 | * U-boot - cache.c |
| 3 | * |
Mike Frysinger | 79279c6 | 2008-02-19 00:50:58 -0500 | [diff] [blame] | 4 | * Copyright (c) 2005-2008 Analog Devices Inc. |
Wolfgang Denk | 97caf67 | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 5 | * |
| 6 | * (C) Copyright 2000-2004 |
| 7 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 8 | * |
Mike Frysinger | 79279c6 | 2008-02-19 00:50:58 -0500 | [diff] [blame] | 9 | * Licensed under the GPL-2 or later. |
Wolfgang Denk | 97caf67 | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 10 | */ |
| 11 | |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 12 | #include <common.h> |
| 13 | #include <asm/blackfin.h> |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 14 | |
Mike Frysinger | 79279c6 | 2008-02-19 00:50:58 -0500 | [diff] [blame] | 15 | void flush_cache(unsigned long addr, unsigned long size) |
Wolfgang Denk | 97caf67 | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 16 | { |
Mike Frysinger | 79279c6 | 2008-02-19 00:50:58 -0500 | [diff] [blame] | 17 | /* no need to flush stuff in on chip memory (L1/L2/etc...) */ |
| 18 | if (addr >= 0xE0000000) |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 19 | return; |
| 20 | |
| 21 | if (icache_status()) |
Mike Frysinger | 79279c6 | 2008-02-19 00:50:58 -0500 | [diff] [blame] | 22 | blackfin_icache_flush_range((void *)addr, (void *)(addr + size)); |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 23 | |
Mike Frysinger | 79279c6 | 2008-02-19 00:50:58 -0500 | [diff] [blame] | 24 | if (dcache_status()) |
| 25 | blackfin_dcache_flush_range((void *)addr, (void *)(addr + size)); |
Wolfgang Denk | 97caf67 | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 26 | } |