soc/mediatek/mt8192: Turn off L2C SRAM and reconfigure as L2 cache
Mediatek SoC uses part of the L2 cache as SRAM before DRAM is ready. After DRAM is ready, we should invoke disable_l2c_sram to reconfigure the L2C SRAM as L2 cache. Signed-off-by: CK Hu <ck.hu@mediatek.com> Change-Id: Icaf80bd9da3e082405ba66ef05dd5ea9185784a0 Reviewed-on: https://review.coreboot.org/c/coreboot/+/46387 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
9190345bf0
commit
3398f3152c
|
@ -30,6 +30,7 @@ ramstage-y += flash_controller.c
|
|||
ramstage-y += ../common/gpio.c gpio.c
|
||||
ramstage-y += emi.c
|
||||
ramstage-$(CONFIG_SPI_FLASH) += ../common/spi.c spi.c
|
||||
ramstage-y += ../common/mmu_operations.c mmu_operations.c
|
||||
ramstage-y += ../common/mtcmos.c mtcmos.c
|
||||
ramstage-y += soc.c
|
||||
ramstage-y += ../common/timer.c
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
|
||||
#include <device/mmio.h>
|
||||
#include <soc/mcucfg.h>
|
||||
#include <soc/mmu_operations.h>
|
||||
|
||||
DEFINE_BIT(MP0_CLUSTER_CFG0_L3_SHARE_EN, 9)
|
||||
DEFINE_BIT(MP0_CLUSTER_CFG0_L3_SHARE_PRE_EN, 8)
|
||||
|
||||
void mtk_soc_disable_l2c_sram(void)
|
||||
{
|
||||
unsigned long v;
|
||||
|
||||
SET32_BITFIELDS(&mt8192_mcucfg->mp0_cluster_cfg0,
|
||||
MP0_CLUSTER_CFG0_L3_SHARE_EN, 0);
|
||||
dsb();
|
||||
|
||||
__asm__ volatile ("mrs %0, S3_0_C15_C3_5" : "=r" (v));
|
||||
v |= (0xf << 4);
|
||||
__asm__ volatile ("msr S3_0_C15_C3_5, %0" : : "r" (v));
|
||||
dsb();
|
||||
|
||||
do {
|
||||
__asm__ volatile ("mrs %0, S3_0_C15_C3_7" : "=r" (v));
|
||||
} while (((v >> 0x4) & 0xf) != 0xf);
|
||||
|
||||
SET32_BITFIELDS(&mt8192_mcucfg->mp0_cluster_cfg0,
|
||||
MP0_CLUSTER_CFG0_L3_SHARE_PRE_EN, 0);
|
||||
dsb();
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <device/device.h>
|
||||
#include <soc/emi.h>
|
||||
#include <soc/mmu_operations.h>
|
||||
#include <symbols.h>
|
||||
|
||||
static void soc_read_resources(struct device *dev)
|
||||
|
@ -11,6 +12,7 @@ static void soc_read_resources(struct device *dev)
|
|||
|
||||
static void soc_init(struct device *dev)
|
||||
{
|
||||
mtk_mmu_disable_l2c_sram();
|
||||
}
|
||||
|
||||
static struct device_operations soc_ops = {
|
||||
|
|
Loading…
Reference in New Issue