Merge changes from topic "us_mhuv3" into integration

* changes:
  feat(tc): add MHUv3 addresses between RSS and AP
  feat(tc): specify MHU version based on platform
  feat(tc): bind SCMI over MHUv3 for TC3
  feat(tc): add MHUv3 DT binding for TC3
  feat(tc): add MHUv3 doorbell support on TC3
  refactor(tc): change tc_scmi_plat_info to single structure
This commit is contained in:
Manish Pandey 2024-05-30 17:10:22 +02:00 committed by TrustedFirmware Code Review
commit 95bf32e77c
7 changed files with 96 additions and 26 deletions

View file

@ -278,37 +278,35 @@
#size-cells = <1>;
ranges = <0 0x0 PLAT_ARM_NSRAM_BASE PLAT_ARM_NSRAM_SIZE>;
cpu_scp_scmi_mem: scp-shmem@0 {
cpu_scp_scmi_a2p: scp-shmem@0 {
compatible = "arm,scmi-shmem";
reg = <0x0 0x80>;
};
};
mbox_db_rx: mhu@MHU_RX_ADDR {
compatible = "arm,mhuv2-rx","arm,primecell";
reg = <0x0 ADDRESSIFY(MHU_RX_ADDR) 0x0 0x1000>;
compatible = MHU_RX_COMPAT;
reg = <0x0 ADDRESSIFY(MHU_RX_ADDR) 0x0 MHU_OFFSET>;
clocks = <&soc_refclk>;
clock-names = "apb_pclk";
#mbox-cells = <2>;
interrupts = <GIC_SPI INT_MBOX_RX IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "mhu_rx";
#mbox-cells = <MHU_MBOX_CELLS>;
interrupts = <GIC_SPI MHU_RX_INT_NUM IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = MHU_RX_INT_NAME;
};
mbox_db_tx: mhu@MHU_TX_ADDR {
compatible = "arm,mhuv2-tx","arm,primecell";
reg = <0x0 ADDRESSIFY(MHU_TX_ADDR) 0x0 0x1000>;
compatible = MHU_TX_COMPAT;
reg = <0x0 ADDRESSIFY(MHU_TX_ADDR) 0x0 MHU_OFFSET>;
clocks = <&soc_refclk>;
clock-names = "apb_pclk";
#mbox-cells = <2>;
interrupt-names = "mhu_tx";
#mbox-cells = <MHU_MBOX_CELLS>;
interrupt-names = MHU_TX_INT_NAME;
};
firmware {
scmi {
compatible = "arm,scmi";
mbox-names = "tx", "rx";
mboxes = <&mbox_db_tx 0 0 &mbox_db_rx 0 0 >;
shmem = <&cpu_scp_scmi_mem &cpu_scp_scmi_mem>;
#address-cells = <1>;
#size-cells = <0>;

View file

@ -20,9 +20,17 @@
#endif /* TARGET_FLAVOUR_FPGA */
#define BIG_CAPACITY 1024
#define INT_MBOX_RX 317
#define MHU_TX_ADDR 45000000 /* hex */
#define MHU_TX_COMPAT "arm,mhuv2-tx","arm,primecell"
#define MHU_TX_INT_NAME "mhu_tx"
#define MHU_RX_ADDR 45010000 /* hex */
#define MHU_RX_COMPAT "arm,mhuv2-rx","arm,primecell"
#define MHU_OFFSET 0x1000
#define MHU_MBOX_CELLS 2
#define MHU_RX_INT_NUM 317
#define MHU_RX_INT_NAME "mhu_rx"
#define MPAM_ADDR 0x1 0x00010000 /* 0x1_0001_0000 */
#define UARTCLK_FREQ 5000000
@ -211,6 +219,24 @@
arm,mhuv2-protocols = <0 1>;
};
firmware {
/*
* TC2 does not have a P2A channel, but wiring one was needed to make Linux work
* (by chance). At the time the SCMI driver did not support bidirectional
* mailboxes so as a workaround, the A2P channel was wired for TX communication
* and the synchronous replies would be read asyncrhonously as if coming from
* the P2A channel, while being the actual A2P channel.
*
* This will not work with kernels > 5.15, but keep it around to keep TC2
* working with its target kernel. Newer kernels will still work, but SCMI
* won't as they check that the two regions are distinct.
*/
scmi {
mboxes = <&mbox_db_tx 0 0 &mbox_db_rx 0 0>;
shmem = <&cpu_scp_scmi_a2p &cpu_scp_scmi_a2p>;
};
};
dp0: display@DPU_ADDR {
#if TC_SCMI_PD_CTRL_EN
power-domains = <&scmi_devpd (PLAT_MAX_CPUS_PER_CLUSTER + 2)>;

View file

@ -14,9 +14,17 @@
#define MID_CAPACITY 686
#define BIG_CAPACITY 1024
#define INT_MBOX_RX 300
#define MHU_TX_ADDR 46040000 /* hex */
#define MHU_TX_COMPAT "arm,mhuv3"
#define MHU_TX_INT_NAME ""
#define MHU_RX_ADDR 46140000 /* hex */
#define MHU_RX_COMPAT "arm,mhuv3"
#define MHU_OFFSET 0x10000
#define MHU_MBOX_CELLS 3
#define MHU_RX_INT_NUM 300
#define MHU_RX_INT_NAME "combined-mbx"
#define MPAM_ADDR 0x0 0x5f010000 /* 0x5f01_0000 */
#define UARTCLK_FREQ 3750000
@ -63,4 +71,18 @@
interrupt-affinity = <&CPU0>, <&CPU1>, <&CPU2>, <&CPU3>,
<&CPU4>, <&CPU5>, <&CPU6>, <&CPU7>;
};
sram: sram@6000000 {
cpu_scp_scmi_p2a: scp-shmem@80 {
compatible = "arm,scmi-shmem";
reg = <0x80 0x80>;
};
};
firmware {
scmi {
mboxes = <&mbox_db_tx 0 0 0 &mbox_db_rx 0 0 0 &mbox_db_rx 0 0 1>;
shmem = <&cpu_scp_scmi_a2p &cpu_scp_scmi_p2a>;
};
};
};

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2020, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2014-2024, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -22,6 +22,10 @@
#define SENDER_REG_STAT(_channel) (0x20 * (_channel))
#define SENDER_REG_SET(_channel) ((0x20 * (_channel)) + 0xC)
#define MHU_V3_PBX_PDBCW_PAGE_OFFSET UL(0x1000)
#define MHU_V3_SENDER_REG_SET(_channel) (MHU_V3_PBX_PDBCW_PAGE_OFFSET + \
SENDER_REG_SET(_channel))
/* Helper macro to ring doorbell */
#define MHU_RING_DOORBELL(addr, modify_mask, preserve_mask) do { \
uint32_t db = mmio_read_32(addr) & (preserve_mask); \

