mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Suman Anna <s-anna@ti.com>
To: Bjorn Andersson <bjorn.andersson@linaro.org>,
	Ohad Ben-Cohen <ohad@wizery.com>,
	Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>, <devicetree@vger.kernel.org>,
	<linux-remoteproc@vger.kernel.org>, Sekhar Nori <nsekhar@ti.com>,
	Robert Tivy <rtivy@ti.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, Suman Anna <s-anna@ti.com>
Subject: [PATCH v2 4/4] remoteproc/davinci: Add device tree support for OMAP-L138 DSP
Date: Tue, 1 Aug 2017 10:48:44 -0500	[thread overview]
Message-ID: <20170801154844.24662-5-s-anna@ti.com> (raw)
In-Reply-To: <20170801154844.24662-1-s-anna@ti.com>

The Davinci remoteproc driver currently supports the DSP remoteproc
device created in legacy-style on OMAP-L13x SoCs. The driver has been
enhanced to support the DSP remoteproc device created through Device
Tree now. The current DT support handles the C674x DSP processor
subsystem on OMAP-L138 SoCs.

Signed-off-by: Suman Anna <s-anna@ti.com>
---
v2:
 - Add __maybe_unused and of_match_ptr to deal with non-OF builds
 - Rebased patch after dropping the interrupt management patch from
   the cleanup series, https://patchwork.kernel.org/patch/9735321/
v1: https://patchwork.kernel.org/patch/9751277/

 drivers/remoteproc/da8xx_remoteproc.c | 30 +++++++++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/drivers/remoteproc/da8xx_remoteproc.c b/drivers/remoteproc/da8xx_remoteproc.c
index c1cff78de67b..bf3b9034c319 100644
--- a/drivers/remoteproc/da8xx_remoteproc.c
+++ b/drivers/remoteproc/da8xx_remoteproc.c
@@ -16,6 +16,7 @@
 #include <linux/irq.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/of_reserved_mem.h>
 #include <linux/platform_device.h>
 #include <linux/remoteproc.h>
 
@@ -261,10 +262,21 @@ static int da8xx_rproc_probe(struct platform_device *pdev)
 		return PTR_ERR(dsp_clk);
 	}
 
+	if (dev->of_node) {
+		ret = of_reserved_mem_device_init(dev);
+		if (ret) {
+			dev_err(dev, "device does not have specific CMA pool: %d\n",
+				ret);
+			return ret;
+		}
+	}
+
 	rproc = rproc_alloc(dev, "dsp", &da8xx_rproc_ops, da8xx_fw_name,
 		sizeof(*drproc));
-	if (!rproc)
-		return -ENOMEM;
+	if (!rproc) {
+		ret = -ENOMEM;
+		goto free_mem;
+	}
 
 	drproc = rproc->priv;
 	drproc->rproc = rproc;
@@ -311,7 +323,9 @@ static int da8xx_rproc_probe(struct platform_device *pdev)
 
 free_rproc:
 	rproc_free(rproc);
-
+free_mem:
+	if (dev->of_node)
+		of_reserved_mem_device_release(dev);
 	return ret;
 }
 
@@ -319,6 +333,7 @@ static int da8xx_rproc_remove(struct platform_device *pdev)
 {
 	struct rproc *rproc = platform_get_drvdata(pdev);
 	struct da8xx_rproc *drproc = (struct da8xx_rproc *)rproc->priv;
+	struct device *dev = &pdev->dev;
 
 	/*
 	 * The devm subsystem might end up releasing things before
@@ -329,15 +344,24 @@ static int da8xx_rproc_remove(struct platform_device *pdev)
 
 	rproc_del(rproc);
 	rproc_free(rproc);
+	if (dev->of_node)
+		of_reserved_mem_device_release(dev);
 
 	return 0;
 }
 
+static const struct of_device_id davinci_rproc_of_match[] __maybe_unused = {
+	{ .compatible = "ti,da850-dsp", },
+	{ /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, davinci_rproc_of_match);
+
 static struct platform_driver da8xx_rproc_driver = {
 	.probe = da8xx_rproc_probe,
 	.remove = da8xx_rproc_remove,
 	.driver = {
 		.name = "davinci-rproc",
+		.of_match_table = of_match_ptr(davinci_rproc_of_match),
 	},
 };
 
-- 
2.13.1

  parent reply	other threads:[~2017-08-01 15:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-01 15:48 [PATCH v2 0/4] Add DT support for davinci remoteproc driver Suman Anna
2017-08-01 15:48 ` [PATCH v2 1/4] remoteproc/davinci: Switch to platform_get_resource_byname() Suman Anna
2017-08-01 15:48 ` [PATCH v2 2/4] remoteproc/davinci: Add support to parse internal memories Suman Anna
2017-08-01 15:48 ` [PATCH v2 3/4] dt-bindings: remoteproc: Add bindings for Davinci DSP processors Suman Anna
2017-08-10 14:01   ` Rob Herring
2017-08-10 15:05     ` Suman Anna
2017-08-01 15:48 ` Suman Anna [this message]
2017-08-01 16:55 ` [PATCH v2 0/4] Add DT support for davinci remoteproc driver Suman Anna

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170801154844.24662-5-s-anna@ti.com \
    --to=s-anna@ti.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=nsekhar@ti.com \
    --cc=ohad@wizery.com \
    --cc=robh+dt@kernel.org \
    --cc=rtivy@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®