From: Matt Porter <mporter@ti.com>
To: Tony Lindgren <tony@atomide.com>, Sekhar Nori <nsekhar@ti.com>,
Grant Likely <grant.likely@secretlab.ca>,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
Benoit Cousson <b-cousson@ti.com>,
Russell King <linux@arm.linux.org.uk>,
Vinod Koul <vinod.koul@intel.com>, Rob Landley <rob@landley.net>,
Chris Ball <cjb@laptop.org>
Cc: Devicetree Discuss <devicetree-discuss@lists.ozlabs.org>,
Linux OMAP List <linux-omap@vger.kernel.org>,
Linux ARM Kernel List <linux-arm-kernel@lists.infradead.org>,
Linux DaVinci Kernel List
<davinci-linux-open-source@linux.davincidsp.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux Documentation List <linux-doc@vger.kernel.org>,
Linux MMC List <linux-mmc@vger.kernel.org>,
Linux SPI Devel List <spi-devel-general@lists.sourceforge.net>,
Arnd Bergmann <arnd@arndb.de>, Dan Williams <djbw@fb.com>,
Rob Herring <rob.herring@calxeda.com>
Subject: [PATCH v7 03/10] ARM: edma: add AM33XX support to the private EDMA API
Date: Fri, 1 Feb 2013 13:22:48 -0500 [thread overview]
Message-ID: <1359742975-10421-4-git-send-email-mporter@ti.com> (raw)
In-Reply-To: <1359742975-10421-1-git-send-email-mporter@ti.com>
Adds support for parsing the TI EDMA DT data into the
required EDMA private API platform data. Enables runtime
PM support to initialize the EDMA hwmod. Adds AM33XX EDMA
crossbar event mux support. Enables build on OMAP.
Signed-off-by: Matt Porter <mporter@ti.com>
Acked-by: Sekhar Nori <nsekhar@ti.com>
---
arch/arm/common/edma.c | 96 ++++++++++++++++++++++++++++++++----
arch/arm/plat-omap/Kconfig | 1 +
include/linux/platform_data/edma.h | 1 +
3 files changed, 89 insertions(+), 9 deletions(-)
diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c
index 3440d16..bd2416a 100644
--- a/arch/arm/common/edma.c
+++ b/arch/arm/common/edma.c
@@ -24,6 +24,13 @@
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/slab.h>
+#include <linux/edma.h>
+#include <linux/err.h>
+#include <linux/of_address.h>
+#include <linux/of_device.h>
+#include <linux/of_dma.h>
+#include <linux/of_irq.h>
+#include <linux/pm_runtime.h>
#include <linux/platform_data/edma.h>
@@ -723,6 +730,9 @@ EXPORT_SYMBOL(edma_free_channel);
*/
int edma_alloc_slot(unsigned ctlr, int slot)
{
+ if (!edma_cc[ctlr])
+ return -EINVAL;
+
if (slot >= 0)
slot = EDMA_CHAN_SLOT(slot);
@@ -1575,27 +1585,69 @@ static struct of_dma_filter_info edma_filter_info = {
static int edma_probe(struct platform_device *pdev)
{
struct edma_soc_info **info = pdev->dev.platform_data;
+ struct edma_soc_info *ninfo[EDMA_MAX_CC] = {NULL, NULL};
+ struct edma_soc_info tmpinfo;
const s8 (*queue_priority_mapping)[2];
const s8 (*queue_tc_mapping)[2];
int i, j, off, ln, found = 0;
int status = -1;
const s16 (*rsv_chans)[2];
const s16 (*rsv_slots)[2];
+ const s16 (*xbar_chans)[2];
int irq[EDMA_MAX_CC] = {0, 0};
int err_irq[EDMA_MAX_CC] = {0, 0};
- struct resource *r[EDMA_MAX_CC] = {NULL};
+ struct resource *r[EDMA_MAX_CC] = {NULL, NULL};
+ struct resource res[EDMA_MAX_CC];
resource_size_t len[EDMA_MAX_CC];
char res_name[10];
char irq_name[10];
+ struct device_node *node = pdev->dev.of_node;
+ struct device *dev = &pdev->dev;
+ int ret;
+
+ if (node) {
+ /* Check if this is a second instance registered */
+ if (arch_num_cc) {
+ dev_err(dev, "only one EDMA instance is supported via DT\n");
+ return -ENODEV;
+ }
+ info = ninfo;
+ edma_of_parse_dt(dev, node, &tmpinfo);
+ info[0] = &tmpinfo;
+
+ dma_cap_set(DMA_SLAVE, edma_filter_info.dma_cap);
+ of_dma_controller_register(dev->of_node,
+ of_dma_simple_xlate,
+ &edma_filter_info);
+ }
if (!info)
return -ENODEV;
+ pm_runtime_enable(dev);
+ ret = pm_runtime_get_sync(dev);
+ if (IS_ERR_VALUE(ret)) {
+ dev_err(dev, "pm_runtime_get_sync() failed\n");
+ return ret;
+ }
+
for (j = 0; j < EDMA_MAX_CC; j++) {
- sprintf(res_name, "edma_cc%d", j);
- r[j] = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+ if (!info[j]) {
+ if (!found)
+ return -ENODEV;
+ break;
+ }
+ if (node) {
+ ret = of_address_to_resource(node, j, &res[j]);
+ if (!IS_ERR_VALUE(ret))
+ r[j] = &res[j];
+ } else {
+ sprintf(res_name, "edma_cc%d", j);
+ r[j] = platform_get_resource_byname(pdev,
+ IORESOURCE_MEM,
res_name);
- if (!r[j] || !info[j]) {
+ }
+ if (!r[j]) {
if (found)
break;
else
@@ -1670,8 +1722,22 @@ static int edma_probe(struct platform_device *pdev)
}
}
- sprintf(irq_name, "edma%d", j);
- irq[j] = platform_get_irq_byname(pdev, irq_name);
+ /* Clear the xbar mapped channels in unused list */
+ xbar_chans = info[j]->xbar_chans;
+ if (xbar_chans) {
+ for (i = 0; xbar_chans[i][1] != -1; i++) {
+ off = xbar_chans[i][1];
+ clear_bits(off, 1,
+ edma_cc[j]->edma_unused);
+ }
+ }
+
+ if (node)
+ irq[j] = irq_of_parse_and_map(node, 0);
+ else {
+ sprintf(irq_name, "edma%d", j);
+ irq[j] = platform_get_irq_byname(pdev, irq_name);
+ }
edma_cc[j]->irq_res_start = irq[j];
status = request_irq(irq[j], dma_irq_handler, 0, "edma",
&pdev->dev);
@@ -1681,8 +1747,12 @@ static int edma_probe(struct platform_device *pdev)
goto fail;
}
- sprintf(irq_name, "edma%d_err", j);
- err_irq[j] = platform_get_irq_byname(pdev, irq_name);
+ if (node)
+ err_irq[j] = irq_of_parse_and_map(node, 2);
+ else {
+ sprintf(irq_name, "edma%d_err", j);
+ err_irq[j] = platform_get_irq_byname(pdev, irq_name);
+ }
edma_cc[j]->irq_res_end = err_irq[j];
status = request_irq(err_irq[j], dma_ccerr_handler, 0,
"edma_error", &pdev->dev);
@@ -1743,9 +1813,17 @@ fail1:
return status;
}
+static const struct of_device_id edma_of_ids[] = {
+ { .compatible = "ti,edma3", },
+ {}
+};
static struct platform_driver edma_driver = {
- .driver.name = "edma",
+ .driver = {
+ .name = "edma",
+ .of_match_table = edma_of_ids,
+ },
+ .probe = edma_probe,
};
static int __init edma_init(void)
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index 665870d..0b81d6c 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -29,6 +29,7 @@ config ARCH_OMAP2PLUS
select PINCTRL
select PROC_DEVICETREE if PROC_FS
select SPARSE_IRQ
+ select TI_PRIV_EDMA
select USE_OF
help
"Systems based on OMAP2, OMAP3, OMAP4 or OMAP5"
diff --git a/include/linux/platform_data/edma.h b/include/linux/platform_data/edma.h
index 2344ea2..ffc1fb2 100644
--- a/include/linux/platform_data/edma.h
+++ b/include/linux/platform_data/edma.h
@@ -177,6 +177,7 @@ struct edma_soc_info {
const s8 (*queue_tc_mapping)[2];
const s8 (*queue_priority_mapping)[2];
+ const s16 (*xbar_chans)[2];
};
#endif
--
1.7.9.5
next prev parent reply other threads:[~2013-02-01 18:22 UTC|newest]
Thread overview: 82+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-01 18:22 [PATCH v7 00/10] DMA Engine support for AM33XX Matt Porter
2013-02-01 18:22 ` Matt Porter [this message]
2013-02-01 18:22 ` [PATCH v7 04/10] dmaengine: edma: enable build " Matt Porter
[not found] ` <1359742975-10421-1-git-send-email-mporter-l0cyMroinI0@public.gmane.org>
2013-02-01 18:22 ` [PATCH v7 01/10] ARM: davinci: move private EDMA API to arm/common Matt Porter
2013-02-01 18:41 ` Tony Lindgren
2013-02-02 12:49 ` Russell King - ARM Linux
2013-02-02 14:44 ` Matt Porter
[not found] ` <5022f635a527470dbd0be932063e9cd2@DFLE72.ent.ti.com>
2013-02-01 18:49 ` Matt Porter
[not found] ` <2077c13e12314dc3adc8e5b653855da0@DFLE72.ent.ti.com>
2013-02-01 18:59 ` Matt Porter
2013-02-02 0:01 ` Sergei Shtylyov
2013-02-02 12:45 ` Russell King - ARM Linux
2013-02-02 17:27 ` Sergei Shtylyov
[not found] ` <e9be6668da8b4372a04687847daa1d8c@DFLE72.ent.ti.com>
2013-02-02 18:07 ` Matt Porter
2013-02-02 18:16 ` Tony Lindgren
2013-02-02 19:48 ` Matt Porter
2013-02-02 21:02 ` Tony Lindgren
2013-02-02 19:06 ` Sergei Shtylyov
[not found] ` <3245316d7aa94b2e823f98b69497547d@DLEE74.ent.ti.com>
[not found] ` <3245316d7aa94b2e823f98b69497547d-0VoBT8GTp4aIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2013-02-02 19:55 ` Matt Porter
2013-02-02 20:18 ` Sergei Shtylyov
2013-02-01 19:52 ` Sergei Shtylyov
[not found] ` <510C1D0E.6030401-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
2013-02-01 18:58 ` Felipe Balbi
2013-02-01 20:49 ` Sergei Shtylyov
[not found] ` <510C2A47.1090607-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
2013-02-01 20:56 ` Felipe Balbi
2013-02-01 21:30 ` Russell King - ARM Linux
2013-02-02 0:07 ` Sergei Shtylyov
2013-02-02 0:44 ` Russell King - ARM Linux
[not found] ` <20130202004455.GX2637-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2013-02-02 2:09 ` Sergei Shtylyov
2013-02-02 10:18 ` Russell King - ARM Linux
2013-02-02 12:17 ` Russell King - ARM Linux
[not found] ` <20130202121738.GZ2637-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2013-02-02 17:02 ` Sergei Shtylyov
[not found] ` <20130202101851.GY2637-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2013-02-02 16:27 ` Sergei Shtylyov
2013-02-02 16:45 ` Russell King - ARM Linux
[not found] ` <20130202164522.GC2637-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2013-02-02 17:17 ` Sergei Shtylyov
[not found] ` <510C58DF.3010103-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
2013-02-04 14:27 ` Arnd Bergmann
2013-02-02 0:13 ` Sergei Shtylyov
[not found] ` <20130201213003.GW2637-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2013-02-04 15:41 ` Felipe Balbi
2013-02-04 15:45 ` Russell King - ARM Linux
2013-02-04 17:36 ` Sergei Shtylyov
2013-02-04 16:47 ` Felipe Balbi
2013-02-04 17:10 ` Russell King - ARM Linux
2013-02-04 17:54 ` Sergei Shtylyov
[not found] ` <510FF5C9.3030600-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
2013-02-04 17:02 ` Felipe Balbi
2013-02-04 18:22 ` Sergei Shtylyov
[not found] ` <20130204170216.GC4269-S8G//mZuvNWo5Im9Ml3/Zg@public.gmane.org>
2013-02-04 19:22 ` Cyril Chemparathy
2013-02-04 20:29 ` Linus Walleij
2013-02-04 20:33 ` Mark Brown
2013-02-04 21:11 ` Linus Walleij
[not found] ` <CACRpkdbPyZt8=pLhz-5qcaSSAk6VBn61dPTNp6teU9HksBwN2w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-04 21:47 ` Arnd Bergmann
2013-02-05 12:38 ` Russell King - ARM Linux
[not found] ` <20130205123828.GB17852-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2013-02-05 15:37 ` Cyril Chemparathy
2013-02-04 21:54 ` Cyril Chemparathy
2013-02-05 12:41 ` Russell King - ARM Linux
[not found] ` <20130205124120.GC17852-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2013-02-05 15:42 ` Cyril Chemparathy
2013-02-05 15:30 ` Linus Walleij
2013-02-05 17:14 ` Russell King - ARM Linux
[not found] ` <20130205171451.GE17852-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2013-02-05 18:33 ` Linus Walleij
[not found] ` <CACRpkdZihnp3_Df==QRWxQupgi7W_YXZxc-MxkusVH6J+Vx56A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-04 22:30 ` Cyril Chemparathy
[not found] ` <5110369B.9060901-l0cyMroinI0@public.gmane.org>
2013-02-05 16:21 ` Linus Walleij
2013-02-05 16:47 ` Mark Brown
2013-02-05 17:06 ` Russell King - ARM Linux
2013-02-05 17:41 ` Mark Brown
2013-02-05 18:29 ` Linus Walleij
[not found] ` <CACRpkdbeoMO1rjPiWDAuVL0uYwMGF+9-vCxqoMiMd1uAgZm=RQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-05 19:45 ` Cyril Chemparathy
2013-02-05 18:28 ` Tony Lindgren
[not found] ` <20130205182848.GJ25185-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2013-02-05 22:26 ` Arnd Bergmann
[not found] ` <201302052226.30754.arnd-r2nGTMty4D4@public.gmane.org>
2013-02-06 7:45 ` Felipe Balbi
2013-02-01 23:10 ` Sergei Shtylyov
[not found] ` <1359742975-10421-2-git-send-email-mporter-l0cyMroinI0@public.gmane.org>
2013-02-09 16:05 ` Sekhar Nori
2013-02-09 20:08 ` Russell King - ARM Linux
2013-03-04 22:05 ` Matt Porter
[not found] ` <e92425fefcc04bb4ab739ec8d4e82672@DLEE74.ent.ti.com>
[not found] ` <e92425fefcc04bb4ab739ec8d4e82672-0VoBT8GTp4aIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2013-03-04 22:12 ` Matt Porter
2013-02-01 18:22 ` [PATCH v7 02/10] ARM: edma: remove unused transfer controller handlers Matt Porter
2013-02-01 18:22 ` [PATCH v7 05/10] dmaengine: edma: Add TI EDMA device tree binding Matt Porter
2013-02-01 18:26 ` Matt Porter
2013-02-01 18:22 ` [PATCH v7 06/10] ARM: dts: add AM33XX EDMA support Matt Porter
2013-02-01 18:22 ` [PATCH v7 07/10] dmaengine: add dma_request_slave_channel_compat() Matt Porter
2013-02-01 18:28 ` Matt Porter
2013-02-12 16:38 ` Vinod Koul
2013-02-01 18:22 ` [PATCH v7 08/10] spi: omap2-mcspi: convert to dma_request_slave_channel_compat() Matt Porter
2013-02-01 18:22 ` [PATCH v7 09/10] spi: omap2-mcspi: add generic DMA request support to the DT binding Matt Porter
2013-02-01 18:22 ` [PATCH v7 10/10] ARM: dts: add AM33XX SPI DMA support Matt Porter
2013-02-01 18:32 ` [PATCH v7 00/10] DMA Engine support for AM33XX Matt Porter
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=1359742975-10421-4-git-send-email-mporter@ti.com \
--to=mporter@ti.com \
--cc=arnd@arndb.de \
--cc=b-cousson@ti.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=cjb@laptop.org \
--cc=davinci-linux-open-source@linux.davincidsp.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=djbw@fb.com \
--cc=grant.likely@secretlab.ca \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=nsekhar@ti.com \
--cc=rob.herring@calxeda.com \
--cc=rob@landley.net \
--cc=spi-devel-general@lists.sourceforge.net \
--cc=tony@atomide.com \
--cc=vinod.koul@intel.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;
as well as URLs for NNTP newsgroup(s).