mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-26 06:50:10 +00:00

Enforce full include path for includes. Deprecate old paths. The following folders inside include/lib have been left unchanged: - include/lib/cpus/${ARCH} - include/lib/el3_runtime/${ARCH} The reason for this change is that having a global namespace for includes isn't a good idea. It defeats one of the advantages of having folders and it introduces problems that are sometimes subtle (because you may not know the header you are actually including if there are two of them). For example, this patch had to be created because two headers were called the same way:e0ea0928d5
("Fix gpio includes of mt8173 platform to avoid collision."). More recently, this patch has had similar problems:46f9b2c3a2
("drivers: add tzc380 support"). This problem was introduced in commit4ecca33988
("Move include and source files to logical locations"). At that time, there weren't too many headers so it wasn't a real issue. However, time has shown that this creates problems. Platforms that want to preserve the way they include headers may add the removed paths to PLAT_INCLUDES, but this is discouraged. Change-Id: I39dc53ed98f9e297a5966e723d1936d6ccf2fc8f Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
111 lines
2.2 KiB
C
111 lines
2.2 KiB
C
/*
|
|
* Copyright (C) 2018 Marvell International Ltd.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
* https://spdx.org/licenses
|
|
*/
|
|
|
|
/* LLC driver is the Last Level Cache (L3C) driver
|
|
* for Marvell SoCs in AP806, AP807, and AP810
|
|
*/
|
|
|
|
#include <assert.h>
|
|
|
|
#include <arch_helpers.h>
|
|
#include <drivers/marvell/cache_llc.h>
|
|
#include <drivers/marvell/ccu.h>
|
|
#include <lib/mmio.h>
|
|
|
|
#include <mvebu_def.h>
|
|
|
|
#define CCU_HTC_CR(ap_index) (MVEBU_CCU_BASE(ap_index) + 0x200)
|
|
#define CCU_SET_POC_OFFSET 5
|
|
|
|
extern void ca72_l2_enable_unique_clean(void);
|
|
|
|
void llc_cache_sync(int ap_index)
|
|
{
|
|
mmio_write_32(LLC_SYNC(ap_index), 0);
|
|
/* Atomic write, no need to wait */
|
|
}
|
|
|
|
void llc_flush_all(int ap_index)
|
|
{
|
|
mmio_write_32(L2X0_CLEAN_INV_WAY(ap_index), LLC_WAY_MASK);
|
|
llc_cache_sync(ap_index);
|
|
}
|
|
|
|
void llc_clean_all(int ap_index)
|
|
{
|
|
mmio_write_32(L2X0_CLEAN_WAY(ap_index), LLC_WAY_MASK);
|
|
llc_cache_sync(ap_index);
|
|
}
|
|
|
|
void llc_inv_all(int ap_index)
|
|
{
|
|
mmio_write_32(L2X0_INV_WAY(ap_index), LLC_WAY_MASK);
|
|
llc_cache_sync(ap_index);
|
|
}
|
|
|
|
void llc_disable(int ap_index)
|
|
{
|
|
llc_flush_all(ap_index);
|
|
mmio_write_32(LLC_CTRL(ap_index), 0);
|
|
dsbishst();
|
|
}
|
|
|
|
void llc_enable(int ap_index, int excl_mode)
|
|
{
|
|
uint32_t val;
|
|
|
|
dsbsy();
|
|
llc_inv_all(ap_index);
|
|
dsbsy();
|
|
|
|
val = LLC_CTRL_EN;
|
|
if (excl_mode)
|
|
val |= LLC_EXCLUSIVE_EN;
|
|
|
|
mmio_write_32(LLC_CTRL(ap_index), val);
|
|
dsbsy();
|
|
}
|
|
|
|
int llc_is_exclusive(int ap_index)
|
|
{
|
|
uint32_t reg;
|
|
|
|
reg = mmio_read_32(LLC_CTRL(ap_index));
|
|
|
|
if ((reg & (LLC_CTRL_EN | LLC_EXCLUSIVE_EN)) ==
|
|
(LLC_CTRL_EN | LLC_EXCLUSIVE_EN))
|
|
return 1;
|
|
|
|
return 0;
|
|
}
|
|
|
|
void llc_runtime_enable(int ap_index)
|
|
{
|
|
uint32_t reg;
|
|
|
|
reg = mmio_read_32(LLC_CTRL(ap_index));
|
|
if (reg & LLC_CTRL_EN)
|
|
return;
|
|
|
|
INFO("Enabling LLC\n");
|
|
|
|
/*
|
|
* Enable L2 UniqueClean evictions with data
|
|
* Note: this configuration assumes that LLC is configured
|
|
* in exclusive mode.
|
|
* Later on in the code this assumption will be validated
|
|
*/
|
|
ca72_l2_enable_unique_clean();
|
|
llc_enable(ap_index, 1);
|
|
|
|
/* Set point of coherency to DDR.
|
|
* This is required by units which have SW cache coherency
|
|
*/
|
|
reg = mmio_read_32(CCU_HTC_CR(ap_index));
|
|
reg |= (0x1 << CCU_SET_POC_OFFSET);
|
|
mmio_write_32(CCU_HTC_CR(ap_index), reg);
|
|
}
|