Skip to contentSkip to conversation

Add ADSP PIL driver for SDM845

PATCH Superseded Rohit kumar 4 participants 13 messages Sep 3, 2018 – Sep 24, 2018

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover Add ADSP PIL driver for SDM845

This provides initial patchset for ADSP PIL driver for SDM845.

Changes since v2:
Separated dt-bindings documentation into separate patch. Used clk_bulk APIs for adsp clocks.
Used power domain API and use reference to rpmhd resource. Renamed qcom_nonpas_adsp_pil.c to qcom_adsp_pil.c
Removed smd as sdm845 does not support smd.
Removed px_supply and aggre2_clk for sdm845 as they are not required. Removed reg-names as there is only one register.

This patch is dependent on the rpmh powerdomain driver https://lkml.org/lkml/2018/6/27/7
and renaming of Hexagon v5 PAS driver https://lkml.org/lkml/2018/8/28/129 .

Rohit kumar (2):
dt-binding: remoteproc: Add QTI ADSP PIL bindings
remoteproc: qcom: Introduce Non-PAS ADSP PIL driver

 .../bindings/remoteproc/qcom,adsp-pil.txt          | 123 +++++
 drivers/remoteproc/Kconfig                         |  14 +
 drivers/remoteproc/Makefile                        |   1 +
 drivers/remoteproc/qcom_adsp_pil.c                 | 500 +++++++++++++++++++++
 4 files changed, 638 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt
 create mode 100644 drivers/remoteproc/qcom_adsp_pil.c
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
#1 lore raw

PATCH v3 1/2 dt-binding: remoteproc: Add QTI ADSP PIL bindings

Add devicetree bindings documentation file for Qualcomm Technolgies Inc ADSP Peripheral Image Loader.

---
 .../bindings/remoteproc/qcom,adsp-pil.txt          | 123 +++++++++++++++++++++
 1 file changed, 123 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt
Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt new file +123 -0
new file mode 100644
index 0000000..f1c215a
@@ -0,0 +1,123 @@
+Qualcomm Technology Inc. ADSP Peripheral Image Loader
+
+This document defines the binding for a component that loads and boots firmware
+on the Qualcomm Technology Inc. ADSP Hexagon core.
+
+- compatible:
+	Usage: required
+	Value type: <string>
+	Definition: must be one of:
+		    "qcom,sdm845-adsp-pil"
+
+- reg:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: must specify the base address and size of the qdsp6ss register
+
+- interrupts-extended:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: must list the watchdog, fatal IRQs ready, handover and
+		    stop-ack IRQs
+
+- interrupt-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: must be "wdog", "fatal", "ready", "handover", "stop-ack"
+
+- clocks:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition:  List of phandle and clock specifier pairs
+
+- clock-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: List of clock input name strings sorted in the same
+				order as the clocks property.
+
+- power-domains:
+	Usage: required
+	Value type: <phandle>
+	Definition: reference to cx power domain node.
+
+- resets:
+	Usage: required
+	Value type: <phandle>
+	Definition: reference to the reset-controller for the lpass
+
+- reset-names:
+        Usage: required
+        Value type: <stringlist>
+        Definition: must be "pdc_sync" and "cc_lpass"
+
+- qcom,halt-regs:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: a phandle reference to a syscon representing TCSR followed
+			by the offset within syscon for lpass halt register.
+
+- memory-region:
+	Usage: required
+	Value type: <phandle>
+	Definition: reference to the reserved-memory for the ADSP
+
+- qcom,smem-states:
+	Usage: required
+	Value type: <phandle>
+	Definition: reference to the smem state for requesting the ADSP to
+		    shut down
+
+- qcom,smem-state-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: must be "stop"
+
+
+= SUBNODES
+The adsp node may have an subnode named "glink-edge" that describes the
+communication edge, channels and devices related to the ADSP.
+See ../soc/qcom/qcom,glink.txt for details on how to describe these.
+
+= EXAMPLE
+The following example describes the resources needed to boot control the
+ADSP, as it is found on SDM845 boards.
+	adsp-pil {
+		compatible = "qcom,sdm845-adsp-pil";
+
+		reg = <0x17300000 0x40c>;
+
+		interrupts-extended = <&intc 0 162 IRQ_TYPE_EDGE_RISING>,
+			<&adsp_smp2p_in 0 IRQ_TYPE_EDGE_RISING>,
+			<&adsp_smp2p_in 1 IRQ_TYPE_EDGE_RISING>,
+			<&adsp_smp2p_in 2 IRQ_TYPE_EDGE_RISING>,
+			<&adsp_smp2p_in 3 IRQ_TYPE_EDGE_RISING>;
+		interrupt-names = "wdog", "fatal", "ready",
+			"handover", "stop-ack";
+
+		clocks = <&rpmhcc RPMH_CXO_CLK>,
+			<&gcc GCC_LPASS_SWAY_CLK>,
+			<&lpasscc LPASS_AUDIO_WRAPPER_AON_CLK>,
+			<&lpasscc LPASS_Q6SS_AHBS_AON_CLK>,
+			<&lpasscc LPASS_Q6SS_AHBM_AON_CLK>,
+			<&lpasscc LPASS_QDSP6SS_XO_CLK>,
+			<&lpasscc LPASS_QDSP6SS_SLEEP_CLK>,
+			<&lpasscc LPASS_QDSP6SS_CORE_CLK>;
+		clock-names = "xo", "sway_cbcr", "lpass_aon",
+			"lpass_ahbs_aon_cbcr",
+			"lpass_ahbm_aon_cbcr", "qdsp6ss_xo",
+			"qdsp6ss_sleep", "qdsp6ss_core";
+
+		power-domains = <&rpmhpd SDM845_CX>;
+
+		resets = <&pdc_reset PDC_AUDIO_SYNC_RESET>,
+			 <&aoss_reset AOSS_CC_LPASS_RESTART>;
+		reset-names = "pdc_sync", "cc_lpass";
+
+		qcom,halt-regs = <&tcsr_mutex_regs 0x22000>;
+
+		memory-region = <&pil_adsp_mem>;
+
+		qcom,smem-states = <&adsp_smp2p_out 0>;
+		qcom,smem-state-names = "stop";
+	};
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
#2 lore raw

Re: [PATCH v3 1/2] dt-binding: remoteproc: Add QTI ADSP PIL bindings

Quoted 4 lines · Rohit kumar

Add devicetree bindings documentation file for Qualcomm Technolgies Inc ADSP Peripheral Image Loader.

Rob, this revision looks good to me and I would like to move ahead and merge it.

Regards,
Bjorn

