2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2003-08-29 22:00:43 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2002
|
|
|
|
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
|
|
|
|
* Marius Groeger <mgroeger@sysgo.de>
|
|
|
|
*
|
|
|
|
* (C) Copyright 2002
|
2009-05-13 08:54:10 +00:00
|
|
|
* Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
|
2003-08-29 22:00:43 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* CPU specific code
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <command.h>
|
2009-04-05 11:02:43 +00:00
|
|
|
#include <asm/system.h>
|
2003-08-29 22:00:43 +00:00
|
|
|
|
2009-04-05 11:06:31 +00:00
|
|
|
static void cache_flush(void);
|
2003-08-29 22:00:43 +00:00
|
|
|
|
|
|
|
int cleanup_before_linux (void)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* this function is called just before we call linux
|
|
|
|
* it prepares the processor for linux
|
|
|
|
*
|
|
|
|
* we turn off caches etc ...
|
|
|
|
*/
|
|
|
|
|
|
|
|
disable_interrupts ();
|
|
|
|
|
|
|
|
|
2009-04-05 11:06:31 +00:00
|
|
|
/* turn off I/D-cache */
|
|
|
|
icache_disable();
|
|
|
|
dcache_disable();
|
2012-02-06 17:12:10 +00:00
|
|
|
l2_cache_disable();
|
|
|
|
|
2003-08-29 22:00:43 +00:00
|
|
|
/* flush I/D-cache */
|
2009-04-05 11:06:31 +00:00
|
|
|
cache_flush();
|
2005-09-24 23:48:28 +00:00
|
|
|
|
2009-04-05 11:06:31 +00:00
|
|
|
return 0;
|
2003-08-29 22:00:43 +00:00
|
|
|
}
|
|
|
|
|
2009-04-05 11:06:31 +00:00
|
|
|
/* flush I/D-cache */
|
|
|
|
static void cache_flush (void)
|
2008-07-10 14:46:33 +00:00
|
|
|
{
|
2019-05-03 13:41:00 +00:00
|
|
|
#if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
|
2009-04-05 11:06:31 +00:00
|
|
|
unsigned long i = 0;
|
2008-07-10 14:46:33 +00:00
|
|
|
|
2009-04-05 11:06:31 +00:00
|
|
|
asm ("mcr p15, 0, %0, c7, c7, 0": :"r" (i));
|
arm, arm926ejs: make thumb mode compileable
in thumb mode compiler says for example for arch/arm/lib/cache-cp15.c
when enabling CONFIG_SYS_THUMB_BUILD:
{standard input}: Assembler messages:
{standard input}:373: Error: selected processor does not support Thumb mode `mrc p15,0,r4,c1,c0,0'
{standard input}:416: Error: selected processor does not support Thumb mode `mcr p15,0,r3,c2,c0,0'
so, if caches are disabled, do not use this command on arm926ejs.
used on at91 in SPL, to reduce size of SPL.
Signed-off-by: Heiko Schocher <hs@denx.de>
2014-11-18 08:41:56 +00:00
|
|
|
#endif
|
2003-08-29 22:00:43 +00:00
|
|
|
}
|