linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] dmaengine: ti-dma-crossbar: Support for eDMA
@ 2015-06-08 13:22 Peter Ujfalusi
  2015-06-08 13:22 ` [PATCH v2 1/2] dmaengine: ti-dma-crossbar: Make idr xbar instance-specific Peter Ujfalusi
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Peter Ujfalusi @ 2015-06-08 13:22 UTC (permalink / raw)
  To: vinod.koul, Tony Lindgren
  Cc: linux-kernel, dmaengine, linux-omap, misael.lopez

Hi,

Changes since v01:
- Drop change in compatible for the crossbar driver and do the configuration
  based on the DT structure.

The ti-dma-crossbar driver in it's current form can work when it is used with
sDMA (omap-dma). On DRA7x class of devices we have both sDMA and eDMA available.
The sDMA driver expects to get the DMA request line with offset 1. The eDMA
stack does not need the offset.
The crosbbar itself is identical for sDMA and eDMA.
At probe time the driver will do a match to figure out which dma engine it is
connected to and based on that information it will configure the offset needed
by the DMA driver.

Regards,
Peter
---
Misael Lopez Cruz (1):
  dmaengine: ti-dma-crossbar: Make idr xbar instance-specific

Peter Ujfalusi (1):
  dmaengine: ti-dma-crossbar: Add support for eDMA

 drivers/dma/ti-dma-crossbar.c | 34 +++++++++++++++++++++++++++++-----
 1 file changed, 29 insertions(+), 5 deletions(-)

-- 
2.4.2


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

* [PATCH v2 1/2] dmaengine: ti-dma-crossbar: Make idr xbar instance-specific
  2015-06-08 13:22 [PATCH v2 0/2] dmaengine: ti-dma-crossbar: Support for eDMA Peter Ujfalusi
@ 2015-06-08 13:22 ` Peter Ujfalusi
  2015-06-08 13:22 ` [PATCH v2 2/2] dmaengine: ti-dma-crossbar: Add support for eDMA Peter Ujfalusi
  2015-07-01 12:41 ` [PATCH v2 0/2] dmaengine: ti-dma-crossbar: Support " Peter Ujfalusi
  2 siblings, 0 replies; 7+ messages in thread
From: Peter Ujfalusi @ 2015-06-08 13:22 UTC (permalink / raw)
  To: vinod.koul, Tony Lindgren
  Cc: linux-kernel, dmaengine, linux-omap, misael.lopez

From: Misael Lopez Cruz <misael.lopez@ti.com>

In preparation for supporting multiple DMA crossbar instances,
make the idr xbar instance specific.

Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 drivers/dma/ti-dma-crossbar.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/ti-dma-crossbar.c b/drivers/dma/ti-dma-crossbar.c
index 24f5ca2356bf..1fd3fb73d6e8 100644
--- a/drivers/dma/ti-dma-crossbar.c
+++ b/drivers/dma/ti-dma-crossbar.c
@@ -20,12 +20,11 @@
 #define TI_XBAR_OUTPUTS	127
 #define TI_XBAR_INPUTS	256
 
-static DEFINE_IDR(map_idr);
-
 struct ti_dma_xbar_data {
 	void __iomem *iomem;
 
 	struct dma_router dmarouter;
+	struct idr map_idr;
 
 	u16 safe_val; /* Value to rest the crossbar lines */
 	u32 xbar_requests; /* number of DMA requests connected to XBAR */
@@ -51,7 +50,7 @@ static void ti_dma_xbar_free(struct device *dev, void *route_data)
 		map->xbar_in, map->xbar_out);
 
 	ti_dma_xbar_write(xbar->iomem, map->xbar_out, xbar->safe_val);
-	idr_remove(&map_idr, map->xbar_out);
+	idr_remove(&xbar->map_idr, map->xbar_out);
 	kfree(map);
 }
 
@@ -81,7 +80,7 @@ static void *ti_dma_xbar_route_allocate(struct of_phandle_args *dma_spec,
 		return ERR_PTR(-ENOMEM);
 	}
 