Quoted 138 lines
---
 .../bindings/remoteproc/qcom,adsp-pil.txt          | 123 +++++++++++++++++++++
 1 file changed, 123 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt
Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt new file +123 -0
new file mode 100644
index 0000000..f1c215a
@@ -0,0 +1,123 @@
+Qualcomm Technology Inc. ADSP Peripheral Image Loader
+
+This document defines the binding for a component that loads and boots firmware
+on the Qualcomm Technology Inc. ADSP Hexagon core.
+
+- compatible:
+	Usage: required
+	Value type: <string>
+	Definition: must be one of:
+		    "qcom,sdm845-adsp-pil"
+
+- reg:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: must specify the base address and size of the qdsp6ss register
+
+- interrupts-extended:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: must list the watchdog, fatal IRQs ready, handover and
+		    stop-ack IRQs
+
+- interrupt-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: must be "wdog", "fatal", "ready", "handover", "stop-ack"
+
+- clocks:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition:  List of phandle and clock specifier pairs
+
+- clock-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: List of clock input name strings sorted in the same
+				order as the clocks property.
+
+- power-domains:
+	Usage: required
+	Value type: <phandle>
+	Definition: reference to cx power domain node.
+
+- resets:
+	Usage: required
+	Value type: <phandle>
+	Definition: reference to the reset-controller for the lpass
+
+- reset-names:
+        Usage: required
+        Value type: <stringlist>
+        Definition: must be "pdc_sync" and "cc_lpass"
+
+- qcom,halt-regs:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: a phandle reference to a syscon representing TCSR followed
+			by the offset within syscon for lpass halt register.
+
+- memory-region:
+	Usage: required
+	Value type: <phandle>
+	Definition: reference to the reserved-memory for the ADSP
+
+- qcom,smem-states:
+	Usage: required
+	Value type: <phandle>
+	Definition: reference to the smem state for requesting the ADSP to
+		    shut down
+
+- qcom,smem-state-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: must be "stop"
+
+
+= SUBNODES
+The adsp node may have an subnode named "glink-edge" that describes the
+communication edge, channels and devices related to the ADSP.
+See ../soc/qcom/qcom,glink.txt for details on how to describe these.
+
+= EXAMPLE
+The following example describes the resources needed to boot control the
+ADSP, as it is found on SDM845 boards.
+	adsp-pil {
+		compatible = "qcom,sdm845-adsp-pil";
+
+		reg = <0x17300000 0x40c>;
+
+		interrupts-extended = <&intc 0 162 IRQ_TYPE_EDGE_RISING>,
+			<&adsp_smp2p_in 0 IRQ_TYPE_EDGE_RISING>,
+			<&adsp_smp2p_in 1 IRQ_TYPE_EDGE_RISING>,
+			<&adsp_smp2p_in 2 IRQ_TYPE_EDGE_RISING>,
+			<&adsp_smp2p_in 3 IRQ_TYPE_EDGE_RISING>;
+		interrupt-names = "wdog", "fatal", "ready",
+			"handover", "stop-ack";
+
+		clocks = <&rpmhcc RPMH_CXO_CLK>,
+			<&gcc GCC_LPASS_SWAY_CLK>,
+			<&lpasscc LPASS_AUDIO_WRAPPER_AON_CLK>,
+			<&lpasscc LPASS_Q6SS_AHBS_AON_CLK>,
+			<&lpasscc LPASS_Q6SS_AHBM_AON_CLK>,
+			<&lpasscc LPASS_QDSP6SS_XO_CLK>,
+			<&lpasscc LPASS_QDSP6SS_SLEEP_CLK>,
+			<&lpasscc LPASS_QDSP6SS_CORE_CLK>;
+		clock-names = "xo", "sway_cbcr", "lpass_aon",
+			"lpass_ahbs_aon_cbcr",
+			"lpass_ahbm_aon_cbcr", "qdsp6ss_xo",
+			"qdsp6ss_sleep", "qdsp6ss_core";
+
+		power-domains = <&rpmhpd SDM845_CX>;
+
+		resets = <&pdc_reset PDC_AUDIO_SYNC_RESET>,
+			 <&aoss_reset AOSS_CC_LPASS_RESTART>;
+		reset-names = "pdc_sync", "cc_lpass";
+
+		qcom,halt-regs = <&tcsr_mutex_regs 0x22000>;
+
+		memory-region = <&pil_adsp_mem>;
+
+		qcom,smem-states = <&adsp_smp2p_out 0>;
+		qcom,smem-state-names = "stop";
+	};
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
maintainer
#3 lore raw

Re: [PATCH v3 1/2] dt-binding: remoteproc: Add QTI ADSP PIL bindings

In reply to Rohit kumar
Quoted 36 lines · Rohit kumar

Add devicetree bindings documentation file for Qualcomm Technolgies Inc ADSP Peripheral Image Loader.

---
 .../bindings/remoteproc/qcom,adsp-pil.txt          | 123 +++++++++++++++++++++
 1 file changed, 123 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt
Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt new file +21 -0
new file mode 100644
index 0000000..f1c215a
@@ -0,0 +1,123 @@
+Qualcomm Technology Inc. ADSP Peripheral Image Loader
+
+This document defines the binding for a component that loads and boots firmware
+on the Qualcomm Technology Inc. ADSP Hexagon core.
+
+- compatible:
+	Usage: required
+	Value type: <string>
+	Definition: must be one of:
+		    "qcom,sdm845-adsp-pil"
+
+- reg:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: must specify the base address and size of the qdsp6ss register
+
+- interrupts-extended:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: must list the watchdog, fatal IRQs ready, handover and
+		    stop-ack IRQs

Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt line 31

Quoted 10 lines
Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt new file +10 -0
+
+- interrupt-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: must be "wdog", "fatal", "ready", "handover", "stop-ack"
+
+- clocks:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition:  List of phandle and clock specifier pairs

How many clocks?

Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt line 37

Quoted 6 lines
Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt new file +6 -0
+
+- clock-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: List of clock input name strings sorted in the same
+				order as the clocks property.

What are the names?

Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt line 47

Quoted 10 lines
Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt new file +10 -0
+
+- power-domains:
+	Usage: required
+	Value type: <phandle>
+	Definition: reference to cx power domain node.
+
+- resets:
+	Usage: required
+	Value type: <phandle>
+	Definition: reference to the reset-controller for the lpass

How many?

Quoted 80 lines
Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt new file +76 -0
+
+- reset-names:
+        Usage: required
+        Value type: <stringlist>
+        Definition: must be "pdc_sync" and "cc_lpass"
+
+- qcom,halt-regs:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: a phandle reference to a syscon representing TCSR followed
+			by the offset within syscon for lpass halt register.
+
+- memory-region:
+	Usage: required
+	Value type: <phandle>
+	Definition: reference to the reserved-memory for the ADSP
+
+- qcom,smem-states:
+	Usage: required
+	Value type: <phandle>
+	Definition: reference to the smem state for requesting the ADSP to
+		    shut down
+
+- qcom,smem-state-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: must be "stop"
+
+
+= SUBNODES
+The adsp node may have an subnode named "glink-edge" that describes the
+communication edge, channels and devices related to the ADSP.
+See ../soc/qcom/qcom,glink.txt for details on how to describe these.
+
+= EXAMPLE
+The following example describes the resources needed to boot control the
+ADSP, as it is found on SDM845 boards.
+	adsp-pil {
+		compatible = "qcom,sdm845-adsp-pil";
+
+		reg = <0x17300000 0x40c>;
+
+		interrupts-extended = <&intc 0 162 IRQ_TYPE_EDGE_RISING>,
+			<&adsp_smp2p_in 0 IRQ_TYPE_EDGE_RISING>,
+			<&adsp_smp2p_in 1 IRQ_TYPE_EDGE_RISING>,
+			<&adsp_smp2p_in 2 IRQ_TYPE_EDGE_RISING>,
+			<&adsp_smp2p_in 3 IRQ_TYPE_EDGE_RISING>;
+		interrupt-names = "wdog", "fatal", "ready",
+			"handover", "stop-ack";
+
+		clocks = <&rpmhcc RPMH_CXO_CLK>,
+			<&gcc GCC_LPASS_SWAY_CLK>,
+			<&lpasscc LPASS_AUDIO_WRAPPER_AON_CLK>,
+			<&lpasscc LPASS_Q6SS_AHBS_AON_CLK>,
+			<&lpasscc LPASS_Q6SS_AHBM_AON_CLK>,
+			<&lpasscc LPASS_QDSP6SS_XO_CLK>,
+			<&lpasscc LPASS_QDSP6SS_SLEEP_CLK>,
+			<&lpasscc LPASS_QDSP6SS_CORE_CLK>;
+		clock-names = "xo", "sway_cbcr", "lpass_aon",
+			"lpass_ahbs_aon_cbcr",
+			"lpass_ahbm_aon_cbcr", "qdsp6ss_xo",
+			"qdsp6ss_sleep", "qdsp6ss_core";
+
+		power-domains = <&rpmhpd SDM845_CX>;
+
+		resets = <&pdc_reset PDC_AUDIO_SYNC_RESET>,
+			 <&aoss_reset AOSS_CC_LPASS_RESTART>;
+		reset-names = "pdc_sync", "cc_lpass";
+
+		qcom,halt-regs = <&tcsr_mutex_regs 0x22000>;
+
+		memory-region = <&pil_adsp_mem>;
+
+		qcom,smem-states = <&adsp_smp2p_out 0>;
+		qcom,smem-state-names = "stop";
+	};
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
#4 lore raw

Re: [PATCH v3 1/2] dt-binding: remoteproc: Add QTI ADSP PIL bindings

Thanks Rob for reviewing.

Quoted 49 lines · Rob Herring
Quoted 36 lines · Rohit kumar

Add devicetree bindings documentation file for Qualcomm Technolgies Inc ADSP Peripheral Image Loader.

---
  .../bindings/remoteproc/qcom,adsp-pil.txt          | 123 +++++++++++++++++++++
  1 file changed, 123 insertions(+)

create mode 100644 Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt

Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt new file +21 -0
new file mode 100644
index 0000000..f1c215a
@@ -0,0 +1,123 @@
+Qualcomm Technology Inc. ADSP Peripheral Image Loader
+
+This document defines the binding for a component that loads and boots firmware
+on the Qualcomm Technology Inc. ADSP Hexagon core.
+
+- compatible:
+	Usage: required
+	Value type: <string>
+	Definition: must be one of:
+		    "qcom,sdm845-adsp-pil"
+
+- reg:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: must specify the base address and size of the qdsp6ss register
+
+- interrupts-extended:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: must list the watchdog, fatal IRQs ready, handover and
+		    stop-ack IRQs

Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt line 31

