Skip to content

Commit 398a4c5

Browse files
Mukesh Ojhaandersson
authored andcommitted
firmware: qcom: scm: Rework dload mode availability check
QCOM_SCM_BOOT_SET_DLOAD_MODE scm command is applicable for very older SoCs where this command is supported from firmware and for newer SoCs, dload mode tcsr registers is used for setting the download mode. Currently, qcom_scm_set_download_mode() checks for availability of QCOM_SCM_BOOT_SET_DLOAD_MODE command even for SoCs where this is not used. Fix this by switching the condition to keep the command availability check only if dload mode registers are not available. Signed-off-by: Mukesh Ojha <[email protected]> Reviewed-by: Elliot Berman <[email protected]> Reviewed-by: Konrad Dybcio <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
1 parent 000636d commit 398a4c5

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

drivers/firmware/qcom/qcom_scm.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -495,17 +495,14 @@ static int __qcom_scm_set_dload_mode(struct device *dev, bool enable)
495495

496496
static void qcom_scm_set_download_mode(bool enable)
497497
{
498-
bool avail;
499498
int ret = 0;
500499

501-
avail = __qcom_scm_is_call_available(__scm->dev,
502-
QCOM_SCM_SVC_BOOT,
503-
QCOM_SCM_BOOT_SET_DLOAD_MODE);
504-
if (avail) {
505-
ret = __qcom_scm_set_dload_mode(__scm->dev, enable);
506-
} else if (__scm->dload_mode_addr) {
500+
if (__scm->dload_mode_addr) {
507501
ret = qcom_scm_io_writel(__scm->dload_mode_addr,
508-
enable ? QCOM_SCM_BOOT_SET_DLOAD_MODE : 0);
502+
enable ? QCOM_SCM_BOOT_SET_DLOAD_MODE : 0);
503+
} else if (__qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_BOOT,
504+
QCOM_SCM_BOOT_SET_DLOAD_MODE)) {
505+
ret = __qcom_scm_set_dload_mode(__scm->dev, enable);
509506
} else {
510507
dev_err(__scm->dev,
511508
"No available mechanism for setting download mode\n");

0 commit comments

Comments
 (0)