All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Qualcomm QCS404 Compute DSP loader
@ 2019-03-07  0:03 Bjorn Andersson
  2019-03-07  0:03 ` [PATCH 1/2] dt-bindings: remoteproc: Rename and amend Hexagon v56 binding Bjorn Andersson
  2019-03-07  0:03 ` [PATCH 2/2] remoteproc: qcom: qdsp6-adsp: Add support for QCS404 CDSP Bjorn Andersson
  0 siblings, 2 replies; 4+ messages in thread
From: Bjorn Andersson @ 2019-03-07  0:03 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Bjorn Andersson
  Cc: Rob Herring, Mark Rutland, linux-arm-msm, linux-remoteproc,
	devicetree, linux-kernel

Remoteproc support for booting the Compute DSP on QCS404, without TrustZone
support.

Bjorn Andersson (2):
  dt-bindings: remoteproc: Rename and amend Hexagon v56 binding
  remoteproc: qcom: qdsp6-adsp: Add support for QCS404 CDSP

 ...qcom,adsp-pil.txt => qcom,hexagon-v56.txt} | 34 ++++++---
 drivers/remoteproc/qcom_q6v5_adsp.c           | 73 ++++++++++++++-----
 2 files changed, 79 insertions(+), 28 deletions(-)
 rename Documentation/devicetree/bindings/remoteproc/{qcom,adsp-pil.txt => qcom,hexagon-v56.txt} (74%)

-- 
2.18.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] dt-bindings: remoteproc: Rename and amend Hexagon v56 binding
  2019-03-07  0:03 [PATCH 0/2] Qualcomm QCS404 Compute DSP loader Bjorn Andersson