Quoted 10 lines
Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt new file +10 -0
+
+- interrupt-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: must be "wdog", "fatal", "ready", "handover", "stop-ack"
+
+- clocks:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition:  List of phandle and clock specifier pairs

How many clocks?

Quoted 7 lines

Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt line 37

Quoted 6 lines
Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt new file +6 -0
+
+- clock-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: List of clock input name strings sorted in the same
+				order as the clocks property.

What are the names?

I will update these in next spin.

Quoted 83 lines

Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt line 47

Quoted 10 lines
Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt new file +10 -0
+
+- power-domains:
+	Usage: required
+	Value type: <phandle>
+	Definition: reference to cx power domain node.
+
+- resets:
+	Usage: required
+	Value type: <phandle>
+	Definition: reference to the reset-controller for the lpass

How many?

Quoted 71 lines
Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt new file +71 -0
+
+- reset-names:
+        Usage: required
+        Value type: <stringlist>
+        Definition: must be "pdc_sync" and "cc_lpass"
+
+- qcom,halt-regs:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: a phandle reference to a syscon representing TCSR followed
+			by the offset within syscon for lpass halt register.
+
+- memory-region:
+	Usage: required
+	Value type: <phandle>
+	Definition: reference to the reserved-memory for the ADSP
+
+- qcom,smem-states:
+	Usage: required
+	Value type: <phandle>
+	Definition: reference to the smem state for requesting the ADSP to
+		    shut down
+
+- qcom,smem-state-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: must be "stop"
+
+
+= SUBNODES
+The adsp node may have an subnode named "glink-edge" that describes the
+communication edge, channels and devices related to the ADSP.
+See ../soc/qcom/qcom,glink.txt for details on how to describe these.
+
+= EXAMPLE
+The following example describes the resources needed to boot control the
+ADSP, as it is found on SDM845 boards.
+	adsp-pil {
+		compatible = "qcom,sdm845-adsp-pil";
+
+		reg = <0x17300000 0x40c>;
+
+		interrupts-extended = <&intc 0 162 IRQ_TYPE_EDGE_RISING>,
+			<&adsp_smp2p_in 0 IRQ_TYPE_EDGE_RISING>,
+			<&adsp_smp2p_in 1 IRQ_TYPE_EDGE_RISING>,
+			<&adsp_smp2p_in 2 IRQ_TYPE_EDGE_RISING>,
+			<&adsp_smp2p_in 3 IRQ_TYPE_EDGE_RISING>;
+		interrupt-names = "wdog", "fatal", "ready",
+			"handover", "stop-ack";
+
+		clocks = <&rpmhcc RPMH_CXO_CLK>,
+			<&gcc GCC_LPASS_SWAY_CLK>,
+			<&lpasscc LPASS_AUDIO_WRAPPER_AON_CLK>,
+			<&lpasscc LPASS_Q6SS_AHBS_AON_CLK>,
+			<&lpasscc LPASS_Q6SS_AHBM_AON_CLK>,
+			<&lpasscc LPASS_QDSP6SS_XO_CLK>,
+			<&lpasscc LPASS_QDSP6SS_SLEEP_CLK>,
+			<&lpasscc LPASS_QDSP6SS_CORE_CLK>;
+		clock-names = "xo", "sway_cbcr", "lpass_aon",
+			"lpass_ahbs_aon_cbcr",
+			"lpass_ahbm_aon_cbcr", "qdsp6ss_xo",
+			"qdsp6ss_sleep", "qdsp6ss_core";
+
+		power-domains = <&rpmhpd SDM845_CX>;
+
+		resets = <&pdc_reset PDC_AUDIO_SYNC_RESET>,
+			 <&aoss_reset AOSS_CC_LPASS_RESTART>;
+		reset-names = "pdc_sync", "cc_lpass";
+
+		qcom,halt-regs = <&tcsr_mutex_regs 0x22000>;
+
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt new file +5 -0
+		memory-region = <&pil_adsp_mem>;
+
+		qcom,smem-states = <&adsp_smp2p_out 0>;
+		qcom,smem-state-names = "stop";
+	};
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.

Thanks,
Rohit

#5 lore raw

PATCH v3 2/2 remoteproc: qcom: Introduce Non-PAS ADSP PIL driver

In reply to Rohit kumar

This adds Non PAS ADSP PIL driver for Qualcomm Technologies Inc SoCs.
Added initial support for SDM845 with ADSP bootup and shutdown operation handled from Application Processor SubSystem(APSS).

---
 drivers/remoteproc/Kconfig         |  14 ++
 drivers/remoteproc/Makefile        |   1 +
 drivers/remoteproc/qcom_adsp_pil.c | 500 +++++++++++++++++++++++++++++++++++++
 3 files changed, 515 insertions(+)
 create mode 100644 drivers/remoteproc/qcom_adsp_pil.c
drivers/remoteproc/Kconfig +14 -0
index c98c0b2..445de2d 100644
@@ -139,6 +139,20 @@ config QCOM_Q6V5_WCSS
 	  Say y here to support the Qualcomm Peripheral Image Loader for the
 	  Hexagon V5 based WCSS remote processors.
 
+config QCOM_ADSP_PIL
+	tristate "Qualcomm Technology Inc ADSP Peripheral Image Loader"
+	depends on OF && ARCH_QCOM
+	depends on QCOM_SMEM
+	depends on RPMSG_QCOM_GLINK_SMEM || RPMSG_QCOM_GLINK_SMEM=n
+	depends on QCOM_SYSMON || QCOM_SYSMON=n
+	select MFD_SYSCON
+	select QCOM_MDT_LOADER
+	select QCOM_Q6V5_COMMON
+	select QCOM_RPROC_COMMON
+	help
+	  Say y here to support the Peripherial Image Loader
+	  for the Qualcomm Technology Inc. ADSP remote processors.
+
 config QCOM_SYSMON
 	tristate "Qualcomm sysmon driver"
 	depends on RPMSG
drivers/remoteproc/Makefile +1 -0
index eb86c8b..1258519 100644
@@ -19,6 +19,7 @@ obj-$(CONFIG_QCOM_Q6V5_COMMON)		+= qcom_q6v5.o
 obj-$(CONFIG_QCOM_Q6V5_PAS)		+= qcom_q6v5_pas.o
 obj-$(CONFIG_QCOM_Q6V5_PIL)		+= qcom_q6v5_pil.o
 obj-$(CONFIG_QCOM_Q6V5_WCSS)		+= qcom_q6v5_wcss.o
+obj-$(CONFIG_QCOM_ADSP_PIL)		+= qcom_adsp_pil.o
 obj-$(CONFIG_QCOM_SYSMON)		+= qcom_sysmon.o
 obj-$(CONFIG_QCOM_WCNSS_PIL)		+= qcom_wcnss_pil.o
 qcom_wcnss_pil-y			+= qcom_wcnss.o
drivers/remoteproc/qcom_adsp_pil.c new file +500 -0

500 lines not on this page · raw message

Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
#6 lore raw

Re: [PATCH v3 2/2] remoteproc: qcom: Introduce Non-PAS ADSP PIL driver

Quoted 7 lines · Rohit kumar

This adds Non PAS ADSP PIL driver for Qualcomm Technologies Inc SoCs.
Added initial support for SDM845 with ADSP bootup and shutdown operation handled from Application Processor SubSystem(APSS).

Thanks for the changes Rohit, this looks good.

Once we hear from DT maintainers that patch 1 can be applied I will update the name of the file and driver as I apply it to match the naming scheme I'm aiming for - no need for you to resend because of this.

Quoted 12 lines
---
 drivers/remoteproc/Kconfig         |  14 ++
 drivers/remoteproc/Makefile        |   1 +
 drivers/remoteproc/qcom_adsp_pil.c | 500 +++++++++++++++++++++++++++++++++++++
 3 files changed, 515 insertions(+)
 create mode 100644 drivers/remoteproc/qcom_adsp_pil.c
drivers/remoteproc/Kconfig +0 -0
index c98c0b2..445de2d 100644

drivers/remoteproc/Kconfig config QCOM_Q6V5_WCSS · line 142

Quoted 4 lines
drivers/remoteproc/Kconfig +1 -0
@@ -139,6 +139,20 @@ config QCOM_Q6V5_WCSS
 	  Say y here to support the Qualcomm Peripheral Image Loader for the
 	  Hexagon V5 based WCSS remote processors.
 
