All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/4]remoteproc: qcom: Add support for  Qualcomm low pass sensor peripheral loader.
@ 2017-01-30 15:03 Avaneesh Kumar Dwivedi
  2017-01-30 15:03 ` [PATCH v3 1/4] remoteproc: qcom: Compatible string based resource initialization Avaneesh Kumar Dwivedi
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Avaneesh Kumar Dwivedi @ 2017-01-30 15:03 UTC (permalink / raw)
  To: bjorn.andersson
  Cc: sboyd, agross, linux-arm-msm, linux-kernel, linux-remoteproc,
	Avaneesh Kumar Dwivedi

This patchset has changed from last patchset in below respect
	1- Generic regulator and clock resource handling is dropped.
	2- Introdused additional px supply and aggre2 clock initialization.
	3- Add SLPI boot support in existing ADSP driver.
	4- Address other minor comments on patchset 2.

Avaneesh Kumar Dwivedi (4):
  remoteproc: qcom: Compatible string based resource initialization.
  remoteproc: qcom: Add additional agree2_clk and px regulator resource.
  remoteproc: qcom: Add SLPI rproc support to load and boot slpi proc.
  arm64: dts: msm8996: Add SLPI SMP2P dt node.

 .../devicetree/bindings/remoteproc/qcom,adsp.txt   |  28 ++++++
 arch/arm64/boot/dts/qcom/msm8996.dtsi              |  24 +++++
 drivers/remoteproc/qcom_adsp_pil.c                 | 100 ++++++++++++++++-----
 3 files changed, 130 insertions(+), 22 deletions(-)

-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.

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

* [PATCH v3 1/4] remoteproc: qcom: Compatible string based resource initialization.
  2017-01-30 15:03 [PATCH v3 0/4]remoteproc: qcom: Add support for Qualcomm low pass sensor peripheral loader Avaneesh Kumar Dwivedi
@ 2017-01-30 15:03 ` Avaneesh Kumar Dwivedi
  2017-01-30 21:45   ` Bjorn Andersson
  2017-01-30 15:03 ` [PATCH v3 2/4] remoteproc: qcom: Add additional agree2_clk and px regulator resource Avaneesh Kumar Dwivedi
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Avaneesh Kumar Dwivedi @ 2017-01-30 15:03 UTC (permalink / raw)
  To: bjorn.andersson
  Cc: sboyd, agross, linux-arm-msm, linux-kernel, linux-remoteproc,
	Avaneesh Kumar Dwivedi

This patch initialize certain driver related data based on compatible
string. This enable driver to handle more than one similar device in
by differentiating in probe their private data.

Signed-off-by: Avaneesh Kumar Dwivedi <akdwived@codeaurora.org>
---
 drivers/remoteproc/qcom_adsp_pil.c | 47 ++++++++++++++++++++++++++------------
 1 file changed, 33 insertions(+), 14 deletions(-)

diff --git a/drivers/remoteproc/qcom_adsp_pil.c b/drivers/remoteproc/qcom_adsp_pil.c
index 43a4ed2..f674301 100644
--- a/drivers/remoteproc/qcom_adsp_pil.c
+++ b/drivers/remoteproc/qcom_adsp_pil.c
@@ -32,9 +32,12 @@
 #include "qcom_mdt_loader.h"
 #include "remoteproc_internal.h"
 
