Skip to contentSkip to conversation

mmc: atmel-mci: allow DMA transfers for AVR32

PATCH In review Andy Shevchenko 3 participants 8 messages Jul 27, 2015 – Jan 11, 2016

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

PATCH 1/1 mmc: atmel-mci: allow DMA transfers for AVR32

The commit ecb89f2f5f3e (mmc: atmel-mci: remove compat for non DT board when requesting dma chan) removes compat transfer which breaks DMA support for ATNGW100. This patch returns back that functionality.

Cc Ludovic Desroches <[email protected]>
---
 drivers/mmc/host/atmel-mci.c | 49 +++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 46 insertions(+), 3 deletions(-)
drivers/mmc/host/atmel-mci.c +46 -3
index 9a39e0b..70865be 100644
@@ -2277,12 +2277,55 @@ static void atmci_cleanup_slot(struct atmel_mci_slot *slot,
 	mmc_free_host(slot->mmc);
 }
 
-static int atmci_configure_dma(struct atmel_mci *host)
+static bool atmci_filter(struct dma_chan *chan, void *pdata)
 {
+	struct mci_platform_data *sl_pdata = pdata;
+	struct mci_dma_data *sl;
+
+	if (!sl_pdata)
+		return false;
+
+	sl = sl_pdata->dma_slave;
+	if (sl && find_slave_dev(sl) == chan->device->dev) {
+		chan->private = slave_data_ptr(sl);
+		return true;
+	} else {
+		return false;
+	}
+}
+
+static int atmci_dma_request_channel(struct atmel_mci *host)
+{
+	struct mci_platform_data	*pdata;
+	dma_cap_mask_t mask;
+
 	host->dma.chan = dma_request_slave_channel_reason(&host->pdev->dev,
 							"rxtx");
-	if (IS_ERR(host->dma.chan))
-		return PTR_ERR(host->dma.chan);
+	if (!IS_ERR(host->dma.chan))
+		return 0;
+
+	if (PTR_ERR(host->dma.chan) == -EPROBE_DEFER)
+		return -EPROBE_DEFER;
+
+	pdata = host->pdev->dev.platform_data;
+
+	dma_cap_zero(mask);
+	dma_cap_set(DMA_SLAVE, mask);
+
+	host->dma.chan = dma_request_channel(mask, atmci_filter, pdata);
+	if (!host->dma.chan)
+		return -ENODEV;
+
+	return 0;
+}
+
+static int atmci_configure_dma(struct atmel_mci *host)
+{
+	int ret;
+
+	ret = atmci_dma_request_channel(host);
+	if (ret)
+		return ret;
 
 	dev_info(&host->pdev->dev, "using %s for DMA transfers\n",
 		 dma_chan_name(host->dma.chan));
Signature · 1 line
2.4.6
#1 lore raw
Quoted 7 lines · On Monday 27 July 2015 14:53:30 you wrote:

The commit ecb89f2f5f3e (mmc: atmel-mci: remove compat for non DT board when requesting dma chan) removes compat transfer which breaks DMA support for ATNGW100. This patch returns back that functionality.

Cc Ludovic Desroches <[email protected]>

How about moving that filter function into arch/avr32 to make the mmc driver independent of the underlying dma engine implementation at the same time?

Arnd

#2 lore raw
Quoted 6 lines · Arnd Bergmann
Quoted 5 lines · On Monday 27 July 2015 14:53:30 you wrote:

The commit ecb89f2f5f3e (mmc: atmel-mci: remove compat for non DT board when
requesting dma chan) removes compat transfer which breaks DMA support for ATNGW100. This patch returns back that functionality.

Quoted 7 lines
Quoted 3 lines
Cc Ludovic Desroches <[email protected]>

How about moving that filter function into arch/avr32 to make the mmc driver independent of the underlying dma engine implementation at the same time?

It might be a good idea, but I'm neither an expert in avr32 nor have time right now to do this better. Consider this a bug report with a work around which works for me. I can test any better solution someone proposes.

Quoted 2 lines

Arnd

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#3 lore raw

Hi Andy,

Your patch does a bit more than reverting commit ecb89f2f5f3e. I will split it in order to see well which previous patches have been reverted.

Quoted 7 lines · Andy Shevchenko
Quoted 6 lines · Arnd Bergmann
Quoted 5 lines · On Monday 27 July 2015 14:53:30 you wrote:

The commit ecb89f2f5f3e (mmc: atmel-mci: remove compat for non DT board when
requesting dma chan) removes compat transfer which breaks DMA support for ATNGW100. This patch returns back that functionality.

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Cc Ludovic Desroches <[email protected]>

How about moving that filter function into arch/avr32 to make the mmc driver independent of the underlying dma engine implementation at the same time?

It would be great to not keep code which becomes architecture dependant. If we can move the filter function somewhere in arch/avr32, we will have to revert commit fda1b26 and use dma_request_slave_channel_compat.

I had a look to the arch/avr32 directory but I don't know where to put this kind of stuff.

Quoted 5 lines

It might be a good idea, but I'm neither an expert in avr32 nor have time right now to do this better. Consider this a bug report with a work around which works for me. I can test any better solution someone proposes.

Regards

Ludovic

#4 lore raw
Quoted 21 lines · On Thursday 06 August 2015 09:01:56 Ludovic Desroches wrote:

Hi Andy,

Your patch does a bit more than reverting commit ecb89f2f5f3e. I will split it in order to see well which previous patches have been reverted.

Quoted 7 lines · Andy Shevchenko
Quoted 6 lines · Arnd Bergmann
Quoted 5 lines · On Monday 27 July 2015 14:53:30 you wrote:

The commit ecb89f2f5f3e (mmc: atmel-mci: remove compat for non DT board when
requesting dma chan) removes compat transfer which breaks DMA support for ATNGW100. This patch returns back that functionality.

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Cc Ludovic Desroches <[email protected]>

How about moving that filter function into arch/avr32 to make the mmc driver independent of the underlying dma engine implementation at the same time?

Quoted 6 lines

It would be great to not keep code which becomes architecture dependant. If we can move the filter function somewhere in arch/avr32, we will have to revert commit fda1b26 and use dma_request_slave_channel_compat.

I had a look to the arch/avr32 directory but I don't know where to put this kind of stuff.

Next to the at32_add_device_mci() function, with a pointer to the filter function added to struct mci_platform_data, and the mci_dma_data structure replaced with a void pointer after moving the definition to the same place.

Arnd

#5 lore raw

PATCH 1/1 repair mci dma transfers for avr32

In reply to Andy Shevchenko

---

Hi,

Here is a rough draft to fix the regression. I have only compiled it. I will update all the boards later.

I have removed the mci_dma_data since it is no more used for ARM platforms.

 arch/avr32/boards/atngw100/setup.c          |  1 +
 arch/avr32/mach-at32ap/at32ap700x.c         | 31 +++++++++++++++++++++--------
 arch/avr32/mach-at32ap/include/mach/board.h |  2 ++
 drivers/mmc/host/atmel-mci.c                | 16 +++++++++++++--
 include/linux/atmel-mci.h                   |  2 ++
 include/linux/platform_data/mmc-atmel-mci.h | 22 --------------------
 6 files changed, 42 insertions(+), 32 deletions(-)
 delete mode 100644 include/linux/platform_data/mmc-atmel-mci.h
arch/avr32/boards/atngw100/setup.c +1 -0
index afeae89..8b4f3d1 100644
@@ -131,6 +131,7 @@ static struct mci_platform_data __initdata mci0_data = {
 		.wp_pin		= GPIO_PIN_PE(0),
 #endif
 	},
+	.dma_filter = &atmci_filter,
 };
 
 static struct usba_platform_data atngw100_usba_data __initdata = {
arch/avr32/mach-at32ap/at32ap700x.c +23 -8
index 1d8b147..8c6f77e 100644
@@ -7,6 +7,7 @@
  */
 #include <linux/clk.h>
 #include <linux/delay.h>
+#include <linux/dmaengine.h>
 #include <linux/platform_data/dma-dw.h>
 #include <linux/fb.h>
 #include <linux/init.h>
@@ -17,7 +18,6 @@
 #include <linux/spi/spi.h>
 #include <linux/usb/atmel_usba_udc.h>
 
-#include <linux/platform_data/mmc-atmel-mci.h>
 #include <linux/atmel-mci.h>
 
 #include <asm/io.h>
@@ -1332,7 +1332,7 @@ struct platform_device *__init
 at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
 {
 	struct platform_device		*pdev;
-	struct mci_dma_data	        *slave;
+	struct dw_dma_slave     	*slave;
 	u32				pioa_mask;
 	u32				piob_mask;
 
@@ -1351,15 +1351,15 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
 				ARRAY_SIZE(atmel_mci0_resource)))
 		goto fail;
 
