From ecd138df71ef59b59b0cf3be8d91206626b86274 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Mon, 8 Jul 2019 13:46:44 +0900 Subject: [PATCH] uniphier: call uniphier_scp_is_running() only when on-chip STM is supported uniphier_scp_is_running() reads the UNIPHIER_STMBE2COM register, but it does not exist on all SoCs. Do not call this function if the on-chip SCP is not supported. Change-Id: I7c71ca0735e3a8e095c3f22ba6165f82a2986362 Signed-off-by: Masahiro Yamada --- plat/socionext/uniphier/platform.mk | 1 + plat/socionext/uniphier/uniphier_psci.c | 25 ++++++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/plat/socionext/uniphier/platform.mk b/plat/socionext/uniphier/platform.mk index d97458490..d31fbe88f 100644 --- a/plat/socionext/uniphier/platform.mk +++ b/plat/socionext/uniphier/platform.mk @@ -60,6 +60,7 @@ BL31_SOURCES += drivers/arm/cci/cci.c \ plat/common/plat_gicv3.c \ plat/common/plat_psci_common.c \ $(PLAT_PATH)/uniphier_bl31_setup.c \ + $(PLAT_PATH)/uniphier_boot_device.c \ $(PLAT_PATH)/uniphier_cci.c \ $(PLAT_PATH)/uniphier_gicv3.c \ $(PLAT_PATH)/uniphier_psci.c \ diff --git a/plat/socionext/uniphier/uniphier_psci.c b/plat/socionext/uniphier/uniphier_psci.c index 464252ddd..2acc87440 100644 --- a/plat/socionext/uniphier/uniphier_psci.c +++ b/plat/socionext/uniphier/uniphier_psci.c @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -113,17 +114,27 @@ static const struct plat_psci_ops uniphier_psci_ops = { int plat_setup_psci_ops(uintptr_t sec_entrypoint, const struct plat_psci_ops **psci_ops) { + unsigned int soc; + + soc = uniphier_get_soc_id(); + if (soc == UNIPHIER_SOC_UNKNOWN) { + ERROR("unsupported SoC\n"); + return -ENOTSUP; + } + + if (uniphier_get_boot_master(soc) == UNIPHIER_BOOT_MASTER_SCP) { + uniphier_psci_scp_mode = uniphier_scp_is_running(); + flush_dcache_range((uint64_t)&uniphier_psci_scp_mode, + sizeof(uniphier_psci_scp_mode)); + + if (uniphier_psci_scp_mode) + uniphier_scp_open_com(); + } + uniphier_sec_entrypoint = sec_entrypoint; flush_dcache_range((uint64_t)&uniphier_sec_entrypoint, sizeof(uniphier_sec_entrypoint)); - uniphier_psci_scp_mode = uniphier_scp_is_running(); - flush_dcache_range((uint64_t)&uniphier_psci_scp_mode, - sizeof(uniphier_psci_scp_mode)); - - if (uniphier_psci_scp_mode) - uniphier_scp_open_com(); - *psci_ops = &uniphier_psci_ops; return 0;