mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-05 20:54:31 +00:00
9edefc2776
These functions belong in cpu_func.h. Another option would be cache.h but that code uses driver model and we have not moved these cache functions to use driver model. Since they are CPU-related it seems reasonable to put them here. Move them over. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
49 lines
820 B
C
49 lines
820 B
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* (C) Copyright 2017
|
|
* Christophe Leroy, CS Systemes d'Information, christophe.leroy@c-s.fr
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <cpu_func.h>
|
|
#include <asm/processor.h>
|
|
#include <asm/ppc.h>
|
|
#include <asm/io.h>
|
|
#include <asm/mmu.h>
|
|
|
|
int icache_status(void)
|
|
{
|
|
return !!(mfspr(IC_CST) & IDC_ENABLED);
|
|
}
|
|
|
|
void icache_enable(void)
|
|
{
|
|
sync();
|
|
mtspr(IC_CST, IDC_INVALL);
|
|
mtspr(IC_CST, IDC_ENABLE);
|
|
}
|
|
|
|
void icache_disable(void)
|
|
{
|
|
sync();
|
|
mtspr(IC_CST, IDC_DISABLE);
|
|
}
|
|
|
|
int dcache_status(void)
|
|
{
|
|
return !!(mfspr(IC_CST) & IDC_ENABLED);
|
|
}
|
|
|
|
void dcache_enable(void)
|
|
{
|
|
mtspr(MD_CTR, MD_RESETVAL); /* Set cache mode with MMU off */
|
|
mtspr(DC_CST, IDC_INVALL);
|
|
mtspr(DC_CST, IDC_ENABLE);
|
|
}
|
|
|
|
void dcache_disable(void)
|
|
{
|
|
sync();
|
|
mtspr(DC_CST, IDC_DISABLE);
|
|
mtspr(DC_CST, IDC_INVALL);
|
|
}
|