Skip to contentSkip to conversation

ARM: OMAP2+: dma: Define dma capabilities register bitfields and use them.

PATCH New R Sricharan 3 participants 3 messages May 4, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: OMAP2+: dma: Define dma capabilities register bitfields and use them.

The system dma module has capabiities register indicating the support for descriptor loading, constant fill, etc. Use this instead of OMAP revision check to identify the features supported runtime.

This avoids patching the code for feature SOCs which has those capabilities.

---
 arch/arm/mach-omap2/dma.c             |   11 +++++++----
 arch/arm/plat-omap/include/plat/dma.h |    5 +++++
 2 files changed, 12 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/dma.c +7 -4
index b19d849..ff75abe 100644
@@ -227,10 +227,6 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
 
 	dma_stride		= OMAP2_DMA_STRIDE;
 	dma_common_ch_start	= CSDP;
-	if (cpu_is_omap3630() || cpu_is_omap44xx())
-		dma_common_ch_end = CCDN;
-	else
-		dma_common_ch_end = CCFN;
 
 	p = kzalloc(sizeof(struct omap_system_dma_plat_info), GFP_KERNEL);
 	if (!p) {
@@ -277,6 +273,13 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
 		dev_err(&pdev->dev, "%s: kzalloc fail\n", __func__);
 		return -ENOMEM;
 	}
+
+	/* Check the capabilities register for descriptor loading feature */
+	if (dma_read(CAPS_0, 0) & DMA_HAS_DESCRIPTOR_CAPS)
+		dma_common_ch_end = CCDN;
+	else
+		dma_common_ch_end = CCFN;
+
 	return 0;
 }
 
arch/arm/plat-omap/include/plat/dma.h +5 -0
index dc562a5..7742204 100644
@@ -312,6 +312,11 @@
 #define CLEAR_CSR_ON_READ		BIT(0xC)
 #define IS_WORD_16			BIT(0xD)
 
+/* Defines for DMA Capabilities */
+#define DMA_HAS_TRANSPARENT_CAPS	(0x1 << 18)
+#define DMA_HAS_CONSTANT_FILL_CAPS	(0x1 << 19)
+#define DMA_HAS_DESCRIPTOR_CAPS		(0x3 << 20)
+
 enum omap_reg_offsets {
 
 GCR,		GSCR,		GRST1,		HW_ID,
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 ARM: OMAP2+: dma: Define dma capabilities register bitfields and use them.

Quoted 5 lines · R Sricharan

The system dma module has capabiities register indicating the support for descriptor loading, constant fill, etc. Use this instead of OMAP revision check to identify the features supported runtime.

Quoted 9 lines

This avoids patching the code for feature SOCs which has those capabilities.

---
?arch/arm/mach-omap2/dma.c ? ? ? ? ? ? | ? 11 +++++++---- ?arch/arm/plat-omap/include/plat/dma.h | ? ?5 +++++ ?2 files changed, 12 insertions(+), 4 deletions(-)

Looks fine. Will add it to my clean-up series if no has any objection on the patch.

Regards
Santosh

maintainer
#2 lore raw

PATCH 1/1 ARM: OMAP2+: dma: Define dma capabilities register bitfields and use them.

Quoted 9 lines · Shilimkar, Santosh
Quoted 8 lines · R Sricharan

The system dma module has capabiities register indicating the support for descriptor loading, constant fill, etc. Use this instead of OMAP revision check to identify the features supported runtime.

This avoids patching the code for feature SOCs which has those capabilities.

Quoted 8 lines
Quoted 6 lines

---
?arch/arm/mach-omap2/dma.c ? ? ? ? ? ? | ? 11 +++++++---- ?arch/arm/plat-omap/include/plat/dma.h | ? ?5 +++++ ?2 files changed, 12 insertions(+), 4 deletions(-)

Looks fine. Will add it to my clean-up series if no has any objection on the patch.

Yes this is nice.

Tony