blob: f1c0792ce8da0afcf1b17b68f6cd9b7547b07822 [file] [log] [blame]
wdenkedc48b62002-09-08 17:56:50 +00001/*
2 * (C) Copyright 2002
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
wdenkedc48b62002-09-08 17:56:50 +00006 */
7
8/* for now: just dummy functions to satisfy the linker */
9
wdenk8ed96042005-01-09 23:16:25 +000010#include <common.h>
11
Jeroen Hofsteefcfddfd2014-06-23 22:07:04 +020012__weak void flush_cache(unsigned long start, unsigned long size)
wdenkedc48b62002-09-08 17:56:50 +000013{
Masahiro Yamada3fd968e2014-11-06 14:59:37 +090014#if defined(CONFIG_CPU_ARM1136)
wdenk8ed96042005-01-09 23:16:25 +000015
Albert ARIBAUDb4ee1492014-04-15 16:13:47 +020016#if !defined(CONFIG_SYS_ICACHE_OFF)
17 asm("mcr p15, 0, r1, c7, c5, 0"); /* invalidate I cache */
wdenk8ed96042005-01-09 23:16:25 +000018#endif
Albert ARIBAUDb4ee1492014-04-15 16:13:47 +020019
20#if !defined(CONFIG_SYS_DCACHE_OFF)
21 asm("mcr p15, 0, r1, c7, c14, 0"); /* Clean+invalidate D cache */
22#endif
23
Masahiro Yamada3fd968e2014-11-06 14:59:37 +090024#endif /* CONFIG_CPU_ARM1136 */
Albert ARIBAUDb4ee1492014-04-15 16:13:47 +020025
Masahiro Yamada5d7b1312014-11-06 14:59:36 +090026#ifdef CONFIG_CPU_ARM926EJS
Heiko Schocherc3330e92010-09-17 13:10:30 +020027 /* test and clean, page 2-23 of arm926ejs manual */
28 asm("0: mrc p15, 0, r15, c7, c10, 3\n\t" "bne 0b\n" : : : "memory");
29 /* disable write buffer as well (page 2-22) */
30 asm("mcr p15, 0, %0, c7, c10, 4" : : "r" (0));
Masahiro Yamada5d7b1312014-11-06 14:59:36 +090031#endif /* CONFIG_CPU_ARM926EJS */
wdenkedc48b62002-09-08 17:56:50 +000032 return;
33}
Aneesh Ve05f0072011-06-16 23:30:50 +000034
35/*
36 * Default implementation:
37 * do a range flush for the entire range
38 */
Jeroen Hofsteefcfddfd2014-06-23 22:07:04 +020039__weak void flush_dcache_all(void)
Aneesh Ve05f0072011-06-16 23:30:50 +000040{
41 flush_cache(0, ~0);
42}
Aneesh Vcba4b182011-08-16 04:33:05 +000043
44/*
45 * Default implementation of enable_caches()
46 * Real implementation should be in platform code
47 */
Jeroen Hofsteefcfddfd2014-06-23 22:07:04 +020048__weak void enable_caches(void)
Aneesh Vcba4b182011-08-16 04:33:05 +000049{
50 puts("WARNING: Caches not enabled\n");
51}