Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 14cd632c authored by Stepan Moskovchenko's avatar Stepan Moskovchenko Committed by Matt Wagantall
Browse files

power: reset: msm: Allow configuring reset type via secure I/O



Some targets require that the Download Mode / EDL
configuration be performed by means of a Secure I/O write
to the TCSR_BOOT_MISC_DETECT register rather than through a
generic SCM operation. Provide a mechanism for specifying
the address of this register in the device tree, to use as
a fallback method if the generic SCM call to set the
download mode configuration is unavailable.

This is necessary to comply with atomicity requirements of the
secure environment.

Change-Id: I5d3fcb48b0b47815d4839a3b722b0462a1bca087
Signed-off-by: default avatarStepan Moskovchenko <stepanm@codeaurora.org>
parent 771d9b37
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -9,6 +9,13 @@ Required Properties:
-compatible: "qcom,pshold"
-reg: Specifies the physical address of the ps-hold register

Optional Properties:
-reg: A secondary reg address/size pair may be provided, to specify the address
      of the TCSR_BOOT_MISC_DETECT register. This address is typically used to
      configure the type of reset desired. Omitting this address implies that
      the reset type shall be configured by means of a call to the secure
      environment.

Example:

	restart@fc4ab000 {
+10 −1
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ static bool scm_pmic_arbiter_disable_supported;
static bool scm_deassert_ps_hold_supported;
/* Download mode master kill-switch */
static void __iomem *msm_ps_hold;
static phys_addr_t tcsr_boot_misc_detect;

#ifdef CONFIG_MSM_DLOAD_MODE
#define EDL_MODE_PROP "qcom,msm-imem-emergency_download_mode"
@@ -85,8 +86,12 @@ int scm_set_dload_mode(int arg1, int arg2)
		.arginfo = SCM_ARGS(2),
	};

	if (!scm_dload_supported)
	if (!scm_dload_supported) {
		if (tcsr_boot_misc_detect)
			return scm_io_write(tcsr_boot_misc_detect, arg1);

		return 0;
	}

	if (!is_scm_armv8())
		return scm_call_atomic2(SCM_SVC_BOOT, SCM_DLOAD_CMD, arg1,
@@ -402,6 +407,10 @@ static int msm_restart_probe(struct platform_device *pdev)
	if (IS_ERR(msm_ps_hold))
		return PTR_ERR(msm_ps_hold);

	mem = platform_get_resource(pdev, IORESOURCE_MEM, 1);
	if (mem)
		tcsr_boot_misc_detect = mem->start;

	pm_power_off = do_msm_poweroff;
	arm_pm_restart = do_msm_restart;