@ 2019-03-07  0:03 ` Bjorn Andersson
  2019-03-27 23:45   ` Rob Herring
  2019-03-07  0:03 ` [PATCH 2/2] remoteproc: qcom: qdsp6-adsp: Add support for QCS404 CDSP Bjorn Andersson
  1 sibling, 1 reply; 4+ messages in thread
From: Bjorn Andersson @ 2019-03-07  0:03 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Bjorn Andersson, Rob Herring, Mark Rutland
  Cc: linux-arm-msm, linux-remoteproc, devicetree, linux-kernel

The SDM845 Audio DSP peripheral image loader binding describes the
properties needed to load and boot firmware on a Hexagon v56. Rename the
file and add the Compute DSP (CDSP) found in QCS404 to the binding.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
 ...qcom,adsp-pil.txt => qcom,hexagon-v56.txt} | 34 +++++++++++++------
 1 file changed, 24 insertions(+), 10 deletions(-)
 rename Documentation/devicetree/bindings/remoteproc/{qcom,adsp-pil.txt => qcom,hexagon-v56.txt} (74%)

diff --git a/Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt b/Documentation/devicetree/bindings/remoteproc/qcom,hexagon-v56.txt
similarity index 74%
rename from Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt
rename to Documentation/devicetree/bindings/remoteproc/qcom,hexagon-v56.txt
index 66af2c30944f..8011f88f7c1f 100644
--- a/Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt
+++ b/Documentation/devicetree/bindings/remoteproc/qcom,hexagon-v56.txt
@@ -1,12 +1,13 @@
-Qualcomm Technology Inc. ADSP Peripheral Image Loader
+Qualcomm Technology Inc. Hexagon v56 Peripheral Image Loader
 
 This document defines the binding for a component that loads and boots firmware
-on the Qualcomm Technology Inc. ADSP Hexagon core.
+on the Qualcomm Technology Inc. Hexagon v56 core.
 
 - compatible:
 	Usage: required
 	Value type: <string>
 	Definition: must be one of:
+		    "qcom,qcs404-cdsp-pil",
 		    "qcom,sdm845-adsp-pil"
 
 - reg:
@@ -28,10 +29,10 @@ on the Qualcomm Technology Inc. ADSP Hexagon core.
 - clocks:
 	Usage: required
 	Value type: <prop-encoded-array>
-	Definition:  List of 8 phandle and clock specifier pairs for the adsp.
+	Definition:  List of phandles and clock specifier pairs for the Hexagon.
 
 - clock-names:
-	Usage: required
+	Usage: required for SDM845 ADSP
 	Value type: <stringlist>
 	Definition: List of clock input name strings sorted in the same
 		    order as the clocks property. Definition must have
@@ -39,6 +40,14 @@ on the Qualcomm Technology Inc. ADSP Hexagon core.
 		    "lpass_ahbm_aon_cbcr", "qdsp6ss_xo", "qdsp6ss_sleep"
 		    and "qdsp6ss_core".
 
+- clock-names:
+	Usage: required for QCS404 CDSP
+	Value type: <stringlist>
+	Definition: List of clock input name strings sorted in the same
+		    order as the clocks property. Definition must have
+		    "xo", "sway", "tbu", "bimc", "ahb_aon", "q6ss_slave",
+		    "q6ss_master", "q6_axim".
+
 - power-domains:
 	Usage: required
 	Value type: <phandle>
@@ -47,28 +56,33 @@ on the Qualcomm Technology Inc. ADSP Hexagon core.
 - resets:
 	Usage: required
 	Value type: <phandle>
-	Definition: reference to the list of 2 reset-controller for the adsp.
+	Definition: reference to the list of resets for the Hexagon.
 
 - reset-names:
-        Usage: required
+        Usage: required for SDM845 ADSP
         Value type: <stringlist>
         Definition: must be "pdc_sync" and "cc_lpass"
 
+- reset-names:
+        Usage: required for QCS404 CDSP
+        Value type: <stringlist>
+        Definition: must be "restart"
+
 - 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.
+		    by the offset within syscon for Hexagon halt register.
 
 - memory-region:
 	Usage: required
 	Value type: <phandle>
-	Definition: reference to the reserved-memory for the ADSP
+	Definition: reference to the reserved-memory for the firmware
 
 - qcom,smem-states:
 	Usage: required
 	Value type: <phandle>
-	Definition: reference to the smem state for requesting the ADSP to
+	Definition: reference to the smem state for requesting the Hexagon to
 		    shut down
 
 - qcom,smem-state-names:
@@ -79,7 +93,7 @@ on the Qualcomm Technology Inc. ADSP Hexagon core.
 
 = SUBNODES
 The adsp node may have an subnode named "glink-edge" that describes the
-communication edge, channels and devices related to the ADSP.
+communication edge, channels and devices related to the Hexagon.
 See ../soc/qcom/qcom,glink.txt for details on how to describe these.
 
 = EXAMPLE
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] remoteproc: qcom: qdsp6-adsp: Add support for QCS404 CDSP
  2019-03-07  0:03 [PATCH 0/2] Qualcomm QCS404 Compute DSP loader Bjorn Andersson
  2019-03-07  0:03 ` [PATCH 1/2] dt-bindings: remoteproc: Rename and amend Hexagon v56 binding Bjorn Andersson
