[PATCH 0/3] soc: qcom: Add download mode support for QTI platforms

STALE1847d

10 messages, 5 authors, 2021-09-27 · open the first message on its own page

[PATCH 0/3] soc: qcom: Add download mode support for QTI platforms

From: Sai Prakash Ranjan <hidden>
Date: 2021-08-12 09:18:04

Collecting ramdumps on QTI platforms mainly require two things,
SDI (System Debug Image) enabled firmware and kernel support to
configure download mode cookies and SDI settings. Ramdumps can
be collected once the system enters the download mode. To enter
download mode, magic values or cookies need to be set in IMEM
which is used by firmware to decide to enter download mode or not.
Download mode cookies remain the same across targets and SDI disable
register needs to be set or SDI needs to be disabled in case of normal
reboot since ramdumps are supposed to be for crash debugging and
not for every reboot. This series adds the kernel support required
to enter download mode.

Currently this series doesn't add support for android targets where
a couple of SCM calls are required to set/unset the download mode
cookies and SDI configuration but can be easily added gradually to
the same driver, so as of now only chrome platforms are supported
and tested.

Sai Prakash Ranjan (3):
  soc: qcom: Add download mode support
  dt-bindings: msm: Add QTI download mode support binding
  arm64: dts: qcom: sc7180: Add IMEM, pil info and download mode region

 .../bindings/arm/msm/qcom,dload-mode.yaml     |  53 ++++++
 MAINTAINERS                                   |   7 +
 arch/arm64/boot/dts/qcom/sc7180.dtsi          |  21 +++
 drivers/soc/qcom/Kconfig                      |  10 ++
 drivers/soc/qcom/Makefile                     |   1 +
 drivers/soc/qcom/download_mode.c              | 152 ++++++++++++++++++
 6 files changed, 244 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml
 create mode 100644 drivers/soc/qcom/download_mode.c

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

[PATCH 1/3] soc: qcom: Add download mode support

From: Sai Prakash Ranjan <hidden>
Date: 2021-08-12 09:18:26

Add support for download mode on QTI platforms with SDI
(System Debug Image) enabled firmware. SDI checks for
the download mode cookies set by the kernel to decide on
whether to enter download mode or not. Additionally, SDI
needs to be disabled in case of normal reboot to prevent
entering download mode for every reboot and is enabled for
for crash reboots such as kernel panic and other crashes
such as watchdog bite/NOC errors handled by other entities
like secure world.

Signed-off-by: Sai Prakash Ranjan <redacted>
---
 MAINTAINERS                      |   7 ++
 drivers/soc/qcom/Kconfig         |  10 ++
 drivers/soc/qcom/Makefile        |   1 +
 drivers/soc/qcom/download_mode.c | 152 +++++++++++++++++++++++++++++++
 4 files changed, 170 insertions(+)
 create mode 100644 drivers/soc/qcom/download_mode.c
diff --git a/MAINTAINERS b/MAINTAINERS
index a61f4f3b78a9..e51226f11bce 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -15327,6 +15327,13 @@ L:	linux-arm-msm@vger.kernel.org
 S:	Maintained
 F:	drivers/crypto/qce/
 
+QUALCOMM DOWNLOAD MODE DRIVER
+M:	Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
+L:	linux-arm-msm@vger.kernel.org
+S:	Maintained
+F:	Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml
+F:	drivers/soc/qcom/download_mode.c
+
 QUALCOMM EMAC GIGABIT ETHERNET DRIVER
 M:	Timur Tabi <timur@kernel.org>
 L:	netdev@vger.kernel.org
diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig
index 79b568f82a1c..dc41fcfc4ac8 100644
--- a/drivers/soc/qcom/Kconfig
+++ b/drivers/soc/qcom/Kconfig
@@ -42,6 +42,16 @@ config QCOM_CPR
 	  To compile this driver as a module, choose M here: the module will
 	  be called qcom-cpr
 
+config QCOM_DLOAD_MODE
+	tristate "QCOM Download Mode support"
+	depends on ARCH_QCOM || COMPILE_TEST
+	help
+	  Say Y here to enable support for download mode on QTI platforms.
+
+	  Download mode driver configures the download mode cookies and SDI
+	  (System Debug Image) required to collect ramdump for post-mortem
+	  debug on Qualcomm Technologies, Inc. platforms.
+
 config QCOM_GENI_SE
 	tristate "QCOM GENI Serial Engine Driver"
 	depends on ARCH_QCOM || COMPILE_TEST
diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile
index ad675a6593d0..674520c9828e 100644
--- a/drivers/soc/qcom/Makefile
+++ b/drivers/soc/qcom/Makefile
@@ -4,6 +4,7 @@ obj-$(CONFIG_QCOM_AOSS_QMP) +=	qcom_aoss.o
 obj-$(CONFIG_QCOM_GENI_SE) +=	qcom-geni-se.o
 obj-$(CONFIG_QCOM_COMMAND_DB) += cmd-db.o
 obj-$(CONFIG_QCOM_CPR)		+= cpr.o
+obj-$(CONFIG_QCOM_DLOAD_MODE)	+= download_mode.o
 obj-$(CONFIG_QCOM_GSBI)	+=	qcom_gsbi.o
 obj-$(CONFIG_QCOM_MDT_LOADER)	+= mdt_loader.o
 obj-$(CONFIG_QCOM_OCMEM)	+= ocmem.o
diff --git a/drivers/soc/qcom/download_mode.c b/drivers/soc/qcom/download_mode.c
new file mode 100644
index 000000000000..519fdbe8669b
--- /dev/null
+++ b/drivers/soc/qcom/download_mode.c
@@ -0,0 +1,152 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2021, The Linux Foundation. All rights reserved.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/notifier.h>
+#include <linux/of_address.h>
+#include <linux/panic_notifier.h>
+#include <linux/reboot.h>
+#include <linux/slab.h>
+
+#define DLOAD_MODE_COOKIE1	0xe47b337d
+#define DLOAD_MODE_COOKIE2	0xce14091a
+
+struct qcom_dload_mode {
+	void __iomem *dload_mode;
+	void __iomem *sdi_disable;
+	bool in_panic;
+};
+
+static struct qcom_dload_mode *dmode;
+
+static int dload_mode_reboot_notifier(struct notifier_block *self,
+			       unsigned long v, void *p)
+{
+	/*
+	 * Don't enter download mode for normal reboot, so clear the
+	 * download mode cookie and disable SDI.
+	 */
+	if (!dmode->in_panic) {
+		writel(0, dmode->dload_mode);
+		writel(1, dmode->sdi_disable);
+	}
+
+	return NOTIFY_DONE;
+}
+
+static int dload_mode_panic_notifier(struct notifier_block *self,
+			       unsigned long v, void *p)
+{
+	dmode->in_panic = true;
+
+	return NOTIFY_DONE;
+}
+
+static struct notifier_block dload_mode_reboot_nb = {
+	.notifier_call = dload_mode_reboot_notifier,
+};
+
+static struct notifier_block dload_mode_panic_nb = {
+	.notifier_call = dload_mode_panic_notifier,
+};
+
+static void qcom_unset_dload_mode(void)
+{
+	writel(0, dmode->dload_mode);
+	writel(0, dmode->dload_mode + sizeof(u32));
+}
+
+static void qcom_set_dload_mode(void)
+{
+	writel(DLOAD_MODE_COOKIE1, dmode->dload_mode);
+	writel(DLOAD_MODE_COOKIE2, dmode->dload_mode + sizeof(u32));
+}
+
+static int __init qcom_dload_mode_init(void)
+{
+	struct resource imem, sdi_base;
+	struct of_phandle_args args;
+	struct device_node *np;
+	int ret;
+
+	dmode = kzalloc(sizeof(*dmode), GFP_KERNEL);
+	if (!dmode)
+		return -ENOMEM;
+
+	np = of_find_compatible_node(NULL, NULL, "qcom,dload-mode");
+	if (!np)
+		return -ENOENT;
+
+	ret = of_address_to_resource(np, 0, &imem);
+	if (ret < 0)
+		return ret;
+
+	ret = of_parse_phandle_with_fixed_args(np,
+					       "qcom,sdi-disable-regs",
+					       2, 0, &args);
+	of_node_put(np);
+	if (ret < 0) {
+		pr_err("Failed to parse sdi-disable-regs\n");
+		return -EINVAL;
+	}
+
+	ret = of_address_to_resource(args.np, 0, &sdi_base);
+	of_node_put(args.np);
+	if (ret < 0)
+		return ret;
+
+	dmode->dload_mode = ioremap(imem.start, resource_size(&imem));
+	if (!dmode->dload_mode) {
+		pr_err("Failed to map download mode region\n");
+		return -ENOMEM;
+	}
+
+	dmode->sdi_disable = ioremap(sdi_base.start + args.args[0], args.args[1]);
+	if (!dmode->sdi_disable) {
+		pr_err("Failed to map sdi disable region\n");
+		return -ENOMEM;
+	}
+
+	ret = atomic_notifier_chain_register(&panic_notifier_list,
+					     &dload_mode_panic_nb);
+	if (ret) {
+		pr_err("Failed to register panic notifier: %d\n", ret);
+		return ret;
+	}
+
+	ret = register_reboot_notifier(&dload_mode_reboot_nb);
+	if (ret) {
+		pr_err("Failed to register reboot notifier: %d\n", ret);
+		return ret;
+	}
+
+	/*
+	 * Set the download mode cookies here so that after this point on
+	 * any crash handled either by kernel or other crashes such as
+	 * watchdog bite handled by other entities like secure world,
+	 * download mode is entered.
+	 */
+	qcom_set_dload_mode();
+
+	return 0;
+}
+device_initcall(qcom_dload_mode_init);
+
+static void __exit qcom_dload_mode_exit(void)
+{
+	qcom_unset_dload_mode();
+	unregister_reboot_notifier(&dload_mode_reboot_nb);
+	atomic_notifier_chain_unregister(&panic_notifier_list,
+					 &dload_mode_panic_nb);
+	iounmap(dmode->sdi_disable);
+	iounmap(dmode->dload_mode);
+	kfree(dmode);
+	dmode = NULL;
+}
+module_exit(qcom_dload_mode_exit);
+
+MODULE_DESCRIPTION("Qualcomm Technologies, Inc. Download Mode driver");
+MODULE_LICENSE("GPL v2");
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