+config QCOM_ADSP_PIL

I will make this QCOM_Q6V5_ADSP

[..]

drivers/remoteproc/qcom_adsp_pil.c

Quoted 1 line
drivers/remoteproc/qcom_adsp_pil.c +0 -0

Make this qcom_q6v5_adsp.c

[..]

drivers/remoteproc/qcom_adsp_pil.c line 493

Quoted 5 lines
drivers/remoteproc/qcom_adsp_pil.c +5 -0
+static struct platform_driver adsp_pil_driver = {
+	.probe = adsp_probe,
+	.remove = adsp_remove,
+	.driver = {
+		.name = "qcom_adsp_pil",

and this qcom_q6v5_adsp".

drivers/remoteproc/qcom_adsp_pil.c line 496

Quoted 3 lines
drivers/remoteproc/qcom_adsp_pil.c +3 -0
+		.of_match_table = adsp_of_match,
+	},
+};

Please let me know if you have any objections to this.

Regards,
Bjorn

#7 lore raw

Re: [PATCH v3 2/2] remoteproc: qcom: Introduce Non-PAS ADSP PIL driver

Thanks Bjorn for reviewing.

Quoted 8 lines · Bjorn Andersson
Quoted 6 lines · Rohit kumar

This adds Non PAS ADSP PIL driver for Qualcomm Technologies Inc SoCs.
Added initial support for SDM845 with ADSP bootup and shutdown operation handled from Application Processor SubSystem(APSS).

Quoted 6 lines
Quoted 1 line

Thanks for the changes Rohit, this looks good.

Once we hear from DT maintainers that patch 1 can be applied I will update the name of the file and driver as I apply it to match the naming scheme I'm aiming for - no need for you to resend because of this.

Sure, I will just update dt-bindings with addressing some comments given by Rob.

Quoted 30 lines
Quoted 12 lines
---
  drivers/remoteproc/Kconfig         |  14 ++
  drivers/remoteproc/Makefile        |   1 +
  drivers/remoteproc/qcom_adsp_pil.c | 500 +++++++++++++++++++++++++++++++++++++
  3 files changed, 515 insertions(+)

create mode 100644 drivers/remoteproc/qcom_adsp_pil.c

drivers/remoteproc/Kconfig +0 -0
index c98c0b2..445de2d 100644

drivers/remoteproc/Kconfig config QCOM_Q6V5_WCSS · line 142

Quoted 4 lines
drivers/remoteproc/Kconfig +1 -0
@@ -139,6 +139,20 @@ config QCOM_Q6V5_WCSS
  	  Say y here to support the Qualcomm Peripheral Image Loader for the
  	  Hexagon V5 based WCSS remote processors.
 
+config QCOM_ADSP_PIL

I will make this QCOM_Q6V5_ADSP

[..]

drivers/remoteproc/qcom_adsp_pil.c

Quoted 1 line
drivers/remoteproc/qcom_adsp_pil.c +0 -0

Make this qcom_q6v5_adsp.c

[..]

drivers/remoteproc/qcom_adsp_pil.c line 493

Quoted 5 lines
drivers/remoteproc/qcom_adsp_pil.c +5 -0
+static struct platform_driver adsp_pil_driver = {
+	.probe = adsp_probe,
+	.remove = adsp_remove,
+	.driver = {
+		.name = "qcom_adsp_pil",

and this qcom_q6v5_adsp".

Quoted 4 lines

drivers/remoteproc/qcom_adsp_pil.c line 496

Quoted 3 lines
drivers/remoteproc/qcom_adsp_pil.c +3 -0
+		.of_match_table = adsp_of_match,
+	},
+};

Please let me know if you have any objections to this.

Naming looks fine.

Thanks,
Rohit

Quoted 2 lines

Regards,
Bjorn

#8 lore raw

Re: [PATCH v3 2/2] remoteproc: qcom: Introduce Non-PAS ADSP PIL driver

In reply to Rohit kumar

Hi Rohit,

Quoted 8 lines · Rohit kumar

This adds Non PAS ADSP PIL driver for Qualcomm Technologies Inc SoCs.
Added initial support for SDM845 with ADSP bootup and shutdown operation handled from Application Processor SubSystem(APSS).

---

....

drivers/remoteproc/Kconfig config QCOM_Q6V5_WCSS · line 153

Quoted 5 lines
drivers/remoteproc/Kconfig +5 -0
+	select QCOM_MDT_LOADER
+	select QCOM_Q6V5_COMMON
+	select QCOM_RPROC_COMMON
+	help
+	  Say y here to support the Peripherial Image Loader

replace Peripherial/Peripheral.
....

Quoted 11 lines
drivers/remoteproc/qcom_adsp_pil.c new file +11 -0
+#include <linux/clk.h>
+#include <linux/firmware.h>
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/delay.h>
+#include <linux/io.h>
+#include <linux/reset.h>
+#include <linux/iopoll.h>
+#include <linux/pm_domain.h>
+#include <linux/pm_runtime.h>

drivers/remoteproc/qcom_adsp_pil.c line 27

Quoted 10 lines
drivers/remoteproc/qcom_adsp_pil.c new file +10 -0
+#include <linux/regmap.h>
+#include <linux/mfd/syscon.h>
+#include <linux/of_address.h>
+#include <linux/of_device.h>
+#include <linux/platform_device.h>
+#include <linux/remoteproc.h>
+#include <linux/soc/qcom/mdt_loader.h>
+#include <linux/soc/qcom/smem.h>
+#include <linux/soc/qcom/smem_state.h>
+

The headers should be in alphabetical order.

....

drivers/remoteproc/qcom_adsp_pil.c line 81

Quoted 5 lines
drivers/remoteproc/qcom_adsp_pil.c new file +5 -0
+	struct reset_control *pdc_sync_reset;
+	struct reset_control *cc_lpass_restart;
+
+	struct regmap *halt_map;
+	unsigned int  halt_lpass;

remove the double spaces above.
....

drivers/remoteproc/qcom_adsp_pil.c line 126

Quoted 7 lines
drivers/remoteproc/qcom_adsp_pil.c new file +7 -0
+	if (ret || val)
+		goto reset;
+
+	regmap_write(adsp->halt_map,
+			adsp->halt_lpass + LPASS_HALTREQ_REG, 1);
+
+	/*  Wait for halt ACK from QDSP6 */

Minor nit, please remove the double spaces in the comment above.

drivers/remoteproc/qcom_adsp_pil.c line 134

Quoted 8 lines
drivers/remoteproc/qcom_adsp_pil.c new file +8 -0
+	timeout = jiffies + msecs_to_jiffies(ACK_TIMEOUT);
+	for (;;) {
+		ret = regmap_read(adsp->halt_map,
+			adsp->halt_lpass + LPASS_HALTACK_REG, &val);
+		if (ret || val || time_after(jiffies, timeout))
+			break;
+
+		udelay(1000);

According to Documentation/timers/timers-howto.txt please use usleep_range() when the delay range is between(10us - 20ms).

Quoted 4 lines
drivers/remoteproc/qcom_adsp_pil.c new file +4 -0
+	}
+
+	ret = regmap_read(adsp->halt_map,
+			adsp->halt_lpass + LPASS_MASTER_IDLE_REG, &val);

....

Review

Quoted 2 lines
(quoted diff) +2 -0
+	/* wait after asserting subsystem restart from AOSS */
+	udelay(200);

ditto

drivers/remoteproc/qcom_adsp_pil.c line 158

Quoted 11 lines
drivers/remoteproc/qcom_adsp_pil.c new file +3 -0
+
+	/* Clear the halt request for the AXIM and AHBM for Q6 */
+	regmap_write(adsp->halt_map, adsp->halt_lpass + LPASS_HALTREQ_REG, 

0);

drivers/remoteproc/qcom_adsp_pil.c new file +7 -0
+
+	/* De-assert the LPASS PDC Reset */
+	reset_control_deassert(adsp->pdc_sync_reset);
+	/* Remove the LPASS reset */
+	reset_control_deassert(adsp->cc_lpass_restart);
+	/* wait after de-asserting subsystem restart from AOSS */
+	udelay(200);

ditto

Quoted 3 lines
drivers/remoteproc/qcom_adsp_pil.c new file +3 -0
+
+	return 0;
+}

....

drivers/remoteproc/qcom_adsp_pil.c line 182