-	map->xbar_out = idr_alloc(&map_idr, NULL, 0, xbar->dma_requests,
+	map->xbar_out = idr_alloc(&xbar->map_idr, NULL, 0, xbar->dma_requests,
 				  GFP_KERNEL);
 	map->xbar_in = (u16)dma_spec->args[0];
 
@@ -113,6 +112,8 @@ static int ti_dma_xbar_probe(struct platform_device *pdev)
 	if (!xbar)
 		return -ENOMEM;
 
+	idr_init(&xbar->map_idr);
+
 	dma_node = of_parse_phandle(node, "dma-masters", 0);
 	if (!dma_node) {
 		dev_err(&pdev->dev, "Can't get DMA master node\n");
-- 
2.4.2


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

* [PATCH v2 2/2] dmaengine: ti-dma-crossbar: Add support for eDMA
  2015-06-08 13:22 [PATCH v2 0/2] dmaengine: ti-dma-crossbar: Support for eDMA Peter Ujfalusi
  2015-06-08 13:22 ` [PATCH v2 1/2] dmaengine: ti-dma-crossbar: Make idr xbar instance-specific Peter Ujfalusi
@ 2015-06-08 13:22 ` Peter Ujfalusi
  2015-07-01 12:41 ` [PATCH v2 0/2] dmaengine: ti-dma-crossbar: Support " Peter Ujfalusi
  2 siblings, 0 replies; 7+ messages in thread
From: Peter Ujfalusi @ 2015-06-08 13:22 UTC (permalink / raw)
  To: vinod.koul, Tony Lindgren
  Cc: linux-kernel, dmaengine, linux-omap, misael.lopez

The crossbar for eDMA works exactly the same way as sDMA, but sDMA
requires an offset of 1, while no offset is needed for eDMA.

Based on the patch from Misael Lopez Cruz <misael.lopez@ti.com>

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
CC: Misael Lopez Cruz <misael.lopez@ti.com>
---
 drivers/dma/ti-dma-crossbar.c | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/ti-dma-crossbar.c b/drivers/dma/ti-dma-crossbar.c
index 1fd3fb73d6e8..10487d91e60d 100644
--- a/drivers/dma/ti-dma-crossbar.c
+++ b/drivers/dma/ti-dma-crossbar.c
@@ -20,6 +20,9 @@
 #define TI_XBAR_OUTPUTS	127
 #define TI_XBAR_INPUTS	256
 
+#define TI_XBAR_EDMA_OFFSET	0
+#define TI_XBAR_SDMA_OFFSET	1
+
 struct ti_dma_xbar_data {
 	void __iomem *iomem;
 
@@ -29,6 +32,7 @@ struct ti_dma_xbar_data {
 	u16 safe_val; /* Value to rest the crossbar lines */
 	u32 xbar_requests; /* number of DMA requests connected to XBAR */
 	u32 dma_requests; /* number of DMA requests forwarded to DMA */
+	u32 dma_offset;
 };
 
 struct ti_dma_xbar_map {
@@ -84,8 +88,7 @@ static void *ti_dma_xbar_route_allocate(struct of_phandle_args *dma_spec,
 				  GFP_KERNEL);
 	map->xbar_in = (u16)dma_spec->args[0];
 
-	/* The DMA request is 1 based in sDMA */
-	dma_spec->args[0] = map->xbar_out + 1;
+	dma_spec->args[0] = map->xbar_out + xbar->dma_offset;
 
 	dev_dbg(&pdev->dev, "Mapping XBAR%u to DMA%d\n",
 		map->xbar_in, map->xbar_out);
@@ -95,9 +98,22 @@ static void *ti_dma_xbar_route_allocate(struct of_phandle_args *dma_spec,
 	return map;
 }
 
+static const struct of_device_id ti_dma_master_match[] = {
+	{
+		.compatible = "ti,omap4430-sdma",
+		.data = (void *)TI_XBAR_SDMA_OFFSET,
+	},
+	{
+		.compatible = "ti,edma3",
+		.data = (void *)TI_XBAR_EDMA_OFFSET,
+	},
+	{},
+};
+
 static int ti_dma_xbar_probe(struct platform_device *pdev)
 {
 	struct device_node *node = pdev->dev.of_node;
+	const struct of_device_id *match;
 	struct device_node *dma_node;
 	struct ti_dma_xbar_data *xbar;
 	struct resource *res;
@@ -120,6 +136,12 @@ static int ti_dma_xbar_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
+	match = of_match_node(ti_dma_master_match, dma_node);
+	if (!match) {
+		dev_err(&pdev->dev, "DMA master is not supported\n");
+		return -EINVAL;
+	}
+
 	if (of_property_read_u32(dma_node, "dma-requests",
 				 &xbar->dma_requests)) {
 		dev_info(&pdev->dev,
@@ -151,6 +173,7 @@ static int ti_dma_xbar_probe(struct platform_device *pdev)
 
 	xbar->dmarouter.dev = &pdev->dev;
 	xbar->dmarouter.route_free = ti_dma_xbar_free;
+	xbar->dma_offset = (u32)match->data;
 
 	platform_set_drvdata(pdev, xbar);
 
-- 
2.4.2


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

* Re: [PATCH v2 0/2] dmaengine: ti-dma-crossbar: Support for eDMA
  2015-06-08 13:22 [PATCH v2 0/2] dmaengine: ti-dma-crossbar: Support for eDMA Peter Ujfalusi
  2015-06-08 13:22 ` [PATCH v2 1/2] dmaengine: ti-dma-crossbar: Make idr xbar instance-specific Peter Ujfalusi
  2015-06-08 13:22 ` [PATCH v2 2/2] dmaengine: ti-dma-crossbar: Add support for eDMA Peter Ujfalusi
@ 2015-07-01 12:41 ` Peter Ujfalusi
  2015-07-02 15:56   ` Vinod Koul
  2 siblings, 1 reply; 7+ messages in thread
From: Peter Ujfalusi @ 2015-07-01 12:41 UTC (permalink / raw)
  To: vinod.koul, Tony Lindgren
  Cc: linux-kernel, dmaengine, linux-omap, misael.lopez

Hi,

On 06/08/2015 04:22 PM, Peter Ujfalusi wrote:
> Hi,
> 
> Changes since v01:
> - Drop change in compatible for the crossbar driver and do the configuration
>   based on the DT structure.
> 
> The ti-dma-crossbar driver in it's current form can work when it is used with
> sDMA (omap-dma). On DRA7x class of devices we have both sDMA and eDMA available.
> The sDMA driver expects to get the DMA request line with offset 1. The eDMA
> stack does not need the offset.
> The crosbbar itself is identical for sDMA and eDMA.
> At probe time the driver will do a match to figure out which dma engine it is
> connected to and based on that information it will configure the offset needed
> by the DMA driver.

Gentle ping, it has been almost a month ago this series has been sent.

> Regards,
> Peter
> ---
> Misael Lopez Cruz (1):
>   dmaengine: ti-dma-crossbar: Make idr xbar instance-specific
> 
> Peter Ujfalusi (1):
>   dmaengine: ti-dma-crossbar: Add support for eDMA
> 
>  drivers/dma/ti-dma-crossbar.c | 34 +++++++++++++++++++++++++++++-----
>  1 file changed, 29 insertions(+), 5 deletions(-)
> 


-- 
Péter

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

* Re: [PATCH v2 0/2] dmaengine: ti-dma-crossbar: Support for eDMA
  2015-07-01 12:41 ` [PATCH v2 0/2] dmaengine: ti-dma-crossbar: Support " Peter Ujfalusi
@ 2015-07-02 15:56   ` Vinod Koul
  2015-07-03 14:10     ` Peter Ujfalusi
  0 siblings, 1 reply; 7+ messages in thread
From: Vinod Koul @ 2015-07-02 15:56 UTC (permalink / raw)
  To: Peter Ujfalusi
  Cc: Tony Lindgren, linux-kernel, dmaengine, linux-omap, misael.lopez

On Wed, Jul 01, 2015 at 03:41:26PM +0300, Peter Ujfalusi wrote:
> Hi,
> 
> On 06/08/2015 04:22 PM, Peter Ujfalusi wrote:
> > Hi,
> > 
> > Changes since v01:
> > - Drop change in compatible for the crossbar driver and do the configuration
> >   based on the DT structure.
> > 
> > The ti-dma-crossbar driver in it's current form can work when it is used with
> > sDMA (omap-dma). On DRA7x class of devices we have both sDMA and eDMA available.
> > The sDMA driver expects to get the DMA request line with offset 1. The eDMA
> > stack does not need the offset.
> > The crosbbar itself is identical for sDMA and eDMA.
> > At probe time the driver will do a match to figure out which dma engine it is
> > connected to and based on that information it will configure the offset needed
> > by the DMA driver.
> 
> Gentle ping, it has been almost a month ago this series has been sent.
Sorry I seem to have missed this series. I relooked at this and it looks
fine. I will apply it once rc1 is out. If it needs rebase please resend

-- 
~Vinod


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

* Re: [PATCH v2 0/2] dmaengine: ti-dma-crossbar: Support for eDMA
  2015-07-02 15:56   ` Vinod Koul
@ 2015-07-03 14:10     ` Peter Ujfalusi
  2015-07-06 13:06       ` Vinod Koul
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Ujfalusi @ 2015-07-03 14:10 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Tony Lindgren, linux-kernel, dmaengine, linux-omap, misael.lopez

On 07/02/2015 06:56 PM, Vinod Koul wrote:
> On Wed, Jul 01, 2015 at 03:41:26PM +0300, Peter Ujfalusi wrote:
>> Hi,
>>
>> On 06/08/2015 04:22 PM, Peter Ujfalusi wrote:
>>> Hi,
>>>
>>> Changes since v01:
>>> - Drop change in compatible for the crossbar driver and do the configuration
>>>   based on the DT structure.
>>>
>>> The ti-dma-crossbar driver in it's current form can work when it is used with
>>> sDMA (omap-dma). On DRA7x class of devices we have both sDMA and eDMA available.
>>> The sDMA driver expects to get the DMA request line with offset 1. The eDMA
>>> stack does not need the offset.
>>> The crosbbar itself is identical for sDMA and eDMA.
>>> At probe time the driver will do a match to figure out which dma engine it is
>>> connected to and based on that information it will configure the offset needed
>>> by the DMA driver.
>>
>> Gentle ping, it has been almost a month ago this series has been sent.
> Sorry I seem to have missed this series. I relooked at this and it looks
> fine. I will apply it once rc1 is out. If it needs rebase please resend

No problem,
the patch still applies cleanly.

Thanks,
Péter

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

* Re: [PATCH v2 0/2] dmaengine: ti-dma-crossbar: Support for eDMA
  2015-07-03 14:10     ` Peter Ujfalusi
@ 2015-07-06 13:06       ` Vinod Koul
  0 siblings, 0 replies; 7+ messages in thread
From: Vinod Koul @ 2015-07-06 13:06 UTC (permalink / raw)
  To: Peter Ujfalusi
  Cc: Tony Lindgren, linux-kernel, dmaengine, linux-omap, misael.lopez

On Fri, Jul 03, 2015 at 05:10:46PM +0300, Peter Ujfalusi wrote:
> On 07/02/2015 06:56 PM, Vinod Koul wrote:
> > On Wed, Jul 01, 2015 at 03:41:26PM +0300, Peter Ujfalusi wrote:
> >> Hi,
> >>
> >> On 06/08/2015 04:22 PM, Peter Ujfalusi wrote:
> >>> Hi,
> >>>
> >>> Changes since v01:
> >>> - Drop change in compatible for the crossbar driver and do the configuration
> >>>   based on the DT structure.
> >>>
> >>> The ti-dma-crossbar driver in it's current form can work when it is used with
> >>> sDMA (omap-dma). On DRA7x class of devices we have both sDMA and eDMA available.
> >>> The sDMA driver expects to get the DMA request line with offset 1. The eDMA
> >>> stack does not need the offset.
> >>> The crosbbar itself is identical for sDMA and eDMA.
> >>> At probe time the driver will do a match to figure out which dma engine it is
> >>> connected to and based on that information it will configure the offset needed
> >>> by the DMA driver.
> >>
> >> Gentle ping, it has been almost a month ago this series has been sent.
> > Sorry I seem to have missed this series. I relooked at this and it looks
> > fine. I will apply it once rc1 is out. If it needs rebase please resend
> 
> No problem,
> the patch still applies cleanly.
No luck, I tried on -rc1 an 1st fails, can you please rebase and resend

-- 
~Vinod


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

end of thread, other threads:[~2015-07-06 13:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-08 13:22 [PATCH v2 0/2] dmaengine: ti-dma-crossbar: Support for eDMA Peter Ujfalusi
2015-06-08 13:22 ` [PATCH v2 1/2] dmaengine: ti-dma-crossbar: Make idr xbar instance-specific Peter Ujfalusi
2015-06-08 13:22 ` [PATCH v2 2/2] dmaengine: ti-dma-crossbar: Add support for eDMA Peter Ujfalusi
2015-07-01 12:41 ` [PATCH v2 0/2] dmaengine: ti-dma-crossbar: Support " Peter Ujfalusi
2015-07-02 15:56   ` Vinod Koul
2015-07-03 14:10     ` Peter Ujfalusi
2015-07-06 13:06       ` Vinod Koul

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