2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2015-03-01 11:44:39 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2010,2011
|
|
|
|
* Vladimir Khusainov, Emcraft Systems, vlad@emcraft.com
|
|
|
|
*
|
|
|
|
* (C) Copyright 2015
|
2015-11-29 10:50:53 +00:00
|
|
|
* Kamil Lulko, <kamil.lulko@gmail.com>
|
2015-03-01 11:44:39 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2019-11-14 19:57:37 +00:00
|
|
|
#include <cpu_func.h>
|
2019-11-14 19:57:42 +00:00
|
|
|
#include <irq_func.h>
|
2015-03-01 11:44:39 +00:00
|
|
|
#include <asm/io.h>
|
|
|
|
#include <asm/armv7m.h>
|
2022-01-01 17:13:25 +00:00
|
|
|
#include <spl.h>
|
2015-03-01 11:44:39 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This is called right before passing control to
|
|
|
|
* the Linux kernel point.
|
|
|
|
*/
|
|
|
|
int cleanup_before_linux(void)
|
|
|
|
{
|
2017-05-03 22:48:26 +00:00
|
|
|
/*
|
|
|
|
* this function is called just before we call linux
|
|
|
|
* it prepares the processor for linux
|
|
|
|
*
|
|
|
|
* disable interrupt and turn off caches etc ...
|
|
|
|
*/
|
|
|
|
disable_interrupts();
|
|
|
|
/*
|
|
|
|
* turn off D-cache
|
|
|
|
* dcache_disable() in turn flushes the d-cache
|
|
|
|
* MPU is still enabled & can't be disabled as the u-boot
|
|
|
|
* code might be running in sdram which by default is not
|
|
|
|
* executable area.
|
|
|
|
*/
|
|
|
|
dcache_disable();
|
|
|
|
/* invalidate to make sure no cache line gets dirty between
|
|
|
|
* dcache flushing and disabling dcache */
|
|
|
|
invalidate_dcache_all();
|
|
|
|
|
2018-03-30 07:22:40 +00:00
|
|
|
icache_disable();
|
|
|
|
invalidate_icache_all();
|
|
|
|
|
2015-03-01 11:44:39 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Perform the low-level reset.
|
|
|
|
*/
|
2020-12-15 15:47:52 +00:00
|
|
|
void reset_cpu(void)
|
2015-03-01 11:44:39 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Perform reset but keep priority group unchanged.
|
|
|
|
*/
|
|
|
|
writel((V7M_AIRCR_VECTKEY << V7M_AIRCR_VECTKEY_SHIFT)
|
|
|
|
| (V7M_SCB->aircr & V7M_AIRCR_PRIGROUP_MSK)
|
|
|
|
| V7M_AIRCR_SYSRESET, &V7M_SCB->aircr);
|
|
|
|
}
|
2022-01-01 17:13:25 +00:00
|
|
|
|
|
|
|
void spl_perform_fixups(struct spl_image_info *spl_image)
|
|
|
|
{
|
|
|
|
spl_image->entry_point |= 0x1;
|
|
|
|
}
|