Skip to content

Commit b971829

Browse files
Mukesh Ojhaandersson
authored andcommitted
firmware: qcom: scm: Modify only the download bits in TCSR register
Crashdump collection is done based on DLOAD bits of TCSR register. To retain other bits, scm driver need to read the register and modify only the DLOAD bits, as other bits in TCSR may have their own significance. Co-developed-by: Poovendhan Selvaraj <[email protected]> Signed-off-by: Poovendhan Selvaraj <[email protected]> Signed-off-by: Mukesh Ojha <[email protected]> Tested-by: Kathiravan Thirumoorthy <[email protected]> # IPQ9574 and IPQ5332 Reviewed-by: Dmitry Baryshkov <[email protected]> Reviewed-by: Elliot Berman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
1 parent 2e49551 commit b971829

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

drivers/firmware/qcom/qcom_scm.c

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
*/
55

66
#include <linux/arm-smccc.h>
7+
#include <linux/bitfield.h>
8+
#include <linux/bits.h>
79
#include <linux/clk.h>
810
#include <linux/completion.h>
911
#include <linux/cpumask.h>
@@ -114,6 +116,10 @@ static const u8 qcom_scm_cpu_warm_bits[QCOM_SCM_BOOT_MAX_CPUS] = {
114116
#define QCOM_SMC_WAITQ_FLAG_WAKE_ONE BIT(0)
115117
#define QCOM_SMC_WAITQ_FLAG_WAKE_ALL BIT(1)
116118

119+
#define QCOM_DLOAD_MASK GENMASK(5, 4)
120+
#define QCOM_DLOAD_NODUMP 0
121+
#define QCOM_DLOAD_FULLDUMP 1
122+
117123
static const char * const qcom_scm_convention_names[] = {
118124
[SMC_CONVENTION_UNKNOWN] = "unknown",
119125
[SMC_CONVENTION_ARM_32] = "smc arm 32",
@@ -493,13 +499,29 @@ static int __qcom_scm_set_dload_mode(struct device *dev, bool enable)
493499
return qcom_scm_call_atomic(__scm->dev, &desc, NULL);
494500
}
495501

502+
static int qcom_scm_io_rmw(phys_addr_t addr, unsigned int mask, unsigned int val)
503+
{
504+
unsigned int old;
505+
unsigned int new;
506+
int ret;
507+
508+
ret = qcom_scm_io_readl(addr, &old);
509+
if (ret)
510+
return ret;
511+
512+
new = (old & ~mask) | (val & mask);
513+
514+
return qcom_scm_io_writel(addr, new);
515+
}
516+
496517
static void qcom_scm_set_download_mode(bool enable)
497518
{
519+
u32 val = enable ? QCOM_DLOAD_FULLDUMP : QCOM_DLOAD_NODUMP;
498520
int ret = 0;
499521

500522
if (__scm->dload_mode_addr) {
501-
ret = qcom_scm_io_writel(__scm->dload_mode_addr,
502-
enable ? QCOM_SCM_BOOT_SET_DLOAD_MODE : 0);
523+
ret = qcom_scm_io_rmw(__scm->dload_mode_addr, QCOM_DLOAD_MASK,
524+
FIELD_PREP(QCOM_DLOAD_MASK, val));
503525
} else if (__qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_BOOT,
504526
QCOM_SCM_BOOT_SET_DLOAD_MODE)) {
505527
ret = __qcom_scm_set_dload_mode(__scm->dev, enable);

0 commit comments

Comments
 (0)