[PATCH 2/3] dt-bindings: msm: Add QTI download mode support binding

From: Sai Prakash Ranjan <hidden>
Date: 2021-08-12 09:19:04

Add device tree binding for QTI download mode cookies
region found in IMEM.

Signed-off-by: Sai Prakash Ranjan <redacted>
---
 .../bindings/arm/msm/qcom,dload-mode.yaml     | 53 +++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml
diff --git a/Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml b/Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml
new file mode 100644
index 000000000000..90b9b6a9b75e
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml
@@ -0,0 +1,53 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/arm/msm/qcom,dload-mode.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Download Mode binding
+
+maintainers:
+  - Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
+
+description:
+  Qualcomm download mode cookies memory region in IMEM is used by SDI
+  (System Debug Image) firmware to determine whether to enter download
+  mode or not to collect ramdump for post mortem debug.
+
+properties:
+  compatible:
+    const: qcom,dload-mode
+
+  reg:
+    maxItems: 1
+
+  qcom,sdi-disable-regs:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    description:
+      Phandle reference to a syscon representing TCSR followed by the
+      offset and length for SDI disable register.
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    imem@146aa000 {
+      compatible = "simple-mfd";
+      reg = <0x146aa000 0x2000>;
+
+      #address-cells = <1>;
+      #size-cells = <1>;
+
+      ranges = <0 0x146aa000 0x2000>;
+
+      dload-mode@1c00 {
+        compatible = "qcom,dload-mode";
+        reg = <0x1c00 0x1000>;
+        qcom,sdi-disable-regs = <&tcsr_regs 0x3a000 0x4>;
+      };
+    };
+...
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

[PATCH 3/3] arm64: dts: qcom: sc7180: Add IMEM, pil info and download mode region

From: Sai Prakash Ranjan <hidden>
Date: 2021-08-12 09:19:04

Add IMEM, pil info and download mode DT nodes for SC7180 SoC which
will help in the post-mortem debug.

Signed-off-by: Sai Prakash Ranjan <redacted>
---
 arch/arm64/boot/dts/qcom/sc7180.dtsi | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/sc7180.dtsi b/arch/arm64/boot/dts/qcom/sc7180.dtsi
index 47b20ba69057..f2957db166e9 100644
--- a/arch/arm64/boot/dts/qcom/sc7180.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180.dtsi
@@ -3222,6 +3222,27 @@ spmi_bus: spmi@c440000 {
 			cell-index = <0>;
 		};
 
