Skip to contentSkip to conversation

LPC32XX: 002-mmc.2: Workaround for MMC+DMA on LPC32xx (V2)

PATCH New Cedric Berger 1 participant 1 message Apr 23, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 2/10 LPC32XX: 002-mmc.2: Workaround for MMC+DMA on LPC32xx (V2)

Because of some PL08x and PL18x buggered up design, software workaround is needed be integrated to maje that combination work. Here is a rework of original NXP patch for the 3.9 kernel.

---

linux/amba/mmci.h +9 -0
Index: include/linux/amba/mmci.h
===================================================================
@@ -19,6 +19,12 @@
 #define MCI_ST_FBCLKEN		(1 << 7)
 #define MCI_ST_DATA74DIREN	(1 << 8)
 
+/*
+ * list of DMA quirks
+ */
+#define MCI_DMA_QUIRK_PL18X_RX	(1 << 0)
+#define MCI_DMA_QUIRK_PL18X_TX	(1 << 1)
+
 /* Just some dummy forwarding */
 struct dma_chan;
 
@@ -57,6 +63,8 @@
  * @dma_tx_param: parameter passed to the DMA allocation
  * filter in order to select an appropriate TX channel. If this
  * is NULL the driver will attempt to use the RX channel as a
+ * @dma_pl18x_quirks: apply quirks to make the pl08x/pl18x combination
+ * work properly, such as with nxp lpc32xx cpu.
  * bidirectional channel
  */
 struct mmci_platform_data {
@@ -70,6 +78,7 @@
 	unsigned long capabilities;
 	unsigned long capabilities2;
 	u32 sigdir;
+	u32 dma_quirks;
 	bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
 	void *dma_rx_param;
 	void *dma_tx_param;
mmc/host/mmci.c +130 -18

274 lines not on this page · raw message

mmc/host/mmci.h +11 -1
Index: drivers/mmc/host/mmci.h
===================================================================
@@ -158,10 +158,16 @@
 struct variant_data;
 struct dma_chan;
 
+struct mmci_bounce_buf {
+	void				*dma_v_tx;
+	dma_addr_t			dma_p_tx;
+};
+
 struct mmci_host_next {
 	struct dma_async_tx_descriptor	*dma_desc;
 	struct dma_chan			*dma_chan;
-	s32				cookie;
+	struct mmci_bounce_buf		*bounce_buf;
+	s32				cookie_cnt;
 };
 
 struct mmci_host {
@@ -208,6 +214,10 @@
 	struct dma_async_tx_descriptor	*dma_desc_current;
 	struct mmci_host_next	next_data;
 
+	struct mmci_bounce_buf  *bounce_buf;
+	struct mmci_bounce_buf	bounce_buf_pool[2];
+	u32			dma_quirks;
+
 #define dma_inprogress(host)	((host)->dma_current)
 #else
 #define dma_inprogress(host)	(0)