Thread (24 messages) 24 messages, 7 authors, 2015-08-06

Re: [RFC PATCH v3 1/5] mmc: dw_mmc: Add external dma interface support

From: Shawn Lin <shawn.lin@rock-chips.com>
Date: 2015-08-05 09:11:50
Also in: linux-mips, linux-mmc, linux-rockchip, linux-samsung-soc

在 2015/8/5 16:49, Heiko Stübner 写道:
Am Mittwoch, 5. August 2015, 16:17:28 schrieb Shawn Lin:
quoted
DesignWare MMC Controller can supports two types of DMA
mode: external dma and internal dma. We get a RK312x platform
integrated dw_mmc and ARM pl330 dma controller. This patch add
edmac ops to support these platforms. I've tested it on RK312x
platform with edmac mode and RK3288 platform with idmac mode.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>

---
[...]
quoted
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index 5be9767..6c1c7ea 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -16,6 +16,7 @@

  #include <linux/scatterlist.h>
  #include <linux/mmc/core.h>
+#include <linux/dmaengine.h>

  #define MAX_MCI_SLOTS	2
@@ -40,6 +41,17 @@ enum {

  struct mmc_data;

+enum {
+	TRANS_MODE_PIO = 0,
+	TRANS_MODE_IDMAC,
+	TRANS_MODE_EDMAC
+};
+
+struct dw_mci_dma_slave {
+	struct dma_chan *ch;
+	enum dma_transfer_direction direction;
+};
+
  /**
   * struct dw_mci - MMC controller state shared between all slots
   * @lock: Spinlock protecting the queue and associated data.
@@ -147,17 +159,23 @@ struct dw_mci {

  	/* DMA interface members*/
  	int			use_dma;
+	int			trans_mode;
you're introducing this new trans_mode, but we have "use_dma" already.

So you could just define

enum {
	TRANS_DMA_PIO = 0,
	TRANS_DMA_IDMAC,
	TRANS_DMA_EDMAC
};

and fill use_dma appropriately. "0" is meaning PIO already, which I also did fix
up some days ago in "[PATCH] mmc: dw_mmc: fix pio mode when internal dmac is
enabled" [0].
    I  agree.  "trans_mode" is redundant here since it does the same 
work as "use_dma" to some degree.
    Thanks.
Heiko

[0] https://lkml.org/lkml/2015/8/3/407


-- 
Shawn Lin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help