+		imem@146aa000 {
+			compatible = "simple-mfd";
+			reg = <0 0x146aa000 0 0x2000>;
+
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			ranges = <0 0 0x146aa000 0x2000>;
+
+			pil-reloc@94c {
+				compatible = "qcom,pil-reloc-info";
+				reg = <0x94c 0xc8>;
+			};
+
+			dload-mode@1c00 {
+				compatible = "qcom,dload-mode";
+				reg = <0x1c00 0x1000>;
+				qcom,sdi-disable-regs = <&tcsr_regs 0x3a000 0x4>;
+			};
+		};
+
 		apps_smmu: iommu@15000000 {
 			compatible = "qcom,sc7180-smmu-500", "arm,mmu-500";
 			reg = <0 0x15000000 0 0x100000>;
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

Re: [PATCH 0/3] soc: qcom: Add download mode support for QTI platforms

From: Stephen Boyd <hidden>
Date: 2021-08-13 00:16:15

Quoting Sai Prakash Ranjan (2021-08-12 02:17:39)
Collecting ramdumps on QTI platforms mainly require two things,
SDI (System Debug Image) enabled firmware and kernel support to
configure download mode cookies and SDI settings. Ramdumps can
be collected once the system enters the download mode. To enter
download mode, magic values or cookies need to be set in IMEM
which is used by firmware to decide to enter download mode or not.
Download mode cookies remain the same across targets and SDI disable
register needs to be set or SDI needs to be disabled in case of normal
reboot since ramdumps are supposed to be for crash debugging and
not for every reboot. This series adds the kernel support required
to enter download mode.
I don't recall if we discussed this on the list, but I'd really prefer
that we don't make kernel changes to support this beyond implementing
PSCI SYSTEM_RESET2 support and then some sort of vendor specific (or if
ARM is willing to update the spec then ARM specific) reset command on
panic reboot paths. The idea is to set the cookie in the bootloader
before the kernel is booted, then any insta-reboots/watchdogs would go
into download mode, no special init code required to lay down the cookie
or clear it on normal reboot. The normal reboot PSCI call would clear
the cookie in the firmware, in case something goes wrong after the
kernel hands off control to PSCI, and then panics that want to go into
download mode would make the SYSTEM_RESET2 reboot call into PSCI that
sets the cookie.

Maybe it could be a linux specific psci number or maybe we could
configure the reboot call in the psci node to be this specific number so
that it can be different based on the firmware implementation if
consolidating around a single number doesn't work. Either way, that all
seems manageable and we can keep these cookie details out of the kernel
and the reboot/panic paths.
Currently this series doesn't add support for android targets where
a couple of SCM calls are required to set/unset the download mode
cookies and SDI configuration but can be easily added gradually to
the same driver, so as of now only chrome platforms are supported
and tested.

Sai Prakash Ranjan (3):
  soc: qcom: Add download mode support
  dt-bindings: msm: Add QTI download mode support binding
  arm64: dts: qcom: sc7180: Add IMEM, pil info and download mode region

 .../bindings/arm/msm/qcom,dload-mode.yaml     |  53 ++++++
 MAINTAINERS                                   |   7 +
 arch/arm64/boot/dts/qcom/sc7180.dtsi          |  21 +++
 drivers/soc/qcom/Kconfig                      |  10 ++
 drivers/soc/qcom/Makefile                     |   1 +
 drivers/soc/qcom/download_mode.c              | 152 ++++++++++++++++++
 6 files changed, 244 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml
 create mode 100644 drivers/soc/qcom/download_mode.c

Re: [PATCH 0/3] soc: qcom: Add download mode support for QTI platforms

From: Trilok Soni <hidden>
Date: 2021-08-13 04:31:13

Stephen,

On 8/12/2021 5:16 PM, Stephen Boyd wrote:
Quoting Sai Prakash Ranjan (2021-08-12 02:17:39)
quoted
Collecting ramdumps on QTI platforms mainly require two things,
SDI (System Debug Image) enabled firmware and kernel support to
configure download mode cookies and SDI settings. Ramdumps can
be collected once the system enters the download mode. To enter
download mode, magic values or cookies need to be set in IMEM
which is used by firmware to decide to enter download mode or not.
Download mode cookies remain the same across targets and SDI disable
register needs to be set or SDI needs to be disabled in case of normal
reboot since ramdumps are supposed to be for crash debugging and
not for every reboot. This series adds the kernel support required
to enter download mode.
I don't recall if we discussed this on the list, but I'd really prefer
that we don't make kernel changes to support this beyond implementing
PSCI SYSTEM_RESET2 support and then some sort of vendor specific (or if
ARM is willing to update the spec then ARM specific) reset command on
panic reboot paths. The idea is to set the cookie in the bootloader
before the kernel is booted, then any insta-reboots/watchdogs would go
into download mode, no special init code required to lay down the cookie
quoted
  create mode 100644 drivers/soc/qcom/download_mode.c
Some discussion by Elliot on the PSCI_SYSTEM_RESET2 and vendor bits was done here. You may want to check.

https://lkml.org/lkml/2020/2/24/1137

---Trilok Soni

Re: [PATCH 0/3] soc: qcom: Add download mode support for QTI platforms

From: Sai Prakash Ranjan <hidden>
Date: 2021-08-16 10:39:37

On 2021-08-13 05:46, Stephen Boyd wrote:
Quoting Sai Prakash Ranjan (2021-08-12 02:17:39)
quoted
Collecting ramdumps on QTI platforms mainly require two things,
SDI (System Debug Image) enabled firmware and kernel support to
configure download mode cookies and SDI settings. Ramdumps can
be collected once the system enters the download mode. To enter
download mode, magic values or cookies need to be set in IMEM
which is used by firmware to decide to enter download mode or not.
Download mode cookies remain the same across targets and SDI disable
register needs to be set or SDI needs to be disabled in case of normal
reboot since ramdumps are supposed to be for crash debugging and
not for every reboot. This series adds the kernel support required
to enter download mode.
I don't recall if we discussed this on the list, but I'd really prefer
that we don't make kernel changes to support this beyond implementing
PSCI SYSTEM_RESET2 support and then some sort of vendor specific (or if
ARM is willing to update the spec then ARM specific) reset command on
panic reboot paths. The idea is to set the cookie in the bootloader
before the kernel is booted, then any insta-reboots/watchdogs would go
into download mode, no special init code required to lay down the cookie
or clear it on normal reboot. The normal reboot PSCI call would clear
the cookie in the firmware, in case something goes wrong after the
kernel hands off control to PSCI, and then panics that want to go into
download mode would make the SYSTEM_RESET2 reboot call into PSCI that
sets the cookie.

Maybe it could be a linux specific psci number or maybe we could
configure the reboot call in the psci node to be this specific number so
that it can be different based on the firmware implementation if
consolidating around a single number doesn't work. Either way, that all
seems manageable and we can keep these cookie details out of the kernel
and the reboot/panic paths.
Alright, I think we can probably make it work without much/any changes
in kernel. So following what you said, we can just implement
PSCI_SYSTEM_RESET2 in firmware to enter the download mode having cookies
already set by default and the cookie is cleared when we have a normal
reboot via PSCI_SYSTEM_RESET. For panic reboot, we already have a cmdline
*reboot=panic_warm* to identify panic reboots and can call into
PSCI_SYSTEM_RESET2. I have just tested and it works fine if we have
psci_system_reset2_supported as true.

@Trilok/@Elliot, you can check if above works for your usecases in android
as well and it doesn't need any of your additional changes to kernel.

Thanks,
Sai
quoted
Currently this series doesn't add support for android targets where
a couple of SCM calls are required to set/unset the download mode
cookies and SDI configuration but can be easily added gradually to
the same driver, so as of now only chrome platforms are supported
and tested.

Sai Prakash Ranjan (3):
  soc: qcom: Add download mode support
  dt-bindings: msm: Add QTI download mode support binding
  arm64: dts: qcom: sc7180: Add IMEM, pil info and download mode region

 .../bindings/arm/msm/qcom,dload-mode.yaml     |  53 ++++++
 MAINTAINERS                                   |   7 +
 arch/arm64/boot/dts/qcom/sc7180.dtsi          |  21 +++
 drivers/soc/qcom/Kconfig                      |  10 ++
 drivers/soc/qcom/Makefile                     |   1 +
 drivers/soc/qcom/download_mode.c              | 152 ++++++++++++++++++
 6 files changed, 244 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml
 create mode 100644 drivers/soc/qcom/download_mode.c
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

Re: [PATCH 2/3] dt-bindings: msm: Add QTI download mode support binding

From: Rob Herring <robh@kernel.org>
Date: 2021-08-17 21:28:46

On Thu, Aug 12, 2021 at 02:47:41PM +0530, Sai Prakash Ranjan wrote:
quoted hunk
Add device tree binding for QTI download mode cookies
region found in IMEM.

Signed-off-by: Sai Prakash Ranjan <redacted>
---
 .../bindings/arm/msm/qcom,dload-mode.yaml     | 53 +++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml
diff --git a/Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml b/Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml
new file mode 100644
index 000000000000..90b9b6a9b75e
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml
@@ -0,0 +1,53 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/arm/msm/qcom,dload-mode.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Download Mode binding
+
+maintainers:
+  - Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
+
+description:
+  Qualcomm download mode cookies memory region in IMEM is used by SDI
+  (System Debug Image) firmware to determine whether to enter download
+  mode or not to collect ramdump for post mortem debug.
+
+properties:
+  compatible:
+    const: qcom,dload-mode
+
+  reg:
+    maxItems: 1
+
+  qcom,sdi-disable-regs:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    description:
+      Phandle reference to a syscon representing TCSR followed by the
+      offset and length for SDI disable register.
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    imem@146aa000 {
+      compatible = "simple-mfd";
If this is just internal RAM, then we already have a binding for it and 
'simple-mfd' is not it.
quoted hunk
+      reg = <0x146aa000 0x2000>;
+
+      #address-cells = <1>;
+      #size-cells = <1>;
+
+      ranges = <0 0x146aa000 0x2000>;
+
+      dload-mode@1c00 {
+        compatible = "qcom,dload-mode";
+        reg = <0x1c00 0x1000>;
0x1c00 + 0x1000 > 0x2000

+        qcom,sdi-disable-regs = <&tcsr_regs 0x3a000 0x4>;
+      };
+    };
+...
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

Re: [PATCH 2/3] dt-bindings: msm: Add QTI download mode support binding

From: Sai Prakash Ranjan <hidden>
Date: 2021-08-18 03:36:06

On 2021-08-18 02:58, Rob Herring wrote:
On Thu, Aug 12, 2021 at 02:47:41PM +0530, Sai Prakash Ranjan wrote:
quoted
Add device tree binding for QTI download mode cookies
region found in IMEM.

Signed-off-by: Sai Prakash Ranjan <redacted>
---
 .../bindings/arm/msm/qcom,dload-mode.yaml     | 53 +++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml
diff --git a/Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml b/Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml
new file mode 100644
index 000000000000..90b9b6a9b75e
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/msm/qcom,dload-mode.yaml
@@ -0,0 +1,53 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/arm/msm/qcom,dload-mode.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Download Mode binding
+
+maintainers:
+  - Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
+
+description:
+  Qualcomm download mode cookies memory region in IMEM is used by SDI
+  (System Debug Image) firmware to determine whether to enter download
+  mode or not to collect ramdump for post mortem debug.
+
+properties:
+  compatible:
+    const: qcom,dload-mode
+
+  reg:
+    maxItems: 1
+
+  qcom,sdi-disable-regs:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    description:
+      Phandle reference to a syscon representing TCSR followed by the
+      offset and length for SDI disable register.
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    imem@146aa000 {
+      compatible = "simple-mfd";
If this is just internal RAM, then we already have a binding for it and
'simple-mfd' is not it.
Hmm, I followed qcom,pil-info.yaml as a reference but maybe that's old.
quoted
+      reg = <0x146aa000 0x2000>;
+
+      #address-cells = <1>;
+      #size-cells = <1>;
+
+      ranges = <0 0x146aa000 0x2000>;
+
+      dload-mode@1c00 {
+        compatible = "qcom,dload-mode";
+        reg = <0x1c00 0x1000>;
0x1c00 + 0x1000 > 0x2000
Sorry my mistake. I am dropping this series as we will move
to using PSCI_SYSTEM_RESET2 as detailed in cover letter.

Thanks,
Sai
quoted
+        qcom,sdi-disable-regs = <&tcsr_regs 0x3a000 0x4>;
+      };
+    };
+...
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

Re: (subset) [PATCH 3/3] arm64: dts: qcom: sc7180: Add IMEM, pil info and download mode region

From: Bjorn Andersson <hidden>
Date: 2021-09-27 22:56:29

On Thu, 12 Aug 2021 14:47:42 +0530, Sai Prakash Ranjan wrote:
Add IMEM, pil info and download mode DT nodes for SC7180 SoC which
will help in the post-mortem debug.
Applied, thanks!

[3/3] arm64: dts: qcom: sc7180: Add IMEM, pil info and download mode region
      commit: ede638c42c82b1e6648a3c6ac71aaf088ff830e2

Best regards,
-- 
Bjorn Andersson [off-list ref]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help