Skip to content

Commit

Permalink
product/sgm776: Improve transport module init sequence
Browse files Browse the repository at this point in the history
At present, the transport module delays the initialization of
the shared memory channel due to dependency on the power domain
responsible for the shared memory. The transport module registers
a notification for the status of this power domain and waits
for powered on notification, it will then initialize the channel
once it receives power on notification from the power domain module.
However, for some platforms power domain can be initialized early
using default_power_on = true setting in respective
platform-specific config_ppu*.c as many platforms have its shared
memory in the SYSTOP power domain which is usually enabled by default.
The reason we need above early initialization because few other
modules would not be proceeding without the transport module channel
initialization which would further interact with the transport module
using notifications, thus deferring its initialization.
If we can initialize the transport module early we can also
initialize other modules early too.

This change includes modifications to
    1. ppu configuration that sets default_power_on = true
    for SYSTOP
    2. Relevant modification to clock configurations, as we are
    enabling the required clocks before all modules are started.
    3. Change the order of module initialisation in cmake file

Note, this change depends on the following commits

clock: allow the initial rate to be set during initialization
transport: add condition to check power domain is valid

Change-Id: I7d176d4c58ada0e944bb14a635efb7a3ffae3ad8
Signed-off-by: Girish Pathak <[email protected]>
  • Loading branch information
girishpathak authored and tarek-arm committed Aug 7, 2023
1 parent d3aae1e commit 8851d49
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 68 deletions.
8 changes: 4 additions & 4 deletions product/sgm776/scp_ramfw/Firmware.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# Arm SCP/MCP Software
# Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.
# Copyright (c) 2021-2023, Arm Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
Expand Down Expand Up @@ -31,16 +31,16 @@ list(APPEND SCP_MODULES "sid")
list(APPEND SCP_MODULES "system-info")
list(APPEND SCP_MODULES "pcid")
list(APPEND SCP_MODULES "pl011")
list(APPEND SCP_MODULES "ppu-v1")
list(APPEND SCP_MODULES "system-power")
list(APPEND SCP_MODULES "power-domain")
list(APPEND SCP_MODULES "gtimer")
list(APPEND SCP_MODULES "timer")
list(APPEND SCP_MODULES "ddr-phy500")
list(APPEND SCP_MODULES "dmc500")
list(APPEND SCP_MODULES "reg-sensor")
list(APPEND SCP_MODULES "sensor")
list(APPEND SCP_MODULES "ppu-v1")
list(APPEND SCP_MODULES "system-power")
list(APPEND SCP_MODULES "sgm776-system")
list(APPEND SCP_MODULES "power-domain")
list(APPEND SCP_MODULES "psu")
list(APPEND SCP_MODULES "mock-psu")
list(APPEND SCP_MODULES "mhu2")
Expand Down
3 changes: 2 additions & 1 deletion product/sgm776/scp_ramfw/config_clock.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Arm SCP/MCP Software
* Copyright (c) 2015-2021, Arm Limited and Contributors. All rights reserved.
* Copyright (c) 2015-2023, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
Expand Down Expand Up @@ -83,6 +83,7 @@ static const struct fwk_element clock_dev_desc_table[] = {
.driver_id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_PIK_CLOCK, 11),
.api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_PIK_CLOCK,
MOD_PIK_CLOCK_API_TYPE_CLOCK),
.default_on = true,
}),
},
[CLOCK_DEV_IDX_COUNT] = { 0 }, /* Termination description. */
Expand Down
4 changes: 3 additions & 1 deletion product/sgm776/scp_ramfw/config_ppu_v1.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Arm SCP/MCP Software
* Copyright (c) 2017-2021, Arm Limited and Contributors. All rights reserved.
* Copyright (c) 2017-2023, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
Expand Down Expand Up @@ -97,6 +97,7 @@ static struct fwk_element ppu_table[PPU_V1_ELEMENT_IDX_COUNT + 1] = {
.ppu.reg_base = PPU_SYS0_BASE,
.ppu.irq = PPU_SYS0_IRQ,
.observer_id = FWK_ID_NONE_INIT,
.default_power_on = true,
}),
},
[PPU_V1_ELEMENT_IDX_SYS1] = {
Expand All @@ -106,6 +107,7 @@ static struct fwk_element ppu_table[PPU_V1_ELEMENT_IDX_COUNT + 1] = {
.ppu.reg_base = PPU_SYS1_BASE,
.ppu.irq = PPU_SYS1_IRQ,
.observer_id = FWK_ID_NONE_INIT,
.default_power_on = true,
}),
},
[PPU_V1_ELEMENT_IDX_COUNT] = {0},
Expand Down
14 changes: 4 additions & 10 deletions product/sgm776/scp_ramfw/config_scmi.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Arm SCP/MCP Software
* Copyright (c) 2015-2022, Arm Limited and Contributors. All rights reserved.
* Copyright (c) 2015-2023, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
Expand All @@ -24,9 +24,7 @@ static const struct fwk_element service_table[] = {
SGM776_SCMI_SERVICE_IDX_PSCI),
.transport_api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_TRANSPORT,
MOD_TRANSPORT_API_IDX_SCMI_TO_TRANSPORT),
.transport_notification_init_id =
FWK_ID_NOTIFICATION_INIT(FWK_MODULE_IDX_TRANSPORT,
MOD_TRANSPORT_NOTIFICATION_IDX_INITIALIZED),
.transport_notification_init_id = FWK_ID_NONE_INIT,
.scmi_agent_id = SCMI_AGENT_ID_PSCI,
.scmi_p2a_id = FWK_ID_NONE_INIT,
}),
Expand All @@ -38,9 +36,7 @@ static const struct fwk_element service_table[] = {
SGM776_SCMI_SERVICE_IDX_OSPM_0),
.transport_api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_TRANSPORT,
MOD_TRANSPORT_API_IDX_SCMI_TO_TRANSPORT),
.transport_notification_init_id =
FWK_ID_NOTIFICATION_INIT(FWK_MODULE_IDX_TRANSPORT,
MOD_TRANSPORT_NOTIFICATION_IDX_INITIALIZED),
.transport_notification_init_id = FWK_ID_NONE_INIT,
.scmi_agent_id = SCMI_AGENT_ID_OSPM,
.scmi_p2a_id = FWK_ID_NONE_INIT,
}),
Expand All @@ -52,9 +48,7 @@ static const struct fwk_element service_table[] = {
SGM776_SCMI_SERVICE_IDX_OSPM_1),
.transport_api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_TRANSPORT,
MOD_TRANSPORT_API_IDX_SCMI_TO_TRANSPORT),
.transport_notification_init_id =
FWK_ID_NOTIFICATION_INIT(FWK_MODULE_IDX_TRANSPORT,
MOD_TRANSPORT_NOTIFICATION_IDX_INITIALIZED),
.transport_notification_init_id = FWK_ID_NONE_INIT,
.scmi_agent_id = SCMI_AGENT_ID_OSPM,
.scmi_p2a_id = FWK_ID_NONE_INIT,
}),
Expand Down
8 changes: 3 additions & 5 deletions product/sgm776/scp_ramfw/config_sds.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Arm SCP/MCP Software
* Copyright (c) 2017-2021, Arm Limited and Contributors. All rights reserved.
* Copyright (c) 2017-2023, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
Expand Down Expand Up @@ -43,11 +43,9 @@ static_assert(FWK_ARRAY_SIZE(sds_module_regions) == SGM776_SDS_REGION_COUNT,
"provided by the SDS configuration.");