-	slave = kzalloc(sizeof(struct mci_dma_data), GFP_KERNEL);
+	slave = kzalloc(sizeof(*slave), GFP_KERNEL);
 	if (!slave)
 		goto fail;
 
-	slave->sdata.dma_dev = &dw_dmac0_device.dev;
-	slave->sdata.src_id = 0;
-	slave->sdata.dst_id = 1;
-	slave->sdata.src_master = 1;
-	slave->sdata.dst_master = 0;
+	slave->dma_dev = &dw_dmac0_device.dev;
+	slave->src_id = 0;
+	slave->dst_id = 1;
+	slave->src_master = 1;
+	slave->dst_master = 0;
 
 	data->dma_slave = slave;
 
@@ -1435,6 +1435,21 @@ fail:
 	return NULL;
 }
 
+bool atmci_filter(struct dma_chan *chan, void *pdata)
+{
+	struct dw_dma_slave *sl_pdata = pdata;
+
+	if (!sl_pdata)
+		return false;
+
+	if (sl_pdata->dma_dev == chan->device->dev) {
+		chan->private = sl_pdata;
+		return true;
+	} else {
+		return false;
+	}
+}
+
 /* --------------------------------------------------------------------
  *  LCDC
  * -------------------------------------------------------------------- */
arch/avr32/mach-at32ap/include/mach/board.h +2 -0
index f1a316d..e6f9e56 100644
@@ -4,6 +4,7 @@
 #ifndef __ASM_ARCH_BOARD_H
 #define __ASM_ARCH_BOARD_H
 
