devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/9] drivers: dma: Add support for dma-channel router
@ 2014-03-07 12:16 Sricharan R
  2014-03-07 12:16 ` [RFC PATCH 1/9] drivers: dma: omap-dma: Avoid hard-coding of the dma-request channels Sricharan R
                   ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: Sricharan R @ 2014-03-07 12:16 UTC (permalink / raw)
  To: r.sricharan-l0cyMroinI0, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	dmaengine-u79uwXL29TY76Z2rM5mHXA
  Cc: santosh.shilimkar-l0cyMroinI0, rnayak-l0cyMroinI0,
	nsekhar-l0cyMroinI0, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	linux-lFZ/pmaqli7XmaaqVzeoHQ, vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
	dan.j.williams-ral2JQCrhuEAvxtiuMwx3w, nm-l0cyMroinI0

In some SoCs the dma request lines from the peripherals are
routed to the dma-controller through a crossbar. With this the
dma controller's available request lines are shared between the
peripherals.

This adds support to register the crossbar router associated with
a dma-channel and let the dma-controller driver map/unmap
the peripheral dma crossbar line to dma-controller's request
line.

This is on top of Russell's OMAP dma engine rework series

	http://www.spinics.net/lists/linux-omap/msg102969.html

Sricharan R (9):
  drivers: dma: omap-dma: Avoid hard-coding of the dma-request channels
  drivers: dma: of-dma: Add support for dma-request line routers
  drivers: dma: omap-dma: Add a seperate xlate function to get router
    data
  drivers: omap-dma: Add crossbar line as a resource to omap_chan
    structure
  drivers: dma: Add dma crossbar driver
  arm: dts: dra: Add dma crossbar node
  arm: dts: dra: Add dma-request router phandle to dma-specs
  arm: dra: Enable dma crossbar support on dra7xx
  arm: dts: dra7: Change the total dma-req numbers to crossbar channels

 .../devicetree/bindings/arm/omap/dma-crossbar.txt  |   26 +++
 arch/arm/boot/dts/dra7.dtsi                        |   47 +++--
 arch/arm/configs/omap2plus_defconfig               |    1 +
 drivers/dma/Kconfig                                |    7 +
 drivers/dma/Makefile                               |    1 +
 drivers/dma/of-dma.c                               |   82 +++++++-
 drivers/dma/omap-dma-xbar.c                        |  219 ++++++++++++++++++++
 drivers/dma/omap-dma-xbar.h                        |   32 +++
 drivers/dma/omap-dma.c                             |   72 ++++++-
 include/linux/of_dma.h                             |   22 ++
 10 files changed, 479 insertions(+), 30 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/omap/dma-crossbar.txt
 create mode 100644 drivers/dma/omap-dma-xbar.c
 create mode 100644 drivers/dma/omap-dma-xbar.h

-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [RFC PATCH 1/9] drivers: dma: omap-dma: Avoid hard-coding of the dma-request channels
  2014-03-07 12:16 [RFC PATCH 0/9] drivers: dma: Add support for dma-channel router Sricharan R
@ 2014-03-07 12:16 ` Sricharan R
  2014-03-07 12:16 ` [RFC PATCH 2/9] drivers: dma: of-dma: Add support for dma-request line routers Sricharan R
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Sricharan R @ 2014-03-07 12:16 UTC (permalink / raw)
  To: r.sricharan, devicetree, linux-kernel, linux-arm-kernel,
	linux-omap, dmaengine
  Cc: santosh.shilimkar, rnayak, nsekhar, tony, linux, vinod.koul,
	dan.j.williams, nm

The total number of dma-request channels is hard-coded. Instead read the
data from DT.

Signed-off-by: Sricharan R <r.sricharan@ti.com>
---
 drivers/dma/omap-dma.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c
index 64ceca2..a0d6639 100644
--- a/drivers/dma/omap-dma.c
+++ b/drivers/dma/omap-dma.c
@@ -1093,6 +1093,7 @@ static int omap_dma_probe(struct platform_device *pdev)
 	struct omap_dmadev *od;
 	struct resource *res;
 	int rc, i, irq;
+	u32 reqs;
 
 	od = devm_kzalloc(&pdev->dev, sizeof(*od), GFP_KERNEL);
 	if (!od)
@@ -1126,7 +1127,9 @@ static int omap_dma_probe(struct platform_device *pdev)
 
 	tasklet_init(&od->task, omap_dma_sched, (unsigned long)od);
 
-	for (i = 0; i < 127; i++) {
+	of_property_read_u32(pdev->dev.of_node, "#dma-requests", &reqs);
+
+	for (i = 0; i < reqs; i++) {
 		rc = omap_dma_chan_init(od, i);
 		if (rc) {
 			omap_dma_free(od);
-- 
1.7.9.5


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

* [RFC PATCH 2/9] drivers: dma: of-dma: Add support for dma-request line routers
  2014-03-07 12:16 [RFC PATCH 0/9] drivers: dma: Add support for dma-channel router Sricharan R
  2014-03-07 12:16 ` [RFC PATCH 1/9] drivers: dma: omap-dma: Avoid hard-coding of the dma-request channels Sricharan R
@ 2014-03-07 12:16 ` Sricharan R
  2014-03-07 12:16 ` [RFC PATCH 3/9] drivers: dma: omap-dma: Add a seperate xlate function to get router data Sricharan R
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Sricharan R @ 2014-03-07 12:16 UTC (permalink / raw)
  To: r.sricharan, devicetree, linux-kernel, linux-arm-kernel,
	linux-omap, dmaengine
  Cc: nm, linux, tony, rnayak, nsekhar, vinod.koul, santosh.shilimkar,
	dan.j.williams

In some socs dma requests lines from the peripherals to the
dma controller can be connected either directly or through
a crossbar router. The crossbar in turn maps the peripheral
request line to a free dma-controller request line. In such
cases the crossbar associated with the particular request lines
has to configured.

This add two APIS, one to register the crossbar router and other
to retrieve the router associated with a dma request line. The
peripheral's dma-specs mentions the dma-controller, request-line and
also the IP to which it is connected to via DT.

The dma-controller will have to check if a request line is routed
and then use that router's map/unmap function to configure the
request line.

Signed-off-by: Sricharan R <r.sricharan@ti.com>
---
 drivers/dma/of-dma.c   |   82 ++++++++++++++++++++++++++++++++++++++++++++++--
 include/linux/of_dma.h |   22 +++++++++++++
 2 files changed, 102 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/of-dma.c b/drivers/dma/of-dma.c
index e8fe9dc..86129ef 100644
--- a/drivers/dma/of-dma.c
+++ b/drivers/dma/of-dma.c
@@ -19,7 +19,29 @@
 #include <linux/of_dma.h>
 
 static LIST_HEAD(of_dma_list);
+static LIST_HEAD(of_dma_router_list);
 static DEFINE_MUTEX(of_dma_lock);
+static DEFINE_MUTEX(of_dma_router_lock);
+
+/**
+ * of_dma_get_router_data - Get a DMA router in DT DMA routers list
+ * @phandle:	phandle to the dma router
+ *
+ * Finds a DMA router using matching phandle and returns the router
+ * specific data. Should be called from dma-controller xlate callback.
+ */
+void *of_dma_get_router_data(phandle router)
+{
+	struct of_dma_router *ofrouter;
+
+	list_for_each_entry(ofrouter, &of_dma_router_list, of_dma_routers) {
+		if (ofrouter->of_node->phandle == router)
+			return ofrouter->of_router_data;
+	}
+
+	return NULL;
+}
+EXPORT_SYMBOL(of_dma_get_router_data);
 
 /**
  * of_dma_find_controller - Get a DMA controller in DT DMA helpers list
@@ -45,6 +67,39 @@ static struct of_dma *of_dma_find_controller(struct of_phandle_args *dma_spec)
 }
 
 /**
+ * of_dma_router_register - Register a DMA router to DT DMA helpers
+ * @np:			device node of DMA controller
+ * @data		pointer to controller specific data to be used by
+ *			dma-controller
+ *
+ * Returns 0 on success or appropriate errno value on error.
+ *
+ * Allocated memory should be freed with appropriate of_dma_router_free()
+ * call.
+ */
+int of_dma_router_register(struct device_node *np, void *data)
+{
+	struct of_dma_router *ofrouter;
+
+	if (!np || !data)
+		return -EINVAL;
+
+	ofrouter = kzalloc(sizeof(*ofrouter), GFP_KERNEL);
+	if (!ofrouter)
+		return -ENOMEM;
+
+	ofrouter->of_node = np;
+	ofrouter->of_router_data = data;
+
+	mutex_lock(&of_dma_router_lock);
+	list_add_tail(&ofrouter->of_dma_routers, &of_dma_router_list);
+	mutex_unlock(&of_dma_router_lock);
+
+	return 0;
+}
+EXPORT_SYMBOL(of_dma_router_register);
+
+/**
  * of_dma_controller_register - Register a DMA controller to DT DMA helpers
  * @np:			device node of DMA controller
  * @of_dma_xlate:	translation function which converts a phandle
@@ -87,10 +142,10 @@ int of_dma_controller_register(struct device_node *np,
 EXPORT_SYMBOL_GPL(of_dma_controller_register);
 
 /**
- * of_dma_controller_free - Remove a DMA controller from DT DMA helpers list
+ * of_dma_router_free - Remove a DMA router from DT DMA routers list
  * @np:		device node of DMA controller
  *
- * Memory allocated by of_dma_controller_register() is freed here.
+ * Memory allocated by of_dma_router_register() is freed here.
  */
 void of_dma_controller_free(struct device_node *np)
 {
@@ -110,6 +165,29 @@ void of_dma_controller_free(struct device_node *np)
 EXPORT_SYMBOL_GPL(of_dma_controller_free);
 
 /**
+ * of_dma_controller_free - Remove a DMA controller from DT DMA helpers list
+ * @np:		device node of DMA controller
+ *
+ * Memory allocated by of_dma_router_register() is freed here.
+ */
+void of_dma_router_free(struct device_node *np)
+{
+	struct of_dma_router *ofrouter;
+
+	mutex_lock(&of_dma_router_lock);
+
+	list_for_each_entry(ofrouter, &of_dma_router_list, of_dma_routers)
+		if (ofrouter->of_node == np) {
+			list_del(&ofrouter->of_dma_routers);
+			kfree(ofrouter);
+			break;
+		}
+
+	mutex_unlock(&of_dma_router_lock);
+}
+EXPORT_SYMBOL_GPL(of_dma_router_free);
+
+/**
  * of_dma_match_channel - Check if a DMA specifier matches name
  * @np:		device node to look for DMA channels
  * @name:	channel name to be matched
diff --git a/include/linux/of_dma.h b/include/linux/of_dma.h
index ae36298..50962a0 100644
--- a/include/linux/of_dma.h
+++ b/include/linux/of_dma.h
@@ -26,6 +26,12 @@ struct of_dma {
 	void			*of_dma_data;
 };
 
+struct of_dma_router {
+	struct list_head	of_dma_routers;
+	struct device_node	*of_node;
+	void			*of_router_data;
+};
+
 struct of_dma_filter_info {
 	dma_cap_mask_t	dma_cap;
 	dma_filter_fn	filter_fn;
@@ -41,6 +47,9 @@ extern struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
 						     const char *name);
 extern struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
 		struct of_dma *ofdma);
+extern void *of_dma_get_router_data(phandle router);
+extern int of_dma_router_register(struct device_node *np, void *data);
+extern void of_dma_router_free(struct device_node *np);
 #else
 static inline int of_dma_controller_register(struct device_node *np,
 		struct dma_chan *(*of_dma_xlate)
@@ -66,6 +75,19 @@ static inline struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_s
 	return NULL;
 }
 
+static inline void *of_dma_get_router_data(phandle router)
+{
+	return NULL;
+}
+
+static inline int of_dma_router_register(struct device_node *np, void *data)
+{
+	return NULL;
+}
+
+static void of_dma_router_free(struct device_node *np)
+{
+}
 #endif
 
 #endif /* __LINUX_OF_DMA_H */
-- 
1.7.9.5

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

* [RFC PATCH 3/9] drivers: dma: omap-dma: Add a seperate xlate function to get router data
  2014-03-07 12:16 [RFC PATCH 0/9] drivers: dma: Add support for dma-channel router Sricharan R
  2014-03-07 12:16 ` [RFC PATCH 1/9] drivers: dma: omap-dma: Avoid hard-coding of the dma-request channels Sricharan R
  2014-03-07 12:16 ` [RFC PATCH 2/9] drivers: dma: of-dma: Add support for dma-request line routers Sricharan R
@ 2014-03-07 12:16 ` Sricharan R
  2014-03-07 12:16 ` [RFC PATCH 4/9] drivers: omap-dma: Add crossbar line as a resource to omap_chan structure Sricharan R
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Sricharan R @ 2014-03-07 12:16 UTC (permalink / raw)
  To: r.sricharan, devicetree, linux-kernel, linux-arm-kernel,
	linux-omap, dmaengine
  Cc: santosh.shilimkar, rnayak, nsekhar, tony, linux, vinod.koul,
	dan.j.williams, nm

Each dma-request channel can be connected to the dma-controller either
directly or through a crossbar router. In such cases request lines
should be routed to the dma-controller. Adding a xlate function
which would retrieve and store the router data associated with a particular
channel in the dma-channel specific structure. This is used to map/unmap
the dma request lines.

Signed-off-by: Sricharan R <r.sricharan@ti.com>
---
 drivers/dma/omap-dma.c |   47 ++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 44 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c
index a0d6639..38407f9 100644
--- a/drivers/dma/omap-dma.c
+++ b/drivers/dma/omap-dma.c
@@ -44,6 +44,8 @@ struct omap_chan {
 	uint32_t ccr;
 
 	struct dma_slave_config	cfg;
+	struct dma_xbar_device *router;
+
 	unsigned dma_sig;
 	bool cyclic;
 	bool paused;
@@ -75,6 +77,11 @@ struct omap_desc {
 	struct omap_sg sg[0];
 };
 
+struct omap_dma_filter_args {
+	void *router_data;
+	unsigned chan;
+};
+
 enum {
 	CCR_FS			= BIT(5),
 	CCR_READ_PRIORITY	= BIT(6),
@@ -586,6 +593,7 @@ static void omap_dma_free_chan_resources(struct dma_chan *chan)
 	c->channel_base = NULL;
 	od->lch_map[c->dma_ch] = NULL;
 	vchan_free_chan_resources(&c->vc);
+
 	omap_free_dma(c->dma_ch);
 
 	dev_dbg(od->ddev.dev, "freeing channel for %u\n", c->dma_sig);
@@ -1088,6 +1096,34 @@ static void omap_dma_free(struct omap_dmadev *od)
 	}
 }
 
+static struct dma_chan *of_omap_dma_xlate(struct of_phandle_args *dma_spec,
+						 struct of_dma *ofdma)
+{
+	int count = dma_spec->args_count;
+	struct of_dma_filter_info *info = ofdma->of_dma_data;
+	struct omap_dma_filter_args args;
+	struct dma_xbar_device *c = NULL;
+
+	if (!info || !info->filter_fn)
+		return NULL;
+
+	if ((count != 1) && (count != 2))
+		return NULL;
+
+	args.chan = dma_spec->args[0];
+	args.router_data = NULL;
+
+	if (count == 2) {
+		c = of_dma_get_router_data(dma_spec->args[1]);
+
+		if (c && c->ops && c->ops->map && c->ops->unmap)
+			args.router_data = c;
+	}
+
+	return dma_request_channel(info->dma_cap, info->filter_fn,
+			&args);
+}
+
 static int omap_dma_probe(struct platform_device *pdev)
 {
 	struct omap_dmadev *od;
@@ -1167,7 +1203,7 @@ static int omap_dma_probe(struct platform_device *pdev)
 
 		/* Device-tree DMA controller registration */
 		rc = of_dma_controller_register(pdev->dev.of_node,
-				of_dma_simple_xlate, &omap_dma_info);
+				of_omap_dma_xlate, &omap_dma_info);
 		if (rc) {
 			pr_warn("OMAP-DMA: failed to register DMA controller\n");
 			dma_async_device_unregister(&od->ddev);
@@ -1221,11 +1257,16 @@ static struct platform_driver omap_dma_driver = {
 
 bool omap_dma_filter_fn(struct dma_chan *chan, void *param)
 {
+	struct omap_dma_filter_args *args = param;
+
 	if (chan->device->dev->driver == &omap_dma_driver.driver) {
 		struct omap_chan *c = to_omap_dma_chan(chan);
-		unsigned req = *(unsigned *)param;
+		unsigned req = args->chan;
 
-		return req == c->dma_sig;
+		if (req == c->dma_sig) {
+			c->router = args->router_data;
+			return true;
+		}
 	}
 	return false;
 }
-- 
1.7.9.5

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

* [RFC PATCH 4/9] drivers: omap-dma: Add crossbar line as a resource to omap_chan structure
  2014-03-07 12:16 [RFC PATCH 0/9] drivers: dma: Add support for dma-channel router Sricharan R
                   ` (2 preceding siblings ...)
  2014-03-07 12:16 ` [RFC PATCH 3/9] drivers: dma: omap-dma: Add a seperate xlate function to get router data Sricharan R
@ 2014-03-07 12:16 ` Sricharan R
  2014-03-07 12:16 ` [RFC PATCH 5/9] drivers: dma: Add dma crossbar driver Sricharan R
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Sricharan R @ 2014-03-07 12:16 UTC (permalink / raw)
  To: r.sricharan, devicetree, linux-kernel, linux-arm-kernel,
	linux-omap, dmaengine
  Cc: santosh.shilimkar, rnayak, nsekhar, tony, linux, vinod.koul,
	dan.j.williams, nm

In socs which have crossbar to route the peripheral dma request
line to the dma controller, only the peripheral crossbar request line
number is fixed and this is passed through the DT nodes. The dma request
channel to be used is allocated dynamically.

The total number of crossbar channels are registered during probe a
the dma request line free is mapped using the registered router's map function
during the device_alloc_chan_resource callback and freed with free_resource.
When a router is not registered, the dma request number is same as the
crossbar number.

Signed-off-by: Sricharan R <r.sricharan@ti.com>
---
 drivers/dma/omap-dma.c |   21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c
index 38407f9..05ac480 100644
--- a/drivers/dma/omap-dma.c
+++ b/drivers/dma/omap-dma.c
@@ -47,6 +47,7 @@ struct omap_chan {
 	struct dma_xbar_device *router;
 
 	unsigned dma_sig;
+	unsigned dma_xbar;
 	bool cyclic;
 	bool paused;
 
@@ -530,6 +531,11 @@ static int omap_dma_alloc_chan_resources(struct dma_chan *chan)
 	struct omap_chan *c = to_omap_dma_chan(chan);
 	int ret;
 
+	if (c->router)
+		c->dma_sig = c->router->ops->map(c->dma_xbar, c->router);
+	else
+		c->dma_sig = c->dma_xbar;
+
 	if (od->legacy) {
 		ret = omap_request_dma(c->dma_sig, "DMA engine",
 				       omap_dma_callback, c, &c->dma_ch);
@@ -539,7 +545,7 @@ static int omap_dma_alloc_chan_resources(struct dma_chan *chan)
 	}
 
 	dev_dbg(od->ddev.dev, "allocating channel %u for %u\n",
-		c->dma_ch, c->dma_sig);
+		c->dma_ch, c->dma_xbar);
 
 	if (ret >= 0) {
 		omap_dma_assign(od, c, c->dma_ch);
@@ -594,9 +600,14 @@ static void omap_dma_free_chan_resources(struct dma_chan *chan)
 	od->lch_map[c->dma_ch] = NULL;
 	vchan_free_chan_resources(&c->vc);
 
+	if (c->router) {
+		c->router->ops->unmap(c->dma_sig, c->router);
+		c->dma_sig = 0;
+	}
+
 	omap_free_dma(c->dma_ch);
 
-	dev_dbg(od->ddev.dev, "freeing channel for %u\n", c->dma_sig);
+	dev_dbg(od->ddev.dev, "freeing channel for %u\n", c->dma_xbar);
 }
 
 static size_t omap_dma_sg_size(struct omap_sg *sg)
@@ -1064,7 +1075,7 @@ static int omap_dma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
 	return ret;
 }
 
-static int omap_dma_chan_init(struct omap_dmadev *od, int dma_sig)
+static int omap_dma_chan_init(struct omap_dmadev *od, int dma_xbar)
 {
 	struct omap_chan *c;
 
@@ -1073,7 +1084,7 @@ static int omap_dma_chan_init(struct omap_dmadev *od, int dma_sig)
 		return -ENOMEM;
 
 	c->reg_map = od->reg_map;
-	c->dma_sig = dma_sig;
+	c->dma_xbar = dma_xbar;
 	c->vc.desc_free = omap_dma_desc_free;
 	vchan_init(&c->vc, &od->ddev);
 	INIT_LIST_HEAD(&c->node);
@@ -1263,7 +1274,7 @@ bool omap_dma_filter_fn(struct dma_chan *chan, void *param)
 		struct omap_chan *c = to_omap_dma_chan(chan);
 		unsigned req = args->chan;
 
-		if (req == c->dma_sig) {
+		if (req == c->dma_xbar) {
 			c->router = args->router_data;
 			return true;
 		}
-- 
1.7.9.5

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

* [RFC PATCH 5/9] drivers: dma: Add dma crossbar driver
  2014-03-07 12:16 [RFC PATCH 0/9] drivers: dma: Add support for dma-channel router Sricharan R
                   ` (3 preceding siblings ...)
  2014-03-07 12:16 ` [RFC PATCH 4/9] drivers: omap-dma: Add crossbar line as a resource to omap_chan structure Sricharan R
@ 2014-03-07 12:16 ` Sricharan R
  2014-03-07 12:16 ` [RFC PATCH 6/9] arm: dts: dra: Add dma crossbar node Sricharan R
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Sricharan R @ 2014-03-07 12:16 UTC (permalink / raw)
  To: r.sricharan, devicetree, linux-kernel, linux-arm-kernel,
	linux-omap, dmaengine
  Cc: santosh.shilimkar, rnayak, nsekhar, tony, linux, vinod.koul,
	dan.j.williams, nm

DRA7XX dma controller IP's are preceded by a crossbar which
routes the dma requests from the peripherals to the dma
request input lines of the appropriate dma controller.
With this the dma controller's available request lines
are shared between the peripherals.

The driver maintains a list of free dma request lines and
allocates one during the map callback which is invoked as
a part the dma engine driver's device_alloc_chan_resources
callback. The allocated request line is freed during the
device_free_chan_resources.

Signed-off-by: Sricharan R <r.sricharan@ti.com>
---
 .../devicetree/bindings/arm/omap/dma-crossbar.txt  |   26 +++
 drivers/dma/Kconfig                                |    7 +
 drivers/dma/Makefile                               |    1 +
 drivers/dma/omap-dma-xbar.c                        |  219 ++++++++++++++++++++
 drivers/dma/omap-dma-xbar.h                        |   32 +++
 drivers/dma/omap-dma.c                             |    1 +
 6 files changed, 286 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/omap/dma-crossbar.txt
 create mode 100644 drivers/dma/omap-dma-xbar.c
 create mode 100644 drivers/dma/omap-dma-xbar.h

diff --git a/Documentation/devicetree/bindings/arm/omap/dma-crossbar.txt b/Documentation/devicetree/bindings/arm/omap/dma-crossbar.txt
new file mode 100644
index 0000000..feac013
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/omap/dma-crossbar.txt
@@ -0,0 +1,26 @@
+Some socs have a crossbar ip which muxes the dma requests
+from the peripherals to the dma request input lines of the
+appropriate dma controller. With this the dma controller's
+available request lines are shared between the peripherals
+
+Required properties:
+- compatible : Should be "ti,dma-crossbar"
+- reg: Base address and the size of the crossbar registers.
+- ti,dma-reqs: Total number of dma request lines available at dma controller.
+- ti,reg-size: Size of a individual register in bytes. Every individual
+	    register is assumed to be of same size. Valid sizes are 1, 2, 4.
+- ti,dmas-reserved: List of the reserved dma lines that are not muxed using
+		 crossbar. These dma lines are reserved in the soc,
+		 so crossbar bar driver should not consider them as free
+		 lines. This is a table of dma request-number and a count of
+		 reserved values from that number.
+
+Examples:
+		crossbar_dma: crossbar@4a020000 {
+			compatible = "ti,dma-crossbar";
+			reg = <0x4a002b78 0x100>;
+			ti,dma-reqs = <160>;
+			ti,reg-size = <2>;
+			ti,dmas-reserved = < 2, 5,
+					     10, 2 >;
+		};
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index 9bed1a2..7e8d3f4 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -400,4 +400,11 @@ config DMATEST
 config DMA_ENGINE_RAID
 	bool
 
+config OMAP_DMA_CROSSBAR
+	bool "OMAP dma crossbar support"
+	depends on DMA_OMAP
+	help
+	  This enables the dma crossbar ip support to dynamically map the
+	  peripheral dma request lines to the dma controller's input.
+
 endif
diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile
index a029d0f4..d84190e 100644
--- a/drivers/dma/Makefile
+++ b/drivers/dma/Makefile
@@ -44,3 +44,4 @@ obj-$(CONFIG_DMA_JZ4740) += dma-jz4740.o
 obj-$(CONFIG_TI_CPPI41) += cppi41.o
 obj-$(CONFIG_K3_DMA) += k3dma.o
 obj-$(CONFIG_MOXART_DMA) += moxart-dma.o
+obj-$(CONFIG_OMAP_DMA_CROSSBAR) += omap-dma-xbar.o
diff --git a/drivers/dma/omap-dma-xbar.c b/drivers/dma/omap-dma-xbar.c
new file mode 100644
index 0000000..bed2923
--- /dev/null
+++ b/drivers/dma/omap-dma-xbar.c
@@ -0,0 +1,219 @@
+/*
+ *  Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com
+ *  Author: Sricharan R <r.sricharan@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+#include <linux/slab.h>
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/list.h>
+#include <linux/io.h>
+#include <linux/of_address.h>
+#include <linux/of_device.h>
+#include <linux/of_dma.h>
+#include <linux/module.h>
+
+#include "omap-dma-xbar.h"
+
+static struct platform_device *pd_xbar;
+
+static void dma_xbar_writeb(int dma_sig, int dma_xbar,
+			    struct dma_xbar_device *xbar)
+{
+	writeb(dma_xbar, xbar->dma_xbar_base + xbar->reg_offs[dma_sig]);
+}
+
+static void dma_xbar_writew(int dma_sig, int dma_xbar,
+			    struct dma_xbar_device *xbar)
+{
+	writew(dma_xbar, xbar->dma_xbar_base + xbar->reg_offs[dma_sig]);
+}
+
+static void dma_xbar_writel(int dma_sig, int dma_xbar,
+			    struct dma_xbar_device *xbar)
+{
+	writel(dma_xbar, xbar->dma_xbar_base + xbar->reg_offs[dma_sig]);
+}
+
+static uint32_t dma_xbar_map(uint32_t dma_xbar, struct dma_xbar_device *xbar)
+{
+	struct dma_req *r;
+	uint32_t dma_sig;
+
+	if (!list_empty(&xbar->free_reqs))
+		r = list_first_entry(&xbar->free_reqs, struct dma_req, node);
+	else
+		return -ENODEV;
+
+	dma_sig = r->req_line;
+	list_del(&r->node);
+
+	xbar->write(dma_sig - 1, dma_xbar, xbar);
+
+	return dma_sig;
+}
+
+static void dma_xbar_unmap(uint32_t dma_sig, struct dma_xbar_device *xbar)
+{
+	struct dma_req *r;
+
+	r = devm_kzalloc(&pd_xbar->dev, sizeof(*r), GFP_KERNEL);
+	r->req_line = dma_sig;
+
+	list_add_tail(&r->node, &xbar->free_reqs);
+}
+
+const struct xbar_ops dma_xbar_ops = {
+	.map = dma_xbar_map,
+	.unmap = dma_xbar_unmap,
+};
+
+static int __init omap_dma_xbar_probe(struct platform_device *pdev)
+{
+	int i, j, reserved = 0;
+	const __be32 *dmar;
+	uint32_t *dma_map, max, size, entry, range;
+	struct dma_req *p;
+	struct resource *res;
+	struct dma_xbar_device *xbar;
+
+	pd_xbar = pdev;
+
+	xbar = devm_kzalloc(&pdev->dev, sizeof(*xbar), GFP_KERNEL);
+	if (!xbar)
+		return -ENOMEM;
+
+	xbar->ops = &dma_xbar_ops;
+
+	INIT_LIST_HEAD(&xbar->free_reqs);
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	xbar->dma_xbar_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(xbar->dma_xbar_base))
+		return PTR_ERR(xbar->dma_xbar_base);
+
+	of_property_read_u32(pdev->dev.of_node, "ti,dma-reqs", &max);
+	dma_map = kzalloc(max * sizeof(*dma_map), GFP_KERNEL);
+	if (!dma_map)
+		return -ENOMEM;
+
+	/* Get and mark reserved dma req lines */
+	dmar = of_get_property(pdev->dev.of_node, "ti,dmas-reserved", &size);
+	if (dmar) {
+		size /= sizeof(__be32);
+
+		for (i = 0; i < size; i++) {
+			of_property_read_u32_index(pdev->dev.of_node,
+						   "ti,dmas-reserved",
+						   i++, &entry);
+			of_property_read_u32_index(pdev->dev.of_node,
+						   "ti,dmas-reserved",
+						   i, &range);
+			if ((entry + range > max) ||
+			    ((entry + range) <= entry)) {
+				pr_err("Invalid reserved entry\n");
+				return -ENODEV;
+			}
+
+			for (j = entry; j <= range; j++)
+				dma_map[j] = 1;
+
+			/* For a single entry */
+			if (!range)
+				dma_map[entry] = 1;
+		}
+	}
+
+	/* Add the free dma req lines to free list */
+	for (j = 1; j < max; j++) {
+		if (!dma_map[j]) {
+			p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL);
+			p->req_line = j;
+			list_add_tail(&p->node, &xbar->free_reqs);
+		}
+	}
+
+	xbar->reg_offs = devm_kzalloc(&pdev->dev, max * sizeof(int),
+				      GFP_KERNEL);
+	if (!xbar->reg_offs)
+		return -ENOMEM;
+
+	of_property_read_u32(pdev->dev.of_node, "ti,reg-size", &size);
+
+	switch (size) {
+	case 1:
+		xbar->write = dma_xbar_writeb;
+		break;
+	case 2:
+		xbar->write = dma_xbar_writew;
+		break;
+	case 4:
+		xbar->write = dma_xbar_writel;
+		break;
+	default:
+		pr_err("Invalid reg-size property\n");
+		return -ENODEV;
+		break;
+	}
+
+	/*
+	 * Register offsets are not linear because of the
+	 * reserved lines. so find and store the offsets once.
+	 */
+	for (i = 0; i < max; i++) {
+		if (dma_map[i])
+			continue;
+
+		xbar->reg_offs[i] = reserved;
+		reserved += size;
+	}
+
+	if (of_dma_router_register(pdev->dev.of_node, xbar))
+		return -ENODEV;
+
+	kfree(dma_map);
+	return 0;
+}
+
+static int omap_dma_xbar_remove(struct platform_device *pdev)
+{
+	if (pdev->dev.of_node)
+		of_dma_router_free(pdev->dev.of_node);
+
+	return 0;
+}
+
+static const struct of_device_id dma_xbar_match[] __initconst = {
+	{ .compatible = "ti,dma-xbar" },
+	{},
+};
+
+static struct platform_driver omap_dma_xbar_driver = {
+	.probe	= omap_dma_xbar_probe,
+	.remove	= omap_dma_xbar_remove,
+	.driver = {
+		.name = "omap-dma-xbar",
+		.owner = THIS_MODULE,
+		.of_match_table = of_match_ptr(dma_xbar_match),
+	},
+};
+
+int __init omap_dmaxbar_init(void)
+{
+	return platform_driver_register(&omap_dma_xbar_driver);
+}
+arch_initcall(omap_dmaxbar_init);
+
+static void __exit omap_dmaxbar_exit(void)
+{
+	platform_driver_unregister(&omap_dma_xbar_driver);
+}
+module_exit(omap_dmaxbar_exit);
+
+MODULE_DESCRIPTION("OMAP DMA XBAR");
+MODULE_AUTHOR("Sricharan R");
+MODULE_LICENSE("GPL");
diff --git a/drivers/dma/omap-dma-xbar.h b/drivers/dma/omap-dma-xbar.h
new file mode 100644
index 0000000..bd0b208
--- /dev/null
+++ b/drivers/dma/omap-dma-xbar.h
@@ -0,0 +1,32 @@
+/*
+ *  Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com
+ *  Author: Sricharan R <r.sricharan@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+struct dma_req {
+	uint32_t req_line;
+	struct list_head node;
+};
+
+/*
+ * @crossbar_base: crossbar base address
+ * @register_offsets: offsets for each dma request number
+ * @write: function to write in to the dma crossbar
+ * @free_reqs: list of free dma request lines
+ */
+struct dma_xbar_device {
+	void __iomem *dma_xbar_base;
+	int *reg_offs;
+	void (*write)(int, int, struct dma_xbar_device *);
+	struct list_head free_reqs;
+	const struct xbar_ops *ops;
+};
+
+struct xbar_ops {
+	uint32_t (*map)(uint32_t, struct dma_xbar_device *);
+	void (*unmap)(uint32_t,  struct dma_xbar_device *);
+};
diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c
index 05ac480..b527bed 100644
--- a/drivers/dma/omap-dma.c
+++ b/drivers/dma/omap-dma.c
@@ -21,6 +21,7 @@
 #include <linux/of_device.h>
 
 #include "virt-dma.h"
+#include "omap-dma-xbar.h"
 
 struct omap_dmadev {
 	struct dma_device ddev;
-- 
1.7.9.5

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

* [RFC PATCH 6/9] arm: dts: dra: Add dma crossbar node
  2014-03-07 12:16 [RFC PATCH 0/9] drivers: dma: Add support for dma-channel router Sricharan R
                   ` (4 preceding siblings ...)
  2014-03-07 12:16 ` [RFC PATCH 5/9] drivers: dma: Add dma crossbar driver Sricharan R
@ 2014-03-07 12:16 ` Sricharan R
  2014-03-07 12:16 ` [RFC PATCH 7/9] arm: dts: dra: Add dma-request crossbar phandle to dma-specs Sricharan R
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Sricharan R @ 2014-03-07 12:16 UTC (permalink / raw)
  To: r.sricharan, devicetree, linux-kernel, linux-arm-kernel,
	linux-omap, dmaengine
  Cc: santosh.shilimkar, rnayak, nsekhar, tony, linux, vinod.koul,
	dan.j.williams, nm

Adding the crossbar node.

Signed-off-by: Sricharan R <r.sricharan@ti.com>
---
 arch/arm/boot/dts/dra7.dtsi |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index 1fd75aa..f84991b 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -170,6 +170,13 @@
 			#dma-requests = <127>;
 		};
 
+		dmacb: crossbar@4a020000 {
+			compatible = "ti,dma-crossbar";
+			reg = <0x4a002b78 0x100>;
+			ti,dma-reqs = <160>;
+			ti,reg-size = <2>;
+		};
+
 		gpio1: gpio@4ae10000 {
 			compatible = "ti,omap4-gpio";
 			reg = <0x4ae10000 0x200>;
-- 
1.7.9.5

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

* [RFC PATCH 7/9] arm: dts: dra: Add dma-request crossbar phandle to dma-specs
  2014-03-07 12:16 [RFC PATCH 0/9] drivers: dma: Add support for dma-channel router Sricharan R
                   ` (5 preceding siblings ...)
  2014-03-07 12:16 ` [RFC PATCH 6/9] arm: dts: dra: Add dma crossbar node Sricharan R
@ 2014-03-07 12:16 ` Sricharan R
  2014-03-07 12:16 ` [RFC PATCH 8/9] arm: dra: Enable dma crossbar support on dra7xx Sricharan R
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Sricharan R @ 2014-03-07 12:16 UTC (permalink / raw)
  To: r.sricharan, devicetree, linux-kernel, linux-arm-kernel,
	linux-omap, dmaengine
  Cc: santosh.shilimkar, rnayak, nsekhar, tony, linux, vinod.koul,
	dan.j.williams, nm

The dma-request lines from peripherals are connected to
the dma-controller through a crossbar router. Adding this
crossbar phandle to the peripheral's dma-specs. This is
used by the driver to identify the router associated with
a dma-request line and map it.

Signed-off-by: Sricharan R <r.sricharan@ti.com>
---
 arch/arm/boot/dts/dra7.dtsi |   38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index f84991b..baa781e 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -165,7 +165,7 @@
 				     <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>,
 				     <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>,
 				     <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
-			#dma-cells = <1>;
+			#dma-cells = <2>;
 			#dma-channels = <32>;
 			#dma-requests = <127>;
 		};
@@ -528,7 +528,7 @@
 			ti,hwmods = "mmc1";
 			ti,dual-volt;
 			ti,needs-special-reset;
-			dmas = <&sdma 61>, <&sdma 62>;
+			dmas = <&sdma 61 &dmacb>, <&sdma 62 &dmacb>;
 			dma-names = "tx", "rx";
 			status = "disabled";
 		};
@@ -539,7 +539,7 @@
 			interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
 			ti,hwmods = "mmc2";
 			ti,needs-special-reset;
-			dmas = <&sdma 47>, <&sdma 48>;
+			dmas = <&sdma 47 &dmacb>, <&sdma 48 &dmacb>;
 			dma-names = "tx", "rx";
 			status = "disabled";
 		};