-#define ADSP_CRASH_REASON_SMEM		423
-#define ADSP_FIRMWARE_NAME		"adsp.mdt"
-#define ADSP_PAS_ID			1
+struct adsp_data {
+	int crash_reason_smem;
+	const char *firmware_name;
+	int pas_id;
+};
+
 
 struct qcom_adsp {
 	struct device *dev;
@@ -53,6 +56,9 @@ struct qcom_adsp {
 
 	struct regulator *cx_supply;
 
+	int pas_id;
+	int crash_reason_smem;
+
 	struct completion start_done;
 	struct completion stop_done;
 
@@ -70,7 +76,7 @@ static int adsp_load(struct rproc *rproc, const struct firmware *fw)
 	bool relocate;
 	int ret;
 
-	ret = qcom_scm_pas_init_image(ADSP_PAS_ID, fw->data, fw->size);
+	ret = qcom_scm_pas_init_image(adsp->pas_id, fw->data, fw->size);
 	if (ret) {
 		dev_err(&rproc->dev, "invalid firmware metadata\n");
 		return ret;
@@ -85,7 +91,8 @@ static int adsp_load(struct rproc *rproc, const struct firmware *fw)
 	if (relocate) {
 		adsp->mem_reloc = fw_addr;
 
-		ret = qcom_scm_pas_mem_setup(ADSP_PAS_ID, adsp->mem_phys, fw_size);
+		ret = qcom_scm_pas_mem_setup(adsp->pas_id,
+					adsp->mem_phys, fw_size);
 		if (ret) {
 			dev_err(&rproc->dev, "unable to setup memory for image\n");
 			return ret;
@@ -113,7 +120,7 @@ static int adsp_start(struct rproc *rproc)
 	if (ret)
 		goto disable_clocks;
 
-	ret = qcom_scm_pas_auth_and_reset(ADSP_PAS_ID);
+	ret = qcom_scm_pas_auth_and_reset(adsp->pas_id);
 	if (ret) {
 		dev_err(adsp->dev,
 			"failed to authenticate image and release reset\n");
@@ -124,7 +131,7 @@ static int adsp_start(struct rproc *rproc)
 					  msecs_to_jiffies(5000));
 	if (!ret) {
 		dev_err(adsp->dev, "start timed out\n");
-		qcom_scm_pas_shutdown(ADSP_PAS_ID);
+		qcom_scm_pas_shutdown(adsp->pas_id);
 		ret = -ETIMEDOUT;
 		goto disable_regulators;
 	}
@@ -157,7 +164,7 @@ static int adsp_stop(struct rproc *rproc)
 				    BIT(adsp->stop_bit),
 				    0);
 
-	ret = qcom_scm_pas_shutdown(ADSP_PAS_ID);
+	ret = qcom_scm_pas_shutdown(adsp->pas_id);
 	if (ret)
 		dev_err(adsp->dev, "failed to shutdown: %d\n", ret);
 
@@ -197,7 +204,7 @@ static irqreturn_t adsp_fatal_interrupt(int irq, void *dev)
 	size_t len;
 	char *msg;
 
-	msg = qcom_smem_get(QCOM_SMEM_HOST_ANY, ADSP_CRASH_REASON_SMEM, &len);
+	msg = qcom_smem_get(QCOM_SMEM_HOST_ANY, adsp->crash_reason_smem, &len);
 	if (!IS_ERR(msg) && len > 0 && msg[0])
 		dev_err(adsp->dev, "fatal error received: %s\n", msg);
 
@@ -311,20 +318,25 @@ static int adsp_alloc_memory_region(struct qcom_adsp *adsp)
 
 static int adsp_probe(struct platform_device *pdev)
 {
+	const struct adsp_data *desc;
 	struct qcom_adsp *adsp;
 	struct rproc *rproc;
 	int ret;
 
+	desc = of_device_get_match_data(&pdev->dev);
+	if (!desc)
+		return -EINVAL;
+
 	if (!qcom_scm_is_available())
 		return -EPROBE_DEFER;
 
-	if (!qcom_scm_pas_supported(ADSP_PAS_ID)) {
-		dev_err(&pdev->dev, "PAS is not available for ADSP\n");
+	if (!qcom_scm_pas_supported(desc->pas_id)) {
+		dev_err(&pdev->dev, "PAS is not available for subsystem\n");
 		return -ENXIO;
 	}
 
 	rproc = rproc_alloc(&pdev->dev, pdev->name, &adsp_ops,
-			    ADSP_FIRMWARE_NAME, sizeof(*adsp));
+			    desc->firmware_name, sizeof(*adsp));
 	if (!rproc) {
 		dev_err(&pdev->dev, "unable to allocate remoteproc\n");
 		return -ENOMEM;
@@ -344,6 +356,8 @@ static int adsp_probe(struct platform_device *pdev)
 	if (ret)
 		goto free_rproc;
 
+	adsp->pas_id = desc->pas_id;
+	adsp->crash_reason_smem = desc->crash_reason_smem;
 	ret = adsp_init_clock(adsp);
 	if (ret)
 		goto free_rproc;
@@ -407,9 +421,14 @@ static int adsp_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct adsp_data adsp_resource_init = {
+		.crash_reason_smem = 423,
+		.firmware_name = "adsp.mdt",
+		.pas_id = 1,
+};
 static const struct of_device_id adsp_of_match[] = {
-	{ .compatible = "qcom,msm8974-adsp-pil" },
-	{ .compatible = "qcom,msm8996-adsp-pil" },
+	{ .compatible = "qcom,msm8974-adsp-pil", .data = &adsp_resource_init},
+	{ .compatible = "qcom,msm8996-adsp-pil", .data = &adsp_resource_init},
 	{ },
 };
 MODULE_DEVICE_TABLE(of, adsp_of_match);
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.

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

* [PATCH v3 2/4] remoteproc: qcom: Add additional agree2_clk and px regulator resource.
  2017-01-30 15:03 [PATCH v3 0/4]remoteproc: qcom: Add support for Qualcomm low pass sensor peripheral loader Avaneesh Kumar Dwivedi
  2017-01-30 15:03 ` [PATCH v3 1/4] remoteproc: qcom: Compatible string based resource initialization Avaneesh Kumar Dwivedi
@ 2017-01-30 15:03 ` Avaneesh Kumar Dwivedi
  2017-01-30 21:46   ` Bjorn Andersson
  2017-01-30 15:03 ` [PATCH v3 3/4] remoteproc: qcom: Add SLPI rproc support to load and boot slpi proc Avaneesh Kumar Dwivedi
  2017-01-30 15:03 ` [PATCH v3 4/4] arm64: dts: msm8996: Add SLPI SMP2P dt node Avaneesh Kumar Dwivedi
  3 siblings, 1 reply; 11+ messages in thread
From: Avaneesh Kumar Dwivedi @ 2017-01-30 15:03 UTC (permalink / raw)
  To: bjorn.andersson
  Cc: sboyd, agross, linux-arm-msm, linux-kernel, linux-remoteproc,
	Avaneesh Kumar Dwivedi

This patch add additional clock and regulator resource which are
initialized based on compatible and has no impact on existing driver
working. This resourse addition enable the existing driver to handle.
low pass sensor processor device also.

Signed-off-by: Avaneesh Kumar Dwivedi <akdwived@codeaurora.org>
---
 drivers/remoteproc/qcom_adsp_pil.c | 43 +++++++++++++++++++++++++++++++-------
 1 file changed, 36 insertions(+), 7 deletions(-)

diff --git a/drivers/remoteproc/qcom_adsp_pil.c b/drivers/remoteproc/qcom_adsp_pil.c
index f674301..58cc46d 100644
--- a/drivers/remoteproc/qcom_adsp_pil.c
+++ b/drivers/remoteproc/qcom_adsp_pil.c
@@ -36,6 +36,7 @@ struct adsp_data {
 	int crash_reason_smem;
 	const char *firmware_name;
 	int pas_id;
+	bool has_aggre2_clk;
 };
 
 
@@ -53,11 +54,13 @@ struct qcom_adsp {
 	unsigned stop_bit;
 
 	struct clk *xo;
-
+	struct clk *aggre2_clk;
 	struct regulator *cx_supply;
+	struct regulator *px_supply;
 
 	int pas_id;
 	int crash_reason_smem;
+	bool has_aggre2_clk;
 
 	struct completion start_done;
 	struct completion stop_done;
@@ -115,16 +118,22 @@ static int adsp_start(struct rproc *rproc)
 	ret = clk_prepare_enable(adsp->xo);
 	if (ret)
 		return ret;
+	ret = clk_prepare_enable(adsp->aggre2_clk);
+	if (ret)
+		goto disable_xo_clk;
 
 	ret = regulator_enable(adsp->cx_supply);
 	if (ret)
-		goto disable_clocks;
+		goto disable_aggre2_clk;
+	ret = regulator_enable(adsp->px_supply);
+	if (ret)
+		goto disable_cx_supply;
 
 	ret = qcom_scm_pas_auth_and_reset(adsp->pas_id);
 	if (ret) {
 		dev_err(adsp->dev,
 			"failed to authenticate image and release reset\n");
-		goto disable_regulators;
+		goto disable_px_supply;
 	}
 
 	ret = wait_for_completion_timeout(&adsp->start_done,
@@ -133,14 +142,18 @@ static int adsp_start(struct rproc *rproc)
 		dev_err(adsp->dev, "start timed out\n");
 		qcom_scm_pas_shutdown(adsp->pas_id);
 		ret = -ETIMEDOUT;
-		goto disable_regulators;
+		goto disable_px_supply;
 	}
 
 	ret = 0;
 
-disable_regulators:
+disable_px_supply:
+	regulator_disable(adsp->px_supply);
+disable_cx_supply:
 	regulator_disable(adsp->cx_supply);
-disable_clocks:
+disable_aggre2_clk:
+	clk_disable_unprepare(adsp->aggre2_clk);
+disable_xo_clk:
 	clk_disable_unprepare(adsp->xo);
 
 	return ret;
@@ -251,17 +264,31 @@ static int adsp_init_clock(struct qcom_adsp *adsp)
 		return ret;
 	}
 
+	if (adsp->has_aggre2_clk) {
+		adsp->aggre2_clk = devm_clk_get(adsp->dev, "aggre2");
+		if (IS_ERR(adsp->aggre2_clk)) {
+			ret = PTR_ERR(adsp->aggre2_clk);
+			if (ret != -EPROBE_DEFER)
+				dev_err(adsp->dev,
+					"failed to get aggre2 clock");
+			return ret;
+		}
+	}
+
 	return 0;
 }
 
 static int adsp_init_regulator(struct qcom_adsp *adsp)
 {
-	adsp->cx_supply = devm_regulator_get(adsp->dev, "cx");
+	adsp->cx_supply = devm_regulator_get(adsp->dev, "vdd_cx");
 	if (IS_ERR(adsp->cx_supply))
 		return PTR_ERR(adsp->cx_supply);
 
 	regulator_set_load(adsp->cx_supply, 100000);
 
+	adsp->px_supply = devm_regulator_get(adsp->dev, "vdd_px");
+	if (IS_ERR(adsp->px_supply))
+		return PTR_ERR(adsp->px_supply);
 	return 0;
 }
 
@@ -358,6 +385,7 @@ static int adsp_probe(struct platform_device *pdev)
 
 	adsp->pas_id = desc->pas_id;
 	adsp->crash_reason_smem = desc->crash_reason_smem;
+	adsp->has_aggre2_clk = desc->has_aggre2_clk;
 	ret = adsp_init_clock(adsp);
 	if (ret)
 		goto free_rproc;
@@ -425,6 +453,7 @@ static int adsp_remove(struct platform_device *pdev)
 		.crash_reason_smem = 423,
 		.firmware_name = "adsp.mdt",
 		.pas_id = 1,
+		.has_aggre2_clk = 0,
 };
 static const struct of_device_id adsp_of_match[] = {
 	{ .compatible = "qcom,msm8974-adsp-pil", .data = &adsp_resource_init},
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.

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

* [PATCH v3 3/4] remoteproc: qcom: Add SLPI rproc support to load and boot slpi proc.
  2017-01-30 15:03 [PATCH v3 0/4]remoteproc: qcom: Add support for Qualcomm low pass sensor peripheral loader Avaneesh Kumar Dwivedi
  2017-01-30 15:03 ` [PATCH v3 1/4] remoteproc: qcom: Compatible string based resource initialization Avaneesh Kumar Dwivedi
  2017-01-30 15:03 ` [PATCH v3 2/4] remoteproc: qcom: Add additional agree2_clk and px regulator resource Avaneesh Kumar Dwivedi
@ 2017-01-30 15:03 ` Avaneesh Kumar Dwivedi
  2017-01-30 21:50   ` Bjorn Andersson
  2017-01-30 15:03 ` [PATCH v3 4/4] arm64: dts: msm8996: Add SLPI SMP2P dt node Avaneesh Kumar Dwivedi
  3 siblings, 1 reply; 11+ messages in thread
From: Avaneesh Kumar Dwivedi @ 2017-01-30 15:03 UTC (permalink / raw)
  To: bjorn.andersson
  Cc: sboyd, agross, linux-arm-msm, linux-kernel, linux-remoteproc,
	Avaneesh Kumar Dwivedi

This patch add slpi remoteproc support in existing adsp rproc driver.

Signed-off-by: Avaneesh Kumar Dwivedi <akdwived@codeaurora.org>
---
 .../devicetree/bindings/remoteproc/qcom,adsp.txt   | 28 ++++++++++++++++++++++
 drivers/remoteproc/qcom_adsp_pil.c                 | 10 +++++++-
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/remoteproc/qcom,adsp.txt b/Documentation/devicetree/bindings/remoteproc/qcom,adsp.txt
index b85885a..1fb63b8 100644
--- a/Documentation/devicetree/bindings/remoteproc/qcom,adsp.txt
+++ b/Documentation/devicetree/bindings/remoteproc/qcom,adsp.txt
@@ -9,6 +9,7 @@ on the Qualcomm ADSP Hexagon core.
 	Definition: must be one of:
 		    "qcom,msm8974-adsp-pil"
 		    "qcom,msm8996-adsp-pil"
+			"qcom,msm8996-slpi-pil"
 
 - interrupts-extended:
 	Usage: required
@@ -96,3 +97,30 @@ ADSP, as it is found on MSM8974 boards.
 			qcom,smd-edge = <1>;
 		};
 	};
+
+The following example describes the resources needed to boot control the
+SLPI, as it is found on MSM8996 boards.
+
+	slpi {
+		compatible = "qcom,msm8996-slpi-pil";
+		interrupts-extended = <&intc 0 390 IRQ_TYPE_EDGE_RISING>,
+				<&slpi_smp2p_in 0 IRQ_TYPE_EDGE_RISING>,
+				<&slpi_smp2p_in 1 IRQ_TYPE_EDGE_RISING>,
+				<&slpi_smp2p_in 2 IRQ_TYPE_EDGE_RISING>,
+				<&slpi_smp2p_in 3 IRQ_TYPE_EDGE_RISING>;
+		interrupt-names = "wdog",
+				"fatal",
+				"ready",
+				"handover",
+				"stop-ack";
+
+		clocks = <&rpmcc MSM8996_RPM_SMD_XO_CLK_SRC>,
+			<&rpmcc MSM8996_RPM_SMD_AGGR2_NOC_CLK>;
+		clock-names = "xo",
+			"aggre2";
+		vdd_cx-supply = <&pm8994_l26_corner>;
+		vdd_px-supply = <&pm8994_lvs2>;
+		memory-region = <&slpi_region>;
+		qcom,smem-states = <&slpi_smp2p_out 0>;
+		qcom,smem-state-names = "stop";
+        };
diff --git a/drivers/remoteproc/qcom_adsp_pil.c b/drivers/remoteproc/qcom_adsp_pil.c
index 58cc46d..e6bb1f0 100644
--- a/drivers/remoteproc/qcom_adsp_pil.c
+++ b/drivers/remoteproc/qcom_adsp_pil.c
@@ -1,5 +1,5 @@
 /*
- * Qualcomm ADSP Peripheral Image Loader for MSM8974 and MSM8996
+ * Qualcomm ADSP/SLPI Peripheral Image Loader for MSM8974 and MSM8996
  *
  * Copyright (C) 2016 Linaro Ltd
  * Copyright (C) 2014 Sony Mobile Communications AB
@@ -455,9 +455,17 @@ static int adsp_remove(struct platform_device *pdev)
 		.pas_id = 1,
 		.has_aggre2_clk = 0,
 };
+
+static const struct adsp_data slpi_resource_init = {
+		.crash_reason_smem = 424,
+		.firmware_name = "slpi.mdt",
+		.pas_id = 12,
+		.has_aggre2_clk = 1,
+};
 static const struct of_device_id adsp_of_match[] = {
 	{ .compatible = "qcom,msm8974-adsp-pil", .data = &adsp_resource_init},
 	{ .compatible = "qcom,msm8996-adsp-pil", .data = &adsp_resource_init},
+	{ .compatible = "qcom,msm8996-slpi-pil", .data = &slpi_resource_init},
 	{ },
 };
 MODULE_DEVICE_TABLE(of, adsp_of_match);
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.

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

* [PATCH v3 4/4] arm64: dts: msm8996: Add SLPI SMP2P dt node.
  2017-01-30 15:03 [PATCH v3 0/4]remoteproc: qcom: Add support for Qualcomm low pass sensor peripheral loader Avaneesh Kumar Dwivedi
                   ` (2 preceding siblings ...)
  2017-01-30 15:03 ` [PATCH v3 3/4] remoteproc: qcom: Add SLPI rproc support to load and boot slpi proc Avaneesh Kumar Dwivedi
@ 2017-01-30 15:03 ` Avaneesh Kumar Dwivedi
  2017-01-31  1:33   ` Bjorn Andersson
  3 siblings, 1 reply; 11+ messages in thread
From: Avaneesh Kumar Dwivedi @ 2017-01-30 15:03 UTC (permalink / raw)
  To: bjorn.andersson
  Cc: sboyd, agross, linux-arm-msm, linux-kernel, linux-remoteproc,
	Avaneesh Kumar Dwivedi

Add smp2p support to communicate with slpi processor.

Signed-off-by: Avaneesh Kumar Dwivedi <akdwived@codeaurora.org>
---
 arch/arm64/boot/dts/qcom/msm8996.dtsi | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi
index 29ed6b6..5bec315 100644
--- a/arch/arm64/boot/dts/qcom/msm8996.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi
@@ -551,5 +551,29 @@
 			#interrupt-cells = <2>;
 		};
 	};
+
+	smp2p-slpi {
+		compatible = "qcom,smp2p";
+		qcom,smem = <481>, <430>;
+
+		interrupts = <GIC_SPI 178 IRQ_TYPE_EDGE_RISING>;
+
+		qcom,ipc = <&apcs 16 26>;
+
+		qcom,local-pid = <0>;
+		qcom,remote-pid = <3>;
+
+		slpi_smp2p_in: slave-kernel {
+			qcom,entry-name = "slave-kernel";
+			interrupt-controller;
+			#interrupt-cells = <2>;
+		};
+
+		slpi_smp2p_out: master-kernel {
+			qcom,entry-name = "master-kernel";
+			#qcom,smem-state-cells = <1>;
+		};
+	};
+
 };
 #include "msm8996-pins.dtsi"
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.

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

* Re: [PATCH v3 1/4] remoteproc: qcom: Compatible string based resource initialization.
  2017-01-30 15:03 ` [PATCH v3 1/4] remoteproc: qcom: Compatible string based resource initialization Avaneesh Kumar Dwivedi
@ 2017-01-30 21:45   ` Bjorn Andersson
  0 siblings, 0 replies; 11+ messages in thread
From: Bjorn Andersson @ 2017-01-30 21:45 UTC (permalink / raw)
  To: Avaneesh Kumar Dwivedi
  Cc: sboyd, agross, linux-arm-msm, linux-kernel, linux-remoteproc

On Mon 30 Jan 07:03 PST 2017, Avaneesh Kumar Dwivedi wrote:

> This patch initialize certain driver related data based on compatible
> string. This enable driver to handle more than one similar device in
> by differentiating in probe their private data.
> 
> Signed-off-by: Avaneesh Kumar Dwivedi <akdwived@codeaurora.org>

Applied, thanks

Regards,
Bjorn

> ---
>  drivers/remoteproc/qcom_adsp_pil.c | 47 ++++++++++++++++++++++++++------------
>  1 file changed, 33 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/remoteproc/qcom_adsp_pil.c b/drivers/remoteproc/qcom_adsp_pil.c
> index 43a4ed2..f674301 100644
> --- a/drivers/remoteproc/qcom_adsp_pil.c
> +++ b/drivers/remoteproc/qcom_adsp_pil.c
> @@ -32,9 +32,12 @@
>  #include "qcom_mdt_loader.h"
>  #include "remoteproc_internal.h"
>  
> -#define ADSP_CRASH_REASON_SMEM		423
> -#define ADSP_FIRMWARE_NAME		"adsp.mdt"
> -#define ADSP_PAS_ID			1
> +struct adsp_data {
> +	int crash_reason_smem;
> +	const char *firmware_name;
> +	int pas_id;
> +};
> +
>  
>  struct qcom_adsp {
>  	struct device *dev;
> @@ -53,6 +56,9 @@ struct qcom_adsp {
>  
>  	struct regulator *cx_supply;
>  
> +	int pas_id;
> +	int crash_reason_smem;
> +
>  	struct completion start_done;
>  	struct completion stop_done;
>  
> @@ -70,7 +76,7 @@ static int adsp_load(struct rproc *rproc, const struct firmware *fw)
>  	bool relocate;
>  	int ret;
>  
> -	ret = qcom_scm_pas_init_image(ADSP_PAS_ID, fw->data, fw->size);
> +	ret = qcom_scm_pas_init_image(adsp->pas_id, fw->data, fw->size);
>  	if (ret) {
>  		dev_err(&rproc->dev, "invalid firmware metadata\n");
>  		return ret;
> @@ -85,7 +91,8 @@ static int adsp_load(struct rproc *rproc, const struct firmware *fw)
>  	if (relocate) {
>  		adsp->mem_reloc = fw_addr;
>  
> -		ret = qcom_scm_pas_mem_setup(ADSP_PAS_ID, adsp->mem_phys, fw_size);
> +		ret = qcom_scm_pas_mem_setup(adsp->pas_id,
> +					adsp->mem_phys, fw_size);
>  		if (ret) {
>  			dev_err(&rproc->dev, "unable to setup memory for image\n");
>  			return ret;
> @@ -113,7 +120,7 @@ static int adsp_start(struct rproc *rproc)
>  	if (ret)
>  		goto disable_clocks;
>  
> -	ret = qcom_scm_pas_auth_and_reset(ADSP_PAS_ID);
> +	ret = qcom_scm_pas_auth_and_reset(adsp->pas_id);
>  	if (ret) {
>  		dev_err(adsp->dev,
>  			"failed to authenticate image and release reset\n");
> @@ -124,7 +131,7 @@ static int adsp_start(struct rproc *rproc)
>  					  msecs_to_jiffies(5000));
>  	if (!ret) {
>  		dev_err(adsp->dev, "start timed out\n");
> -		qcom_scm_pas_shutdown(ADSP_PAS_ID);
> +		qcom_scm_pas_shutdown(adsp->pas_id);
>  		ret = -ETIMEDOUT;
>  		goto disable_regulators;
>  	}
> @@ -157,7 +164,7 @@ static int adsp_stop(struct rproc *rproc)
>  				    BIT(adsp->stop_bit),
>  				    0);
>  
> -	ret = qcom_scm_pas_shutdown(ADSP_PAS_ID);
> +	ret = qcom_scm_pas_shutdown(adsp->pas_id);
>  	if (ret)
>  		dev_err(adsp->dev, "failed to shutdown: %d\n", ret);
>  
> @@ -197,7 +204,7 @@ static irqreturn_t adsp_fatal_interrupt(int irq, void *dev)
>  	size_t len;
>  	char *msg;
>  
> -	msg = qcom_smem_get(QCOM_SMEM_HOST_ANY, ADSP_CRASH_REASON_SMEM, &len);
> +	msg = qcom_smem_get(QCOM_SMEM_HOST_ANY, adsp->crash_reason_smem, &len);
>  	if (!IS_ERR(msg) && len > 0 && msg[0])
>  		dev_err(adsp->dev, "fatal error received: %s\n", msg);
>  
> @@ -311,20 +318,25 @@ static int adsp_alloc_memory_region(struct qcom_adsp *adsp)
>  
>  static int adsp_probe(struct platform_device *pdev)
>  {
> +	const struct adsp_data *desc;
>  	struct qcom_adsp *adsp;
>  	struct rproc *rproc;
>  	int ret;
>  
> +	desc = of_device_get_match_data(&pdev->dev);
> +	if (!desc)
> +		return -EINVAL;
> +
>  	if (!qcom_scm_is_available())
>  		return -EPROBE_DEFER;
>  
> -	if (!qcom_scm_pas_supported(ADSP_PAS_ID)) {
> -		dev_err(&pdev->dev, "PAS is not available for ADSP\n");
> +	if (!qcom_scm_pas_supported(desc->pas_id)) {
> +		dev_err(&pdev->dev, "PAS is not available for subsystem\n");
>  		return -ENXIO;
>  	}
>  
>  	rproc = rproc_alloc(&pdev->dev, pdev->name, &adsp_ops,
> -			    ADSP_FIRMWARE_NAME, sizeof(*adsp));
> +			    desc->firmware_name, sizeof(*adsp));
>  	if (!rproc) {
>  		dev_err(&pdev->dev, "unable to allocate remoteproc\n");
>  		return -ENOMEM;
> @@ -344,6 +356,8 @@ static int adsp_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto free_rproc;
>  
> +	adsp->pas_id = desc->pas_id;
> +	adsp->crash_reason_smem = desc->crash_reason_smem;
>  	ret = adsp_init_clock(adsp);
>  	if (ret)
>  		goto free_rproc;
> @@ -407,9 +421,14 @@ static int adsp_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> +static const struct adsp_data adsp_resource_init = {
> +		.crash_reason_smem = 423,
> +		.firmware_name = "adsp.mdt",
> +		.pas_id = 1,
> +};
>  static const struct of_device_id adsp_of_match[] = {
> -	{ .compatible = "qcom,msm8974-adsp-pil" },
> -	{ .compatible = "qcom,msm8996-adsp-pil" },
> +	{ .compatible = "qcom,msm8974-adsp-pil", .data = &adsp_resource_init},
> +	{ .compatible = "qcom,msm8996-adsp-pil", .data = &adsp_resource_init},
>  	{ },
>  };
>  MODULE_DEVICE_TABLE(of, adsp_of_match);
> -- 
> Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project.
> 

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

* Re: [PATCH v3 2/4] remoteproc: qcom: Add additional agree2_clk and px regulator resource.
  2017-01-30 15:03 ` [PATCH v3 2/4] remoteproc: qcom: Add additional agree2_clk and px regulator resource Avaneesh Kumar Dwivedi
@ 2017-01-30 21:46   ` Bjorn Andersson
  2017-01-31  5:58     ` Dwivedi, Avaneesh Kumar (avani)
  0 siblings, 1 reply; 11+ messages in thread
From: Bjorn Andersson @ 2017-01-30 21:46 UTC (permalink / raw)
  To: Avaneesh Kumar Dwivedi
  Cc: sboyd, agross, linux-arm-msm, linux-kernel, linux-remoteproc

On Mon 30 Jan 07:03 PST 2017, Avaneesh Kumar Dwivedi wrote:

> This patch add additional clock and regulator resource which are
> initialized based on compatible and has no impact on existing driver
> working. This resourse addition enable the existing driver to handle.
> low pass sensor processor device also.
> 
> Signed-off-by: Avaneesh Kumar Dwivedi <akdwived@codeaurora.org>

Applied, with below modification.

> ---
>  drivers/remoteproc/qcom_adsp_pil.c | 43 +++++++++++++++++++++++++++++++-------
>  1 file changed, 36 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/remoteproc/qcom_adsp_pil.c b/drivers/remoteproc/qcom_adsp_pil.c
[..]
>  static int adsp_init_regulator(struct qcom_adsp *adsp)
>  {
> -	adsp->cx_supply = devm_regulator_get(adsp->dev, "cx");
> +	adsp->cx_supply = devm_regulator_get(adsp->dev, "vdd_cx");

We should not change the name of devicetree properties, so I dropped
"vdd_" on both of these.

>  	if (IS_ERR(adsp->cx_supply))
>  		return PTR_ERR(adsp->cx_supply);
>  
>  	regulator_set_load(adsp->cx_supply, 100000);
>  
> +	adsp->px_supply = devm_regulator_get(adsp->dev, "vdd_px");
> +	if (IS_ERR(adsp->px_supply))
> +		return PTR_ERR(adsp->px_supply);

Regards,
Bjorn

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

* Re: [PATCH v3 3/4] remoteproc: qcom: Add SLPI rproc support to load and boot slpi proc.
  2017-01-30 15:03 ` [PATCH v3 3/4] remoteproc: qcom: Add SLPI rproc support to load and boot slpi proc Avaneesh Kumar Dwivedi
@ 2017-01-30 21:50   ` Bjorn Andersson
  0 siblings, 0 replies; 11+ messages in thread
From: Bjorn Andersson @ 2017-01-30 21:50 UTC (permalink / raw)
  To: Avaneesh Kumar Dwivedi
  Cc: sboyd, agross, linux-arm-msm, linux-kernel, linux-remoteproc

On Mon 30 Jan 07:03 PST 2017, Avaneesh Kumar Dwivedi wrote:

> This patch add slpi remoteproc support in existing adsp rproc driver.
> 
> Signed-off-by: Avaneesh Kumar Dwivedi <akdwived@codeaurora.org>

I added documentation for "aggre2" and "px-supply" and applied this,
thanks.

Regards,
Bjorn

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

* Re: [PATCH v3 4/4] arm64: dts: msm8996: Add SLPI SMP2P dt node.
  2017-01-30 15:03 ` [PATCH v3 4/4] arm64: dts: msm8996: Add SLPI SMP2P dt node Avaneesh Kumar Dwivedi
@ 2017-01-31  1:33   ` Bjorn Andersson
  0 siblings, 0 replies; 11+ messages in thread
From: Bjorn Andersson @ 2017-01-31  1:33 UTC (permalink / raw)
  To: Avaneesh Kumar Dwivedi
  Cc: sboyd, agross, linux-arm-msm, linux-kernel, linux-remoteproc

On Mon 30 Jan 07:03 PST 2017, Avaneesh Kumar Dwivedi wrote:

> Add smp2p support to communicate with slpi processor.
> 
> Signed-off-by: Avaneesh Kumar Dwivedi <akdwived@codeaurora.org>

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Regards,
Bjorn

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

* Re: [PATCH v3 2/4] remoteproc: qcom: Add additional agree2_clk and px regulator resource.
  2017-01-30 21:46   ` Bjorn Andersson
@ 2017-01-31  5:58     ` Dwivedi, Avaneesh Kumar (avani)
  2017-01-31  6:05       ` Bjorn Andersson
  0 siblings, 1 reply; 11+ messages in thread
From: Dwivedi, Avaneesh Kumar (avani) @ 2017-01-31  5:58 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: sboyd, agross, linux-arm-msm, linux-kernel, linux-remoteproc



On 1/31/2017 3:16 AM, Bjorn Andersson wrote:
> On Mon 30 Jan 07:03 PST 2017, Avaneesh Kumar Dwivedi wrote:
>
>> This patch add additional clock and regulator resource which are
>> initialized based on compatible and has no impact on existing driver
>> working. This resourse addition enable the existing driver to handle.
>> low pass sensor processor device also.
>>
>> Signed-off-by: Avaneesh Kumar Dwivedi <akdwived@codeaurora.org>
> Applied, with below modification.
Thanks Bjorn, but please look below inline comment.
>> ---
>>   drivers/remoteproc/qcom_adsp_pil.c | 43 +++++++++++++++++++++++++++++++-------
>>   1 file changed, 36 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/remoteproc/qcom_adsp_pil.c b/drivers/remoteproc/qcom_adsp_pil.c
> [..]
>>   static int adsp_init_regulator(struct qcom_adsp *adsp)
>>   {
>> -	adsp->cx_supply = devm_regulator_get(adsp->dev, "cx");
>> +	adsp->cx_supply = devm_regulator_get(adsp->dev, "vdd_cx");
> We should not change the name of devicetree properties, so I dropped
> "vdd_" on both of these.
I observed that giving "cx" or "px" string to devm_regulator_get() was 
returning with dummy regulator, and if i gave "vdd_cx" and "vdd_px" it 
did not print dummy regulator warning.
in device tree these regulators node were defined as "vdd_cx-supply" and 
"vdd_px-supply"
>
>>   	if (IS_ERR(adsp->cx_supply))
>>   		return PTR_ERR(adsp->cx_supply);
>>   
>>   	regulator_set_load(adsp->cx_supply, 100000);
>>   
>> +	adsp->px_supply = devm_regulator_get(adsp->dev, "vdd_px");
>> +	if (IS_ERR(adsp->px_supply))
>> +		return PTR_ERR(adsp->px_supply);
> Regards,
> Bjorn

-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.

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

* Re: [PATCH v3 2/4] remoteproc: qcom: Add additional agree2_clk and px regulator resource.
  2017-01-31  5:58     ` Dwivedi, Avaneesh Kumar (avani)
@ 2017-01-31  6:05       ` Bjorn Andersson
  0 siblings, 0 replies; 11+ messages in thread
From: Bjorn Andersson @ 2017-01-31  6:05 UTC (permalink / raw)
  To: Dwivedi, Avaneesh Kumar (avani)
  Cc: sboyd, agross, linux-arm-msm, linux-kernel, linux-remoteproc

On Mon 30 Jan 21:58 PST 2017, Dwivedi, Avaneesh Kumar (avani) wrote:

> 
> 
> On 1/31/2017 3:16 AM, Bjorn Andersson wrote:
> > On Mon 30 Jan 07:03 PST 2017, Avaneesh Kumar Dwivedi wrote:
> > 
> > > This patch add additional clock and regulator resource which are
> > > initialized based on compatible and has no impact on existing driver
> > > working. This resourse addition enable the existing driver to handle.
> > > low pass sensor processor device also.
> > > 
> > > Signed-off-by: Avaneesh Kumar Dwivedi <akdwived@codeaurora.org>
> > Applied, with below modification.
> Thanks Bjorn, but please look below inline comment.
> > > ---
> > >   drivers/remoteproc/qcom_adsp_pil.c | 43 +++++++++++++++++++++++++++++++-------
> > >   1 file changed, 36 insertions(+), 7 deletions(-)
> > > 
> > > diff --git a/drivers/remoteproc/qcom_adsp_pil.c b/drivers/remoteproc/qcom_adsp_pil.c
> > [..]
> > >   static int adsp_init_regulator(struct qcom_adsp *adsp)
> > >   {
> > > -	adsp->cx_supply = devm_regulator_get(adsp->dev, "cx");
> > > +	adsp->cx_supply = devm_regulator_get(adsp->dev, "vdd_cx");
> > We should not change the name of devicetree properties, so I dropped
> > "vdd_" on both of these.
> I observed that giving "cx" or "px" string to devm_regulator_get() was
> returning with dummy regulator, and if i gave "vdd_cx" and "vdd_px" it did
> not print dummy regulator warning.
> in device tree these regulators node were defined as "vdd_cx-supply" and
> "vdd_px-supply"

They are named "vdd_cx" and "vdd_px" in the downstream dts, I didn't
notice this originally and as we have a few other discrepancies to the
downstream binding I rather stay compatible with the existing upstream
DT binding than the downstream.

So please update your dts.


Btw, forgot to mention that aggre2 definitely is a "bus" and I think it
should be represented separately, but I figured its better to merge the
driver as is and then remove aggre2 once we have figured out how to
represent/reference it properly.

Regards,
Bjorn

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

end of thread, other threads:[~2017-01-31  6:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-30 15:03 [PATCH v3 0/4]remoteproc: qcom: Add support for Qualcomm low pass sensor peripheral loader Avaneesh Kumar Dwivedi
2017-01-30 15:03 ` [PATCH v3 1/4] remoteproc: qcom: Compatible string based resource initialization Avaneesh Kumar Dwivedi
2017-01-30 21:45   ` Bjorn Andersson
2017-01-30 15:03 ` [PATCH v3 2/4] remoteproc: qcom: Add additional agree2_clk and px regulator resource Avaneesh Kumar Dwivedi
2017-01-30 21:46   ` Bjorn Andersson
2017-01-31  5:58     ` Dwivedi, Avaneesh Kumar (avani)
2017-01-31  6:05       ` Bjorn Andersson
2017-01-30 15:03 ` [PATCH v3 3/4] remoteproc: qcom: Add SLPI rproc support to load and boot slpi proc Avaneesh Kumar Dwivedi
2017-01-30 21:50   ` Bjorn Andersson
2017-01-30 15:03 ` [PATCH v3 4/4] arm64: dts: msm8996: Add SLPI SMP2P dt node Avaneesh Kumar Dwivedi
2017-01-31  1:33   ` 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.