const struct mod_sds_config sds_module_config = {
.regions = sds_module_regions,
.regions = sds_module_regions,
.region_count = SGM776_SDS_REGION_COUNT,
.clock_id = FWK_ID_ELEMENT_INIT(
FWK_MODULE_IDX_CLOCK,
CLOCK_DEV_IDX_INTERCONNECT),
.clock_id = FWK_ID_NONE_INIT,
};

static const struct fwk_element sds_element_table[] = {
Expand Down
22 changes: 9 additions & 13 deletions product/sgm776/scp_ramfw/config_timer.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Arm SCP/MCP Software
* Copyright (c) 2017-2021, Arm Limited and Contributors. All rights reserved.
* Copyright (c) 2017-2023, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
Expand All @@ -24,18 +24,14 @@
* Generic timer driver config
*/
static const struct fwk_element gtimer_dev_table[] = {
[0] = {
.name = "REFCLK",
.data = &((struct mod_gtimer_dev_config) {
.hw_timer = REFCLK_CNTBASE0_BASE,
.hw_counter = REFCLK_CNTCTL_BASE,
.control = REFCLK_CNTCONTROL_BASE,
.frequency = CLOCK_RATE_REFCLK,
.clock_id = FWK_ID_ELEMENT_INIT(
FWK_MODULE_IDX_CLOCK,
CLOCK_DEV_IDX_INTERCONNECT),
})
},
[0] = { .name = "REFCLK",
.data = &((struct mod_gtimer_dev_config){
.hw_timer = REFCLK_CNTBASE0_BASE,
.hw_counter = REFCLK_CNTCTL_BASE,
.control = REFCLK_CNTCONTROL_BASE,
.frequency = CLOCK_RATE_REFCLK,
.clock_id = FWK_ID_NONE_INIT,
}) },
[1] = { 0 },
};

Expand Down
17 changes: 1 addition & 16 deletions product/sgm776/scp_ramfw/config_transport.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/*
* Arm SCP/MCP Software
* Copyright (c) 2015-2022, Arm Limited and Contributors. All rights reserved.
* Copyright (c) 2015-2023, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/

#include "config_power_domain.h"
#include "sgm776_core.h"
#include "sgm776_mhu.h"
#include "sgm776_scmi.h"
Expand Down Expand Up @@ -73,20 +72,6 @@ static const struct fwk_element transport_element_table[] = {

static const struct fwk_element *transport_get_element_table(fwk_id_t module_id)
{
unsigned int idx;
struct mod_transport_channel_config *config;

for (idx = 0; idx < SGM776_SCMI_SERVICE_IDX_COUNT; idx++) {
config =
(struct mod_transport_channel_config *)(transport_element_table[idx]
.data);

config->pd_source_id = FWK_ID_ELEMENT(
FWK_MODULE_IDX_POWER_DOMAIN,
CONFIG_POWER_DOMAIN_SYSTOP_SYSTEM + sgm776_core_get_count() +
sgm776_cluster_get_count());
}

return transport_element_table;
}

Expand Down
3 changes: 2 additions & 1 deletion product/sgm776/scp_romfw/config_clock.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Arm SCP/MCP Software
* Copyright (c) 2015-2021, Arm Limited and Contributors. All rights reserved.
* Copyright (c) 2015-2023, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
Expand Down Expand Up @@ -53,6 +53,7 @@ static const struct fwk_element clock_dev_desc_table[] = {
.api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_PIK_CLOCK,
MOD_PIK_CLOCK_API_TYPE_CLOCK),
.pd_source_id = FWK_ID_MODULE_INIT(FWK_MODULE_IDX_MSYS_ROM),
.default_on = true,
}),
},
[CLOCK_DEV_IDX_SYS_FCMCLK] = {
Expand Down
6 changes: 2 additions & 4 deletions product/sgm776/scp_romfw/config_sds.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Arm SCP/MCP Software
* Copyright (c) 2017-2021, Arm Limited and Contributors. All rights reserved.
* Copyright (c) 2017-2023, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
Expand Down Expand Up @@ -50,9 +50,7 @@ static_assert(FWK_ARRAY_SIZE(sds_module_regions) == SGM776_SDS_REGION_COUNT,
static const struct mod_sds_config sds_module_config = {
.regions = sds_module_regions,
.region_count = SGM776_SDS_REGION_COUNT,
.clock_id = FWK_ID_ELEMENT_INIT(
FWK_MODULE_IDX_CLOCK,
CLOCK_DEV_IDX_SYS_NOCMEMCLK),
.clock_id = FWK_ID_NONE_INIT,
};

static const struct fwk_element sds_element_table[] = {
Expand Down
22 changes: 9 additions & 13 deletions product/sgm776/scp_romfw/config_timer.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Arm SCP/MCP Software
* Copyright (c) 2017-2021, Arm Limited and Contributors. All rights reserved.
* Copyright (c) 2017-2023, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
Expand All @@ -22,18 +22,14 @@
* Generic timer driver config
*/
static const struct fwk_element gtimer_dev_table[] = {
[0] = {
.name = "REFCLK",
.data = &((struct mod_gtimer_dev_config) {
.hw_timer = REFCLK_CNTBASE0_BASE,
.hw_counter = REFCLK_CNTCTL_BASE,
.control = REFCLK_CNTCONTROL_BASE,
.frequency = CLOCK_RATE_REFCLK,
.clock_id = FWK_ID_ELEMENT_INIT(
FWK_MODULE_IDX_CLOCK,
CLOCK_DEV_IDX_SYS_NOCMEMCLK),
})
},
[0] = { .name = "REFCLK",
.data = &((struct mod_gtimer_dev_config){
.hw_timer = REFCLK_CNTBASE0_BASE,
.hw_counter = REFCLK_CNTCTL_BASE,
.control = REFCLK_CNTCONTROL_BASE,
.frequency = CLOCK_RATE_REFCLK,
.clock_id = FWK_ID_NONE_INIT,
}) },
[1] = { 0 },
};

Expand Down

0 comments on commit 8851d49

Please sign in to comment.