@@ -550,7 +550,7 @@
 			interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>;
 			ti,hwmods = "mmc3";
 			ti,needs-special-reset;
-			dmas = <&sdma 77>, <&sdma 78>;
+			dmas = <&sdma 77 &dmacb>, <&sdma 78 &dmacb>;
 			dma-names = "tx", "rx";
 			status = "disabled";
 		};
@@ -561,7 +561,7 @@
 			interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
 			ti,hwmods = "mmc4";
 			ti,needs-special-reset;
-			dmas = <&sdma 57>, <&sdma 58>;
+			dmas = <&sdma 57 &dmacb>, <&sdma 58 &dmacb>;
 			dma-names = "tx", "rx";
 			status = "disabled";
 		};
@@ -574,14 +574,14 @@
 			#size-cells = <0>;
 			ti,hwmods = "mcspi1";
 			ti,spi-num-cs = <4>;
-			dmas = <&sdma 35>,
-			       <&sdma 36>,
-			       <&sdma 37>,
-			       <&sdma 38>,
-			       <&sdma 39>,
-			       <&sdma 40>,
-			       <&sdma 41>,
-			       <&sdma 42>;
+			dmas = <&sdma 35 &dmacb>,
+			       <&sdma 36 &dmacb>,
+			       <&sdma 37 &dmacb>,
+			       <&sdma 38 &dmacb>,
+			       <&sdma 39 &dmacb>,
+			       <&sdma 40 &dmacb>,
+			       <&sdma 41 &dmacb>,
+			       <&sdma 42 &dmacb>;
 			dma-names = "tx0", "rx0", "tx1", "rx1",
 				    "tx2", "rx2", "tx3", "rx3";
 			status = "disabled";
