diff mbox

[1/2] remoteproc: qcom: Private data support for venus rproc driver.

Message ID 1478627881-20073-2-git-send-email-akdwived@codeaurora.org (mailing list archive)
State Not Applicable, archived
Delegated to: Andy Gross
Headers show

Commit Message

Dwivedi, Avaneesh Kumar (avani) Nov. 8, 2016, 5:58 p.m. UTC
venus remoteproc driver being able to boot standalone venus firmware,
need to initialize and enable clock resource. So providing private data
binding to device structure so that each new venus remoteproc driver
can manage its own clock.

Signed-off-by: Avaneesh Kumar Dwivedi <akdwived@codeaurora.org>
---
 .../devicetree/bindings/remoteproc/qcom,venus.txt  |  3 ++-
 drivers/remoteproc/qcom_venus_pil.c                | 31 +++++++++++++++++++++-
 2 files changed, 32 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/remoteproc/qcom,venus.txt b/Documentation/devicetree/bindings/remoteproc/qcom,venus.txt
index 2d73ba1..9d7865e 100644
--- a/Documentation/devicetree/bindings/remoteproc/qcom,venus.txt
+++ b/Documentation/devicetree/bindings/remoteproc/qcom,venus.txt
@@ -6,7 +6,8 @@  on the Qualcomm Venus remote processor core.
 - compatible:
 	Usage: required
 	Value type: <string>
-	Definition: must contain "qcom,venus-pil"
+	Definition: must contain "qcom,venus-pil" or
+		 "qcom,venus-8996-pil"
 
 - memory-region:
 	Usage: required
diff --git a/drivers/remoteproc/qcom_venus_pil.c b/drivers/remoteproc/qcom_venus_pil.c
index 6d4e55b..5b4ea10 100644
--- a/drivers/remoteproc/qcom_venus_pil.c
+++ b/drivers/remoteproc/qcom_venus_pil.c
@@ -21,6 +21,7 @@ 
 #include <linux/platform_device.h>
 #include <linux/qcom_scm.h>
 #include <linux/remoteproc.h>
+#include <linux/of_device.h>
 
 #include "qcom_mdt_loader.h"
 #include "remoteproc_internal.h"
@@ -30,6 +31,11 @@ 
 #define VENUS_PAS_ID			9
 #define VENUS_FW_MEM_SIZE		SZ_8M
 
+struct qcom_venus_rproc_res {
+	char **venus_clks;
+	int venus_clk_cnt;
+	int *venus_clk_rate;
+};
 struct qcom_venus {
 	struct device *dev;
 	struct rproc *rproc;
@@ -37,6 +43,8 @@  struct qcom_venus {
 	phys_addr_t mem_phys;
 	void *mem_va;
 	size_t mem_size;
+	const struct qcom_venus_rproc_res *venus_rproc_res;
+	struct clk **venus_clks;
 };
 
 static int venus_load(struct rproc *rproc, const struct firmware *fw)
@@ -128,8 +136,13 @@  static int venus_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct qcom_venus *venus;
 	struct rproc *rproc;
+	const struct qcom_venus_rproc_res *desc;
 	int ret;
 
+	desc = of_device_get_match_data(&pdev->dev);
+	if (!desc)
+		return -EINVAL;
+
 	if (!qcom_scm_is_available())
 		return -EPROBE_DEFER;
 
@@ -158,6 +171,7 @@  static int venus_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, venus);
 
+	venus->venus_rproc_res = desc;
 	venus->mem_va = dma_alloc_coherent(dev, venus->mem_size,
 					   &venus->mem_phys, GFP_KERNEL);
 	if (!venus->mem_va) {
@@ -194,8 +208,23 @@  static int venus_remove(struct platform_device *pdev)
 	return 0;
 }
 
+char *venus_clk_str[] = {"core_clk", "iface_clk", "bus_clk", "maxi_clk"};
+int venus_clk_rate[] = {19200000, 19200000, 19200000, 80000000};
+static const struct qcom_venus_rproc_res venus_8996_res = {
+	.venus_clks = venus_clk_str,
+	.venus_clk_cnt = 4,
+	.venus_clk_rate = venus_clk_rate,
+};
+
+static const struct qcom_venus_rproc_res venus_8916_res = {
+	.venus_clks = NULL,
+	.venus_clk_cnt = 0,
+	.venus_clk_rate = NULL,
+};
+
 static const struct of_device_id venus_of_match[] = {
-	{ .compatible = "qcom,venus-pil" },
+	{ .compatible = "qcom,venus-8996-pil", .data = &venus_8996_res },
+	{ .compatible = "qcom,venus-pil", .data = &venus_8916_res},
 	{ },
 };