View file

@ -298,9 +298,14 @@
#endif /* TARGET_PLATFORM == 3 */
#define PLAT_MHUV2_BASE PLAT_CSS_MHU_BASE
/* TC2: AP<->RSE MHUs */
/* AP<->RSS MHUs */
#if TARGET_PLATFORM <= 2
#define PLAT_RSE_AP_SND_MHU_BASE UL(0x2A840000)
#define PLAT_RSE_AP_RCV_MHU_BASE UL(0x2A850000)
#elif TARGET_PLATFORM == 3
#define PLAT_RSE_AP_SND_MHU_BASE UL(0x49000000)
#define PLAT_RSE_AP_RCV_MHU_BASE UL(0x49100000)
#endif
#define CSS_SYSTEM_PWR_DMN_LVL ARM_PWR_LVL2
#define PLAT_MAX_PWR_LVL ARM_PWR_LVL1

View file

@ -71,6 +71,13 @@ CSS_LOAD_SCP_IMAGES := 1
# Save DSU PMU registers on cluster off and restore them on cluster on
PRESERVE_DSU_PMU_REGS := 1
# Specify MHU type based on platform
ifneq ($(filter ${TARGET_PLATFORM}, 2),)
PLAT_MHU_VERSION := 2
else
PLAT_MHU_VERSION := 3
endif
# Include GICv3 driver files
include drivers/arm/gic/v3/gicv3.mk

View file

@ -50,25 +50,33 @@ psa_status_t mbedtls_psa_external_get_random(
}
#endif /* PLATFORM_TEST_TFM_TESTSUITE */
static scmi_channel_plat_info_t tc_scmi_plat_info[] = {
{
.scmi_mbx_mem = CSS_SCMI_PAYLOAD_BASE,
.db_reg_addr = PLAT_CSS_MHU_BASE + SENDER_REG_SET(0),
.db_preserve_mask = 0xfffffffe,
.db_modify_mask = 0x1,
.ring_doorbell = &mhuv2_ring_doorbell,
}
#if TARGET_PLATFORM <= 2
static scmi_channel_plat_info_t tc_scmi_plat_info = {
.scmi_mbx_mem = CSS_SCMI_PAYLOAD_BASE,
.db_reg_addr = PLAT_CSS_MHU_BASE + SENDER_REG_SET(0),
.db_preserve_mask = 0xfffffffe,
.db_modify_mask = 0x1,
.ring_doorbell = &mhuv2_ring_doorbell,
};
#elif TARGET_PLATFORM == 3
static scmi_channel_plat_info_t tc_scmi_plat_info = {
.scmi_mbx_mem = CSS_SCMI_PAYLOAD_BASE,
.db_reg_addr = PLAT_CSS_MHU_BASE + MHU_V3_SENDER_REG_SET(0),
.db_preserve_mask = 0xfffffffe,
.db_modify_mask = 0x1,
.ring_doorbell = &mhu_ring_doorbell,
};
#endif
void bl31_platform_setup(void)
{
tc_bl31_common_platform_setup();
}
scmi_channel_plat_info_t *plat_css_get_scmi_info(unsigned int channel_id)
scmi_channel_plat_info_t *plat_css_get_scmi_info(unsigned int channel_id __unused)
{
return &tc_scmi_plat_info[channel_id];
return &tc_scmi_plat_info;
}