+#include <linux/dmaengine.h>
 #include <linux/types.h>
 #include <linux/serial.h>
 #include <linux/platform_data/macb.h>
@@ -86,6 +87,7 @@ struct platform_device *at32_add_device_twi(unsigned int id,
 struct mci_platform_data;
 struct platform_device *
 at32_add_device_mci(unsigned int id, struct mci_platform_data *data);
+bool atmci_filter(struct dma_chan *chan, void *pdata);
 
 struct ac97c_platform_data;
 struct platform_device *
drivers/mmc/host/atmel-mci.c +14 -2
index 9a39e0b..1d80135 100644
@@ -30,7 +30,6 @@
 #include <linux/stat.h>
 #include <linux/types.h>
 #include <linux/platform_data/atmel.h>
-#include <linux/platform_data/mmc-atmel-mci.h>
 
 #include <linux/mmc/host.h>
 #include <linux/mmc/sdio.h>
@@ -2281,8 +2280,21 @@ static int atmci_configure_dma(struct atmel_mci *host)
 {
 	host->dma.chan = dma_request_slave_channel_reason(&host->pdev->dev,
 							"rxtx");
-	if (IS_ERR(host->dma.chan))
+	if (IS_ERR(host->dma.chan) == -ENODEV) {
+		dma_cap_mask_t mask;
+		struct mci_platform_data *pdata = host->pdev->dev.platform_data;
+		/*  */
+		dma_cap_zero(mask);
+		dma_cap_set(DMA_SLAVE, mask);
+
+		host->dma.chan = dma_request_channel(mask,
+						     pdata->dma_filter,
+						     pdata->dma_slave);
+		if (!host->dma.chan)
+			return -ENODEV;
+	} else {
 		return PTR_ERR(host->dma.chan);
+	}
 
 	dev_info(&host->pdev->dev, "using %s for DMA transfers\n",
 		 dma_chan_name(host->dma.chan));
include/linux/atmel-mci.h +2 -0
index 9177947..fe5d72f 100644
@@ -1,6 +1,7 @@
 #ifndef __LINUX_ATMEL_MCI_H
 #define __LINUX_ATMEL_MCI_H
 
+#include <linux/dmaengine.h>
 #include <linux/types.h>
 
 #define ATMCI_MAX_NR_SLOTS	2
@@ -38,6 +39,7 @@ struct mci_slot_pdata {
 struct mci_platform_data {
 	struct mci_dma_data	*dma_slave;
 	struct mci_slot_pdata	slot[ATMCI_MAX_NR_SLOTS];
+	bool (*dma_filter) 	(struct dma_chan *chan, void *pdata);
 };
 
 #endif /* __LINUX_ATMEL_MCI_H */
include/linux/platform_data/mmc-atmel-mci.h deleted +0 -22
deleted file mode 100644
index 399a2d5..0000000
@@ -1,22 +0,0 @@
-#ifndef __MMC_ATMEL_MCI_H
-#define __MMC_ATMEL_MCI_H
-
-#include <linux/platform_data/dma-atmel.h>
-#include <linux/platform_data/dma-dw.h>
-
-/**
- * struct mci_dma_data - DMA data for MCI interface
- */
-struct mci_dma_data {
-#ifdef CONFIG_ARM
-	struct at_dma_slave     sdata;
-#else
-	struct dw_dma_slave     sdata;
-#endif
-};
-
-/* accessor macros */
-#define	slave_data_ptr(s)	(&(s)->sdata)
-#define find_slave_dev(s)	((s)->sdata.dma_dev)
-
-#endif /* __MMC_ATMEL_MCI_H */
Signature · 1 line
2.5.0
#6 lore raw

Re: [PATCH] [wip] repair mci dma transfers for avr32

Quoted 11 lines · Ludovic Desroches

---

Hi,

Here is a rough draft to fix the regression. I have only compiled it. I will
update all the boards later.

I have removed the mci_dma_data since it is no more used for ARM platforms.

I will test it later, though few comments below.

Quoted 82 lines
 arch/avr32/boards/atngw100/setup.c          |  1 +
 arch/avr32/mach-at32ap/at32ap700x.c         | 31 
+++++++++++++++++++++--------
 arch/avr32/mach-at32ap/include/mach/board.h |  2 ++
 drivers/mmc/host/atmel-mci.c                | 16 +++++++++++++--
 include/linux/atmel-mci.h                   |  2 ++
 include/linux/platform_data/mmc-atmel-mci.h | 22 -------------------
(quoted diff) +0 -1
-
 6 files changed, 42 insertions(+), 32 deletions(-)
 delete mode 100644 include/linux/platform_data/mmc-atmel-mci.h
arch/avr32/boards/atngw100/setup.c +1 -0
index afeae89..8b4f3d1 100644
@@ -131,6 +131,7 @@ static struct mci_platform_data __initdata 
 mci0_data = {
 		.wp_pin		= GPIO_PIN_PE(0),
 #endif
 	},
+	.dma_filter = &atmci_filter,
 };
 

static struct usba_platform_data atngw100_usba_data __initdata = {

arch/avr32/mach renamed from arch/avr32/mach-at32ap/at32ap700x.c +0 -1
-at32ap/at32ap700x.c

index 1d8b147..8c6f77e 100644

arch/avr32/mach-at32ap/at32ap700x.c +2 -2
@@ -7,6 +7,7 @@
  */
 #include <linux/clk.h>
 #include <linux/delay.h>
+#include <linux/dmaengine.h>
 #include <linux/platform_data/dma-dw.h>
 #include <linux/fb.h>
 #include <linux/init.h>
@@ -17,7 +18,6 @@
 #include <linux/spi/spi.h>
 #include <linux/usb/atmel_usba_udc.h>
 
-#include <linux/platform_data/mmc-atmel-mci.h>
 #include <linux/atmel-mci.h>
 
 #include <asm/io.h>
@@ -1332,7 +1332,7 @@ struct platform_device *__init
 at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
 {
 	struct platform_device		*pdev;
-	struct mci_dma_data	        *slave;
+	struct dw_dma_slave     	*slave;
 
 
 	u32				pioa_mask;
arch/avr32/mach-at32ap/at32ap700x.c +6 -6
 	u32				piob_mask;
@@ -1351,15 +1351,15 @@ at32_add_device_mci(unsigned int id, struct 
 mci_platform_data *data)
 				ARRAY_SIZE(atmel_mci0_resource)))
 		goto fail;
 
-	slave = kzalloc(sizeof(struct mci_dma_data), GFP_KERNEL);
+	slave = kzalloc(sizeof(*slave), GFP_KERNEL);
 	if (!slave)
 		goto fail;
 
-	slave->sdata.dma_dev = &dw_dmac0_device.dev;
-	slave->sdata.src_id = 0;
-	slave->sdata.dst_id = 1;
-	slave->sdata.src_master = 1;
-	slave->sdata.dst_master = 0;
+	slave->dma_dev = &dw_dmac0_device.dev;
+	slave->src_id = 0;
+	slave->dst_id = 1;
+	slave->src_master = 1;
+	slave->dst_master = 0;
 
 	data->dma_slave = slave;

arch/avr32/mach-at32ap/at32ap700x.c fail: · line 1440

Quoted 6 lines
arch/avr32/mach-at32ap/at32ap700x.c +3 -0
@@ -1435,6 +1435,21 @@ fail:
 	return NULL;
 }
 
+bool atmci_filter(struct dma_chan *chan, void *pdata)
+{
+	struct dw_dma_slave *sl_pdata = pdata;

I would prefer dws name for struct dw_dma_slave here.

Quoted 30 lines
arch/avr32/mach-at32ap/at32ap700x.c +11 -2
+	if (!sl_pdata)
+		return false;
+
+	if (sl_pdata->dma_dev == chan->device->dev) {
+		chan->private = sl_pdata;
+		return true;
+	} else {
+		return false;
+	}
+}
+
 /* -----------------------------------------------------------------
---
  *  LCDC
  * -----------------------------------------------------------------
--- */
arch/avr32/mach-at32ap/include/mach/board.h +1 -0
index f1a316d..e6f9e56 100644
@@ -4,6 +4,7 @@
 #ifndef __ASM_ARCH_BOARD_H
 #define __ASM_ARCH_BOARD_H
 
+#include <linux/dmaengine.h>
 #include <linux/types.h>
 #include <linux/serial.h>
 #include <linux/platform_data/macb.h>

arch/avr32/mach-at32ap/include/mach/board.h struct platform_device · line 92

Quoted 6 lines
arch/avr32/mach-at32ap/include/mach/board.h +1 -0
@@ -86,6 +87,7 @@ struct platform_device 
 *at32_add_device_twi(unsigned int id,
 struct mci_platform_data;
 struct platform_device *
 at32_add_device_mci(unsigned int id, struct mci_platform_data 
 *data);
+bool atmci_filter(struct dma_chan *chan, void *pdata);

Maybe at32_mci_filter() ?

Quoted 17 lines
arch/avr32/mach-at32ap/include/mach/board.h +0 -0
 struct ac97c_platform_data;

struct platform_device *

drivers/mmc/host/atmel renamed from drivers/mmc/host/atmel-mci.c +0 -1
-mci.c

index 9a39e0b..1d80135 100644

drivers/mmc/host/atmel-mci.c +0 -1
@@ -30,7 +30,6 @@
 #include <linux/stat.h>
 #include <linux/types.h>
 #include <linux/platform_data/atmel.h>
-#include <linux/platform_data/mmc-atmel-mci.h>
 
 #include <linux/mmc/host.h>
 #include <linux/mmc/sdio.h>

drivers/mmc/host/atmel-mci.c static int atmci_configure_dma(struct · line 2284

Quoted 7 lines
drivers/mmc/host/atmel-mci.c +1 -2
@@ -2281,8 +2280,21 @@ static int atmci_configure_dma(struct 
 atmel_mci *host)
 {
 	host->dma.chan = dma_request_slave_channel_reason(&host
->pdev->dev,
 							"rxtx");
-	if (IS_ERR(host->dma.chan))
+	if (IS_ERR(host->dma.chan) == -ENODEV) {

IS_ERR() returns boolean. It wouldn't be comparable with -Exxx.

Quoted 25 lines
drivers/mmc/host/atmel-mci.c +13 -3
+		dma_cap_mask_t mask;
+		struct mci_platform_data *pdata = host->pdev
->dev.platform_data;
+		/*  */
+		dma_cap_zero(mask);
+		dma_cap_set(DMA_SLAVE, mask);
+
+		host->dma.chan = dma_request_channel(mask,
+						     pdata
->dma_filter,
+						     pdata
->dma_slave);
+		if (!host->dma.chan)
+			return -ENODEV;
+	} else {
 		return PTR_ERR(host->dma.chan);
+	}
 
 	dev_info(&host->pdev->dev, "using %s for DMA transfers\n",
 		 dma_chan_name(host->dma.chan));
include/linux/atmel-mci.h +0 -0
index 9177947..fe5d72f 100644

include/linux/atmel-mci.h line 4

Quoted 4 lines
include/linux/atmel-mci.h +1 -0
@@ -1,6 +1,7 @@
 #ifndef __LINUX_ATMEL_MCI_H
 #define __LINUX_ATMEL_MCI_H
 
+#include <linux/dmaengine.h>

You need only struct dma_chan. Why not

struct dma_chan;

?

include/linux/atmel-mci.h struct mci_slot_pdata { · line 40

Quoted 6 lines
include/linux/atmel-mci.h +0 -0
 #include <linux/types.h>
 
 #define ATMCI_MAX_NR_SLOTS	2
@@ -38,6 +39,7 @@ struct mci_slot_pdata {
 struct mci_platform_data {
 	struct mci_dma_data	*dma_slave;

Should be above line left?

Quoted 35 lines
include/linux/atmel-mci.h +1 -0
 	struct mci_slot_pdata	slot[ATMCI_MAX_NR_SLOTS];
+	bool (*dma_filter) 	(struct dma_chan *chan, void 
 *pdata);
 };
 

#endif /* __LINUX_ATMEL_MCI_H */

include/linux/platform_data/mmc-atmel-mci.h deleted +0 -22
deleted file mode 100644
index 399a2d5..0000000
@@ -1,22 +0,0 @@
-#ifndef __MMC_ATMEL_MCI_H
-#define __MMC_ATMEL_MCI_H
-
-#include <linux/platform_data/dma-atmel.h>
-#include <linux/platform_data/dma-dw.h>
-
-/**
- * struct mci_dma_data - DMA data for MCI interface
- */
-struct mci_dma_data {
-#ifdef CONFIG_ARM
-	struct at_dma_slave     sdata;
-#else
-	struct dw_dma_slave     sdata;
-#endif
-};
-
-/* accessor macros */
-#define	slave_data_ptr(s)	(&(s)->sdata)
-#define find_slave_dev(s)	((s)->sdata.dma_dev)
-
-#endif /* __MMC_ATMEL_MCI_H */
Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#7 lore raw

Re: [PATCH] [wip] repair mci dma transfers for avr32

In reply to Ludovic Desroches

+Måns

Quoted 11 lines · Ludovic Desroches

---

Hi,

Here is a rough draft to fix the regression. I have only compiled it. I will
update all the boards later.

I have removed the mci_dma_data since it is no more used for ARM platforms.

Sorry for really late answer, but seems Måns fixed the issue. He has a board to test as well.

Quoted 217 lines

 arch/avr32/boards/atngw100/setup.c          |  1 + arch/avr32/mach-at32ap/at32ap700x.c         | 31
+++++++++++++++++++++--------
 arch/avr32/mach-at32ap/include/mach/board.h |  2 ++ drivers/mmc/host/atmel-mci.c                | 16 +++++++++++++-- include/linux/atmel-mci.h                   |  2 ++ include/linux/platform_data/mmc-atmel-mci.h | 22 -----------------
---

 6 files changed, 42 insertions(+), 32 deletions(-)

 delete mode 100644 include/linux/platform_data/mmc-atmel-mci.h

arch/avr32/boards/atngw100/setup.c +1 -0
index afeae89..8b4f3d1 100644
@@ -131,6 +131,7 @@ static struct mci_platform_data __initdata
 mci0_data = {
  		.wp_pin		= GPIO_PIN_PE(0),
  #endif
  	},
+	.dma_filter = &atmci_filter,
  };


 static struct usba_platform_data atngw100_usba_data __initdata = {

arch/avr32/mach- renamed from arch/avr32/mach-at32ap/at32ap700x.c +0 -0

at32ap/at32ap700x.c
index 1d8b147..8c6f77e 100644

arch/avr32/mach-at32ap/at32ap700x.c +1 -0
@@ -7,6 +7,7 @@
   */
  #include <linux/clk.h>
  #include <linux/delay.h>
+#include <linux/dmaengine.h>
  #include <linux/platform_data/dma-dw.h>
  #include <linux/fb.h>
  #include <linux/init.h>
@@ -17,7 +18,6 @@
  #include <linux/spi/spi.h>
  #include <linux/usb/atmel_usba_udc.h>


-#include <linux/platform_data/mmc-atmel-mci.h>
 #include <linux/atmel-mci.h>

 #include <asm/io.h>

arch/avr32/mach-at32ap/at32ap700x.c +1 -1
@@ -1332,7 +1332,7 @@ struct platform_device *__init
  at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
  {
  	struct platform_device		*pdev;
-	struct mci_dma_data	        *slave;
+	struct dw_dma_slave     	*slave;
  	u32				pioa_mask;
  	u32				piob_mask;

arch/avr32/mach-at32ap/at32ap700x.c +0 -0
@@ -1351,15 +1351,15 @@ at32_add_device_mci(unsigned int id, struct
 mci_platform_data *data)
  				ARRAY_SIZE(atmel_mci0_resource)))
  		goto fail;

arch/avr32/mach-at32ap/at32ap700x.c +1 -1
-	slave = kzalloc(sizeof(struct mci_dma_data), GFP_KERNEL);
+	slave = kzalloc(sizeof(*slave), GFP_KERNEL);

  if (!slave)
  goto fail;

arch/avr32/mach-at32ap/at32ap700x.c +5 -5
-	slave->sdata.dma_dev = &dw_dmac0_device.dev;
-	slave->sdata.src_id = 0;
-	slave->sdata.dst_id = 1;
-	slave->sdata.src_master = 1;
-	slave->sdata.dst_master = 0;
+	slave->dma_dev = &dw_dmac0_device.dev;
+	slave->src_id = 0;
+	slave->dst_id = 1;
+	slave->src_master = 1;
+	slave->dst_master = 0;


  data->dma_slave = slave;

arch/avr32/mach-at32ap/at32ap700x.c +0 -0
@@ -1435,6 +1435,21 @@ fail:
  	return NULL;
  }

arch/avr32/mach-at32ap/at32ap700x.c +15 -0
+bool atmci_filter(struct dma_chan *chan, void *pdata)
+{
+	struct dw_dma_slave *sl_pdata = pdata;
+
+	if (!sl_pdata)
+		return false;
+
+	if (sl_pdata->dma_dev == chan->device->dev) {
+		chan->private = sl_pdata;
+		return true;
+	} else {
+		return false;
+	}
+}
+

 /* ---------------------------------------------------------------
-----
  *  LCDC
  * --------------------------------------------------------------- ----- */

arch/avr32/mach-at32ap/include/mach/board.h +0 -0
index f1a316d..e6f9e56 100644
@@ -4,6 +4,7 @@
  #ifndef __ASM_ARCH_BOARD_H
  #define __ASM_ARCH_BOARD_H


+#include <linux/dmaengine.h>
 #include <linux/types.h>
 #include <linux/serial.h>
 #include <linux/platform_data/macb.h>

arch/avr32/mach-at32ap/include/mach/board.h +0 -0
@@ -86,6 +87,7 @@ struct platform_device
 *at32_add_device_twi(unsigned int id,
  struct mci_platform_data;

 struct platform_device * at32_add_device_mci(unsigned int id, struct mci_platform_data *data);
+bool atmci_filter(struct dma_chan *chan, void *pdata);
 struct ac97c_platform_data;
 struct platform_device *

drivers/mmc/host/atmel- renamed from drivers/mmc/host/atmel-mci.c +0 -0

mci.c
index 9a39e0b..1d80135 100644

drivers/mmc/host/atmel-mci.c +0 -1
@@ -30,7 +30,6 @@
  #include <linux/stat.h>
  #include <linux/types.h>
  #include <linux/platform_data/atmel.h>
-#include <linux/platform_data/mmc-atmel-mci.h>


 #include <linux/mmc/host.h>
 #include <linux/mmc/sdio.h>

drivers/mmc/host/atmel-mci.c +0 -0
@@ -2281,8 +2280,21 @@ static int atmci_configure_dma(struct
 atmel_mci *host)
  {

  host->dma.chan = dma_request_slave_channel_reason(&host-

Quoted 1 line

pdev->dev,

  "rxtx");

drivers/mmc/host/atmel-mci.c +3 -1
-	if (IS_ERR(host->dma.chan))
+	if (IS_ERR(host->dma.chan) == -ENODEV) {
+		dma_cap_mask_t mask;
+		struct mci_platform_data *pdata = host->pdev-
Quoted 1 line

dev.platform_data;

drivers/mmc/host/atmel-mci.c +6 -0
+		/*  */
+		dma_cap_zero(mask);
+		dma_cap_set(DMA_SLAVE, mask);
+
+		host->dma.chan = dma_request_channel(mask,
+						     pdata-
Quoted 1 line

dma_filter,

drivers/mmc/host/atmel-mci.c +1 -0
+						     pdata-
Quoted 1 line

dma_slave);

drivers/mmc/host/atmel-mci.c +3 -0
+		if (!host->dma.chan)
+			return -ENODEV;
+	} else {

  return PTR_ERR(host->dma.chan);

drivers/mmc/host/atmel-mci.c +1 -0
+	}


  dev_info(&host->pdev->dev, "using %s for DMA transfers\n", dma_chan_name(host->dma.chan));

include/linux/atmel-mci.h +0 -0
index 9177947..fe5d72f 100644
@@ -1,6 +1,7 @@
  #ifndef __LINUX_ATMEL_MCI_H
  #define __LINUX_ATMEL_MCI_H


+#include <linux/dmaengine.h>
 #include <linux/types.h>

 #define ATMCI_MAX_NR_SLOTS 2

include/linux/atmel-mci.h +1 -0
@@ -38,6 +39,7 @@ struct mci_slot_pdata {
  struct mci_platform_data {
  	struct mci_dma_data	*dma_slave;
  	struct mci_slot_pdata	slot[ATMCI_MAX_NR_SLOTS];
+	bool (*dma_filter) 	(struct dma_chan *chan, void
 *pdata);
  };


 #endif /* __LINUX_ATMEL_MCI_H */

include/linux/platform_data/mmc-atmel-mci.h deleted +0 -22
deleted file mode 100644
index 399a2d5..0000000
@@ -1,22 +0,0 @@
-#ifndef __MMC_ATMEL_MCI_H
-#define __MMC_ATMEL_MCI_H
-
-#include <linux/platform_data/dma-atmel.h>
-#include <linux/platform_data/dma-dw.h>
-
-/**
- * struct mci_dma_data - DMA data for MCI interface
- */
-struct mci_dma_data {
-#ifdef CONFIG_ARM
-	struct at_dma_slave     sdata;
-#else
-	struct dw_dma_slave     sdata;
-#endif
-};
-
-/* accessor macros */
-#define	slave_data_ptr(s)	(&(s)->sdata)
-#define find_slave_dev(s)	((s)->sdata.dma_dev)
-
-#endif /* __MMC_ATMEL_MCI_H */
Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy