Message ID | 1674562755-5378-1-git-send-email-quic_mojha@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2117381wrn; Tue, 24 Jan 2023 04:21:32 -0800 (PST) X-Google-Smtp-Source: AMrXdXtEoprr/OnyjNxZy2SSk6tUZQyGqGZDns5GAXwEteolpYko5a+A6MJMa8G2qbjAdWrOZN5A X-Received: by 2002:a17:906:af14:b0:844:de87:8684 with SMTP id lx20-20020a170906af1400b00844de878684mr30944891ejb.46.1674562892187; Tue, 24 Jan 2023 04:21:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674562892; cv=none; d=google.com; s=arc-20160816; b=rVxH0wcixJUVm3hb69b9tMKlAM5yJGQnHDIQI7c3kaJrbyzPncx+vx+fXEwG2rAkRK HHDSeRngBKCQ+hQASc7q4zMGd6bpuHhljvN/HsrVVaaBI7tBrr+/c3a6cSGgjkxjHcII H0tqJciQ0+1flP9nK2g94qxXH4cP7GeU0C4a/0yHnO3gpPIRMYMji4l5I0iyRj2AyChd LxT/JSKINwMGyo8Q+vPF3MS3CX4ZTD9kI8cTfmywNRkI43EGdL3r1hgLo+IxQofMoUoG 1scziSOJGiUznB9aQYK+xZp9zLU1N80Cp1hKuQKOOmYOT0JBFDnTKIkFQ33lUPyccdyx 9+1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=crltBwfloSo7xnyTSz7Z0uQPe7RMWKQQnz7Q2pXv6UI=; b=eQ9vsLEMgmG+A5QqcgWQx834Dr+gc56lb910TEduzmpEe+IynmgoCMv01um1C5J72r 22ENYZLELsnqeqGc9YACIVmaYL2k2KhTAUYVVeWhaFvNb6E/j+DCFd8E1beT16l+qYqr VTb7sYHxGmCpyEG3Q5ZWnMKZEOewhsSBAROO9vJJVowYGcc1uzbgTWxKnDLo+pPzhMgC 1RG+qNGcHBONNRznxfQd3u/egwD6qMsHkV3jHB610dnWQlyWeHeVVSZt9gBKaLWRP0SE Yns/i0UaVdccnEiFJY43wjKlq4wGLDiJ3pK+bPZ3F3nz8NFWosSHlkzbSKsi1TJZbheX 2L5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=cJeSFbOz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id um42-20020a170907cb2a00b007ae127c6c80si2257348ejc.672.2023.01.24.04.21.07; Tue, 24 Jan 2023 04:21:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=cJeSFbOz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233734AbjAXMTm (ORCPT <rfc822;rust.linux@gmail.com> + 99 others); Tue, 24 Jan 2023 07:19:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233425AbjAXMTb (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 24 Jan 2023 07:19:31 -0500 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DA6637F02; Tue, 24 Jan 2023 04:19:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1674562770; x=1706098770; h=from:to:cc:subject:date:message-id:mime-version; bh=crltBwfloSo7xnyTSz7Z0uQPe7RMWKQQnz7Q2pXv6UI=; b=cJeSFbOzYz3p+neORcnu8Kud5i7n7aw8qnorST6OEQP5jTqO4KhItDaa toNY2PKkcMQnSdzRYcwy+k121kWZ7T1Hap99KuLp/2iNowMchkNoJ1k1m /DR4CIzgmEYNDuwPRcku/Rpl0hlzBh+EyFqyZrdp5xGY3WXWcSHBrFql0 w=; Received: from unknown (HELO ironmsg04-sd.qualcomm.com) ([10.53.140.144]) by alexa-out-sd-02.qualcomm.com with ESMTP; 24 Jan 2023 04:19:29 -0800 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.45.79.139]) by ironmsg04-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2023 04:19:29 -0800 Received: from hu-mojha-hyd.qualcomm.com (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 24 Jan 2023 04:19:27 -0800 From: Mukesh Ojha <quic_mojha@quicinc.com> To: <agross@kernel.org>, <andersson@kernel.org>, <konrad.dybcio@linaro.org> CC: <linux-arm-msm@vger.kernel.org>, <linux-kernel@vger.kernel.org>, "Mukesh Ojha" <quic_mojha@quicinc.com> Subject: [PATCH] firmware: qcom_scm: modify qcom_scm_set_download_mode() Date: Tue, 24 Jan 2023 17:49:15 +0530 Message-ID: <1674562755-5378-1-git-send-email-quic_mojha@quicinc.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01c.na.qualcomm.com (10.45.79.139) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755906458966507087?= X-GMAIL-MSGID: =?utf-8?q?1755906458966507087?= |
Series |
firmware: qcom_scm: modify qcom_scm_set_download_mode()
|
|
Commit Message
Mukesh Ojha
Jan. 24, 2023, 12:19 p.m. UTC
Modify qcom_scm_set_download_mode() such that it can support
multiple modes. There is no functional change with this change.
Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com>
---
drivers/firmware/qcom_scm.c | 17 ++++++++---------
include/linux/qcom_scm.h | 5 +++++
2 files changed, 13 insertions(+), 9 deletions(-)
Comments
Friendly reminder .. -Mukesh On 1/24/2023 5:49 PM, Mukesh Ojha wrote: > Modify qcom_scm_set_download_mode() such that it can support > multiple modes. There is no functional change with this change. > > Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com> > --- > drivers/firmware/qcom_scm.c | 17 ++++++++--------- > include/linux/qcom_scm.h | 5 +++++ > 2 files changed, 13 insertions(+), 9 deletions(-) > > diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c > index cdbfe54..712bb03 100644 > --- a/drivers/firmware/qcom_scm.c > +++ b/drivers/firmware/qcom_scm.c > @@ -400,22 +400,22 @@ int qcom_scm_set_remote_state(u32 state, u32 id) > } > EXPORT_SYMBOL(qcom_scm_set_remote_state); > > -static int __qcom_scm_set_dload_mode(struct device *dev, bool enable) > +static int __qcom_scm_set_dload_mode(struct device *dev, enum qcom_download_mode mode) > { > struct qcom_scm_desc desc = { > .svc = QCOM_SCM_SVC_BOOT, > .cmd = QCOM_SCM_BOOT_SET_DLOAD_MODE, > .arginfo = QCOM_SCM_ARGS(2), > - .args[0] = QCOM_SCM_BOOT_SET_DLOAD_MODE, > + .args[0] = mode, > .owner = ARM_SMCCC_OWNER_SIP, > }; > > - desc.args[1] = enable ? QCOM_SCM_BOOT_SET_DLOAD_MODE : 0; > + desc.args[1] = mode; > > return qcom_scm_call_atomic(__scm->dev, &desc, NULL); > } > > -static void qcom_scm_set_download_mode(bool enable) > +static void qcom_scm_set_download_mode(enum qcom_download_mode mode) > { > bool avail; > int ret = 0; > @@ -424,10 +424,9 @@ static void qcom_scm_set_download_mode(bool enable) > QCOM_SCM_SVC_BOOT, > QCOM_SCM_BOOT_SET_DLOAD_MODE); > if (avail) { > - ret = __qcom_scm_set_dload_mode(__scm->dev, enable); > + ret = __qcom_scm_set_dload_mode(__scm->dev, mode); > } else if (__scm->dload_mode_addr) { > - ret = qcom_scm_io_writel(__scm->dload_mode_addr, > - enable ? QCOM_SCM_BOOT_SET_DLOAD_MODE : 0); > + ret = qcom_scm_io_writel(__scm->dload_mode_addr, mode); > } else { > dev_err(__scm->dev, > "No available mechanism for setting download mode\n"); > @@ -1410,7 +1409,7 @@ static int qcom_scm_probe(struct platform_device *pdev) > * disabled below by a clean shutdown/reboot. > */ > if (download_mode) > - qcom_scm_set_download_mode(true); > + qcom_scm_set_download_mode(QCOM_DOWNLOAD_FULLDUMP); > > return 0; > } > @@ -1419,7 +1418,7 @@ static void qcom_scm_shutdown(struct platform_device *pdev) > { > /* Clean shutdown, disable download mode to allow normal restart */ > if (download_mode) > - qcom_scm_set_download_mode(false); > + qcom_scm_set_download_mode(QCOM_DOWNLOAD_NODUMP); > } > > static const struct of_device_id qcom_scm_dt_match[] = { > diff --git a/include/linux/qcom_scm.h b/include/linux/qcom_scm.h > index f833564..f9bc84e 100644 > --- a/include/linux/qcom_scm.h > +++ b/include/linux/qcom_scm.h > @@ -14,6 +14,11 @@ > #define QCOM_SCM_CPU_PWR_DOWN_L2_OFF 0x1 > #define QCOM_SCM_HDCP_MAX_REQ_CNT 5 > > +enum qcom_download_mode { > + QCOM_DOWNLOAD_NODUMP = 0x00, > + QCOM_DOWNLOAD_FULLDUMP = 0x10, > +}; > + > struct qcom_scm_hdcp_req { > u32 addr; > u32 val;
On Tue, 24 Jan 2023 at 14:19, Mukesh Ojha <quic_mojha@quicinc.com> wrote: > > Modify qcom_scm_set_download_mode() such that it can support > multiple modes. There is no functional change with this change. Please describe usecases for such a change. Without them it's just an unused complication. > > Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com> > --- > drivers/firmware/qcom_scm.c | 17 ++++++++--------- > include/linux/qcom_scm.h | 5 +++++ > 2 files changed, 13 insertions(+), 9 deletions(-) > > diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c > index cdbfe54..712bb03 100644 > --- a/drivers/firmware/qcom_scm.c > +++ b/drivers/firmware/qcom_scm.c > @@ -400,22 +400,22 @@ int qcom_scm_set_remote_state(u32 state, u32 id) > } > EXPORT_SYMBOL(qcom_scm_set_remote_state); > > -static int __qcom_scm_set_dload_mode(struct device *dev, bool enable) > +static int __qcom_scm_set_dload_mode(struct device *dev, enum qcom_download_mode mode) > { > struct qcom_scm_desc desc = { > .svc = QCOM_SCM_SVC_BOOT, > .cmd = QCOM_SCM_BOOT_SET_DLOAD_MODE, > .arginfo = QCOM_SCM_ARGS(2), > - .args[0] = QCOM_SCM_BOOT_SET_DLOAD_MODE, > + .args[0] = mode, > .owner = ARM_SMCCC_OWNER_SIP, > }; > > - desc.args[1] = enable ? QCOM_SCM_BOOT_SET_DLOAD_MODE : 0; > + desc.args[1] = mode; > > return qcom_scm_call_atomic(__scm->dev, &desc, NULL); > } > > -static void qcom_scm_set_download_mode(bool enable) > +static void qcom_scm_set_download_mode(enum qcom_download_mode mode) > { > bool avail; > int ret = 0; > @@ -424,10 +424,9 @@ static void qcom_scm_set_download_mode(bool enable) > QCOM_SCM_SVC_BOOT, > QCOM_SCM_BOOT_SET_DLOAD_MODE); > if (avail) { > - ret = __qcom_scm_set_dload_mode(__scm->dev, enable); > + ret = __qcom_scm_set_dload_mode(__scm->dev, mode); > } else if (__scm->dload_mode_addr) { > - ret = qcom_scm_io_writel(__scm->dload_mode_addr, > - enable ? QCOM_SCM_BOOT_SET_DLOAD_MODE : 0); > + ret = qcom_scm_io_writel(__scm->dload_mode_addr, mode); > } else { > dev_err(__scm->dev, > "No available mechanism for setting download mode\n"); > @@ -1410,7 +1409,7 @@ static int qcom_scm_probe(struct platform_device *pdev) > * disabled below by a clean shutdown/reboot. > */ > if (download_mode) > - qcom_scm_set_download_mode(true); > + qcom_scm_set_download_mode(QCOM_DOWNLOAD_FULLDUMP); > > return 0; > } > @@ -1419,7 +1418,7 @@ static void qcom_scm_shutdown(struct platform_device *pdev) > { > /* Clean shutdown, disable download mode to allow normal restart */ > if (download_mode) > - qcom_scm_set_download_mode(false); > + qcom_scm_set_download_mode(QCOM_DOWNLOAD_NODUMP); > } > > static const struct of_device_id qcom_scm_dt_match[] = { > diff --git a/include/linux/qcom_scm.h b/include/linux/qcom_scm.h > index f833564..f9bc84e 100644 > --- a/include/linux/qcom_scm.h > +++ b/include/linux/qcom_scm.h > @@ -14,6 +14,11 @@ > #define QCOM_SCM_CPU_PWR_DOWN_L2_OFF 0x1 > #define QCOM_SCM_HDCP_MAX_REQ_CNT 5 > > +enum qcom_download_mode { > + QCOM_DOWNLOAD_NODUMP = 0x00, > + QCOM_DOWNLOAD_FULLDUMP = 0x10, > +}; > + > struct qcom_scm_hdcp_req { > u32 addr; > u32 val; > -- > 2.7.4 >
On 2/2/2023 3:42 PM, Dmitry Baryshkov wrote: > On Tue, 24 Jan 2023 at 14:19, Mukesh Ojha <quic_mojha@quicinc.com> wrote: >> >> Modify qcom_scm_set_download_mode() such that it can support >> multiple modes. There is no functional change with this change. > > Please describe usecases for such a change. Without them it's just an > unused complication. I already mentioned the change is to support more download modes and i am working on the patches to add some other download modes, for which this may be needed as a preparation and since this change could be independent. so, sent it. -Mukesh > >> >> Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com> >> --- >> drivers/firmware/qcom_scm.c | 17 ++++++++--------- >> include/linux/qcom_scm.h | 5 +++++ >> 2 files changed, 13 insertions(+), 9 deletions(-) >> >> diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c >> index cdbfe54..712bb03 100644 >> --- a/drivers/firmware/qcom_scm.c >> +++ b/drivers/firmware/qcom_scm.c >> @@ -400,22 +400,22 @@ int qcom_scm_set_remote_state(u32 state, u32 id) >> } >> EXPORT_SYMBOL(qcom_scm_set_remote_state); >> >> -static int __qcom_scm_set_dload_mode(struct device *dev, bool enable) >> +static int __qcom_scm_set_dload_mode(struct device *dev, enum qcom_download_mode mode) >> { >> struct qcom_scm_desc desc = { >> .svc = QCOM_SCM_SVC_BOOT, >> .cmd = QCOM_SCM_BOOT_SET_DLOAD_MODE, >> .arginfo = QCOM_SCM_ARGS(2), >> - .args[0] = QCOM_SCM_BOOT_SET_DLOAD_MODE, >> + .args[0] = mode, >> .owner = ARM_SMCCC_OWNER_SIP, >> }; >> >> - desc.args[1] = enable ? QCOM_SCM_BOOT_SET_DLOAD_MODE : 0; >> + desc.args[1] = mode; >> >> return qcom_scm_call_atomic(__scm->dev, &desc, NULL); >> } >> >> -static void qcom_scm_set_download_mode(bool enable) >> +static void qcom_scm_set_download_mode(enum qcom_download_mode mode) >> { >> bool avail; >> int ret = 0; >> @@ -424,10 +424,9 @@ static void qcom_scm_set_download_mode(bool enable) >> QCOM_SCM_SVC_BOOT, >> QCOM_SCM_BOOT_SET_DLOAD_MODE); >> if (avail) { >> - ret = __qcom_scm_set_dload_mode(__scm->dev, enable); >> + ret = __qcom_scm_set_dload_mode(__scm->dev, mode); >> } else if (__scm->dload_mode_addr) { >> - ret = qcom_scm_io_writel(__scm->dload_mode_addr, >> - enable ? QCOM_SCM_BOOT_SET_DLOAD_MODE : 0); >> + ret = qcom_scm_io_writel(__scm->dload_mode_addr, mode); >> } else { >> dev_err(__scm->dev, >> "No available mechanism for setting download mode\n"); >> @@ -1410,7 +1409,7 @@ static int qcom_scm_probe(struct platform_device *pdev) >> * disabled below by a clean shutdown/reboot. >> */ >> if (download_mode) >> - qcom_scm_set_download_mode(true); >> + qcom_scm_set_download_mode(QCOM_DOWNLOAD_FULLDUMP); >> >> return 0; >> } >> @@ -1419,7 +1418,7 @@ static void qcom_scm_shutdown(struct platform_device *pdev) >> { >> /* Clean shutdown, disable download mode to allow normal restart */ >> if (download_mode) >> - qcom_scm_set_download_mode(false); >> + qcom_scm_set_download_mode(QCOM_DOWNLOAD_NODUMP); >> } >> >> static const struct of_device_id qcom_scm_dt_match[] = { >> diff --git a/include/linux/qcom_scm.h b/include/linux/qcom_scm.h >> index f833564..f9bc84e 100644 >> --- a/include/linux/qcom_scm.h >> +++ b/include/linux/qcom_scm.h >> @@ -14,6 +14,11 @@ >> #define QCOM_SCM_CPU_PWR_DOWN_L2_OFF 0x1 >> #define QCOM_SCM_HDCP_MAX_REQ_CNT 5 >> >> +enum qcom_download_mode { >> + QCOM_DOWNLOAD_NODUMP = 0x00, >> + QCOM_DOWNLOAD_FULLDUMP = 0x10, >> +}; >> + >> struct qcom_scm_hdcp_req { >> u32 addr; >> u32 val; >> -- >> 2.7.4 >> > >
On 24/01/2023 12:19, Mukesh Ojha wrote: > -static int __qcom_scm_set_dload_mode(struct device *dev, bool enable) > +static int __qcom_scm_set_dload_mode(struct device *dev, enum qcom_download_mode mode) > { > struct qcom_scm_desc desc = { > .svc = QCOM_SCM_SVC_BOOT, > .cmd = QCOM_SCM_BOOT_SET_DLOAD_MODE, > .arginfo = QCOM_SCM_ARGS(2), > - .args[0] = QCOM_SCM_BOOT_SET_DLOAD_MODE, > + .args[0] = mode, Is this a bug fix? why are we changing arg[0]? --srini > .owner = ARM_SMCCC_OWNER_SIP, > }; > > - desc.args[1] = enable ? QCOM_SCM_BOOT_SET_DLOAD_MODE : 0; > + desc.args[1] = mode; > > return qcom_scm_call_atomic(__scm->dev, &desc, NULL); > }
On 2/2/2023 4:47 PM, Srinivas Kandagatla wrote: > > > On 24/01/2023 12:19, Mukesh Ojha wrote: >> -static int __qcom_scm_set_dload_mode(struct device *dev, bool enable) >> +static int __qcom_scm_set_dload_mode(struct device *dev, enum >> qcom_download_mode mode) >> { >> struct qcom_scm_desc desc = { >> .svc = QCOM_SCM_SVC_BOOT, >> .cmd = QCOM_SCM_BOOT_SET_DLOAD_MODE, >> .arginfo = QCOM_SCM_ARGS(2), >> - .args[0] = QCOM_SCM_BOOT_SET_DLOAD_MODE, >> + .args[0] = mode, > > Is this a bug fix? why are we changing arg[0]? Thanks. This is legacy scm call and it is deprecated. Let's not change this. I will fix this in v2. -Mukesh > > --srini >> .owner = ARM_SMCCC_OWNER_SIP, >> }; >> - desc.args[1] = enable ? QCOM_SCM_BOOT_SET_DLOAD_MODE : 0; >> + desc.args[1] = mode; >> return qcom_scm_call_atomic(__scm->dev, &desc, NULL); >> }
diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c index cdbfe54..712bb03 100644 --- a/drivers/firmware/qcom_scm.c +++ b/drivers/firmware/qcom_scm.c @@ -400,22 +400,22 @@ int qcom_scm_set_remote_state(u32 state, u32 id) } EXPORT_SYMBOL(qcom_scm_set_remote_state); -static int __qcom_scm_set_dload_mode(struct device *dev, bool enable) +static int __qcom_scm_set_dload_mode(struct device *dev, enum qcom_download_mode mode) { struct qcom_scm_desc desc = { .svc = QCOM_SCM_SVC_BOOT, .cmd = QCOM_SCM_BOOT_SET_DLOAD_MODE, .arginfo = QCOM_SCM_ARGS(2), - .args[0] = QCOM_SCM_BOOT_SET_DLOAD_MODE, + .args[0] = mode, .owner = ARM_SMCCC_OWNER_SIP, }; - desc.args[1] = enable ? QCOM_SCM_BOOT_SET_DLOAD_MODE : 0; + desc.args[1] = mode; return qcom_scm_call_atomic(__scm->dev, &desc, NULL); } -static void qcom_scm_set_download_mode(bool enable) +static void qcom_scm_set_download_mode(enum qcom_download_mode mode) { bool avail; int ret = 0; @@ -424,10 +424,9 @@ static void qcom_scm_set_download_mode(bool enable) QCOM_SCM_SVC_BOOT, QCOM_SCM_BOOT_SET_DLOAD_MODE); if (avail) { - ret = __qcom_scm_set_dload_mode(__scm->dev, enable); + ret = __qcom_scm_set_dload_mode(__scm->dev, mode); } else if (__scm->dload_mode_addr) { - ret = qcom_scm_io_writel(__scm->dload_mode_addr, - enable ? QCOM_SCM_BOOT_SET_DLOAD_MODE : 0); + ret = qcom_scm_io_writel(__scm->dload_mode_addr, mode); } else { dev_err(__scm->dev, "No available mechanism for setting download mode\n"); @@ -1410,7 +1409,7 @@ static int qcom_scm_probe(struct platform_device *pdev) * disabled below by a clean shutdown/reboot. */ if (download_mode) - qcom_scm_set_download_mode(true); + qcom_scm_set_download_mode(QCOM_DOWNLOAD_FULLDUMP); return 0; } @@ -1419,7 +1418,7 @@ static void qcom_scm_shutdown(struct platform_device *pdev) { /* Clean shutdown, disable download mode to allow normal restart */ if (download_mode) - qcom_scm_set_download_mode(false); + qcom_scm_set_download_mode(QCOM_DOWNLOAD_NODUMP); } static const struct of_device_id qcom_scm_dt_match[] = { diff --git a/include/linux/qcom_scm.h b/include/linux/qcom_scm.h index f833564..f9bc84e 100644 --- a/include/linux/qcom_scm.h +++ b/include/linux/qcom_scm.h @@ -14,6 +14,11 @@ #define QCOM_SCM_CPU_PWR_DOWN_L2_OFF 0x1 #define QCOM_SCM_HDCP_MAX_REQ_CNT 5 +enum qcom_download_mode { + QCOM_DOWNLOAD_NODUMP = 0x00, + QCOM_DOWNLOAD_FULLDUMP = 0x10, +}; + struct qcom_scm_hdcp_req { u32 addr; u32 val;