mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-19 02:54:24 +00:00
Merge "drivers: add a driver for snoop control unit" into integration
This commit is contained in:
commit
22d12c4148
6 changed files with 82 additions and 3 deletions
51
drivers/arm/scu/scu.c
Normal file
51
drivers/arm/scu/scu.c
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019, Arm Limited. All rights reserved.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <drivers/arm/scu.h>
|
||||||
|
#include <lib/mmio.h>
|
||||||
|
#include <plat/common/platform.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
* Turn ON snoop control unit. This is needed to synchronize the data between
|
||||||
|
* CPU's.
|
||||||
|
******************************************************************************/
|
||||||
|
void enable_snoop_ctrl_unit(uintptr_t base)
|
||||||
|
{
|
||||||
|
uint32_t scu_ctrl;
|
||||||
|
|
||||||
|
INFO("[SCU]: enabling snoop control unit ... \n");
|
||||||
|
|
||||||
|
assert(base != 0U);
|
||||||
|
scu_ctrl = mmio_read_32(base + SCU_CTRL_REG);
|
||||||
|
|
||||||
|
/* already enabled? */
|
||||||
|
if ((scu_ctrl & SCU_ENABLE_BIT) != 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
scu_ctrl |= SCU_ENABLE_BIT;
|
||||||
|
mmio_write_32(base + SCU_CTRL_REG, scu_ctrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
* Snoop Control Unit configuration register. This is read-only register and
|
||||||
|
* contains information such as
|
||||||
|
* - number of CPUs present
|
||||||
|
* - is a particular CPU operating in SMP mode or AMP mode
|
||||||
|
* - data cache size of a particular CPU
|
||||||
|
* - does SCU has ACP port
|
||||||
|
* - is L2CPRESENT
|
||||||
|
* NOTE: user of this API should interpert the bits in this register according
|
||||||
|
* to the TRM
|
||||||
|
******************************************************************************/
|
||||||
|
uint32_t read_snoop_ctrl_unit_cfg(uintptr_t base)
|
||||||
|
{
|
||||||
|
assert(base != 0U);
|
||||||
|
|
||||||
|
return mmio_read_32(base + SCU_CFG_REG);
|
||||||
|
}
|
20
include/drivers/arm/scu.h
Normal file
20
include/drivers/arm/scu.h
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019, Arm Limited. All rights reserved.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SCU_H
|
||||||
|
#define SCU_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define SCU_CTRL_REG 0x00
|
||||||
|
#define SCU_CFG_REG 0x04
|
||||||
|
|
||||||
|
#define SCU_ENABLE_BIT (1 << 0)
|
||||||
|
|
||||||
|
void enable_snoop_ctrl_unit(uintptr_t base);
|
||||||
|
uint32_t read_snoop_ctrl_unit_cfg(uintptr_t base);
|
||||||
|
|
||||||
|
#endif /* SCU_H */
|
|
@ -4,11 +4,10 @@
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <drivers/arm/gicv2.h>
|
||||||
#include <lib/psci/psci.h>
|
#include <lib/psci/psci.h>
|
||||||
#include <plat/arm/common/plat_arm.h>
|
#include <plat/arm/common/plat_arm.h>
|
||||||
#include <plat/common/platform.h>
|
#include <plat/common/platform.h>
|
||||||
#include <drivers/arm/gicv2.h>
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Platform handler called when a power domain is about to be turned on. The
|
* Platform handler called when a power domain is about to be turned on. The
|
||||||
|
|
|
@ -334,6 +334,9 @@
|
||||||
#define A5DS_HOLD_STATE_WAIT 0
|
#define A5DS_HOLD_STATE_WAIT 0
|
||||||
#define A5DS_HOLD_STATE_GO 1
|
#define A5DS_HOLD_STATE_GO 1
|
||||||
|
|
||||||
|
/* Snoop Control Unit base address */
|
||||||
|
#define A5DS_SCU_BASE 0x1C000000
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GIC related constants to cater for GICv2
|
* GIC related constants to cater for GICv2
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -4,12 +4,17 @@
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <drivers/arm/scu.h>
|
||||||
#include <plat/arm/common/plat_arm.h>
|
#include <plat/arm/common/plat_arm.h>
|
||||||
|
|
||||||
|
|
||||||
void plat_arm_sp_min_early_platform_setup(u_register_t arg0, u_register_t arg1,
|
void plat_arm_sp_min_early_platform_setup(u_register_t arg0, u_register_t arg1,
|
||||||
u_register_t arg2, u_register_t arg3)
|
u_register_t arg2, u_register_t arg3)
|
||||||
{
|
{
|
||||||
arm_sp_min_early_platform_setup((void *)arg0, arg1, arg2, (void *)arg3);
|
arm_sp_min_early_platform_setup((void *)arg0, arg1, arg2, (void *)arg3);
|
||||||
|
|
||||||
|
/* enable snoop control unit */
|
||||||
|
enable_snoop_ctrl_unit(A5DS_SCU_BASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
# SP_MIN source files specific to A5DS platform
|
# SP_MIN source files specific to A5DS platform
|
||||||
BL32_SOURCES += drivers/cfi/v2m/v2m_flash.c \
|
BL32_SOURCES += drivers/arm/scu/scu.c \
|
||||||
|
drivers/cfi/v2m/v2m_flash.c \
|
||||||
lib/utils/mem_region.c \
|
lib/utils/mem_region.c \
|
||||||
lib/aarch32/arm32_aeabi_divmod.c \
|
lib/aarch32/arm32_aeabi_divmod.c \
|
||||||
lib/aarch32/arm32_aeabi_divmod_a32.S \
|
lib/aarch32/arm32_aeabi_divmod_a32.S \
|
||||||
|
|
Loading…
Add table
Reference in a new issue