[openwrt/openwrt] ipq40xx: update SCM SDI patches with pending upstream
LEDE Commits
lede-commits at lists.infradead.org
Tue Aug 15 07:40:29 PDT 2023
hauke pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/a4aac5909e69abcc786484425e1afb1409f62940
commit a4aac5909e69abcc786484425e1afb1409f62940
Author: Robert Marko <robimarko at gmail.com>
AuthorDate: Sun Aug 13 18:20:08 2023 +0200
ipq40xx: update SCM SDI patches with pending upstream
SCM SDI disable support is pending upstream, so lets use that instead.
Since the board check needs to be split out, export it with a header so
it applies with git-am.
Signed-off-by: Robert Marko <robimarko at gmail.com>
---
...firmware-qcom-scm-Add-SDI-disable-support.patch | 60 ++++++++++++++++++++++
.../420-firmware-qcom-scm-disable-SDI.patch | 47 -----------------
...mware-qcom-scm-disable-SDI-on-Google-WiFi.patch | 34 ++++++++++++
...ware-qcom_scm-Clear-download-bit-during-r.patch | 6 +--
4 files changed, 97 insertions(+), 50 deletions(-)
diff --git a/target/linux/ipq40xx/patches-5.15/420-firmware-qcom-scm-Add-SDI-disable-support.patch b/target/linux/ipq40xx/patches-5.15/420-firmware-qcom-scm-Add-SDI-disable-support.patch
new file mode 100644
index 0000000000..e4ee745ff1
--- /dev/null
+++ b/target/linux/ipq40xx/patches-5.15/420-firmware-qcom-scm-Add-SDI-disable-support.patch
@@ -0,0 +1,60 @@
+From b514bc3c0a5a57bc83843dc66c72788b9c9435ac Mon Sep 17 00:00:00 2001
+From: Robert Marko <robimarko at gmail.com>
+Date: Thu, 18 May 2023 16:02:23 +0200
+Subject: [PATCH 1/3] firmware: qcom: scm: Add SDI disable support
+
+Some SoC-s like IPQ5018 require SDI(Secure Debug Image) to be disabled
+before trying to reboot, otherwise board will just hang after reboot has
+been issued via PSCI.
+
+So, provide a call to SCM that allows disabling it.
+
+Signed-off-by: Robert Marko <robimarko at gmail.com>
+Acked-by: Mukesh Ojha <quic_mojha at quicinc.com>
+---
+ drivers/firmware/qcom_scm.c | 23 +++++++++++++++++++++++
+ drivers/firmware/qcom_scm.h | 1 +
+ 2 files changed, 24 insertions(+)
+
+--- a/drivers/firmware/qcom_scm.c
++++ b/drivers/firmware/qcom_scm.c
+@@ -389,6 +389,29 @@ int qcom_scm_set_remote_state(u32 state,
+ }
+ EXPORT_SYMBOL(qcom_scm_set_remote_state);
+
++static int qcom_scm_disable_sdi(void)
++{
++ int ret;
++ struct qcom_scm_desc desc = {
++ .svc = QCOM_SCM_SVC_BOOT,
++ .cmd = QCOM_SCM_BOOT_SDI_CONFIG,
++ .args[0] = 1, /* Disable watchdog debug */
++ .args[1] = 0, /* Disable SDI */
++ .arginfo = QCOM_SCM_ARGS(2),
++ .owner = ARM_SMCCC_OWNER_SIP,
++ };
++ struct qcom_scm_res res;
++
++ ret = qcom_scm_clk_enable();
++ if (ret)
++ return ret;
++ ret = qcom_scm_call(__scm->dev, &desc, &res);
++
++ qcom_scm_clk_disable();
++
++ return ret ? : res.result[0];
++}
++
+ static int __qcom_scm_set_dload_mode(struct device *dev, bool enable)
+ {
+ struct qcom_scm_desc desc = {
+--- a/drivers/firmware/qcom_scm.h
++++ b/drivers/firmware/qcom_scm.h
+@@ -77,6 +77,7 @@ extern int scm_legacy_call(struct device
+ #define QCOM_SCM_SVC_BOOT 0x01
+ #define QCOM_SCM_BOOT_SET_ADDR 0x01
+ #define QCOM_SCM_BOOT_TERMINATE_PC 0x02
++#define QCOM_SCM_BOOT_SDI_CONFIG 0x09
+ #define QCOM_SCM_BOOT_SET_DLOAD_MODE 0x10
+ #define QCOM_SCM_BOOT_SET_REMOTE_STATE 0x0a
+ #define QCOM_SCM_FLUSH_FLAG_MASK 0x3
diff --git a/target/linux/ipq40xx/patches-5.15/420-firmware-qcom-scm-disable-SDI.patch b/target/linux/ipq40xx/patches-5.15/420-firmware-qcom-scm-disable-SDI.patch
deleted file mode 100644
index a0074103cc..0000000000
--- a/target/linux/ipq40xx/patches-5.15/420-firmware-qcom-scm-disable-SDI.patch
+++ /dev/null
@@ -1,47 +0,0 @@
---- a/drivers/firmware/qcom_scm.c
-+++ b/drivers/firmware/qcom_scm.c
-@@ -404,6 +404,20 @@ static int __qcom_scm_set_dload_mode(str
- return qcom_scm_call_atomic(__scm->dev, &desc, NULL);
- }
-
-+static int __qcom_scm_disable_sdi(struct device *dev)
-+{
-+ struct qcom_scm_desc desc = {
-+ .svc = QCOM_SCM_SVC_BOOT,
-+ .cmd = QCOM_SCM_BOOT_CONFIG_SDI,
-+ .arginfo = QCOM_SCM_ARGS(2),
-+ .args[0] = 1 /* 1: disable watchdog debug */,
-+ .args[1] = 0 /* 0: disable SDI */,
-+ .owner = ARM_SMCCC_OWNER_SIP,
-+ };
-+
-+ return qcom_scm_call(__scm->dev, &desc, NULL);
-+}
-+
- static void qcom_scm_set_download_mode(bool enable)
- {
- bool avail;
-@@ -1314,6 +1328,13 @@ static int qcom_scm_probe(struct platfor
- if (download_mode)
- qcom_scm_set_download_mode(true);
-
-+ /*
-+ * Factory firmware leaves SDI (a debug interface), which prevents
-+ * clean reboot.
-+ */
-+ if (of_machine_is_compatible("google,wifi"))
-+ __qcom_scm_disable_sdi(__scm->dev);
-+
- return 0;
- }
-
---- a/drivers/firmware/qcom_scm.h
-+++ b/drivers/firmware/qcom_scm.h
-@@ -77,6 +77,7 @@ extern int scm_legacy_call(struct device
- #define QCOM_SCM_SVC_BOOT 0x01
- #define QCOM_SCM_BOOT_SET_ADDR 0x01
- #define QCOM_SCM_BOOT_TERMINATE_PC 0x02
-+#define QCOM_SCM_BOOT_CONFIG_SDI 0x09
- #define QCOM_SCM_BOOT_SET_DLOAD_MODE 0x10
- #define QCOM_SCM_BOOT_SET_REMOTE_STATE 0x0a
- #define QCOM_SCM_FLUSH_FLAG_MASK 0x3
diff --git a/target/linux/ipq40xx/patches-5.15/421-firmware-qcom-scm-disable-SDI-on-Google-WiFi.patch b/target/linux/ipq40xx/patches-5.15/421-firmware-qcom-scm-disable-SDI-on-Google-WiFi.patch
new file mode 100644
index 0000000000..98f02934a9
--- /dev/null
+++ b/target/linux/ipq40xx/patches-5.15/421-firmware-qcom-scm-disable-SDI-on-Google-WiFi.patch
@@ -0,0 +1,34 @@
+From a658ad57c2b9d46eb5395c7bb8cf83b8e0f289e7 Mon Sep 17 00:00:00 2001
+From: Brian Norris <computersforpeace at gmail.com>
+Date: Fri, 28 Jul 2023 12:02:19 +0200
+Subject: [PATCH 2/3] firmware: qcom: scm: disable SDI on Google WiFi
+
+Google WiFi seems to have SDI (Secure Debug Image) enabled by default which
+prevents normal reboot from working causing the board to just hang after
+reboot is called.
+
+So lets disable SDI during SCM probe on Google WiFi boards in order to
+avoid a state where WDT will kick in and then the board will just hang
+in the debug mode.
+
+Signed-off-by: Brian Norris <computersforpeace at gmail.com>
+---
+ drivers/firmware/qcom_scm.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+--- a/drivers/firmware/qcom_scm.c
++++ b/drivers/firmware/qcom_scm.c
+@@ -1337,6 +1337,13 @@ static int qcom_scm_probe(struct platfor
+ if (download_mode)
+ qcom_scm_set_download_mode(true);
+
++ /*
++ * Factory firmware leaves SDI (a debug interface), which prevents
++ * clean reboot.
++ */
++ if (of_machine_is_compatible("google,wifi"))
++ qcom_scm_disable_sdi();
++
+ return 0;
+ }
+
diff --git a/target/linux/ipq40xx/patches-5.15/910-Revert-firmware-qcom_scm-Clear-download-bit-during-r.patch b/target/linux/ipq40xx/patches-5.15/910-Revert-firmware-qcom_scm-Clear-download-bit-during-r.patch
index e24895deec..b5b89b26f1 100644
--- a/target/linux/ipq40xx/patches-5.15/910-Revert-firmware-qcom_scm-Clear-download-bit-during-r.patch
+++ b/target/linux/ipq40xx/patches-5.15/910-Revert-firmware-qcom_scm-Clear-download-bit-during-r.patch
@@ -1,6 +1,6 @@
-From c87df89a82c17411cd6b98e5afaa1203ee9508dc Mon Sep 17 00:00:00 2001
+From c668fd2c4d9ad4a510fd214a2da83bd9b67a2508 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko at gmail.com>
-Date: Thu, 18 May 2023 12:16:02 +0200
+Date: Sun, 13 Aug 2023 18:13:08 +0200
Subject: [PATCH] Revert "firmware: qcom_scm: Clear download bit during reboot"
This reverts commit a3ea89b5978dbcd0fa55f675c5a1e04611093709.
@@ -15,7 +15,7 @@ Signed-off-by: Robert Marko <robimarko at gmail.com>
--- a/drivers/firmware/qcom_scm.c
+++ b/drivers/firmware/qcom_scm.c
-@@ -1352,7 +1352,8 @@ static int qcom_scm_probe(struct platfor
+@@ -1361,7 +1361,8 @@ static int qcom_scm_probe(struct platfor
static void qcom_scm_shutdown(struct platform_device *pdev)
{
/* Clean shutdown, disable download mode to allow normal restart */
More information about the lede-commits
mailing list