diff options
author | Tarek El-Sherbiny <tarek.el-sherbiny@arm.com> | 2020-05-04 18:12:25 +0100 |
---|---|---|
committer | jimqui01 <54316584+jimqui01@users.noreply.github.com> | 2020-07-07 11:16:06 +0100 |
commit | 9c47494027dd4286be4306d2be829b98d026363d (patch) | |
tree | 4ad26ee7d39c9fec5b301b2161e0710ad034a1da /product/sgm775 | |
parent | fb4d1ff2df4ad6acff8111d37b1b7ee7a18b1627 (diff) |
power_domain: Simplify power domain tree handling
Each power domain will have a linked list of children
and a pointer to the parent. The configuration will
provide the index of the parent. The parent pointer is
populated based on this index.
Change-Id: I55d476989a581ea70286001728c2200bcc2866f4
Signed-off-by: Tarek El-Sherbiny <tarek.el-sherbiny@arm.com>
Diffstat (limited to 'product/sgm775')
-rw-r--r-- | product/sgm775/scp_ramfw/config_clock.c | 2 | ||||
-rw-r--r-- | product/sgm775/scp_ramfw/config_power_domain.c | 73 | ||||
-rw-r--r-- | product/sgm775/scp_ramfw/config_power_domain.h | 5 | ||||
-rw-r--r-- | product/sgm775/scp_ramfw/config_ppu_v1.c | 2 | ||||
-rw-r--r-- | product/sgm775/scp_ramfw/config_smt.c | 5 |
5 files changed, 32 insertions, 55 deletions
diff --git a/product/sgm775/scp_ramfw/config_clock.c b/product/sgm775/scp_ramfw/config_clock.c index 84d3b29a..8665bc50 100644 --- a/product/sgm775/scp_ramfw/config_clock.c +++ b/product/sgm775/scp_ramfw/config_clock.c @@ -102,7 +102,7 @@ static const struct fwk_element *clock_get_dev_desc_table(fwk_id_t module_id) (struct mod_clock_dev_config *)clock_dev_desc_table[i].data; dev_config->pd_source_id = FWK_ID_ELEMENT( FWK_MODULE_IDX_POWER_DOMAIN, - CONFIG_POWER_DOMAIN_SYSTOP_CHILD_COUNT + core_count); + CONFIG_POWER_DOMAIN_SYSTOP_SYSTEM + core_count); } return clock_dev_desc_table; diff --git a/product/sgm775/scp_ramfw/config_power_domain.c b/product/sgm775/scp_ramfw/config_power_domain.c index 4aa040a5..17a894d1 100644 --- a/product/sgm775/scp_ramfw/config_power_domain.c +++ b/product/sgm775/scp_ramfw/config_power_domain.c @@ -77,12 +77,6 @@ static struct fwk_element sgm775_power_domain_static_element_table[] = { .name = "CLUS0", .data = &((struct mod_power_domain_element_config) { .attributes.pd_type = MOD_PD_TYPE_CLUSTER, - .tree_pos = MOD_PD_TREE_POS( - MOD_PD_LEVEL_1, - 0, - 0, - CONFIG_POWER_DOMAIN_SYSTOP_CHILD_CLUSTER0, - 0), .api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_PPU_V1, MOD_PPU_V1_API_IDX_POWER_DOMAIN_DRIVER), .allowed_state_mask_table = cluster_pd_allowed_state_mask_table, @@ -94,12 +88,6 @@ static struct fwk_element sgm775_power_domain_static_element_table[] = { .name = "DBGTOP", .data = &((struct mod_power_domain_element_config) { .attributes.pd_type = MOD_PD_TYPE_DEVICE_DEBUG, - .tree_pos = MOD_PD_TREE_POS( - MOD_PD_LEVEL_1, - 0, - 0, - CONFIG_POWER_DOMAIN_SYSTOP_CHILD_DBGTOP, - 0), .driver_id = FWK_ID_ELEMENT_INIT( FWK_MODULE_IDX_PPU_V0, PPU_V0_ELEMENT_IDX_DBGTOP), .api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_PPU_V0, 0), @@ -112,12 +100,6 @@ static struct fwk_element sgm775_power_domain_static_element_table[] = { .name = "DPU0TOP", .data = &((struct mod_power_domain_element_config) { .attributes.pd_type = MOD_PD_TYPE_DEVICE, - .tree_pos = MOD_PD_TREE_POS( - MOD_PD_LEVEL_1, - 0, - 0, - CONFIG_POWER_DOMAIN_SYSTOP_CHILD_DPU0TOP, - 0), .driver_id = FWK_ID_ELEMENT_INIT( FWK_MODULE_IDX_PPU_V0, PPU_V0_ELEMENT_IDX_DPU0TOP), .api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_PPU_V0, 0), @@ -130,12 +112,6 @@ static struct fwk_element sgm775_power_domain_static_element_table[] = { .name = "DPU1TOP", .data = &((struct mod_power_domain_element_config) { .attributes.pd_type = MOD_PD_TYPE_DEVICE, - .tree_pos = MOD_PD_TREE_POS( - MOD_PD_LEVEL_1, - 0, - 0, - CONFIG_POWER_DOMAIN_SYSTOP_CHILD_DPU1TOP, - 0), .driver_id = FWK_ID_ELEMENT_INIT( FWK_MODULE_IDX_PPU_V0, PPU_V0_ELEMENT_IDX_DPU1TOP), .api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_PPU_V0, 0), @@ -148,12 +124,6 @@ static struct fwk_element sgm775_power_domain_static_element_table[] = { .name = "GPUTOP", .data = &((struct mod_power_domain_element_config) { .attributes.pd_type = MOD_PD_TYPE_DEVICE, - .tree_pos = MOD_PD_TREE_POS( - MOD_PD_LEVEL_1, - 0, - 0, - CONFIG_POWER_DOMAIN_SYSTOP_CHILD_GPUTOP, - 0), .driver_id = FWK_ID_ELEMENT_INIT( FWK_MODULE_IDX_PPU_V0, PPU_V0_ELEMENT_IDX_GPUTOP), .api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_PPU_V0, 0), @@ -166,12 +136,6 @@ static struct fwk_element sgm775_power_domain_static_element_table[] = { .name = "VPUTOP", .data = &((struct mod_power_domain_element_config) { .attributes.pd_type = MOD_PD_TYPE_DEVICE, - .tree_pos = MOD_PD_TREE_POS( - MOD_PD_LEVEL_1, - 0, - 0, - CONFIG_POWER_DOMAIN_SYSTOP_CHILD_VPUTOP, - 0), .driver_id = FWK_ID_ELEMENT_INIT( FWK_MODULE_IDX_PPU_V0, PPU_V0_ELEMENT_IDX_VPUTOP), .api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_PPU_V0, 0), @@ -180,12 +144,11 @@ static struct fwk_element sgm775_power_domain_static_element_table[] = { FWK_ARRAY_SIZE(toplevel_allowed_state_mask_table) }), }, - [CONFIG_POWER_DOMAIN_SYSTOP_CHILD_COUNT] = { + [CONFIG_POWER_DOMAIN_SYSTOP_SYSTEM] = { .name = "SYSTOP", .data = &((struct mod_power_domain_element_config) { .attributes.pd_type = MOD_PD_TYPE_SYSTEM, - .tree_pos = MOD_PD_TREE_POS( - MOD_PD_LEVEL_2, 0, 0, 0, 0), + .parent_idx = CONFIG_POWER_DOMAIN_NONE, .driver_id = FWK_ID_MODULE_INIT(FWK_MODULE_IDX_SYSTEM_POWER), .api_id = FWK_ID_API_INIT(FWK_MODULE_IDX_SYSTEM_POWER, MOD_SYSTEM_POWER_API_IDX_PD_DRIVER), @@ -196,7 +159,6 @@ static struct fwk_element sgm775_power_domain_static_element_table[] = { }, }; - /* * Function definitions with internal linkage */ @@ -205,12 +167,18 @@ static const struct fwk_element *sgm775_power_domain_get_element_table { struct fwk_element *element_table, *element; struct mod_power_domain_element_config *pd_config_table, *pd_config; - unsigned int core_idx; + unsigned int core_idx, i; + unsigned int cluster_offset = sgm775_core_get_count(); + unsigned int systop_idx; + unsigned int elements_count; + + elements_count = sgm775_core_get_count() + + FWK_ARRAY_SIZE(sgm775_power_domain_static_element_table); + + systop_idx = elements_count - 1; element_table = fwk_mm_calloc( - sgm775_core_get_count() - + FWK_ARRAY_SIZE(sgm775_power_domain_static_element_table) - + 1, /* Terminator */ + elements_count + 1, /* Terminator */ sizeof(struct fwk_element)); pd_config_table = fwk_mm_calloc(sgm775_core_get_count(), @@ -224,12 +192,7 @@ static const struct fwk_element *sgm775_power_domain_get_element_table element->data = pd_config; pd_config->attributes.pd_type = MOD_PD_TYPE_CORE, - pd_config->tree_pos = MOD_PD_TREE_POS( - MOD_PD_LEVEL_0, - 0, - 0, - CONFIG_POWER_DOMAIN_SYSTOP_CHILD_CLUSTER0, - core_idx), + pd_config->parent_idx = cluster_offset, pd_config->driver_id = FWK_ID_ELEMENT(FWK_MODULE_IDX_PPU_V1, core_idx), pd_config->api_id = FWK_ID_API( FWK_MODULE_IDX_PPU_V1, MOD_PPU_V1_API_IDX_POWER_DOMAIN_DRIVER), @@ -245,6 +208,16 @@ static const struct fwk_element *sgm775_power_domain_get_element_table pd_config->driver_id = FWK_ID_ELEMENT(FWK_MODULE_IDX_PPU_V1, sgm775_core_get_count()); + /* Set the parent for all level one domains */ + for (i = 0; + i < (FWK_ARRAY_SIZE(sgm775_power_domain_static_element_table) - 1); + i++) { + pd_config = (struct mod_power_domain_element_config *) + sgm775_power_domain_static_element_table[i] + .data; + pd_config->parent_idx = systop_idx; + } + memcpy(element_table + sgm775_core_get_count(), sgm775_power_domain_static_element_table, sizeof(sgm775_power_domain_static_element_table)); diff --git a/product/sgm775/scp_ramfw/config_power_domain.h b/product/sgm775/scp_ramfw/config_power_domain.h index fc073867..c8926e10 100644 --- a/product/sgm775/scp_ramfw/config_power_domain.h +++ b/product/sgm775/scp_ramfw/config_power_domain.h @@ -8,6 +8,8 @@ #ifndef CONFIG_POWER_DOMAIN_H #define CONFIG_POWER_DOMAIN_H +#include <stdint.h> + enum systop_child_index { CONFIG_POWER_DOMAIN_SYSTOP_CHILD_CLUSTER0, CONFIG_POWER_DOMAIN_SYSTOP_CHILD_DBGTOP, @@ -15,7 +17,8 @@ enum systop_child_index { CONFIG_POWER_DOMAIN_SYSTOP_CHILD_DPU1TOP, CONFIG_POWER_DOMAIN_SYSTOP_CHILD_GPUTOP, CONFIG_POWER_DOMAIN_SYSTOP_CHILD_VPUTOP, - CONFIG_POWER_DOMAIN_SYSTOP_CHILD_COUNT + CONFIG_POWER_DOMAIN_SYSTOP_SYSTEM, + CONFIG_POWER_DOMAIN_NONE = UINT32_MAX }; #endif /* CONFIG_POWER_DOMAIN_H */ diff --git a/product/sgm775/scp_ramfw/config_ppu_v1.c b/product/sgm775/scp_ramfw/config_ppu_v1.c index f13dc3f0..56ca9640 100644 --- a/product/sgm775/scp_ramfw/config_ppu_v1.c +++ b/product/sgm775/scp_ramfw/config_ppu_v1.c @@ -93,7 +93,7 @@ static const struct fwk_element *sgm775_ppu_v1_get_element_table sgm775_ppu_v1_notification_config.pd_source_id = FWK_ID_ELEMENT( FWK_MODULE_IDX_POWER_DOMAIN, - CONFIG_POWER_DOMAIN_SYSTOP_CHILD_COUNT + sgm775_core_get_count()); + CONFIG_POWER_DOMAIN_SYSTOP_SYSTEM + sgm775_core_get_count()); return element_table; } diff --git a/product/sgm775/scp_ramfw/config_smt.c b/product/sgm775/scp_ramfw/config_smt.c index 67e646d2..d1adeaca 100644 --- a/product/sgm775/scp_ramfw/config_smt.c +++ b/product/sgm775/scp_ramfw/config_smt.c @@ -67,8 +67,9 @@ static const struct fwk_element *smt_get_element_table(fwk_id_t module_id) for (idx = 0; idx < SGM775_SCMI_SERVICE_IDX_COUNT; idx++) { config = (struct mod_smt_channel_config *)(smt_element_table[idx].data); - config->pd_source_id = FWK_ID_ELEMENT(FWK_MODULE_IDX_POWER_DOMAIN, - CONFIG_POWER_DOMAIN_SYSTOP_CHILD_COUNT + sgm775_core_get_count()); + config->pd_source_id = FWK_ID_ELEMENT( + FWK_MODULE_IDX_POWER_DOMAIN, + CONFIG_POWER_DOMAIN_SYSTOP_SYSTEM + sgm775_core_get_count()); } return smt_element_table; |