From 5702e2b04441bb6f75f8f4d5149f9e3a92195667 Mon Sep 17 00:00:00 2001 From: Raghavendra Rao Ananta Date: Tue, 22 Sep 2020 15:46:27 -0700 Subject: [PATCH] soc: qcom: eud: Fix enable status for secure mode Currently, the EUD driver performs the check if bootloaders have already enabled the EUD hardware by doing a logical OR of EUD_CSR_EUD_EN (non-secure) and EUD_EUD_EN2 (secure), even if the driver is configured to work in secure mode, which is incorrect. Hence, check the status of the EUD hardware by only looking at the respective register for that particular mode. Change-Id: I9f005557ddb10e304fa5da723b13c1f1108d1a6f Signed-off-by: Raghavendra Rao Ananta --- drivers/soc/qcom/eud.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/soc/qcom/eud.c b/drivers/soc/qcom/eud.c index b2ab8ea62945..91471338a088 100644 --- a/drivers/soc/qcom/eud.c +++ b/drivers/soc/qcom/eud.c @@ -107,12 +107,13 @@ static int msm_eud_hw_is_enabled(struct platform_device *pdev) if (ret) { dev_err(&pdev->dev, "qcom_scm_io_readl failed with rc: %d\n", ret); - sec_eud_enabled = 0; + return 0; } + + return sec_eud_enabled; } - return (sec_eud_enabled & BIT(0)) || - (readl_relaxed(chip->eud_reg_base + EUD_REG_CSR_EUD_EN) & BIT(0)); + return readl_relaxed(chip->eud_reg_base + EUD_REG_CSR_EUD_EN) & BIT(0); } static int check_eud_mode_mgr2(struct eud_chip *chip)