@ 2019-03-07  0:03 ` Bjorn Andersson
  1 sibling, 0 replies; 4+ messages in thread
From: Bjorn Andersson @ 2019-03-07  0:03 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Bjorn Andersson
  Cc: Rob Herring, Mark Rutland, linux-arm-msm, linux-remoteproc,
	devicetree, linux-kernel

Move the clock list to adsp_pil_data, make the pdc_reset optional and
make the driver directly enable the xo, sleep and core clocks.

The three clocks are previously toggled through the clock controller,
but that means the same hardware block needs to be mapped in both
drivers. Making the remoteproc driver enable the clocks is a nop when
using the clock controller, but allow us to remove the clocks from the
clock controller.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
 drivers/remoteproc/qcom_q6v5_adsp.c | 73 ++++++++++++++++++++++-------
 1 file changed, 55 insertions(+), 18 deletions(-)

diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c
index 1f3ef9ee493c..e953886b2eb7 100644
--- a/drivers/remoteproc/qcom_q6v5_adsp.c
+++ b/drivers/remoteproc/qcom_q6v5_adsp.c
@@ -46,11 +46,9 @@
 #define LPASS_PWR_ON_REG		0x10
 #define LPASS_HALTREQ_REG		0x0
 
-/* list of clocks required by ADSP PIL */
-static const char * const adsp_clk_id[] = {
-	"sway_cbcr", "lpass_ahbs_aon_cbcr", "lpass_ahbm_aon_cbcr",
-	"qdsp6ss_xo", "qdsp6ss_sleep", "qdsp6ss_core",
-};
+#define QDSP6SS_XO_CBCR		0x38
+#define QDSP6SS_CORE_CBCR	0x20
+#define QDSP6SS_SLEEP_CBCR	0x3c
 
 struct adsp_pil_data {
 	int crash_reason_smem;
@@ -59,6 +57,9 @@ struct adsp_pil_data {
 	const char *ssr_name;
 	const char *sysmon_name;
 	int ssctl_id;
+
+	const char **clk_ids;
+	int num_clks;
 };
 
 struct qcom_adsp {
@@ -75,7 +76,7 @@ struct qcom_adsp {
 	void __iomem *qdsp6ss_base;
 
 	struct reset_control *pdc_sync_reset;
-	struct reset_control *cc_lpass_restart;
+	struct reset_control *restart;
 
 	struct regmap *halt_map;
 	unsigned int halt_lpass;
@@ -143,7 +144,7 @@ static int qcom_adsp_shutdown(struct qcom_adsp *adsp)
 	/* Assert the LPASS PDC Reset */
 	reset_control_assert(adsp->pdc_sync_reset);
 	/* Place the LPASS processor into reset */
-	reset_control_assert(adsp->cc_lpass_restart);
+	reset_control_assert(adsp->restart);
 	/* wait after asserting subsystem restart from AOSS */
 	usleep_range(200, 300);
 
@@ -153,7 +154,7 @@ static int qcom_adsp_shutdown(struct qcom_adsp *adsp)
 	/* De-assert the LPASS PDC Reset */
 	reset_control_deassert(adsp->pdc_sync_reset);
 	/* Remove the LPASS reset */
-	reset_control_deassert(adsp->cc_lpass_restart);
+	reset_control_deassert(adsp->restart);
 	/* wait after de-asserting subsystem restart from AOSS */
 	usleep_range(200, 300);
 
@@ -192,6 +193,15 @@ static int adsp_start(struct rproc *rproc)
 		goto disable_power_domain;
 	}
 
+	/* Enable the XO clock */
+	writel(1, adsp->qdsp6ss_base + QDSP6SS_XO_CBCR);
+
+	/* Enable the QDSP6SS sleep clock */
+	writel(1, adsp->qdsp6ss_base + QDSP6SS_SLEEP_CBCR);
+
+	/* Enable the QDSP6 core clock */
+	writel(1, adsp->qdsp6ss_base + QDSP6SS_CORE_CBCR);
+
 	/* Program boot address */
 	writel(adsp->mem_phys >> 4, adsp->qdsp6ss_base + RST_EVB_REG);
 
@@ -280,8 +290,9 @@ static const struct rproc_ops adsp_ops = {
 	.load = adsp_load,
 };
 
-static int adsp_init_clock(struct qcom_adsp *adsp)
+static int adsp_init_clock(struct qcom_adsp *adsp, const char **clk_ids)
 {
+	int num_clks = 0;
 	int i, ret;
 
 	adsp->xo = devm_clk_get(adsp->dev, "xo");
@@ -292,32 +303,39 @@ static int adsp_init_clock(struct qcom_adsp *adsp)
 		return ret;
 	}
 
-	adsp->num_clks = ARRAY_SIZE(adsp_clk_id);
+	for (i = 0; clk_ids[i]; i++)
+		num_clks++;
+
+	adsp->num_clks = num_clks;
 	adsp->clks = devm_kcalloc(adsp->dev, adsp->num_clks,
 				sizeof(*adsp->clks), GFP_KERNEL);
 	if (!adsp->clks)
 		return -ENOMEM;
 
 	for (i = 0; i < adsp->num_clks; i++)
-		adsp->clks[i].id = adsp_clk_id[i];
+		adsp->clks[i].id = clk_ids[i];
 
 	return devm_clk_bulk_get(adsp->dev, adsp->num_clks, adsp->clks);
 }
 
 static int adsp_init_reset(struct qcom_adsp *adsp)
 {
-	adsp->pdc_sync_reset = devm_reset_control_get_exclusive(adsp->dev,
+	adsp->pdc_sync_reset = devm_reset_control_get_optional_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);
 	}
 
-	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);
+	adsp->restart = devm_reset_control_get_optional_exclusive(adsp->dev, "restart");
+
+	/* Fall back to the  old "cc_lpass" if "restart" is absent */
+	if (!adsp->restart)
+		adsp->restart = devm_reset_control_get_exclusive(adsp->dev, "cc_lpass");
+
+	if (IS_ERR(adsp->restart)) {
+		dev_err(adsp->dev, "failed to acquire restart\n");
+		return PTR_ERR(adsp->restart);
 	}
 
 	return 0;
@@ -415,7 +433,7 @@ static int adsp_probe(struct platform_device *pdev)
 	if (ret)
 		goto free_rproc;
 
-	ret = adsp_init_clock(adsp);
+	ret = adsp_init_clock(adsp, desc->clk_ids);
 	if (ret)
 		goto free_rproc;
 
@@ -479,9 +497,28 @@ static const struct adsp_pil_data adsp_resource_init = {
 	.ssr_name = "lpass",
 	.sysmon_name = "adsp",
 	.ssctl_id = 0x14,
+	.clk_ids = (const char*[]) {
+		"sway_cbcr", "lpass_ahbs_aon_cbcr", "lpass_ahbm_aon_cbcr",
+		"qdsp6ss_xo", "qdsp6ss_sleep", "qdsp6ss_core", NULL
+	},
+	.num_clks = 7,
+};
+
+static const struct adsp_pil_data cdsp_resource_init = {
+	.crash_reason_smem = 601,
+	.firmware_name = "cdsp.mdt",
+	.ssr_name = "cdsp",
+	.sysmon_name = "cdsp",
+	.ssctl_id = 0x17,
+	.clk_ids = (const char*[]) {
+		"sway", "tbu", "bimc", "ahb_aon", "q6ss_slave", "q6ss_master",
+		"q6_axim", NULL
+	},
+	.num_clks = 7,
 };
 
 static const struct of_device_id adsp_of_match[] = {
+	{ .compatible = "qcom,qcs404-cdsp-pil", .data = &cdsp_resource_init },
 	{ .compatible = "qcom,sdm845-adsp-pil", .data = &adsp_resource_init },
 	{ },
 };
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] dt-bindings: remoteproc: Rename and amend Hexagon v56 binding
  2019-03-07  0:03 ` [PATCH 1/2] dt-bindings: remoteproc: Rename and amend Hexagon v56 binding Bjorn Andersson
