linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: viresh.kumar@st.com (Viresh Kumar)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V2 11/13] dw_dmac: Allow src/dst msize & flow controller to be configured at runtime
Date: Thu, 3 Mar 2011 15:47:24 +0530	[thread overview]
Message-ID: <426996869f6231ebff1cbfab5c7ee4c89ccc8745.1299146382.git.viresh.kumar@st.com> (raw)
In-Reply-To: <cover.1299146382.git.viresh.kumar@st.com>

From: Viresh KUMAR <viresh.kumar@st.com>

Msize or Burst Size is peripheral dependent in case of slave_sg transfers, and
in case of memcpy transfers it is platform dependent. So msize configuration
must come from platform data.

Also some peripherals (ex: JPEG), need to be flow controller for dma transfers,
so this information in case of slave_sg transfers must come from platform data.

Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
---
 drivers/dma/dw_dmac.c      |   10 ++++++----
 drivers/dma/dw_dmac_regs.h |    1 +
 include/linux/dw_dmac.h    |   30 ++++++++++++++++++++++++++++++
 3 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index b1e099e..5f5b28b 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -36,9 +36,11 @@
 		struct dw_dma_slave *__slave = (private);	\
 		int dms = __slave ? __slave->dst_master : 0;	\
 		int sms = __slave ? __slave->src_master : 1;	\
+		u8 smsize = __slave ? __slave->src_msize : 0;	\
+		u8 dmsize = __slave ? __slave->dst_msize : 0;	\
 								\