@@ -595,10 +595,10 @@
 			#size-cells = <0>;
 			ti,hwmods = "mcspi2";
 			ti,spi-num-cs = <2>;
-			dmas = <&sdma 43>,
-			       <&sdma 44>,
-			       <&sdma 45>,
-			       <&sdma 46>;
+			dmas = <&sdma 43 &dmacb>,
+			       <&sdma 44 &dmacb>,
+			       <&sdma 45 &dmacb>,
+			       <&sdma 46 &dmacb>;
 			dma-names = "tx0", "rx0", "tx1", "rx1";
 			status = "disabled";
 		};
@@ -611,7 +611,7 @@
 			#size-cells = <0>;
 			ti,hwmods = "mcspi3";
 			ti,spi-num-cs = <2>;
-			dmas = <&sdma 15>, <&sdma 16>;
+			dmas = <&sdma 15 &dmacb>, <&sdma 16 &dmacb>;
 			dma-names = "tx0", "rx0";
 			status = "disabled";
 		};
@@ -624,7 +624,7 @@
 			#size-cells = <0>;
 			ti,hwmods = "mcspi4";
 			ti,spi-num-cs = <1>;
-			dmas = <&sdma 70>, <&sdma 71>;
+			dmas = <&sdma 70 &dmacb>, <&sdma 71 &dmacb>;
 			dma-names = "tx0", "rx0";
 			status = "disabled";
 		};