@ 2019-03-27 23:45   ` Rob Herring
  0 siblings, 0 replies; 4+ messages in thread
From: Rob Herring @ 2019-03-27 23:45 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Ohad Ben-Cohen, Mark Rutland, linux-arm-msm, linux-remoteproc,
	devicetree, linux-kernel

On Wed, Mar 06, 2019 at 04:03:17PM -0800, Bjorn Andersson wrote:
> The SDM845 Audio DSP peripheral image loader binding describes the
> properties needed to load and boot firmware on a Hexagon v56. Rename the
> file and add the Compute DSP (CDSP) found in QCS404 to the binding.
> 
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---
>  ...qcom,adsp-pil.txt => qcom,hexagon-v56.txt} | 34 +++++++++++++------
>  1 file changed, 24 insertions(+), 10 deletions(-)
>  rename Documentation/devicetree/bindings/remoteproc/{qcom,adsp-pil.txt => qcom,hexagon-v56.txt} (74%)
> 
> diff --git a/Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt b/Documentation/devicetree/bindings/remoteproc/qcom,hexagon-v56.txt
> similarity index 74%
> rename from Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt
> rename to Documentation/devicetree/bindings/remoteproc/qcom,hexagon-v56.txt
> index 66af2c30944f..8011f88f7c1f 100644
> --- a/Documentation/devicetree/bindings/remoteproc/qcom,adsp-pil.txt
> +++ b/Documentation/devicetree/bindings/remoteproc/qcom,hexagon-v56.txt
> @@ -1,12 +1,13 @@
> -Qualcomm Technology Inc. ADSP Peripheral Image Loader
> +Qualcomm Technology Inc. Hexagon v56 Peripheral Image Loader
>  
>  This document defines the binding for a component that loads and boots firmware
> -on the Qualcomm Technology Inc. ADSP Hexagon core.
> +on the Qualcomm Technology Inc. Hexagon v56 core.
>  
>  - compatible:
>  	Usage: required
>  	Value type: <string>
>  	Definition: must be one of:
> +		    "qcom,qcs404-cdsp-pil",
>  		    "qcom,sdm845-adsp-pil"
>  
>  - reg:
> @@ -28,10 +29,10 @@ on the Qualcomm Technology Inc. ADSP Hexagon core.
>  - clocks:
>  	Usage: required
>  	Value type: <prop-encoded-array>
> -	Definition:  List of 8 phandle and clock specifier pairs for the adsp.
> +	Definition:  List of phandles and clock specifier pairs for the Hexagon.

Would be nice to keep some range of what is valid.

>  
>  - clock-names:
> -	Usage: required
> +	Usage: required for SDM845 ADSP
>  	Value type: <stringlist>
>  	Definition: List of clock input name strings sorted in the same
>  		    order as the clocks property. Definition must have
> @@ -39,6 +40,14 @@ on the Qualcomm Technology Inc. ADSP Hexagon core.
>  		    "lpass_ahbm_aon_cbcr", "qdsp6ss_xo", "qdsp6ss_sleep"
>  		    and "qdsp6ss_core".
>  
> +- clock-names:
> +	Usage: required for QCS404 CDSP
> +	Value type: <stringlist>
> +	Definition: List of clock input name strings sorted in the same
> +		    order as the clocks property. Definition must have
> +		    "xo", "sway", "tbu", "bimc", "ahb_aon", "q6ss_slave",
> +		    "q6ss_master", "q6_axim".
> +
>  - power-domains:
>  	Usage: required
>  	Value type: <phandle>
> @@ -47,28 +56,33 @@ on the Qualcomm Technology Inc. ADSP Hexagon core.
>  - resets:
>  	Usage: required
>  	Value type: <phandle>
> -	Definition: reference to the list of 2 reset-controller for the adsp.
> +	Definition: reference to the list of resets for the Hexagon.
>  
>  - reset-names:
> -        Usage: required
> +        Usage: required for SDM845 ADSP
>          Value type: <stringlist>
>          Definition: must be "pdc_sync" and "cc_lpass"
>  
> +- reset-names:
> +        Usage: required for QCS404 CDSP
> +        Value type: <stringlist>
> +        Definition: must be "restart"
> +
>  - 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.
> +		    by the offset within syscon for Hexagon halt register.
>  
>  - memory-region:
>  	Usage: required
>  	Value type: <phandle>
> -	Definition: reference to the reserved-memory for the ADSP
> +	Definition: reference to the reserved-memory for the firmware
>  
>  - qcom,smem-states:
>  	Usage: required
>  	Value type: <phandle>
> -	Definition: reference to the smem state for requesting the ADSP to
> +	Definition: reference to the smem state for requesting the Hexagon to
>  		    shut down
>  
>  - qcom,smem-state-names:
> @@ -79,7 +93,7 @@ on the Qualcomm Technology Inc. ADSP Hexagon core.
>  
>  = SUBNODES
>  The adsp node may have an subnode named "glink-edge" that describes the
> -communication edge, channels and devices related to the ADSP.
> +communication edge, channels and devices related to the Hexagon.
>  See ../soc/qcom/qcom,glink.txt for details on how to describe these.
>  
>  = EXAMPLE
> -- 
> 2.18.0
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-03-27 23:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-07  0:03 [PATCH 0/2] Qualcomm QCS404 Compute DSP loader Bjorn Andersson
2019-03-07  0:03 ` [PATCH 1/2] dt-bindings: remoteproc: Rename and amend Hexagon v56 binding Bjorn Andersson
2019-03-27 23:45   ` Rob Herring
2019-03-07  0:03 ` [PATCH 2/2] remoteproc: qcom: qdsp6-adsp: Add support for QCS404 CDSP Bjorn Andersson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.