Quoted 11 lines
drivers/remoteproc/qcom_adsp_pil.c new file +11 -0
+static int adsp_start(struct rproc *rproc)
+{
+	struct qcom_adsp *adsp = (struct qcom_adsp *)rproc->priv;
+	int ret;
+	unsigned int val;
+
+	qcom_q6v5_prepare(&adsp->q6v5);
+
+	ret = clk_prepare_enable(adsp->xo);
+	if (ret)
+		return ret;

please call qcom_q6v5_unprepare on clk_prepare_enable failure to disable_irqs

Quoted 6 lines
drivers/remoteproc/qcom_adsp_pil.c new file +6 -0
+
+	dev_pm_genpd_set_performance_state(adsp->dev, INT_MAX);
+	ret = pm_runtime_get_sync(adsp->dev);
+	if (ret)
+		goto disable_xo_clk;
+

....

drivers/remoteproc/qcom_adsp_pil.c line 316

Quoted 8 lines
drivers/remoteproc/qcom_adsp_pil.c new file +8 -0
+static int adsp_init_reset(struct qcom_adsp *adsp)
+{
+	adsp->pdc_sync_reset = devm_reset_control_get_exclusive(adsp->dev,
+			"pdc_sync");
+	if (IS_ERR(adsp->pdc_sync_reset)) {
+		dev_err(adsp->dev, "failed to acquire pdc_sync reset\n");
+		return PTR_ERR(adsp->pdc_sync_reset);
+	}

Bjorn, should we return EPROBE_DEFER here since PDC global reset controller can be a module?

Quoted 9 lines
drivers/remoteproc/qcom_adsp_pil.c new file +9 -0
+
+	adsp->cc_lpass_restart = devm_reset_control_get_exclusive(adsp->dev,
+			"cc_lpass");
+	if (IS_ERR(adsp->cc_lpass_restart)) {
+		dev_err(adsp->dev, "failed to acquire cc_lpass restart\n");
+		return PTR_ERR(adsp->cc_lpass_restart);
+	}
+
+	return 0;

....

drivers/remoteproc/qcom_adsp_pil.c line 470

Quoted 12 lines
drivers/remoteproc/qcom_adsp_pil.c new file +12 -0
+static int adsp_remove(struct platform_device *pdev)
+{
+	struct qcom_adsp *adsp = platform_get_drvdata(pdev);
+
+	rproc_del(adsp->rproc);
+
+	qcom_remove_glink_subdev(adsp->rproc, &adsp->glink_subdev);
+	qcom_remove_sysmon_subdev(adsp->sysmon);
+	qcom_remove_ssr_subdev(adsp->rproc, &adsp->ssr_subdev);
+	rproc_free(adsp->rproc);
+	pm_runtime_disable(adsp->dev);
+

rmmod of the driver resulted in the following kernel panic:
having a pm_runtime_disable after rproc_free seems to be the cause of the kernel panic. Please call pm_runtime_disable before rproc_free.

do_raw_spin_lock+0x28/0x118
__raw_spin_lock_irq+0x30/0x3c
__pm_runtime_disable+0x28/0xf4
adsp_remove+0x4c/0x5c [qcom_adsp_pil]
platform_drv_remove+0x28/0x50
device_release_driver_internal+0x124/0x1c8
driver_detach+0x44/0x80
bus_remove_driver+0x78/0x9c
driver_unregister+0x34/0x54
platform_driver_unregister+0x1c/0x28
cleanup_module+0x14/0x6bc [qcom_adsp_pil]
SyS_delete_module+0x1c4/0x214
Quoted 10 lines
drivers/remoteproc/qcom_adsp_pil.c new file +10 -0
+	return 0;
+}
+
+static const struct adsp_pil_data adsp_resource_init = {
+	.crash_reason_smem = 423,
+	.firmware_name = "adsp.mdt",
+	.ssr_name = "lpass",
+	.sysmon_name = "adsp",
+	.ssctl_id = 0x14,
+};

....

drivers/remoteproc/qcom_adsp_pil.c line 499

Quoted 2 lines
drivers/remoteproc/qcom_adsp_pil.c new file +2 -0
+module_platform_driver(adsp_pil_driver);
+MODULE_DESCRIPTION("QTi SDM845 ADSP Peripherial Image Loader");

replace QTi/QTI and Peripherial/Peripheral.

....
Also I see the following warns on stopping the adsp remoteproc, couldn't root cause it though:

 device_del+0x84/0x29c
 platform_device_del+0x2c/0x88
 platform_device_unregister+0x1c/0x30
 of_platform_device_destroy+0x98/0xa8
 device_for_each_child+0x54/0xa4
 of_platform_depopulate+0x38/0x54
 q6asm_remove+0x1c/0x2c
 apr_device_remove+0x38/0x70
 device_release_driver_internal+0x124/0x1c8
 device_release_driver+0x24/0x30
 bus_remove_device+0xcc/0xe4
 device_del+0x1f8/0x29c
 device_unregister+0x1c/0x30
 apr_remove_device+0x1c/0x2c
 device_for_each_child+0x54/0xa4
 apr_remove+0x28/0x34
 rpmsg_dev_remove+0x48/0x70
 device_release_driver_internal+0x124/0x1c8
 device_release_driver+0x24/0x30
 bus_remove_device+0xcc/0xe4
 device_del+0x1f8/0x29c
 device_unregister+0x1c/0x30
 qcom_glink_remove_device+0x1c/0x2c
 device_for_each_child+0x54/0xa4
 qcom_glink_native_remove+0x54/0x15c
 qcom_glink_smem_unregister+0x1c/0x30
 glink_subdev_stop+0x1c/0x2c [qcom_common]
 rproc_stop+0x40/0xc0
 rproc_shutdown+0x6c/0xc0
 rproc_del+0x28/0xa0
 adsp_remove+0x20/0x5c [qcom_adsp_pil]
 platform_drv_remove+0x28/0x50
 device_release_driver_internal+0x124/0x1c8
 driver_detach+0x44/0x80
 bus_remove_driver+0x78/0x9c
 driver_unregister+0x34/0x54
 platform_driver_unregister+0x1c/0x28
 cleanup_module+0x14/0x6bc [qcom_adsp_pil]
 SyS_delete_module+0x1c4/0x214
Signature · 3 lines
-- Sibi Sankar --
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project.
#9 lore raw

Re: [PATCH v3 2/2] remoteproc: qcom: Introduce Non-PAS ADSP PIL driver

Thanks Sibi for reviewing.

Quoted 11 lines · Sibi Sankar

Hi Rohit,

Quoted 8 lines · Rohit kumar

This adds Non PAS ADSP PIL driver for Qualcomm Technologies Inc SoCs.
Added initial support for SDM845 with ADSP bootup and shutdown operation handled from Application Processor SubSystem(APSS).

---

Quoted 8 lines

....

Quoted 5 lines

+    select QCOM_MDT_LOADER
+    select QCOM_Q6V5_COMMON
+    select QCOM_RPROC_COMMON
+    help
+      Say y here to support the Peripherial Image Loader

replace Peripherial/Peripheral.

sure

Quoted 16 lines

....

Quoted 15 lines
drivers/remoteproc/qcom_adsp_pil.c new file +15 -0
+#include <linux/clk.h>
+#include <linux/firmware.h>
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/delay.h>
+#include <linux/io.h>
+#include <linux/reset.h>
+#include <linux/iopoll.h>
+#include <linux/pm_domain.h>
+#include <linux/pm_runtime.h>
+#include <linux/regmap.h>
+#include <linux/mfd/syscon.h>
+#include <linux/of_address.h>
+#include <linux/of_device.h>
Quoted 9 lines

drivers/remoteproc/qcom_adsp_pil.c line 27

Quoted 6 lines
drivers/remoteproc/qcom_adsp_pil.c new file +6 -0
+#include <linux/platform_device.h>
+#include <linux/remoteproc.h>
+#include <linux/soc/qcom/mdt_loader.h>
+#include <linux/soc/qcom/smem.h>
+#include <linux/soc/qcom/smem_state.h>
+

The headers should be in alphabetical order.

ok, will do

Quoted 8 lines

....

Quoted 5 lines

+    struct reset_control *pdc_sync_reset;
+    struct reset_control *cc_lpass_restart;
+
+    struct regmap *halt_map;
+    unsigned int  halt_lpass;

remove the double spaces above.

ok

Quoted 10 lines

....

drivers/remoteproc/qcom_adsp_pil.c line 126

Quoted 7 lines

+    if (ret || val)
+        goto reset;

drivers/remoteproc/qcom_adsp_pil.c new file +5 -0
+
+    regmap_write(adsp->halt_map,
+            adsp->halt_lpass + LPASS_HALTREQ_REG, 1);
+
+    /*  Wait for halt ACK from QDSP6 */

Minor nit, please remove the double spaces in the comment above.

ok

Quoted 10 lines
Quoted 9 lines

+    timeout = jiffies + msecs_to_jiffies(ACK_TIMEOUT); +    for (;;) {
+        ret = regmap_read(adsp->halt_map,
+            adsp->halt_lpass + LPASS_HALTACK_REG, &val); +        if (ret || val || time_after(jiffies, timeout)) +            break;
+
+        udelay(1000);

Quoted 2 lines

According to Documentation/timers/timers-howto.txt please use usleep_range() when the delay range is between(10us - 20ms).

okay, will update in next spin.

Quoted 10 lines
Quoted 5 lines

+    }
+
+    ret = regmap_read(adsp->halt_map,
+            adsp->halt_lpass + LPASS_MASTER_IDLE_REG, &val);

....

Quoted 2 lines

+    /* wait after asserting subsystem restart from AOSS */ +    udelay(200);

ditto

ok

Quoted 19 lines
Quoted 12 lines

+
+    /* Clear the halt request for the AXIM and AHBM for Q6 */ +    regmap_write(adsp->halt_map, adsp->halt_lpass + LPASS_HALTREQ_REG, 0);
+
+    /* De-assert the LPASS PDC Reset */
+    reset_control_deassert(adsp->pdc_sync_reset);
+    /* Remove the LPASS reset */
+    reset_control_deassert(adsp->cc_lpass_restart); +    /* wait after de-asserting subsystem restart from AOSS */ +    udelay(200);

ditto

Quoted 3 lines
drivers/remoteproc/qcom_adsp_pil.c new file +3 -0
+
+    return 0;
+}

....

Quoted 14 lines

drivers/remoteproc/qcom_adsp_pil.c line 182

Quoted 11 lines
drivers/remoteproc/qcom_adsp_pil.c new file +11 -0
+static int adsp_start(struct rproc *rproc)
+{
+    struct qcom_adsp *adsp = (struct qcom_adsp *)rproc->priv;
+    int ret;
+    unsigned int val;
+
+    qcom_q6v5_prepare(&adsp->q6v5);
+
+    ret = clk_prepare_enable(adsp->xo);
+    if (ret)
+        return ret;

please call qcom_q6v5_unprepare on clk_prepare_enable failure to disable_irqs

sure, will do that

Quoted 7 lines
Quoted 6 lines
drivers/remoteproc/qcom_adsp_pil.c new file +6 -0
+
+    dev_pm_genpd_set_performance_state(adsp->dev, INT_MAX);
+    ret = pm_runtime_get_sync(adsp->dev);
+    if (ret)
+        goto disable_xo_clk;
+

....

Quoted 11 lines

drivers/remoteproc/qcom_adsp_pil.c line 316

Quoted 8 lines
drivers/remoteproc/qcom_adsp_pil.c new file +8 -0
+static int adsp_init_reset(struct qcom_adsp *adsp)
+{
+    adsp->pdc_sync_reset = devm_reset_control_get_exclusive(adsp->dev,
+            "pdc_sync");
+    if (IS_ERR(adsp->pdc_sync_reset)) {
+        dev_err(adsp->dev, "failed to acquire pdc_sync reset\n");
+        return PTR_ERR(adsp->pdc_sync_reset);
+    }

Bjorn, should we return EPROBE_DEFER here since PDC global reset controller can be a module?

devm_reset_control_get_exclusive itself returns EPROBE_DEFER until PDC reset driver is probed. return PTR_ERR(adsp->pdc_sync_reset) handles this case.

Quoted 11 lines
Quoted 10 lines

+
+    adsp->cc_lpass_restart = devm_reset_control_get_exclusive(adsp->dev,
+            "cc_lpass");
+    if (IS_ERR(adsp->cc_lpass_restart)) {
+        dev_err(adsp->dev, "failed to acquire cc_lpass restart\n"); +        return PTR_ERR(adsp->cc_lpass_restart);
+    }
+
+    return 0;

....

Quoted 17 lines

drivers/remoteproc/qcom_adsp_pil.c line 470

Quoted 12 lines
drivers/remoteproc/qcom_adsp_pil.c new file +12 -0
+static int adsp_remove(struct platform_device *pdev)
+{
+    struct qcom_adsp *adsp = platform_get_drvdata(pdev);
+
+    rproc_del(adsp->rproc);
+
+    qcom_remove_glink_subdev(adsp->rproc, &adsp->glink_subdev);
+    qcom_remove_sysmon_subdev(adsp->sysmon);
+    qcom_remove_ssr_subdev(adsp->rproc, &adsp->ssr_subdev);
+    rproc_free(adsp->rproc);
+    pm_runtime_disable(adsp->dev);
+

rmmod of the driver resulted in the following kernel panic:
having a pm_runtime_disable after rproc_free seems to be the cause of the kernel panic. Please call pm_runtime_disable before rproc_free.

Thanks for pointing out, will update.

Quoted 24 lines
do_raw_spin_lock+0x28/0x118
__raw_spin_lock_irq+0x30/0x3c
__pm_runtime_disable+0x28/0xf4
adsp_remove+0x4c/0x5c [qcom_adsp_pil]
platform_drv_remove+0x28/0x50
device_release_driver_internal+0x124/0x1c8
driver_detach+0x44/0x80
bus_remove_driver+0x78/0x9c
driver_unregister+0x34/0x54
platform_driver_unregister+0x1c/0x28
cleanup_module+0x14/0x6bc [qcom_adsp_pil]
SyS_delete_module+0x1c4/0x214
Quoted 10 lines

+    return 0;

drivers/remoteproc/qcom_adsp_pil.c new file +9 -0
+}
+
+static const struct adsp_pil_data adsp_resource_init = {
+    .crash_reason_smem = 423,
+    .firmware_name = "adsp.mdt",
+    .ssr_name = "lpass",
+    .sysmon_name = "adsp",
+    .ssctl_id = 0x14,
+};

....

Quoted 5 lines

drivers/remoteproc/qcom_adsp_pil.c line 499

Quoted 2 lines
drivers/remoteproc/qcom_adsp_pil.c new file +2 -0
+module_platform_driver(adsp_pil_driver);
+MODULE_DESCRIPTION("QTi SDM845 ADSP Peripherial Image Loader");

replace QTi/QTI and Peripherial/Peripheral.

ok

Quoted 2 lines

....
Also I see the following warns on stopping the adsp remoteproc, couldn't root cause it though:

It should be issue in Q6 drivers. I will check and update q6 drivers. Thanks for reporting.

Quoted 31 lines
 device_del+0x84/0x29c
 platform_device_del+0x2c/0x88
 platform_device_unregister+0x1c/0x30
 of_platform_device_destroy+0x98/0xa8
 device_for_each_child+0x54/0xa4
 of_platform_depopulate+0x38/0x54
 q6asm_remove+0x1c/0x2c
 apr_device_remove+0x38/0x70
 device_release_driver_internal+0x124/0x1c8
 device_release_driver+0x24/0x30
 bus_remove_device+0xcc/0xe4
 device_del+0x1f8/0x29c
 device_unregister+0x1c/0x30
 apr_remove_device+0x1c/0x2c
 device_for_each_child+0x54/0xa4
 apr_remove+0x28/0x34
 rpmsg_dev_remove+0x48/0x70
 device_release_driver_internal+0x124/0x1c8
 device_release_driver+0x24/0x30
 bus_remove_device+0xcc/0xe4
 device_del+0x1f8/0x29c
 device_unregister+0x1c/0x30
 qcom_glink_remove_device+0x1c/0x2c
 device_for_each_child+0x54/0xa4
 qcom_glink_native_remove+0x54/0x15c
 qcom_glink_smem_unregister+0x1c/0x30
 glink_subdev_stop+0x1c/0x2c [qcom_common]
 rproc_stop+0x40/0xc0
 rproc_shutdown+0x6c/0xc0
 rproc_del+0x28/0xa0
 adsp_remove+0x20/0x5c [qcom_adsp_pil]
Quoted 9 lines
 platform_drv_remove+0x28/0x50
 device_release_driver_internal+0x124/0x1c8
 driver_detach+0x44/0x80
 bus_remove_driver+0x78/0x9c
 driver_unregister+0x34/0x54
 platform_driver_unregister+0x1c/0x28
 cleanup_module+0x14/0x6bc [qcom_adsp_pil]
 SyS_delete_module+0x1c4/0x214

Thanks,
Rohit

#10 lore raw

Re: [PATCH v3 2/2] remoteproc: qcom: Introduce Non-PAS ADSP PIL driver

Quoted 16 lines · Rohit Kumar

Thanks Sibi for reviewing.

Quoted 12 lines · Sibi Sankar

Hi Rohit,

Quoted 8 lines · Rohit kumar

This adds Non PAS ADSP PIL driver for Qualcomm Technologies Inc SoCs.
Added initial support for SDM845 with ADSP bootup and shutdown operation handled from Application Processor SubSystem(APSS).

---

....

...

Quoted 5 lines
Quoted 2 lines

....
Also I see the following warns on stopping the adsp remoteproc, couldn't root cause it though:

It should be issue in Q6 drivers. I will check and update q6 drivers. Thanks for reporting.

Checked this warning. This is a core driver issue fixed with https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/base/core.c?h=next-20180924&id=2ec16150179888b81717d1d3ce84e634f4736af2

Quoted 41 lines
Quoted 31 lines
 device_del+0x84/0x29c
 platform_device_del+0x2c/0x88
 platform_device_unregister+0x1c/0x30
 of_platform_device_destroy+0x98/0xa8
 device_for_each_child+0x54/0xa4
 of_platform_depopulate+0x38/0x54
 q6asm_remove+0x1c/0x2c
 apr_device_remove+0x38/0x70
 device_release_driver_internal+0x124/0x1c8
 device_release_driver+0x24/0x30
 bus_remove_device+0xcc/0xe4
 device_del+0x1f8/0x29c
 device_unregister+0x1c/0x30
 apr_remove_device+0x1c/0x2c
 device_for_each_child+0x54/0xa4
 apr_remove+0x28/0x34
 rpmsg_dev_remove+0x48/0x70
 device_release_driver_internal+0x124/0x1c8
 device_release_driver+0x24/0x30
 bus_remove_device+0xcc/0xe4
 device_del+0x1f8/0x29c
 device_unregister+0x1c/0x30
 qcom_glink_remove_device+0x1c/0x2c
 device_for_each_child+0x54/0xa4
 qcom_glink_native_remove+0x54/0x15c
 qcom_glink_smem_unregister+0x1c/0x30
 glink_subdev_stop+0x1c/0x2c [qcom_common]
 rproc_stop+0x40/0xc0
 rproc_shutdown+0x6c/0xc0
 rproc_del+0x28/0xa0
 adsp_remove+0x20/0x5c [qcom_adsp_pil]
Quoted 9 lines
 platform_drv_remove+0x28/0x50
 device_release_driver_internal+0x124/0x1c8
 driver_detach+0x44/0x80
 bus_remove_driver+0x78/0x9c
 driver_unregister+0x34/0x54
 platform_driver_unregister+0x1c/0x28
 cleanup_module+0x14/0x6bc [qcom_adsp_pil]
 SyS_delete_module+0x1c4/0x214
Quoted 2 lines

Thanks,
Rohit

Thanks

#11 lore raw

Re: [PATCH v3 2/2] remoteproc: qcom: Introduce Non-PAS ADSP PIL driver

Quoted 18 lines · Rohit Kumar
Quoted 16 lines · Rohit Kumar

Thanks Sibi for reviewing.

Quoted 12 lines · Sibi Sankar

Hi Rohit,

Quoted 8 lines · Rohit kumar

This adds Non PAS ADSP PIL driver for Qualcomm Technologies Inc SoCs.
Added initial support for SDM845 with ADSP bootup and shutdown operation handled from Application Processor SubSystem(APSS).

---

....

...

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

....
Also I see the following warns on stopping the adsp remoteproc, couldn't root cause it though:

It should be issue in Q6 drivers. I will check and update q6 drivers. Thanks for reporting.

Checked this warning. This is a core driver issue fixed with
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/base/core.c?h=next-20180924&id=2ec16150179888b81717d1d3ce84e634f4736af2

Thanks for pointing this out.

Quoted 44 lines
Quoted 41 lines
Quoted 31 lines
 device_del+0x84/0x29c
 platform_device_del+0x2c/0x88
 platform_device_unregister+0x1c/0x30
 of_platform_device_destroy+0x98/0xa8
 device_for_each_child+0x54/0xa4
 of_platform_depopulate+0x38/0x54
 q6asm_remove+0x1c/0x2c
 apr_device_remove+0x38/0x70
 device_release_driver_internal+0x124/0x1c8
 device_release_driver+0x24/0x30
 bus_remove_device+0xcc/0xe4
 device_del+0x1f8/0x29c
 device_unregister+0x1c/0x30
 apr_remove_device+0x1c/0x2c
 device_for_each_child+0x54/0xa4
 apr_remove+0x28/0x34
 rpmsg_dev_remove+0x48/0x70
 device_release_driver_internal+0x124/0x1c8
 device_release_driver+0x24/0x30
 bus_remove_device+0xcc/0xe4
 device_del+0x1f8/0x29c
 device_unregister+0x1c/0x30
 qcom_glink_remove_device+0x1c/0x2c
 device_for_each_child+0x54/0xa4
 qcom_glink_native_remove+0x54/0x15c
 qcom_glink_smem_unregister+0x1c/0x30
 glink_subdev_stop+0x1c/0x2c [qcom_common]
 rproc_stop+0x40/0xc0
 rproc_shutdown+0x6c/0xc0
 rproc_del+0x28/0xa0
 adsp_remove+0x20/0x5c [qcom_adsp_pil]
Quoted 9 lines
 platform_drv_remove+0x28/0x50
 device_release_driver_internal+0x124/0x1c8
 driver_detach+0x44/0x80
 bus_remove_driver+0x78/0x9c
 driver_unregister+0x34/0x54
 platform_driver_unregister+0x1c/0x28
 cleanup_module+0x14/0x6bc [qcom_adsp_pil]
 SyS_delete_module+0x1c4/0x214
Quoted 2 lines

Thanks,
Rohit

Thanks

Signature · 3 lines
-- Sibi Sankar --
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project.
#12 lore raw

Re: [PATCH v3 2/2] remoteproc: qcom: Introduce Non-PAS ADSP PIL driver

In reply to Rohit Kumar
Quoted 155 lines · Rohit Kumar

Thanks Sibi for reviewing.

Quoted 11 lines · Sibi Sankar

Hi Rohit,

Quoted 8 lines · Rohit kumar

This adds Non PAS ADSP PIL driver for Qualcomm Technologies Inc SoCs.
Added initial support for SDM845 with ADSP bootup and shutdown operation handled from Application Processor SubSystem(APSS).

---

Quoted 8 lines

....

Quoted 5 lines

+    select QCOM_MDT_LOADER
+    select QCOM_Q6V5_COMMON
+    select QCOM_RPROC_COMMON
+    help
+      Say y here to support the Peripherial Image Loader

replace Peripherial/Peripheral.

sure

Quoted 16 lines

....

Quoted 15 lines
drivers/remoteproc/qcom_adsp_pil.c new file +15 -0
+#include <linux/clk.h>
+#include <linux/firmware.h>
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/delay.h>
+#include <linux/io.h>
+#include <linux/reset.h>
+#include <linux/iopoll.h>
+#include <linux/pm_domain.h>
+#include <linux/pm_runtime.h>
+#include <linux/regmap.h>
+#include <linux/mfd/syscon.h>
+#include <linux/of_address.h>
+#include <linux/of_device.h>
Quoted 9 lines

drivers/remoteproc/qcom_adsp_pil.c line 27

Quoted 6 lines
drivers/remoteproc/qcom_adsp_pil.c new file +6 -0
+#include <linux/platform_device.h>
+#include <linux/remoteproc.h>
+#include <linux/soc/qcom/mdt_loader.h>
+#include <linux/soc/qcom/smem.h>
+#include <linux/soc/qcom/smem_state.h>
+

The headers should be in alphabetical order.

ok, will do

Quoted 8 lines

....

Quoted 5 lines

+    struct reset_control *pdc_sync_reset;
+    struct reset_control *cc_lpass_restart;
+
+    struct regmap *halt_map;
+    unsigned int  halt_lpass;

remove the double spaces above.

ok

Quoted 10 lines

....

drivers/remoteproc/qcom_adsp_pil.c line 126

Quoted 7 lines

+    if (ret || val)
+        goto reset;

drivers/remoteproc/qcom_adsp_pil.c new file +5 -0
+
+    regmap_write(adsp->halt_map,
+            adsp->halt_lpass + LPASS_HALTREQ_REG, 1);
+
+    /*  Wait for halt ACK from QDSP6 */

Minor nit, please remove the double spaces in the comment above.

ok

Quoted 10 lines
Quoted 9 lines

+    timeout = jiffies + msecs_to_jiffies(ACK_TIMEOUT); +    for (;;) {
+        ret = regmap_read(adsp->halt_map,
+            adsp->halt_lpass + LPASS_HALTACK_REG, &val); +        if (ret || val || time_after(jiffies, timeout)) +            break;
+
+        udelay(1000);

Quoted 2 lines

According to Documentation/timers/timers-howto.txt please use usleep_range() when the delay range is between(10us - 20ms).

okay, will update in next spin.

Quoted 10 lines
Quoted 5 lines

+    }
+
+    ret = regmap_read(adsp->halt_map,
+            adsp->halt_lpass + LPASS_MASTER_IDLE_REG, &val);

....

Quoted 2 lines

+    /* wait after asserting subsystem restart from AOSS */ +    udelay(200);

ditto

ok

Quoted 19 lines
Quoted 12 lines

+
+    /* Clear the halt request for the AXIM and AHBM for Q6 */ +    regmap_write(adsp->halt_map, adsp->halt_lpass + LPASS_HALTREQ_REG, 0);
+
+    /* De-assert the LPASS PDC Reset */
+    reset_control_deassert(adsp->pdc_sync_reset);
+    /* Remove the LPASS reset */
+    reset_control_deassert(adsp->cc_lpass_restart); +    /* wait after de-asserting subsystem restart from AOSS */ +    udelay(200);

ditto

Quoted 3 lines
drivers/remoteproc/qcom_adsp_pil.c new file +3 -0
+
+    return 0;
+}

....

Quoted 14 lines

drivers/remoteproc/qcom_adsp_pil.c line 182

Quoted 11 lines
drivers/remoteproc/qcom_adsp_pil.c new file +11 -0
+static int adsp_start(struct rproc *rproc)
+{
+    struct qcom_adsp *adsp = (struct qcom_adsp *)rproc->priv;
+    int ret;
+    unsigned int val;
+
+    qcom_q6v5_prepare(&adsp->q6v5);
+
+    ret = clk_prepare_enable(adsp->xo);
+    if (ret)
+        return ret;

please call qcom_q6v5_unprepare on clk_prepare_enable failure to disable_irqs

sure, will do that

Quoted 7 lines
Quoted 6 lines
drivers/remoteproc/qcom_adsp_pil.c new file +6 -0
+
+    dev_pm_genpd_set_performance_state(adsp->dev, INT_MAX);
+    ret = pm_runtime_get_sync(adsp->dev);
+    if (ret)
+        goto disable_xo_clk;
+

....

Quoted 12 lines
Quoted 9 lines
drivers/remoteproc/qcom_adsp_pil.c new file +3 -0
+static int adsp_init_reset(struct qcom_adsp *adsp)
+{
+    adsp->pdc_sync_reset = 

devm_reset_control_get_exclusive(adsp->dev,
+            "pdc_sync");
+    if (IS_ERR(adsp->pdc_sync_reset)) {
+        dev_err(adsp->dev, "failed to acquire pdc_sync reset\n"); +        return PTR_ERR(adsp->pdc_sync_reset);
+    }

Bjorn, should we return EPROBE_DEFER here since PDC global reset controller can be a module?

Quoted 4 lines

devm_reset_control_get_exclusive itself returns EPROBE_DEFER until PDC reset driver is probed.
return PTR_ERR(adsp->pdc_sync_reset) handles this case.

Thanks for pointing this out, missed this.

Quoted 109 lines
Quoted 11 lines
Quoted 10 lines

+
+    adsp->cc_lpass_restart = devm_reset_control_get_exclusive(adsp->dev,
+            "cc_lpass");
+    if (IS_ERR(adsp->cc_lpass_restart)) {
+        dev_err(adsp->dev, "failed to acquire cc_lpass restart\n"); +        return PTR_ERR(adsp->cc_lpass_restart);
+    }
+
+    return 0;

....

Quoted 17 lines

drivers/remoteproc/qcom_adsp_pil.c line 470

Quoted 12 lines
drivers/remoteproc/qcom_adsp_pil.c new file +12 -0
+static int adsp_remove(struct platform_device *pdev)
+{
+    struct qcom_adsp *adsp = platform_get_drvdata(pdev);
+
+    rproc_del(adsp->rproc);
+
+    qcom_remove_glink_subdev(adsp->rproc, &adsp->glink_subdev);
+    qcom_remove_sysmon_subdev(adsp->sysmon);
+    qcom_remove_ssr_subdev(adsp->rproc, &adsp->ssr_subdev);
+    rproc_free(adsp->rproc);
+    pm_runtime_disable(adsp->dev);
+

rmmod of the driver resulted in the following kernel panic:
having a pm_runtime_disable after rproc_free seems to be the cause of the kernel panic. Please call pm_runtime_disable before rproc_free.

Thanks for pointing out, will update.

Quoted 24 lines
do_raw_spin_lock+0x28/0x118
__raw_spin_lock_irq+0x30/0x3c
__pm_runtime_disable+0x28/0xf4
adsp_remove+0x4c/0x5c [qcom_adsp_pil]
platform_drv_remove+0x28/0x50
device_release_driver_internal+0x124/0x1c8
driver_detach+0x44/0x80
bus_remove_driver+0x78/0x9c
driver_unregister+0x34/0x54
platform_driver_unregister+0x1c/0x28
cleanup_module+0x14/0x6bc [qcom_adsp_pil]
SyS_delete_module+0x1c4/0x214
Quoted 10 lines

+    return 0;

drivers/remoteproc/qcom_adsp_pil.c new file +9 -0
+}
+
+static const struct adsp_pil_data adsp_resource_init = {
+    .crash_reason_smem = 423,
+    .firmware_name = "adsp.mdt",
+    .ssr_name = "lpass",
+    .sysmon_name = "adsp",
+    .ssctl_id = 0x14,
+};

....

Quoted 5 lines

drivers/remoteproc/qcom_adsp_pil.c line 499

Quoted 2 lines
drivers/remoteproc/qcom_adsp_pil.c new file +2 -0
+module_platform_driver(adsp_pil_driver);
+MODULE_DESCRIPTION("QTi SDM845 ADSP Peripherial Image Loader");

replace QTi/QTI and Peripherial/Peripheral.

ok

Quoted 2 lines

....
Also I see the following warns on stopping the adsp remoteproc, couldn't root cause it though:

It should be issue in Q6 drivers. I will check and update q6 drivers. Thanks for reporting.

Quoted 31 lines
 device_del+0x84/0x29c
 platform_device_del+0x2c/0x88
 platform_device_unregister+0x1c/0x30
 of_platform_device_destroy+0x98/0xa8
 device_for_each_child+0x54/0xa4
 of_platform_depopulate+0x38/0x54
 q6asm_remove+0x1c/0x2c
 apr_device_remove+0x38/0x70
 device_release_driver_internal+0x124/0x1c8
 device_release_driver+0x24/0x30
 bus_remove_device+0xcc/0xe4
 device_del+0x1f8/0x29c
 device_unregister+0x1c/0x30
 apr_remove_device+0x1c/0x2c
 device_for_each_child+0x54/0xa4
 apr_remove+0x28/0x34
 rpmsg_dev_remove+0x48/0x70
 device_release_driver_internal+0x124/0x1c8
 device_release_driver+0x24/0x30
 bus_remove_device+0xcc/0xe4
 device_del+0x1f8/0x29c
 device_unregister+0x1c/0x30
 qcom_glink_remove_device+0x1c/0x2c
 device_for_each_child+0x54/0xa4
 qcom_glink_native_remove+0x54/0x15c
 qcom_glink_smem_unregister+0x1c/0x30
 glink_subdev_stop+0x1c/0x2c [qcom_common]
 rproc_stop+0x40/0xc0
 rproc_shutdown+0x6c/0xc0
 rproc_del+0x28/0xa0
 adsp_remove+0x20/0x5c [qcom_adsp_pil]
Quoted 9 lines
 platform_drv_remove+0x28/0x50
 device_release_driver_internal+0x124/0x1c8
 driver_detach+0x44/0x80
 bus_remove_driver+0x78/0x9c
 driver_unregister+0x34/0x54
 platform_driver_unregister+0x1c/0x28
 cleanup_module+0x14/0x6bc [qcom_adsp_pil]
 SyS_delete_module+0x1c4/0x214

Thanks,
Rohit

Signature · 3 lines
-- Sibi Sankar --
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project.