-		(DWC_CTLL_DST_MSIZE(0)				\
-		 | DWC_CTLL_SRC_MSIZE(0)			\
+		(DWC_CTLL_DST_MSIZE(dmsize)			\
+		 | DWC_CTLL_SRC_MSIZE(smsize)			\
 		 | DWC_CTLL_LLP_D_EN				\
 		 | DWC_CTLL_LLP_S_EN				\
 		 | DWC_CTLL_DMS(dms)				\
@@ -683,7 +685,7 @@ dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 				| DWC_CTLL_DST_WIDTH(reg_width)
 				| DWC_CTLL_DST_FIX
 				| DWC_CTLL_SRC_INC
-				| DWC_CTLL_FC_M2P);
+				| DWC_CTLL_FC(dws->fc));
 		reg = dws->tx_reg;
 		for_each_sg(sgl, sg, sg_len, i) {
 			struct dw_desc	*desc;
@@ -728,7 +730,7 @@ dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 				| DWC_CTLL_SRC_WIDTH(reg_width)
 				| DWC_CTLL_DST_INC
 				| DWC_CTLL_SRC_FIX
-				| DWC_CTLL_FC_P2M);
+				| DWC_CTLL_FC(dws->fc));
 
 		reg = dws->rx_reg;
 		for_each_sg(sgl, sg, sg_len, i) {
diff --git a/drivers/dma/dw_dmac_regs.h b/drivers/dma/dw_dmac_regs.h
index 6a8e6d3..9a32964 100644
--- a/drivers/dma/dw_dmac_regs.h
+++ b/drivers/dma/dw_dmac_regs.h
@@ -86,6 +86,7 @@ struct dw_dma_regs {
 #define DWC_CTLL_SRC_MSIZE(n)	((n)<<14)
 #define DWC_CTLL_S_GATH_EN	(1 << 17)	/* src gather, !FIX */
 #define DWC_CTLL_D_SCAT_EN	(1 << 18)	/* dst scatter, !FIX */
+#define DWC_CTLL_FC(n)		((n) << 20)
 #define DWC_CTLL_FC_M2M		(0 << 20)	/* mem-to-mem */
 #define DWC_CTLL_FC_M2P		(1 << 20)	/* mem-to-periph */
 #define DWC_CTLL_FC_P2M		(2 << 20)	/* periph-to-mem */
diff --git a/include/linux/dw_dmac.h b/include/linux/dw_dmac.h
index 3ba2f06..6998d93 100644
--- a/include/linux/dw_dmac.h
+++ b/include/linux/dw_dmac.h
@@ -42,6 +42,30 @@ enum dw_dma_slave_width {
 	DW_DMA_SLAVE_WIDTH_32BIT,
 };
 
+/* bursts size */
+enum dw_dma_msize {
+	DW_DMA_MSIZE_1,
+	DW_DMA_MSIZE_4,
+	DW_DMA_MSIZE_8,
+	DW_DMA_MSIZE_16,
+	DW_DMA_MSIZE_32,
+	DW_DMA_MSIZE_64,
+	DW_DMA_MSIZE_128,
+	DW_DMA_MSIZE_256,
+};
+
+/* flow controller */
+enum dw_dma_fc {
+	DW_DMA_FC_D_M2M,
+	DW_DMA_FC_D_M2P,
+	DW_DMA_FC_D_P2M,
+	DW_DMA_FC_D_P2P,
+	DW_DMA_FC_P_P2M,
+	DW_DMA_FC_SP_P2P,
+	DW_DMA_FC_P_M2P,
+	DW_DMA_FC_DP_P2P,
+};
+
 /**
  * struct dw_dma_slave - Controller-specific information about a slave
  *
@@ -55,6 +79,9 @@ enum dw_dma_slave_width {
  * @cfg_lo: Platform-specific initializer for the CFG_LO register
  * @src_master: src master for transfers on allocated channel.
  * @dst_master: dest master for transfers on allocated channel.
+ * @src_msize: src burst size.
+ * @dst_msize: dest burst size.
+ * @fc: flow controller for DMA transfer
  */
 struct dw_dma_slave {
 	struct device		*dma_dev;
@@ -65,6 +92,9 @@ struct dw_dma_slave {
 	u32			cfg_lo;
 	u8			src_master;
 	u8			dst_master;
+	u8			src_msize;
+	u8			dst_msize;
+	u8			fc;
 };
 
 /* Platform-configurable bits in CFG_HI */
-- 
1.7.2.2

  parent reply	other threads:[~2011-03-03 10:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-03 10:17 [PATCH V2 00/13] dmaengine/dw_dmac: Extending support & minor fixes Viresh Kumar
2011-03-03 10:17 ` [PATCH V2 01/13] dw_dmac: Remove compilation dependency from AVR32 and put on HAVE_CLK Viresh Kumar
2011-03-03 10:17 ` [PATCH V2 02/13] dw_dmac: Replace module_init() with subsys_initcall() Viresh Kumar
2011-03-03 10:17 ` [PATCH V2 03/13] dw_dmac: Move single descriptor from dwc->queue to dwc->active_list in dwc_complete_all Viresh Kumar
2011-03-03 10:17 ` [PATCH V2 04/13] dw_dmac: Calling dwc_scan_descriptors from dwc_tx_status() after taking lock Viresh Kumar
2011-03-03 10:17 ` [PATCH V2 05/13] dw_dmac: Adding support for 64 bit access width for memcpy xfers Viresh Kumar
2011-03-03 10:17 ` [PATCH V2 06/13] dw_dmac: Change value of DWC_MAX_COUNT to 4095 Viresh Kumar
2011-03-04  9:56   ` viresh kumar
2011-03-03 10:17 ` [PATCH V2 07/13] dw_dmac: Mark all tx_descriptors with DMA_CRTL_ACK after xfer finish Viresh Kumar
2011-03-03 10:17 ` [PATCH V2 08/13] dw_dmac: Pass Channel Allocation Order from platform_data Viresh Kumar
2011-03-03 10:17 ` [PATCH V2 09/13] dw_dmac: Pass Channel Priority " Viresh Kumar
2011-03-03 10:17 ` [PATCH V2 10/13] dw_dmac: Changing type of src_master and dest_master to u8 Viresh Kumar
2011-03-03 10:17 ` Viresh Kumar [this message]
2011-03-04  9:57   ` [PATCH V2 11/13] dw_dmac: Allow src/dst msize & flow controller to be configured at runtime viresh kumar
2011-03-03 10:17 ` [PATCH V2 12/13] dw_dmac: Setting Default Burst length for transfers as 16 Viresh Kumar
2011-03-03 10:17 ` [PATCH V2 13/13] avr32: at32ap700x: Specify DMA Flow Controller, Src and Dst msize Viresh Kumar
2011-03-04 10:12 ` [PATCH 06/13 resend] dw_dmac: Change value of DWC_MAX_COUNT to 4095 Viresh Kumar
2011-03-04 10:12 ` [PATCH 11/13 resend] dw_dmac: Allow src/dst msize & flow controller to be configured at runtime Viresh Kumar
2011-03-06 19:45 ` [PATCH V2 00/13] dmaengine/dw_dmac: Extending support & minor fixes Koul, Vinod

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=426996869f6231ebff1cbfab5c7ee4c89ccc8745.1299146382.git.viresh.kumar@st.com \
    --to=viresh.kumar@st.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).