2018-05-07 05:58:06 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2002-09-23 07:07:35 +08:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2002
|
|
|
|
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
|
|
|
|
* Marius Groeger <mgroeger@sysgo.de>
|
|
|
|
*
|
|
|
|
* (C) Copyright 2002
|
2009-05-13 16:54:10 +08:00
|
|
|
* Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
|
2002-09-23 07:07:35 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* CPU specific code
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <command.h>
|
2019-11-15 03:57:37 +08:00
|
|
|
#include <cpu_func.h>
|
2019-11-15 03:57:42 +08:00
|
|
|
#include <irq_func.h>
|
2009-04-05 19:02:43 +08:00
|
|
|
#include <asm/system.h>
|
2002-09-23 07:07:35 +08:00
|
|
|
|
2009-04-05 19:06:31 +08:00
|
|
|
static void cache_flush(void);
|
2002-09-23 07:07:35 +08: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 ...
|
|
|
|
*/
|
|
|
|
|
2019-11-15 03:57:40 +08:00
|
|
|
disable_interrupts();
|
2002-09-23 07:07:35 +08:00
|
|
|
|
|
|
|
/* turn off I/D-cache */
|
2009-04-05 19:06:31 +08:00
|
|
|
icache_disable();
|
|
|
|
dcache_disable();
|
2002-09-23 07:07:35 +08:00
|
|
|
/* flush I/D-cache */
|
2009-04-05 19:06:31 +08:00
|
|
|
cache_flush();
|
2005-09-25 07:48:28 +08:00
|
|
|
|
2009-04-05 19:06:31 +08:00
|
|
|
return 0;
|
2002-09-23 07:07:35 +08:00
|
|
|
}
|
|
|
|
|
2009-04-05 19:06:31 +08:00
|
|
|
/* flush I/D-cache */
|
|
|
|
static void cache_flush (void)
|
2002-09-23 07:07:35 +08:00
|
|
|
{
|
2009-04-05 19:06:31 +08:00
|
|
|
unsigned long i = 0;
|
2002-09-23 07:07:35 +08:00
|
|
|
|
2009-04-05 19:06:31 +08:00
|
|
|
asm ("mcr p15, 0, %0, c7, c7, 0": :"r" (i));
|
2002-09-23 07:07:35 +08:00
|
|
|
}
|