Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1701174 > unrolled thread
| Started by | Suman Anna <s-anna@ti.com> |
|---|---|
| First post | 2017-08-01 17:50 +0200 |
| Last post | 2017-08-01 19:00 +0200 |
| Articles | 4 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH v2 0/4] Add DT support for davinci remoteproc driver Suman Anna <s-anna@ti.com> - 2017-08-01 17:50 +0200
[PATCH v2 4/4] remoteproc/davinci: Add device tree support for OMAP-L138 DSP Suman Anna <s-anna@ti.com> - 2017-08-01 18:00 +0200
[PATCH v2 2/4] remoteproc/davinci: Add support to parse internal memories Suman Anna <s-anna@ti.com> - 2017-08-01 18:00 +0200
Re: [PATCH v2 0/4] Add DT support for davinci remoteproc driver Suman Anna <s-anna@ti.com> - 2017-08-01 19:00 +0200
| From | Suman Anna <s-anna@ti.com> |
|---|---|
| Date | 2017-08-01 17:50 +0200 |
| Subject | [PATCH v2 0/4] Add DT support for davinci remoteproc driver |
| Message-ID | <u9HAJ-5MK-5@gated-at.bofh.it> |
Hi, The following is v2 of the series [1] that adds the device tree support to the Davinci remoteproc driver. Patches are baselined on 4.13-rc1, the main dependent patches from the series "Davinci remoteproc cleanup/fixes" [2] and the resource name additions [3] were merged and available in mainline 4.13-rc1. DTS nodes for the OMAP-L138 LCDK board will be added for a subsequent merge window once these patches are picked up. Change summary for v2: - Patches 1 and 2 are unchanged - Binding in Patch 3 revised slightly to address Rob Herring's comments - Patch 4 updated to deal with non-OF builds since Davinci platforms still support non-DT boots. regards Suman [1] http://marc.info/?l=linux-arm-kernel&m=149514538506046&w=2 [2] http://marc.info/?l=linux-arm-kernel&m=149514538506046&w=2 [3] http://marc.info/?l=linux-kernel&m=149497287512869&w=2 Suman Anna (4): remoteproc/davinci: Switch to platform_get_resource_byname() remoteproc/davinci: Add support to parse internal memories dt-bindings: remoteproc: Add bindings for Davinci DSP processors remoteproc/davinci: Add device tree support for OMAP-L138 DSP .../bindings/remoteproc/ti,davinci-rproc.txt | 86 +++++++++++++++++++ drivers/remoteproc/da8xx_remoteproc.c | 98 ++++++++++++++++++++-- 2 files changed, 179 insertions(+), 5 deletions(-) create mode 100644 Documentation/devicetree/bindings/remoteproc/ti,davinci-rproc.txt -- 2.13.1
[toc] | [next] | [standalone]
| From | Suman Anna <s-anna@ti.com> |
|---|---|
| Date | 2017-08-01 18:00 +0200 |
| Subject | [PATCH v2 4/4] remoteproc/davinci: Add device tree support for OMAP-L138 DSP |
| Message-ID | <u9HKq-5Q8-37@gated-at.bofh.it> |
| In reply to | #1701174 |
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
[toc] | [prev] | [next] | [standalone]
| From | Suman Anna <s-anna@ti.com> |
|---|---|
| Date | 2017-08-01 18:00 +0200 |
| Subject | [PATCH v2 2/4] remoteproc/davinci: Add support to parse internal memories |
| Message-ID | <u9HKq-5Q8-41@gated-at.bofh.it> |
| In reply to | #1701174 |
The DSP subsystem on OMAP-L13x SoCs has various internal RAM
memories that can accessed from the ARM side. These memories
can be configured to be used as either RAM or Cache.
The Davinci remoteproc driver has been enhanced to parse and
store the kernel mappings for these internal RAM memories.
These mappings can then be used to support direct loading of
text/data into these memories from the remoteproc driver.
Signed-off-by: Suman Anna <s-anna@ti.com>
---
v2: No code changes
drivers/remoteproc/da8xx_remoteproc.c | 62 +++++++++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)
diff --git a/drivers/remoteproc/da8xx_remoteproc.c b/drivers/remoteproc/da8xx_remoteproc.c
index 280b66d4f622..c1cff78de67b 100644
--- a/drivers/remoteproc/da8xx_remoteproc.c
+++ b/drivers/remoteproc/da8xx_remoteproc.c
@@ -38,9 +38,27 @@ MODULE_PARM_DESC(da8xx_fw_name,
#define SYSCFG_CHIPSIG3 BIT(3)
#define SYSCFG_CHIPSIG4 BIT(4)
+#define DA8XX_RPROC_LOCAL_ADDRESS_MASK (SZ_16M - 1)
+
+/**
+ * struct da8xx_rproc_mem - internal memory structure
+ * @cpu_addr: MPU virtual address of the memory region
+ * @bus_addr: Bus address used to access the memory region
+ * @dev_addr: Device address of the memory region from DSP view
+ * @size: Size of the memory region
+ */
+struct da8xx_rproc_mem {
+ void __iomem *cpu_addr;
+ phys_addr_t bus_addr;
+ u32 dev_addr;
+ size_t size;
+};
+
/**
* struct da8xx_rproc - da8xx remote processor instance state
* @rproc: rproc handle
+ * @mem: internal memory regions data
+ * @num_mems: number of internal memory regions
* @dsp_clk: placeholder for platform's DSP clk
* @ack_fxn: chip-specific ack function for ack'ing irq
* @irq_data: ack_fxn function parameter
@@ -50,6 +68,8 @@ MODULE_PARM_DESC(da8xx_fw_name,
*/
struct da8xx_rproc {
struct rproc *rproc;
+ struct da8xx_rproc_mem *mem;
+ int num_mems;
struct clk *dsp_clk;
void (*ack_fxn)(struct irq_data *data);
struct irq_data *irq_data;
@@ -158,6 +178,44 @@ static const struct rproc_ops da8xx_rproc_ops = {
.kick = da8xx_rproc_kick,
};
+static int da8xx_rproc_get_internal_memories(struct platform_device *pdev,
+ struct da8xx_rproc *drproc)
+{
+ static const char * const mem_names[] = {"l2sram", "l1pram", "l1dram"};
+ int num_mems = ARRAY_SIZE(mem_names);
+ struct device *dev = &pdev->dev;
+ struct resource *res;
+ int i;
+
+ drproc->mem = devm_kcalloc(dev, num_mems, sizeof(*drproc->mem),
+ GFP_KERNEL);
+ if (!drproc->mem)
+ return -ENOMEM;
+
+ for (i = 0; i < num_mems; i++) {
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+ mem_names[i]);
+ drproc->mem[i].cpu_addr = devm_ioremap_resource(dev, res);
+ if (IS_ERR(drproc->mem[i].cpu_addr)) {
+ dev_err(dev, "failed to parse and map %s memory\n",
+ mem_names[i]);
+ return PTR_ERR(drproc->mem[i].cpu_addr);
+ }
+ drproc->mem[i].bus_addr = res->start;
+ drproc->mem[i].dev_addr =
+ res->start & DA8XX_RPROC_LOCAL_ADDRESS_MASK;
+ drproc->mem[i].size = resource_size(res);
+
+ dev_dbg(dev, "memory %8s: bus addr %pa size 0x%x va %p da 0x%x\n",
+ mem_names[i], &drproc->mem[i].bus_addr,
+ drproc->mem[i].size, drproc->mem[i].cpu_addr,
+ drproc->mem[i].dev_addr);
+ }
+ drproc->num_mems = num_mems;
+
+ return 0;
+}
+
static int da8xx_rproc_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -213,6 +271,10 @@ static int da8xx_rproc_probe(struct platform_device *pdev)
drproc->dsp_clk = dsp_clk;
rproc->has_iommu = false;
+ ret = da8xx_rproc_get_internal_memories(pdev, drproc);
+ if (ret)
+ goto free_rproc;
+
platform_set_drvdata(pdev, rproc);
/* everything the ISR needs is now setup, so hook it up */
--
2.13.1
[toc] | [prev] | [next] | [standalone]
| From | Suman Anna <s-anna@ti.com> |
|---|---|
| Date | 2017-08-01 19:00 +0200 |
| Message-ID | <u9IGu-6pq-17@gated-at.bofh.it> |
| In reply to | #1701174 |
On 08/01/2017 10:48 AM, Suman Anna wrote: > Hi, > > The following is v2 of the series [1] that adds the device tree support to > the Davinci remoteproc driver. Patches are baselined on 4.13-rc1, the > main dependent patches from the series "Davinci remoteproc cleanup/fixes" > [2] and the resource name additions [3] were merged and available in > mainline 4.13-rc1. > > DTS nodes for the OMAP-L138 LCDK board will be added for a subsequent merge > window once these patches are picked up. > > Change summary for v2: > - Patches 1 and 2 are unchanged > - Binding in Patch 3 revised slightly to address Rob Herring's comments > - Patch 4 updated to deal with non-OF builds since Davinci platforms still > support non-DT boots. > > regards > Suman > > [1] http://marc.info/?l=linux-arm-kernel&m=149514538506046&w=2 Oops, pasted the wrong link, correct link is http://marc.info/?l=linux-arm-kernel&m=149583015432586&w=2 > [2] http://marc.info/?l=linux-arm-kernel&m=149514538506046&w=2 > [3] http://marc.info/?l=linux-kernel&m=149497287512869&w=2 > > Suman Anna (4): > remoteproc/davinci: Switch to platform_get_resource_byname() > remoteproc/davinci: Add support to parse internal memories > dt-bindings: remoteproc: Add bindings for Davinci DSP processors > remoteproc/davinci: Add device tree support for OMAP-L138 DSP > > .../bindings/remoteproc/ti,davinci-rproc.txt | 86 +++++++++++++++++++ > drivers/remoteproc/da8xx_remoteproc.c | 98 ++++++++++++++++++++-- > 2 files changed, 179 insertions(+), 5 deletions(-) > create mode 100644 Documentation/devicetree/bindings/remoteproc/ti,davinci-rproc.txt >
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web