-- 
1.7.9.5

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

* [RFC PATCH 8/9] arm: dra: Enable dma crossbar support on dra7xx
  2014-03-07 12:16 [RFC PATCH 0/9] drivers: dma: Add support for dma-channel router Sricharan R
                   ` (6 preceding siblings ...)
  2014-03-07 12:16 ` [RFC PATCH 7/9] arm: dts: dra: Add dma-request crossbar phandle to dma-specs Sricharan R
@ 2014-03-07 12:16 ` Sricharan R
  2014-03-07 12:16 ` [RFC PATCH 9/9] arm: dts: dra7: Change the total dma-req numbers to crossbar channels Sricharan R
  2014-03-08 19:53 ` [RFC PATCH 0/9] drivers: dma: Add support for dma-channel router Rob Herring
  9 siblings, 0 replies; 12+ messages in thread
From: Sricharan R @ 2014-03-07 12:16 UTC (permalink / raw)
  To: r.sricharan, devicetree, linux-kernel, linux-arm-kernel,
	linux-omap, dmaengine
  Cc: santosh.shilimkar, rnayak, nsekhar, tony, linux, vinod.koul,
	dan.j.williams, nm

Enable dma crossbar support on dra7xx

Signed-off-by: Sricharan R <r.sricharan@ti.com>
---
 arch/arm/configs/omap2plus_defconfig |    1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index 3a0b53d..1cf8277 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -295,3 +295,4 @@ CONFIG_LIBCRC32C=y
 CONFIG_FONTS=y
 CONFIG_FONT_8x8=y
 CONFIG_FONT_8x16=y
+CONFIG_OMAP_DMA_CROSSBAR=y
-- 
1.7.9.5

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

* [RFC PATCH 9/9] arm: dts: dra7: Change the total dma-req numbers to crossbar channels
  2014-03-07 12:16 [RFC PATCH 0/9] drivers: dma: Add support for dma-channel router Sricharan R
                   ` (7 preceding siblings ...)
  2014-03-07 12:16 ` [RFC PATCH 8/9] arm: dra: Enable dma crossbar support on dra7xx Sricharan R
@ 2014-03-07 12:16 ` Sricharan R
  2014-03-08 19:53 ` [RFC PATCH 0/9] drivers: dma: Add support for dma-channel router Rob Herring
  9 siblings, 0 replies; 12+ messages in thread
From: Sricharan R @ 2014-03-07 12:16 UTC (permalink / raw)
  To: r.sricharan, devicetree, linux-kernel, linux-arm-kernel,
	linux-omap, dmaengine
  Cc: santosh.shilimkar, rnayak, nsekhar, tony, linux, vinod.koul,
	dan.j.williams, nm

On DRA7 there is a crossbar router which maps the peripheral
dma request channels to the dma controller inputs. The
dma-controller can receive requests from any of the crossbar
channels. So register the total number crossbar channels instead
of the shared dma-request lines.

Signed-off-by: Sricharan R <r.sricharan@ti.com>
---
 arch/arm/boot/dts/dra7.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index baa781e..f5ae8c9 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -167,7 +167,7 @@
 				     <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
 			#dma-cells = <2>;
 			#dma-channels = <32>;
-			#dma-requests = <127>;
+			#dma-requests = <203>;
 		};
 
 		dmacb: crossbar@4a020000 {
-- 
1.7.9.5

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

* Re: [RFC PATCH 0/9] drivers: dma: Add support for dma-channel router
  2014-03-07 12:16 [RFC PATCH 0/9] drivers: dma: Add support for dma-channel router Sricharan R
                   ` (8 preceding siblings ...)
  2014-03-07 12:16 ` [RFC PATCH 9/9] arm: dts: dra7: Change the total dma-req numbers to crossbar channels Sricharan R
@ 2014-03-08 19:53 ` Rob Herring
  2014-03-10 13:58   ` Sricharan R
  9 siblings, 1 reply; 12+ messages in thread
From: Rob Herring @ 2014-03-08 19:53 UTC (permalink / raw)
  To: Sricharan R
  Cc: Nishanth Menon, devicetree@vger.kernel.org,
	Russell King - ARM Linux, Tony Lindgren, rnayak, Sekhar Nori,
	linux-kernel@vger.kernel.org, Vinod Koul, Santosh Shilimkar,
	dmaengine, Dan Williams, linux-omap,
	linux-arm-kernel@lists.infradead.org

On Fri, Mar 7, 2014 at 6:16 AM, Sricharan R <r.sricharan@ti.com> wrote:
> In some SoCs the dma request lines from the peripherals are
> routed to the dma-controller through a crossbar. With this the
> dma controller's available request lines are shared between the
> peripherals.
>
> This adds support to register the crossbar router associated with
> a dma-channel and let the dma-controller driver map/unmap
> the peripheral dma crossbar line to dma-controller's request
> line.

This is not a unique concept and should follow some existing pattern.
Perhaps something like interrupt-map. For the dmas property, the
parent should be the crossbar and then the crossbar block has to
translate that into the DMA controller request. All the DMA ctrlr
request connections should be described in the crossbar node. In
theory, you could have chained crossbars. This should be documented as
part of the generic DMA binding.

There are also other similar IP like CoreSight CTI which are just
signal routers. So there is probably some possibility of common code
here.

Rob

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

* Re: [RFC PATCH 0/9] drivers: dma: Add support for dma-channel router
  2014-03-08 19:53 ` [RFC PATCH 0/9] drivers: dma: Add support for dma-channel router Rob Herring
