Skip to contentSkip to conversation

OMAP: DMA: Add API for setting channel dest addr

PATCH In review Manjunatha GK 3 participants 3 messages Mar 2, 2010

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

PATCH v2 1/1 OMAP: DMA: Add API for setting channel dest addr

The new API - omap_set_dma_dst_pos(int lch, int value) is added for setting channel destination address in CPC/CDAC register

Cc Tony Lindgren <[email protected]>
Cc Santosh Shilimkar <[email protected]>
Cc S, Venkatraman <[email protected]>
---
 arch/arm/plat-omap/dma.c              |   17 +++++++++++++++++
 arch/arm/plat-omap/include/plat/dma.h |    1 +
 2 files changed, 18 insertions(+), 0 deletions(-)
arch/arm/plat-omap/dma.c +17 -0
index 2ab224c..c73f11a 100644
@@ -1109,6 +1109,23 @@ dma_addr_t omap_get_dma_dst_pos(int lch)
 }
 EXPORT_SYMBOL(omap_get_dma_dst_pos);
 
+/**
+ * omap_set_dma_dst_pos() - Set DMA channel destination address
+ * @arg1:  lch      DMA logical channel number
+ * @arg2:  value    Value to write into CDAC register
+ *
+ * Writes "value" into the register CPC/CDAC
+ */
+void omap_set_dma_dst_pos(int lch, int value)
+{
+	if (cpu_is_omap15xx())
+		dma_write(value, CPC(lch));
+	else
+		dma_write(value, CDAC(lch));
+
+}
+EXPORT_SYMBOL(omap_set_dma_dst_pos);
+
 int omap_get_dma_active_status(int lch)
 {
 	return (dma_read(CCR(lch)) & OMAP_DMA_CCR_EN) != 0;
arch/arm/plat-omap/include/plat/dma.h +1 -0
index 02232ca..3b6e43e 100644
@@ -509,6 +509,7 @@ extern int omap_set_dma_callback(int lch,
 			void *data);
 extern dma_addr_t omap_get_dma_src_pos(int lch);
 extern dma_addr_t omap_get_dma_dst_pos(int lch);
+extern void omap_set_dma_dst_pos(int lch, int value);
 extern void omap_clear_dma(int lch);
 extern int omap_get_dma_active_status(int lch);
 extern int omap_dma_running(void);
Signature · 1 line
1.6.0.4
#1 lore raw

Manjunath,

Quoted 46 lines · Manjunatha GK

The new API - omap_set_dma_dst_pos(int lch, int value) is added for setting channel destination address in CPC/CDAC register

Cc Tony Lindgren <[email protected]>
Cc Santosh Shilimkar <[email protected]>
Cc S, Venkatraman <[email protected]>

---
 arch/arm/plat-omap/dma.c              |   17 +++++++++++++++++ arch/arm/plat-omap/include/plat/dma.h |    1 +

 2 files changed, 18 insertions(+), 0 deletions(-)
arch/arm/plat-omap/dma.c +17 -0
index 2ab224c..c73f11a 100644
@@ -1109,6 +1109,23 @@ dma_addr_t omap_get_dma_dst_pos(int lch)
  }
  EXPORT_SYMBOL(omap_get_dma_dst_pos);
 
+/**
+ * omap_set_dma_dst_pos() - Set DMA channel destination address
+ * @arg1:  lch      DMA logical channel number
+ * @arg2:  value    Value to write into CDAC register
+ *
+ * Writes "value" into the register CPC/CDAC
+ */
+void omap_set_dma_dst_pos(int lch, int value)
+{
+       if (cpu_is_omap15xx())
+               dma_write(value, CPC(lch));
+       else
+               dma_write(value, CDAC(lch));
+
+}
+EXPORT_SYMBOL(omap_set_dma_dst_pos);
+
  int omap_get_dma_active_status(int lch)
  {
        return (dma_read(CCR(lch)) & OMAP_DMA_CCR_EN) != 0;
arch/arm/plat-omap/include/plat/dma.h +0 -0
index 02232ca..3b6e43e 100644

arch/arm/plat-omap/include/plat/dma.h extern int omap_set_dma_callback(int lch,

Quoted 8 lines
arch/arm/plat-omap/include/plat/dma.h +1 -1
@@ -509,6 +509,7 @@ extern int omap_set_dma_callback(int lch,
                        void *data);
  extern dma_addr_t omap_get_dma_src_pos(int lch);
  extern dma_addr_t omap_get_dma_dst_pos(int lch);
+extern void omap_set_dma_dst_pos(int lch, int value);
  extern void omap_clear_dma(int lch);
  extern int omap_get_dma_active_status(int lch);
  extern int omap_dma_running(void);
--

CDAC is not the destination address, as the API seems to suggest.
CDSA (Channel Destination Start Address) is.

CDAC is a running counter of the current transfer.
I propose to update the omap_start_dma to reset CDAC to 0 always.

Best regards,
Venkat.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 60 lines · Venkatraman S

Manjunath,

Quoted 46 lines · Manjunatha GK

The new API - omap_set_dma_dst_pos(int lch, int value) is added for setting channel destination address in CPC/CDAC register

Cc Tony Lindgren <[email protected]>
Cc Santosh Shilimkar <[email protected]>
Cc S, Venkatraman <[email protected]>

---
 arch/arm/plat-omap/dma.c              |   17 +++++++++++++++++ arch/arm/plat-omap/include/plat/dma.h |    1 +

 2 files changed, 18 insertions(+), 0 deletions(-)
arch/arm/plat-omap/dma.c +17 -0
index 2ab224c..c73f11a 100644
@@ -1109,6 +1109,23 @@ dma_addr_t omap_get_dma_dst_pos(int lch)
  }
  EXPORT_SYMBOL(omap_get_dma_dst_pos);
 
+/**
+ * omap_set_dma_dst_pos() - Set DMA channel destination address
+ * @arg1:  lch      DMA logical channel number
+ * @arg2:  value    Value to write into CDAC register
+ *
+ * Writes "value" into the register CPC/CDAC
+ */
+void omap_set_dma_dst_pos(int lch, int value)
+{
+       if (cpu_is_omap15xx())
+               dma_write(value, CPC(lch));
+       else
+               dma_write(value, CDAC(lch));
+
+}
+EXPORT_SYMBOL(omap_set_dma_dst_pos);
+
  int omap_get_dma_active_status(int lch)
  {
        return (dma_read(CCR(lch)) & OMAP_DMA_CCR_EN) != 0;
arch/arm/plat-omap/include/plat/dma.h +0 -0
index 02232ca..3b6e43e 100644

arch/arm/plat-omap/include/plat/dma.h extern int omap_set_dma_callback(int lch,

Quoted 8 lines
arch/arm/plat-omap/include/plat/dma.h +1 -1
@@ -509,6 +509,7 @@ extern int omap_set_dma_callback(int lch,
                        void *data);
  extern dma_addr_t omap_get_dma_src_pos(int lch);
  extern dma_addr_t omap_get_dma_dst_pos(int lch);
+extern void omap_set_dma_dst_pos(int lch, int value);
  extern void omap_clear_dma(int lch);
  extern int omap_get_dma_active_status(int lch);
  extern int omap_dma_running(void);
--

CDAC is not the destination address, as the API seems to suggest.
CDSA (Channel Destination Start Address) is.

Quoted 2 lines

CDAC is a running counter of the current transfer.
I propose to update the omap_start_dma to reset CDAC to 0 always.

I agree with Venkat. I think having it reset for every transfer by default is the right way to handle this.

Kevin

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html