Skip to contentSkip to conversation

ARM: EDMA: Fix clearing of unused list for DT DMA resources

PATCH Superseded Joel Fernandes 3 participants 7 messages Aug 23, 2013 – Sep 6, 2013

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ARM: EDMA: Fix clearing of unused list for DT DMA resources

HWMOD removal for MMC and Crypto is breaking edma_start as the events are being manually triggered due to unused channel list not being clear. Atleast breakage has been seen on these peripherals, but it is expected Audio (McASP) maybe breaking too.

This patch fixes the issue, by reading the "dmas" property from the DT node if it exists and clearing the bits in the unused channel list so that these channels are not manually triggered.

v2 changes:
Reduced indendation by returning from if block.

---
Note:
Patch should go in for -rc cycle as it fixes existing crypto drivers.

 arch/arm/common/edma.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
arch/arm/common/edma.c +19 -3
index 39ad030..3867e7e 100644
@@ -560,14 +560,30 @@ static int reserve_contiguous_slots(int ctlr, unsigned int id,
 static int prepare_unused_channel_list(struct device *dev, void *data)
 {
 	struct platform_device *pdev = to_platform_device(dev);
-	int i, ctlr;
+	int i = 0, ctlr;
+	u32 dma_chan;
+	const __be32 *dma_chan_p;
+	struct property *prop;
+
+	if (dev->of_node) {
+		of_property_for_each_u32(dev->of_node, "dmas", prop,
+					 dma_chan_p, dma_chan) {
+			if (i++ & 1) {
+				ctlr = EDMA_CTLR(dma_chan);
+				clear_bit(EDMA_CHAN_SLOT(dma_chan),
+					  edma_cc[ctlr]->edma_unused);
+			}
+		}
+		return;
+	}
 
-	for (i = 0; i < pdev->num_resources; i++) {
+	/* For non-OF case */
+	for (; i < pdev->num_resources; i++) {
 		if ((pdev->resource[i].flags & IORESOURCE_DMA) &&
 				(int)pdev->resource[i].start >= 0) {
 			ctlr = EDMA_CTLR(pdev->resource[i].start);
 			clear_bit(EDMA_CHAN_SLOT(pdev->resource[i].start),
-					edma_cc[ctlr]->edma_unused);
+				  edma_cc[ctlr]->edma_unused);
 		}
 	}
 
Signature · 1 line
1.8.1.2
#1 lore raw
Quoted 11 lines · Joel Fernandes

HWMOD removal for MMC and Crypto is breaking edma_start as the events are being manually triggered due to unused channel list not being clear. Atleast breakage has been seen on these peripherals, but it is expected Audio (McASP) maybe breaking too.

This patch fixes the issue, by reading the "dmas" property from the DT node if it exists and clearing the bits in the unused channel list so that these channels are not manually triggered.

v2 changes:
Reduced indendation by returning from if block.

Is this a v2 or v3 since you already sent a v2 about a month back?

Quoted 8 lines

---
Note:
Patch should go in for -rc cycle as it fixes existing crypto drivers.

We agreed the patch is not needed in -rc cycle since there are no current EDMA users in DT-boot?

Quoted 16 lines
 arch/arm/common/edma.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
arch/arm/common/edma.c +3 -1
index 39ad030..3867e7e 100644
@@ -560,14 +560,30 @@ static int reserve_contiguous_slots(int ctlr, unsigned int id,
 static int prepare_unused_channel_list(struct device *dev, void *data)
 {
 	struct platform_device *pdev = to_platform_device(dev);
-	int i, ctlr;
+	int i = 0, ctlr;
+	u32 dma_chan;
+	const __be32 *dma_chan_p;

arch/arm/common/edma.c static int reserve_contiguous_slots(int ctlr, unsigned int id, · line 575

Quoted 10 lines
arch/arm/common/edma.c +10 -0
+	struct property *prop;
+
+	if (dev->of_node) {
+		of_property_for_each_u32(dev->of_node, "dmas", prop,
+					 dma_chan_p, dma_chan) {
+			if (i++ & 1) {
+				ctlr = EDMA_CTLR(dma_chan);
+				clear_bit(EDMA_CHAN_SLOT(dma_chan),
+					  edma_cc[ctlr]->edma_unused);
+			}

I thought we agreed to do this differently using of_property_count_strings() and of_parse_phandle_with_args(). I seemed to have missed any discussion on why this cannot be done (if such a discussion took place on the list).

Thanks,
Sekhar

#2 lore raw
Quoted 6 lines · Sekhar Nori
Quoted 5 lines · Joel Fernandes

HWMOD removal for MMC and Crypto is breaking edma_start as the events are being manually triggered due to unused channel list not being clear. Atleast breakage has been seen on these peripherals, but it is expected Audio (McASP) maybe breaking too.

Quoted 8 lines
Quoted 6 lines

This patch fixes the issue, by reading the "dmas" property from the DT node if it exists and clearing the bits in the unused channel list so that these channels are not manually triggered.

v2 changes:
Reduced indendation by returning from if block.

Is this a v2 or v3 since you already sent a v2 about a month back?

No, there aren't any changes since v2, I just resubmitted the same patch.

Quoted 11 lines
Quoted 8 lines

---
Note:
Patch should go in for -rc cycle as it fixes existing crypto drivers.

We agreed the patch is not needed in -rc cycle since there are no current EDMA users in DT-boot?

There is now, crypto and EDMA DT patches are being merged in.

Quoted 23 lines
Quoted 23 lines
 arch/arm/common/edma.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
arch/arm/common/edma.c +10 -1
index 39ad030..3867e7e 100644
@@ -560,14 +560,30 @@ static int reserve_contiguous_slots(int ctlr, unsigned int id,
 static int prepare_unused_channel_list(struct device *dev, void *data)
 {
 	struct platform_device *pdev = to_platform_device(dev);
-	int i, ctlr;
+	int i = 0, ctlr;
+	u32 dma_chan;
+	const __be32 *dma_chan_p;
+	struct property *prop;
+
+	if (dev->of_node) {
+		of_property_for_each_u32(dev->of_node, "dmas", prop,
+					 dma_chan_p, dma_chan) {
+			if (i++ & 1) {
+				ctlr = EDMA_CTLR(dma_chan);
Quoted 8 lines

arch/arm/common/edma.c static int reserve_contiguous_slots(int ctlr, unsigned int id, · line 575

Quoted 3 lines
arch/arm/common/edma.c +3 -0
+				clear_bit(EDMA_CHAN_SLOT(dma_chan),
+					  edma_cc[ctlr]->edma_unused);
+			}

I thought we agreed to do this differently using of_property_count_strings() and of_parse_phandle_with_args(). I seemed to have missed any discussion on why this cannot be done (if such a discussion took place on the list).

I kind of missed that particular review comment after reading [1]. Because I thought only change left was the indentation. Let me work on that comment and resubmit as v3.

Regards,

-Joel

#3 lore raw
Quoted 11 lines · Joel Fernandes
Quoted 10 lines · Sekhar Nori
Quoted 9 lines · Joel Fernandes

HWMOD removal for MMC and Crypto is breaking edma_start as the events are being manually triggered due to unused channel list not being clear. Atleast breakage has been seen on these peripherals, but it is expected Audio (McASP) maybe breaking too.

This patch fixes the issue, by reading the "dmas" property from the DT node if it exists and clearing the bits in the unused channel list so that these channels are not manually triggered.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

v2 changes:
Reduced indendation by returning from if block.

Is this a v2 or v3 since you already sent a v2 about a month back?

No, there aren't any changes since v2, I just resubmitted the same patch.

Heh, it does seem to contain some indentation changes per your documentation :)

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines

---
Note:
Patch should go in for -rc cycle as it fixes existing crypto drivers.

Quoted 4 lines
Quoted 2 lines

We agreed the patch is not needed in -rc cycle since there are no current EDMA users in DT-boot?

There is now, crypto and EDMA DT patches are being merged in.

They are being merged in v3.12, right? So you meant the -rc cycle of v3.12? If yes, no need to wait for a broken v3.12-rc1 to come out. It is possible to queue fixes during merge window too.

Thanks,
Sekhar

#4 lore raw
In reply to Joel Fernandes
Quoted 37 lines · Joel Fernandes

HWMOD removal for MMC and Crypto is breaking edma_start as the events are being manually triggered due to unused channel list not being clear. Atleast breakage has been seen on these peripherals, but it is expected Audio (McASP) maybe breaking too.

This patch fixes the issue, by reading the "dmas" property from the DT node if it exists and clearing the bits in the unused channel list so that these channels are not manually triggered.

v2 changes:
Reduced indendation by returning from if block.

---
Note:
Patch should go in for -rc cycle as it fixes existing crypto drivers.

 arch/arm/common/edma.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
arch/arm/common/edma.c +5 -1
index 39ad030..3867e7e 100644
@@ -560,14 +560,30 @@ static int reserve_contiguous_slots(int ctlr, unsigned int id,
 static int prepare_unused_channel_list(struct device *dev, void *data)
 {
 	struct platform_device *pdev = to_platform_device(dev);
-	int i, ctlr;
+	int i = 0, ctlr;
+	u32 dma_chan;
+	const __be32 *dma_chan_p;
+	struct property *prop;
+

arch/arm/common/edma.c static int reserve_contiguous_slots(int ctlr, unsigned int id, · line 577

Quoted 10 lines
arch/arm/common/edma.c +10 -0
+	if (dev->of_node) {
+		of_property_for_each_u32(dev->of_node, "dmas", prop,
+					 dma_chan_p, dma_chan) {
+			if (i++ & 1) {
+				ctlr = EDMA_CTLR(dma_chan);
+				clear_bit(EDMA_CHAN_SLOT(dma_chan),
+					  edma_cc[ctlr]->edma_unused);
+			}
+		}
+		return;

This should return something here, otherwise we get:-

arch/arm/common/edma.c: In function 'prepare_unused_channel_list':
arch/arm/common/edma.c:577:3: warning: 'return' with no value, in function returning non-void [-Wreturn-type]

Mark J.

Quoted 13 lines
arch/arm/common/edma.c +4 -2
+	}
 
-	for (i = 0; i < pdev->num_resources; i++) {
+	/* For non-OF case */
+	for (; i < pdev->num_resources; i++) {
 		if ((pdev->resource[i].flags & IORESOURCE_DMA) &&
 				(int)pdev->resource[i].start >= 0) {
 			ctlr = EDMA_CTLR(pdev->resource[i].start);
 			clear_bit(EDMA_CHAN_SLOT(pdev->resource[i].start),
-					edma_cc[ctlr]->edma_unused);
+				  edma_cc[ctlr]->edma_unused);
 		}
 	}
Tested-by
#5 lore raw
Quoted 51 lines · Mark Jackson
Quoted 37 lines · Joel Fernandes

HWMOD removal for MMC and Crypto is breaking edma_start as the events are being manually triggered due to unused channel list not being clear. Atleast breakage has been seen on these peripherals, but it is expected Audio (McASP) maybe breaking too.

This patch fixes the issue, by reading the "dmas" property from the DT node if it exists and clearing the bits in the unused channel list so that these channels are not manually triggered.

v2 changes:
Reduced indendation by returning from if block.

---
Note:
Patch should go in for -rc cycle as it fixes existing crypto drivers.

 arch/arm/common/edma.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
arch/arm/common/edma.c +5 -1
index 39ad030..3867e7e 100644
@@ -560,14 +560,30 @@ static int reserve_contiguous_slots(int ctlr, unsigned int id,
 static int prepare_unused_channel_list(struct device *dev, void *data)
 {
 	struct platform_device *pdev = to_platform_device(dev);
-	int i, ctlr;
+	int i = 0, ctlr;
+	u32 dma_chan;
+	const __be32 *dma_chan_p;
+	struct property *prop;
+

arch/arm/common/edma.c static int reserve_contiguous_slots(int ctlr, unsigned int id, · line 577

Quoted 10 lines
arch/arm/common/edma.c +10 -0
+	if (dev->of_node) {
+		of_property_for_each_u32(dev->of_node, "dmas", prop,
+					 dma_chan_p, dma_chan) {
+			if (i++ & 1) {
+				ctlr = EDMA_CTLR(dma_chan);
+				clear_bit(EDMA_CHAN_SLOT(dma_chan),
+					  edma_cc[ctlr]->edma_unused);
+			}
+		}
+		return;

This should return something here, otherwise we get:-

Quoted 2 lines

arch/arm/common/edma.c: In function 'prepare_unused_channel_list':
arch/arm/common/edma.c:577:3: warning: 'return' with no value, in function returning non-void [-Wreturn-type]

Other than that I can confirm it fixes the issue for me ...

#6 lore raw
Quoted 52 lines · Mark Jackson
Quoted 51 lines · Mark Jackson
Quoted 37 lines · Joel Fernandes

HWMOD removal for MMC and Crypto is breaking edma_start as the events are being manually triggered due to unused channel list not being clear. Atleast breakage has been seen on these peripherals, but it is expected Audio (McASP) maybe breaking too.

This patch fixes the issue, by reading the "dmas" property from the DT node if it exists and clearing the bits in the unused channel list so that these channels are not manually triggered.

v2 changes:
Reduced indendation by returning from if block.

---
Note:
Patch should go in for -rc cycle as it fixes existing crypto drivers.

 arch/arm/common/edma.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
arch/arm/common/edma.c +5 -1
index 39ad030..3867e7e 100644
@@ -560,14 +560,30 @@ static int reserve_contiguous_slots(int ctlr, unsigned int id,
 static int prepare_unused_channel_list(struct device *dev, void *data)
 {
 	struct platform_device *pdev = to_platform_device(dev);
-	int i, ctlr;
+	int i = 0, ctlr;
+	u32 dma_chan;
+	const __be32 *dma_chan_p;
+	struct property *prop;
+

arch/arm/common/edma.c static int reserve_contiguous_slots(int ctlr, unsigned int id, · line 577

Quoted 10 lines
arch/arm/common/edma.c +10 -0
+	if (dev->of_node) {
+		of_property_for_each_u32(dev->of_node, "dmas", prop,
+					 dma_chan_p, dma_chan) {
+			if (i++ & 1) {
+				ctlr = EDMA_CTLR(dma_chan);
+				clear_bit(EDMA_CHAN_SLOT(dma_chan),
+					  edma_cc[ctlr]->edma_unused);
+			}
+		}
+		return;

This should return something here, otherwise we get:-

Quoted 4 lines
Quoted 2 lines

arch/arm/common/edma.c: In function 'prepare_unused_channel_list':
arch/arm/common/edma.c:577:3: warning: 'return' with no value, in function returning non-void [-Wreturn-type]

Other than that I can confirm it fixes the issue for me ...

Thanks for pointing that out. Will fix it in the next revision.

Regards,

-Joel