@ 2014-03-10 13:58   ` Sricharan R
  0 siblings, 0 replies; 12+ messages in thread
From: Sricharan R @ 2014-03-10 13:58 UTC (permalink / raw)
  To: Rob Herring
  Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-omap, dmaengine,
	Nishanth Menon, Russell King - ARM Linux, Tony Lindgren, rnayak,
	Sekhar Nori, Vinod Koul, Santosh Shilimkar, Dan Williams

Hi Rob,

On Sunday 09 March 2014 01:23 AM, Rob Herring wrote:
> On Fri, Mar 7, 2014 at 6:16 AM, Sricharan R <r.sricharan@ti.com> wrote:
>> In some SoCs the dma request lines from the peripherals are
>> routed to the dma-controller through a crossbar. With this the
>> dma controller's available request lines are shared between the
>> peripherals.
>>
>> This adds support to register the crossbar router associated with
>> a dma-channel and let the dma-controller driver map/unmap
>> the peripheral dma crossbar line to dma-controller's request
>> line.
> This is not a unique concept and should follow some existing pattern.
> Perhaps something like interrupt-map. For the dmas property, the
> parent should be the crossbar and then the crossbar block has to
> translate that into the DMA controller request. All the DMA ctrlr
> request connections should be described in the crossbar node. In
> theory, you could have chained crossbars. This should be documented as
> part of the generic DMA binding.
  The idea here was to do the map/unmap crossbar<->dma-request
 from the  dma-controller at runtime just like any other resource, unlike
  interrupt-map fixed in DTS. I did not think about the chained
  crossbars case. I will add this here. And as you have suggested will
  make it work like irq_parse_and_map.

Regards,
 Sricharan
> There are also other similar IP like CoreSight CTI which are just
> signal routers. So there is probably some possibility of common code
> here.
>
> Rob


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

end of thread, other threads:[~2014-03-10 13:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-07 12:16 [RFC PATCH 0/9] drivers: dma: Add support for dma-channel router Sricharan R
2014-03-07 12:16 ` [RFC PATCH 1/9] drivers: dma: omap-dma: Avoid hard-coding of the dma-request channels Sricharan R
2014-03-07 12:16 ` [RFC PATCH 2/9] drivers: dma: of-dma: Add support for dma-request line routers Sricharan R
2014-03-07 12:16 ` [RFC PATCH 3/9] drivers: dma: omap-dma: Add a seperate xlate function to get router data Sricharan R
2014-03-07 12:16 ` [RFC PATCH 4/9] drivers: omap-dma: Add crossbar line as a resource to omap_chan structure Sricharan R
2014-03-07 12:16 ` [RFC PATCH 5/9] drivers: dma: Add dma crossbar driver Sricharan R
2014-03-07 12:16 ` [RFC PATCH 6/9] arm: dts: dra: Add dma crossbar node Sricharan R
2014-03-07 12:16 ` [RFC PATCH 7/9] arm: dts: dra: Add dma-request crossbar phandle to dma-specs Sricharan R
2014-03-07 12:16 ` [RFC PATCH 8/9] arm: dra: Enable dma crossbar support on dra7xx Sricharan R
2014-03-07 12:16 ` [RFC PATCH 9/9] arm: dts: dra7: Change the total dma-req numbers to crossbar channels Sricharan R
2014-03-08 19:53 ` [RFC PATCH 0/9] drivers: dma: Add support for dma-channel router Rob Herring
2014-03-10 13:58   ` Sricharan R

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).