Skip to contentSkip to conversation

add DMA support to tmio_mmc, using dmaengine API, use it on SH

PATCH Applied Guennadi Liakhovetski 3 participants 20 messages Apr 21, 2010 – Apr 27, 2010

Subsystems (5)

v1 of 4 Applied Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover add DMA support to tmio_mmc, using dmaengine API, use it on SH

This patch series adds DMA support to the tmio_mmc SD/MMC host driver, using the dmaengine API. So far this is only used on SuperH platforms, will also be supported on ARM shmobile boards, both use the sh_mobile_sdhi MFD driver. Other TMIO MFD implementations are unaffected. The patch transparently falls back to PIO if no DMA is configured by the MFD driver, or if DMA initialisation or execution fail.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#1 lore raw

PATCH 1/8 SH: constify multiple DMA related objects and references to them

Lists of DMA channels and slaves are not changed, make them constant. Besides, SH7724 channel and slave configuration of both DMA controllers is identical, remove the extra copy of the configuration data.

---

Just some preparatory clean up.

 arch/sh/kernel/cpu/sh4a/setup-sh7722.c |    6 ++--
 arch/sh/kernel/cpu/sh4a/setup-sh7724.c |   54 ++++---------------------------
 arch/sh/kernel/cpu/sh4a/setup-sh7780.c |    6 ++--
 arch/sh/kernel/cpu/sh4a/setup-sh7785.c |    6 ++--
 drivers/dma/shdma.c                    |   12 ++++---
 include/linux/sh_dma.h                 |    9 +++--
 6 files changed, 28 insertions(+), 65 deletions(-)
arch/sh/kernel/cpu/sh4a/setup-sh7722.c +3 -3
index fd7e363..fe28f52 100644
@@ -24,7 +24,7 @@
 #include <cpu/dma-register.h>
 #include <cpu/sh7722.h>
 
-static struct sh_dmae_slave_config sh7722_dmae_slaves[] = {
+static const struct sh_dmae_slave_config sh7722_dmae_slaves[] = {
 	{
 		.slave_id	= SHDMA_SLAVE_SCIF0_TX,
 		.addr		= 0xffe0000c,
@@ -78,7 +78,7 @@ static struct sh_dmae_slave_config sh7722_dmae_slaves[] = {
 	},
 };
 
-static struct sh_dmae_channel sh7722_dmae_channels[] = {
+static const struct sh_dmae_channel sh7722_dmae_channels[] = {
 	{
 		.offset = 0,
 		.dmars = 0,
@@ -106,7 +106,7 @@ static struct sh_dmae_channel sh7722_dmae_channels[] = {
 	}
 };
 
-static unsigned int ts_shift[] = TS_SHIFT;
+static const unsigned int ts_shift[] = TS_SHIFT;
 
 static struct sh_dmae_pdata dma_platform_data = {
 	.slave		= sh7722_dmae_slaves,
arch/sh/kernel/cpu/sh4a/setup-sh7724.c +7 -47

79 lines not on this page · raw message

arch/sh/kernel/cpu/sh4a/setup-sh7780.c +3 -3
index 02e792c..c3fcb39 100644
@@ -251,7 +251,7 @@ static struct platform_device rtc_device = {
 };
 
 /* DMA */
-static struct sh_dmae_channel sh7780_dmae0_channels[] = {
+static const struct sh_dmae_channel sh7780_dmae0_channels[] = {
 	{
 		.offset = 0,
 		.dmars = 0,
@@ -279,7 +279,7 @@ static struct sh_dmae_channel sh7780_dmae0_channels[] = {
 	}
 };
 
-static struct sh_dmae_channel sh7780_dmae1_channels[] = {
+static const struct sh_dmae_channel sh7780_dmae1_channels[] = {
 	{
 		.offset = 0,
 	}, {
@@ -295,7 +295,7 @@ static struct sh_dmae_channel sh7780_dmae1_channels[] = {
 	}
 };
 
-static unsigned int ts_shift[] = TS_SHIFT;
+static const unsigned int ts_shift[] = TS_SHIFT;
 
 static struct sh_dmae_pdata dma0_platform_data = {
 	.channel	= sh7780_dmae0_channels,
arch/sh/kernel/cpu/sh4a/setup-sh7785.c +3 -3
index 1fcd88b..771ae76 100644
@@ -299,7 +299,7 @@ static struct platform_device tmu5_device = {
 };
 
 /* DMA */
-static struct sh_dmae_channel sh7785_dmae0_channels[] = {
+static const struct sh_dmae_channel sh7785_dmae0_channels[] = {
 	{
 		.offset = 0,
 		.dmars = 0,
@@ -327,7 +327,7 @@ static struct sh_dmae_channel sh7785_dmae0_channels[] = {
 	}
 };
 
-static struct sh_dmae_channel sh7785_dmae1_channels[] = {
+static const struct sh_dmae_channel sh7785_dmae1_channels[] = {
 	{
 		.offset = 0,
 	}, {
@@ -343,7 +343,7 @@ static struct sh_dmae_channel sh7785_dmae1_channels[] = {
 	}
 };
 
-static unsigned int ts_shift[] = TS_SHIFT;
+static const unsigned int ts_shift[] = TS_SHIFT;
 
 static struct sh_dmae_pdata dma0_platform_data = {
 	.channel	= sh7785_dmae0_channels,
drivers/dma/shdma.c +7 -5
index 549bae9..25ddb1e 100644
@@ -188,7 +188,7 @@ static int dmae_set_dmars(struct sh_dmae_chan *sh_chan, u16 val)
 	struct sh_dmae_device *shdev = container_of(sh_chan->common.device,
 						struct sh_dmae_device, common);
 	struct sh_dmae_pdata *pdata = shdev->pdata;
-	struct sh_dmae_channel *chan_pdata = &pdata->channel[sh_chan->id];
+	const struct sh_dmae_channel *chan_pdata = &pdata->channel[sh_chan->id];
 	u16 __iomem *addr = shdev->dmars + chan_pdata->dmars / sizeof(u16);
 	int shift = chan_pdata->dmars_bit;
 
@@ -264,7 +264,7 @@ static struct sh_desc *sh_dmae_get_desc(struct sh_dmae_chan *sh_chan)
 	return NULL;
 }
 
-static struct sh_dmae_slave_config *sh_dmae_find_slave(
+static const struct sh_dmae_slave_config *sh_dmae_find_slave(
 	struct sh_dmae_chan *sh_chan, struct sh_dmae_slave *param)
 {
 	struct dma_device *dma_dev = sh_chan->common.device;
@@ -297,7 +297,7 @@ static int sh_dmae_alloc_chan_resources(struct dma_chan *chan)
 	 * never runs concurrently with itself or free_chan_resources.
 	 */
 	if (param) {
-		struct sh_dmae_slave_config *cfg;
+		const struct sh_dmae_slave_config *cfg;
 
 		cfg = sh_dmae_find_slave(sh_chan, param);
 		if (!cfg) {
@@ -572,12 +572,14 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_slave_sg(
 {
 	struct sh_dmae_slave *param;
 	struct sh_dmae_chan *sh_chan;
+	dma_addr_t slave_addr;
 
 	if (!chan)
 		return NULL;
 
 	sh_chan = to_sh_chan(chan);
 	param = chan->private;
+	slave_addr = param->config->addr;
 
 	/* Someone calling slave DMA on a public channel? */
 	if (!param || !sg_len) {
@@ -590,7 +592,7 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_slave_sg(
 	 * if (param != NULL), this is a successfully requested slave channel,
 	 * therefore param->config != NULL too.
 	 */
-	return sh_dmae_prep_sg(sh_chan, sgl, sg_len, &param->config->addr,
+	return sh_dmae_prep_sg(sh_chan, sgl, sg_len, &slave_addr,
 			       direction, flags);
 }
 
@@ -871,7 +873,7 @@ static int __devinit sh_dmae_chan_probe(struct sh_dmae_device *shdev, int id,
 					int irq, unsigned long flags)
 {
 	int err;
-	struct sh_dmae_channel *chan_pdata = &shdev->pdata->channel[id];
+	const struct sh_dmae_channel *chan_pdata = &shdev->pdata->channel[id];
 	struct platform_device *pdev = to_platform_device(shdev->common.dev);
 	struct sh_dmae_chan *new_sh_chan;
 
include/linux/sh_dma.h +5 -4
index cdaaff4..b08cd4e 100644
@@ -17,7 +17,7 @@
 struct sh_dmae_slave {
 	unsigned int			slave_id; /* Set by the platform */
 	struct device			*dma_dev; /* Set by the platform */
-	struct sh_dmae_slave_config	*config;  /* Set by the driver */
+	const struct sh_dmae_slave_config	*config;  /* Set by the driver */
 };
 
 struct sh_dmae_regs {
@@ -36,6 +36,7 @@ struct sh_desc {
 	int chunks;
 	int mark;
 };
+
 struct sh_dmae_slave_config {
 	unsigned int			slave_id;
 	dma_addr_t			addr;
@@ -50,15 +51,15 @@ struct sh_dmae_channel {
 };
 
 struct sh_dmae_pdata {
-	struct sh_dmae_slave_config *slave;
+	const struct sh_dmae_slave_config *slave;
 	int slave_num;
-	struct sh_dmae_channel *channel;
+	const struct sh_dmae_channel *channel;
 	int channel_num;
 	unsigned int ts_low_shift;
 	unsigned int ts_low_mask;
 	unsigned int ts_high_shift;
 	unsigned int ts_high_mask;
-	unsigned int *ts_shift;
+	const unsigned int *ts_shift;
 	int ts_shift_num;
 	u16 dmaor_init;
 };
Signature · 1 line
1.6.2.4
Applied
#2 lore raw

Re: [PATCH 1/8] SH: constify multiple DMA related objects and references to them

Quoted 3 lines · Guennadi Liakhovetski

Lists of DMA channels and slaves are not changed, make them constant. Besides, SH7724 channel and slave configuration of both DMA controllers is identical, remove the extra copy of the configuration data.

I've applied this one, thanks.

#3 lore raw

PATCH 2/8 SH: add DMA slave IDs for two SDHI controllers, add slaves to sh7722

In reply to Guennadi Liakhovetski

SuperH SDHI controllers can use DMA, add slave IDs to the header and slave definitions to sh7722.

---
 arch/sh/include/asm/dmaengine.h        |    4 ++++
 arch/sh/kernel/cpu/sh4a/setup-sh7722.c |   10 ++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)
arch/sh/include/asm/dmaengine.h +4 -0
index 2a02b61..876e601 100644
@@ -29,6 +29,10 @@ enum {
 	SHDMA_SLAVE_SIUA_RX,
 	SHDMA_SLAVE_SIUB_TX,
 	SHDMA_SLAVE_SIUB_RX,
+	SHDMA_SLAVE_SDHI0_RX,
+	SHDMA_SLAVE_SDHI0_TX,
+	SHDMA_SLAVE_SDHI1_RX,
+	SHDMA_SLAVE_SDHI1_TX,
 };
 
 #endif
arch/sh/kernel/cpu/sh4a/setup-sh7722.c +10 -0
index fe28f52..7f78cc2 100644
@@ -75,6 +75,16 @@ static const struct sh_dmae_slave_config sh7722_dmae_slaves[] = {
 		.addr		= 0xa454c094,
 		.chcr		= DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT),
 		.mid_rid	= 0xb6,
+	}, {
+		.slave_id	= SHDMA_SLAVE_SDHI0_TX,
+		.addr		= 0x04ce0030,
+		.chcr		= DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT),
+		.mid_rid	= 0xc1,
+	}, {
+		.slave_id	= SHDMA_SLAVE_SDHI0_RX,
+		.addr		= 0x04ce0030,
+		.chcr		= DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT),
+		.mid_rid	= 0xc2,
 	},
 };
 
Signature · 1 line
1.6.2.4
#4 lore raw

Re: [PATCH 2/8] SH: add DMA slave IDs for two SDHI controllers, add slaves to sh7722

Hi Guennadi,

Quoted 14 lines · Guennadi Liakhovetski

SuperH SDHI controllers can use DMA, add slave IDs to the header and slave definitions to sh7722.

---
 arch/sh/include/asm/dmaengine.h        |    4 ++++ arch/sh/kernel/cpu/sh4a/setup-sh7722.c |   10 ++++++++++

 2 files changed, 14 insertions(+), 0 deletions(-)
arch/sh/include/asm/dmaengine.h +0 -0
index 2a02b61..876e601 100644

arch/sh/include/asm/dmaengine.h enum { · line 38

Quoted 10 lines
arch/sh/include/asm/dmaengine.h +4 -0
@@ -29,6 +29,10 @@ enum {
        SHDMA_SLAVE_SIUA_RX,
        SHDMA_SLAVE_SIUB_TX,
        SHDMA_SLAVE_SIUB_RX,
+       SHDMA_SLAVE_SDHI0_RX,
+       SHDMA_SLAVE_SDHI0_TX,
+       SHDMA_SLAVE_SDHI1_RX,
+       SHDMA_SLAVE_SDHI1_TX,
  };
 
  #endif

Thanks for your work on this. Two SDHIs may be enough for most processor types, but I think the G3 processor actually has three. With that in mind, I think it makes more sense to keep the slave ids together with the processor specific bits in for instance arch/sh/include/cpu-sh4/cpu/sh7722.h.

If you have time, can you please make a patch that moves the slave ids into the processor specific header files? This on top of the other code in the sh/dmaengine topic branch.

With that in place it will be easy to extend each processor type by itself without having to tie in dependencies on a single asm file.

Thanks,

/ magnus

#5 lore raw

Re: [PATCH 2/8] SH: add DMA slave IDs for two SDHI controllers, add slaves to sh7722

Quoted 35 lines · Magnus Damm

Hi Guennadi,

Quoted 14 lines · Guennadi Liakhovetski

SuperH SDHI controllers can use DMA, add slave IDs to the header and slave definitions to sh7722.

---
 arch/sh/include/asm/dmaengine.h        |    4 ++++ arch/sh/kernel/cpu/sh4a/setup-sh7722.c |   10 ++++++++++

 2 files changed, 14 insertions(+), 0 deletions(-)
arch/sh/include/asm/dmaengine.h +0 -0
index 2a02b61..876e601 100644

arch/sh/include/asm/dmaengine.h enum { · line 38

Quoted 10 lines
arch/sh/include/asm/dmaengine.h +4 -0
@@ -29,6 +29,10 @@ enum {
        SHDMA_SLAVE_SIUA_RX,
        SHDMA_SLAVE_SIUB_TX,
        SHDMA_SLAVE_SIUB_RX,
+       SHDMA_SLAVE_SDHI0_RX,
+       SHDMA_SLAVE_SDHI0_TX,
+       SHDMA_SLAVE_SDHI1_RX,
+       SHDMA_SLAVE_SDHI1_TX,
  };
 
  #endif

Thanks for your work on this. Two SDHIs may be enough for most processor types, but I think the G3 processor actually has three. With that in mind, I think it makes more sense to keep the slave ids together with the processor specific bits in for instance arch/sh/include/cpu-sh4/cpu/sh7722.h.

Quoted 3 lines

If you have time, can you please make a patch that moves the slave ids into the processor specific header files? This on top of the other code in the sh/dmaengine topic branch.

Ok, yes, first, I forgot to mention - this patch series is based on your earlier SH dmaengine patches. Secondly - sure, we can move these defines in cpu-specific headers, otoh - why? This is just an enum, it doesn't take space in binaries, and having them all together helps uniformity and avoids duplication, I think. So, I would just add those SDHI2 macros to this list. The important thing is, the actual slave definition array are per-CPU. Which is now the case after your patch series.

Quoted 2 lines

With that in place it will be easy to extend each processor type by itself without having to tie in dependencies on a single asm file.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#6 lore raw

Re: [PATCH 2/8] SH: add DMA slave IDs for two SDHI controllers, add slaves to sh7722

Quoted 38 lines · Guennadi Liakhovetski
Quoted 33 lines · Magnus Damm
Quoted 14 lines · Guennadi Liakhovetski

SuperH SDHI controllers can use DMA, add slave IDs to the header and slave definitions to sh7722.

---
 arch/sh/include/asm/dmaengine.h        |    4 ++++ arch/sh/kernel/cpu/sh4a/setup-sh7722.c |   10 ++++++++++

 2 files changed, 14 insertions(+), 0 deletions(-)
arch/sh/include/asm/dmaengine.h +0 -0
index 2a02b61..876e601 100644

arch/sh/include/asm/dmaengine.h enum { · line 38

Quoted 10 lines
arch/sh/include/asm/dmaengine.h +4 -0
@@ -29,6 +29,10 @@ enum {
        SHDMA_SLAVE_SIUA_RX,
        SHDMA_SLAVE_SIUB_TX,
        SHDMA_SLAVE_SIUB_RX,
+       SHDMA_SLAVE_SDHI0_RX,
+       SHDMA_SLAVE_SDHI0_TX,
+       SHDMA_SLAVE_SDHI1_RX,
+       SHDMA_SLAVE_SDHI1_TX,
  };
 
  #endif

Thanks for your work on this. Two SDHIs may be enough for most processor types, but I think the G3 processor actually has three. With that in mind, I think it makes more sense to keep the slave ids together with the processor specific bits in for instance arch/sh/include/cpu-sh4/cpu/sh7722.h.

Quoted 3 lines

If you have time, can you please make a patch that moves the slave ids into the processor specific header files? This on top of the other code in the sh/dmaengine topic branch.

Quoted 7 lines

Ok, yes, first, I forgot to mention - this patch series is based on your earlier SH dmaengine patches. Secondly - sure, we can move these defines in cpu-specific headers, otoh - why? This is just an enum, it doesn't take space in binaries, and having them all together helps uniformity and avoids duplication, I think. So, I would just add those SDHI2 macros to this list. The important thing is, the actual slave definition array are per-CPU. Which is now the case after your patch series.

Like you say, the actual slave definition array is per processor type. But the available hardware blocks varies with processor type, and we already have other processor specific information in the cpu-specific headers. It does not add any code size, true.

The reasons why I prefer them to be split out are:

1) When someone adds support for a new processor it's easy to implement the same type of information in the new cpu-specific header as other processors. Adding and removing things from a global list of processor blocks in a driver/framework specific header file hidden somewhere is not going to happen. Also, people usually only focus on one processor at a time. A long global list is just going to make people confused. "Why is there a SDHI2 there when I only have SDHI on my processor?"

2) Having them in a global list adds an unneccesary point of patch serialization.

3) We keep other things like GPIOs and HWBLK in cpu-specific headers already, why be special?

4) Having it in a global list may encourage people to include this header from drivers. Isn't it better to force the drivers to use this value as a cookie instead? This prevents people from adding hardware block specific workarounds to the driver that may or may not work on all processors...

/ magnus

#7 lore raw

Re: [PATCH 2/8] SH: add DMA slave IDs for two SDHI controllers, add slaves to sh7722

Quoted 64 lines · Magnus Damm
Quoted 38 lines · Guennadi Liakhovetski
Quoted 33 lines · Magnus Damm
Quoted 14 lines · Guennadi Liakhovetski

SuperH SDHI controllers can use DMA, add slave IDs to the header and slave definitions to sh7722.

---
 arch/sh/include/asm/dmaengine.h        |    4 ++++ arch/sh/kernel/cpu/sh4a/setup-sh7722.c |   10 ++++++++++

 2 files changed, 14 insertions(+), 0 deletions(-)
arch/sh/include/asm/dmaengine.h +0 -0
index 2a02b61..876e601 100644

arch/sh/include/asm/dmaengine.h enum { · line 38

Quoted 10 lines
arch/sh/include/asm/dmaengine.h +4 -0
@@ -29,6 +29,10 @@ enum {
        SHDMA_SLAVE_SIUA_RX,
        SHDMA_SLAVE_SIUB_TX,
        SHDMA_SLAVE_SIUB_RX,
+       SHDMA_SLAVE_SDHI0_RX,
+       SHDMA_SLAVE_SDHI0_TX,
+       SHDMA_SLAVE_SDHI1_RX,
+       SHDMA_SLAVE_SDHI1_TX,
  };
 
  #endif

Thanks for your work on this. Two SDHIs may be enough for most processor types, but I think the G3 processor actually has three. With that in mind, I think it makes more sense to keep the slave ids together with the processor specific bits in for instance arch/sh/include/cpu-sh4/cpu/sh7722.h.

Quoted 3 lines

If you have time, can you please make a patch that moves the slave ids into the processor specific header files? This on top of the other code in the sh/dmaengine topic branch.

Quoted 7 lines

Ok, yes, first, I forgot to mention - this patch series is based on your earlier SH dmaengine patches. Secondly - sure, we can move these defines in cpu-specific headers, otoh - why? This is just an enum, it doesn't take space in binaries, and having them all together helps uniformity and avoids duplication, I think. So, I would just add those SDHI2 macros to this list. The important thing is, the actual slave definition array are per-CPU. Which is now the case after your patch series.

Like you say, the actual slave definition array is per processor type. But the available hardware blocks varies with processor type, and we already have other processor specific information in the cpu-specific headers. It does not add any code size, true.

The reasons why I prefer them to be split out are:

1) When someone adds support for a new processor it's easy to implement the same type of information in the new cpu-specific header as other processors. Adding and removing things from a global list of processor blocks in a driver/framework specific header file hidden somewhere is not going to happen. Also, people usually only focus on one processor at a time. A long global list is just going to make people confused. "Why is there a SDHI2 there when I only have SDHI on my processor?"

Quoted 5 lines

2) Having them in a global list adds an unneccesary point of patch serialization.

3) We keep other things like GPIOs and HWBLK in cpu-specific headers already, why be special?

ok... you mean headers like arch/sh/include/cpu-sh4/cpu/sh7722.h, yeah, that makes sense, agree. Will redo.

Quoted 5 lines

4) Having it in a global list may encourage people to include this header from drivers. Isn't it better to force the drivers to use this value as a cookie instead? This prevents people from adding hardware block specific workarounds to the driver that may or may not work on all processors...

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#8 lore raw

PATCH 3/8 SH: add DMA slave definitions to sh7724

In reply to Guennadi Liakhovetski

Add a list of SCIF and SDHI DMA slave definitions to sh7724.

---
 arch/sh/kernel/cpu/sh4a/setup-sh7724.c |   86 ++++++++++++++++++++++++++++++++
 1 files changed, 86 insertions(+), 0 deletions(-)
arch/sh/kernel/cpu/sh4a/setup-sh7724.c +86 -0
index c4572b1..afdc5ad 100644
@@ -31,6 +31,90 @@
 #include <cpu/sh7724.h>
 
 /* DMA */
+static const struct sh_dmae_slave_config sh7724_dmae_slaves[] = {
+	{
+		.slave_id	= SHDMA_SLAVE_SCIF0_TX,
+		.addr		= 0xffe0000c,
+		.chcr		= DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
+		.mid_rid	= 0x21,
+	}, {
+		.slave_id	= SHDMA_SLAVE_SCIF0_RX,
+		.addr		= 0xffe00014,
+		.chcr		= DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
+		.mid_rid	= 0x22,
+	}, {
+		.slave_id	= SHDMA_SLAVE_SCIF1_TX,
+		.addr		= 0xffe1000c,
+		.chcr		= DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
+		.mid_rid	= 0x25,
+	}, {
+		.slave_id	= SHDMA_SLAVE_SCIF1_RX,
+		.addr		= 0xffe10014,
+		.chcr		= DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
+		.mid_rid	= 0x26,
+	}, {
+		.slave_id	= SHDMA_SLAVE_SCIF2_TX,
+		.addr		= 0xffe2000c,
+		.chcr		= DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
+		.mid_rid	= 0x29,
+	}, {
+		.slave_id	= SHDMA_SLAVE_SCIF2_RX,
+		.addr		= 0xffe20014,
+		.chcr		= DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
+		.mid_rid	= 0x2a,
+	}, {
+		.slave_id	= SHDMA_SLAVE_SCIF3_TX,
+		.addr		= 0xa4e30020,
+		.chcr		= DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
+		.mid_rid	= 0x2d,
+	}, {
+		.slave_id	= SHDMA_SLAVE_SCIF3_RX,
+		.addr		= 0xa4e30024,
+		.chcr		= DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
+		.mid_rid	= 0x2e,
+	}, {
+		.slave_id	= SHDMA_SLAVE_SCIF4_TX,
+		.addr		= 0xa4e40020,
+		.chcr		= DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
+		.mid_rid	= 0x31,
+	}, {
+		.slave_id	= SHDMA_SLAVE_SCIF4_RX,
+		.addr		= 0xa4e40024,
+		.chcr		= DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
+		.mid_rid	= 0x32,
+	}, {
+		.slave_id	= SHDMA_SLAVE_SCIF5_TX,
+		.addr		= 0xa4e50020,
+		.chcr		= DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
+		.mid_rid	= 0x35,
+	}, {
+		.slave_id	= SHDMA_SLAVE_SCIF5_RX,
+		.addr		= 0xa4e50024,
+		.chcr		= DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
+		.mid_rid	= 0x36,
+	}, {
+		.slave_id	= SHDMA_SLAVE_SDHI0_TX,
+		.addr		= 0x04ce0030,
+		.chcr		= DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT),
+		.mid_rid	= 0xc1,
+	}, {
+		.slave_id	= SHDMA_SLAVE_SDHI0_RX,
+		.addr		= 0x04ce0030,
+		.chcr		= DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT),
+		.mid_rid	= 0xc2,
+	}, {
+		.slave_id	= SHDMA_SLAVE_SDHI1_TX,
+		.addr		= 0x04cf0030,
+		.chcr		= DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT),
+		.mid_rid	= 0xc9,
+	}, {
+		.slave_id	= SHDMA_SLAVE_SDHI1_RX,
+		.addr		= 0x04cf0030,
+		.chcr		= DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT),
+		.mid_rid	= 0xca,
+	},
+};
+
 static const struct sh_dmae_channel sh7724_dmae_channels[] = {
 	{
 		.offset = 0,
@@ -62,6 +146,8 @@ static const struct sh_dmae_channel sh7724_dmae_channels[] = {
 static const unsigned int ts_shift[] = TS_SHIFT;
 
 static struct sh_dmae_pdata dma_platform_data = {
+	.slave		= sh7724_dmae_slaves,
+	.slave_num	= ARRAY_SIZE(sh7724_dmae_slaves),
 	.channel	= sh7724_dmae_channels,
 	.channel_num	= ARRAY_SIZE(sh7724_dmae_channels),
 	.ts_low_shift	= CHCR_TS_LOW_SHIFT,
Signature · 1 line
1.6.2.4
#9 lore raw

PATCH 4/8 MMC: add DMA support to tmio_mmc driver, when used on SuperH

In reply to Guennadi Liakhovetski

SDHI controllers on SuperH, served by the tmio_mmc driver, can use slave DMA for data transfer. This patch adds support for the dmaengine API to tmio_mmc and the necessary interfacing to the sh_mobile_sdhi MFD driver.

---

It could be further broken down into MMC and MFD parts if required, I think.

 drivers/mfd/sh_mobile_sdhi.c       |   25 +++-
 drivers/mmc/host/tmio_mmc.c        |  346 ++++++++++++++++++++++++++++++++----
 drivers/mmc/host/tmio_mmc.h        |   11 ++
 include/linux/mfd/sh_mobile_sdhi.h |    3 +
 include/linux/mfd/tmio.h           |   10 +
 5 files changed, 359 insertions(+), 36 deletions(-)
drivers/mfd/sh_mobile_sdhi.c +21 -4
index 468fd36..c368254 100644
@@ -25,11 +25,15 @@
 #include <linux/mfd/core.h>
 #include <linux/mfd/tmio.h>
 #include <linux/mfd/sh_mobile_sdhi.h>
+#include <linux/sh_dma.h>
 
 struct sh_mobile_sdhi {
 	struct clk *clk;
 	struct tmio_mmc_data mmc_data;
 	struct mfd_cell cell_mmc;
+	struct sh_dmae_slave param_tx;
+	struct sh_dmae_slave param_rx;
+	struct tmio_mmc_dma dma_priv;
 };
 
 static struct resource sh_mobile_sdhi_resources[] = {
@@ -63,6 +67,8 @@ static void sh_mobile_sdhi_set_pwr(struct platform_device *tmio, int state)
 static int __init sh_mobile_sdhi_probe(struct platform_device *pdev)
 {
 	struct sh_mobile_sdhi *priv;
+	struct tmio_mmc_data *mmc_data;
+	struct sh_mobile_sdhi_info *p = pdev->dev.platform_data;
 	struct resource *mem;
 	char clk_name[8];
 	int ret, irq;
@@ -84,6 +90,8 @@ static int __init sh_mobile_sdhi_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
+	mmc_data = &priv->mmc_data;
+
 	snprintf(clk_name, sizeof(clk_name), "sdhi%d", pdev->id);
 	priv->clk = clk_get(&pdev->dev, clk_name);
 	if (IS_ERR(priv->clk)) {
@@ -95,12 +103,21 @@ static int __init sh_mobile_sdhi_probe(struct platform_device *pdev)
 
 	clk_enable(priv->clk);
 
-	priv->mmc_data.hclk = clk_get_rate(priv->clk);
-	priv->mmc_data.set_pwr = sh_mobile_sdhi_set_pwr;
-	priv->mmc_data.capabilities = MMC_CAP_MMC_HIGHSPEED;
+	mmc_data->hclk = clk_get_rate(priv->clk);
+	mmc_data->set_pwr = sh_mobile_sdhi_set_pwr;
+	mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
+
+	if (p && p->dma_slave_tx >= 0 && p->dma_slave_rx >= 0) {
+		priv->param_tx.slave_id = p->dma_slave_tx;
+		priv->param_rx.slave_id = p->dma_slave_rx;
+		priv->dma_priv.chan_priv_tx = &priv->param_tx;
+		priv->dma_priv.chan_priv_rx = &priv->param_rx;
+		mmc_data->dma = &priv->dma_priv;
+		mmc_data->flags = p->tmio_flags;
+	}
 
 	memcpy(&priv->cell_mmc, &sh_mobile_sdhi_cell, sizeof(priv->cell_mmc));
-	priv->cell_mmc.driver_data = &priv->mmc_data;
+	priv->cell_mmc.driver_data = mmc_data;
 	priv->cell_mmc.platform_data = &priv->cell_mmc;
 	priv->cell_mmc.data_size = sizeof(priv->cell_mmc);
 
drivers/mmc/host/tmio_mmc.c +314 -32

487 lines not on this page · raw message

drivers/mmc/host/tmio_mmc.h +11 -0
index dafecfb..1008d1e 100644
@@ -10,6 +10,8 @@
  */
 
 #include <linux/highmem.h>
+#include <linux/interrupt.h>
+#include <linux/dmaengine.h>
 
 #define CTL_SD_CMD 0x00
 #define CTL_ARG_REG 0x04
@@ -106,6 +108,15 @@ struct tmio_mmc_host {
 	unsigned int            sg_off;
 
 	struct platform_device *pdev;
+
+	/* DMA support */
+	struct dma_chan		*chan_rx;
+	struct dma_chan		*chan_tx;
+	struct dma_async_tx_descriptor *desc;
+	unsigned int            dma_sglen;
+	struct tasklet_struct	dma_complete;
+	struct tasklet_struct	dma_issue;
+	dma_cookie_t		cookie;
 };
 
 #include <linux/io.h>
include/linux/mfd/sh_mobile_sdhi.h +3 -0
index 3bcd716..c7b47f8 100644
@@ -2,6 +2,9 @@
 #define __SH_MOBILE_SDHI_H__
 
 struct sh_mobile_sdhi_info {
+	int dma_slave_tx;
+	int dma_slave_rx;
+	unsigned long tmio_flags;
 	void (*set_pwr)(struct platform_device *pdev, int state);
 };
 
include/linux/mfd/tmio.h +10 -0
index c3f7dff..9882b45 100644
@@ -55,12 +55,22 @@ int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
 void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
 void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
 
+struct tmio_mmc_dma {
+	void *chan_priv_tx;
+	void *chan_priv_rx;
+};
+
+/* MFD flags */
+#define TMIO_IMMEDIATE_RX_COMPLETE	(1 << 0)
+
 /*
  * data for the MMC controller
  */
 struct tmio_mmc_data {
 	unsigned int			hclk;
 	unsigned long			capabilities;
+	unsigned long			flags;
+	struct tmio_mmc_dma		*dma;
 	void (*set_pwr)(struct platform_device *host, int state);
 	void (*set_clk_div)(struct platform_device *host, int state);
 };
Signature · 1 line
1.6.2.4
#10 lore raw

Re: [PATCH 4/8] MMC: add DMA support to tmio_mmc driver, when used on SuperH

Hi Guennadi,

Quoted 16 lines · Guennadi Liakhovetski

SDHI controllers on SuperH, served by the tmio_mmc driver, can use slave DMA for data transfer. This patch adds support for the dmaengine API to tmio_mmc and the necessary interfacing to the sh_mobile_sdhi MFD driver.

---

It could be further broken down into MMC and MFD parts if required, I think.

 drivers/mfd/sh_mobile_sdhi.c       |   25 +++- drivers/mmc/host/tmio_mmc.c        |  346 ++++++++++++++++++++++++++++++++---- drivers/mmc/host/tmio_mmc.h        |   11 ++ include/linux/mfd/sh_mobile_sdhi.h |    3 + include/linux/mfd/tmio.h           |   10 +

 5 files changed, 359 insertions(+), 36 deletions(-)

[snip]

Quoted 13 lines
drivers/mmc/host/tmio_mmc.c +1 -0
index b2b577f..fafd8c9 100644
@@ -29,12 +29,21 @@
  #include <linux/irq.h>
  #include <linux/device.h>
  #include <linux/delay.h>
+#include <linux/dmaengine.h>
  #include <linux/mmc/host.h>
  #include <linux/mfd/core.h>
  #include <linux/mfd/tmio.h>
 

drivers/mmc/host/tmio_mmc.c line 46

Quoted 10 lines
drivers/mmc/host/tmio_mmc.c +8 -0
  #include "tmio_mmc.h"
 
+static void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable)
+{
+#if defined(CONFIG_SUPERH) || defined(CONFIG_ARCH_SHMOBILE)
+       /* Switch DMA mode on or off - SuperH specific? */
+       sd_ctrl_write16(host, 0xd8, enable ? 2 : 0);
+#endif
+}
+

Uhh.. #ifdefs. =)

Can't this register setting be implented in the SDHI driver?

In general I realize that you need to extend the logic in the tmio_mmc driver quite a bit to implement DMA support, but I wonder if it is possible to extend the tmio_mmc driver with callbacks and use them to hook in the DMA code?

Thanks!

/ magnus

#11 lore raw

Re: [PATCH 4/8] MMC: add DMA support to tmio_mmc driver, when used on SuperH

Quoted 38 lines · Magnus Damm

Hi Guennadi,

Quoted 16 lines · Guennadi Liakhovetski

SDHI controllers on SuperH, served by the tmio_mmc driver, can use slave DMA for data transfer. This patch adds support for the dmaengine API to tmio_mmc and the necessary interfacing to the sh_mobile_sdhi MFD driver.

---

It could be further broken down into MMC and MFD parts if required, I think.

 drivers/mfd/sh_mobile_sdhi.c       |   25 +++- drivers/mmc/host/tmio_mmc.c        |  346 ++++++++++++++++++++++++++++++++---- drivers/mmc/host/tmio_mmc.h        |   11 ++ include/linux/mfd/sh_mobile_sdhi.h |    3 + include/linux/mfd/tmio.h           |   10 +

 5 files changed, 359 insertions(+), 36 deletions(-)

[snip]

Quoted 15 lines
drivers/mmc/host/tmio_mmc.c +1 -0
index b2b577f..fafd8c9 100644
@@ -29,12 +29,21 @@
  #include <linux/irq.h>
  #include <linux/device.h>
  #include <linux/delay.h>
+#include <linux/dmaengine.h>
  #include <linux/mmc/host.h>
  #include <linux/mfd/core.h>
  #include <linux/mfd/tmio.h>
 
  #include "tmio_mmc.h"
 
Quoted 10 lines

drivers/mmc/host/tmio_mmc.c line 46

Quoted 8 lines
drivers/mmc/host/tmio_mmc.c +8 -0
+static void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable)
+{
+#if defined(CONFIG_SUPERH) || defined(CONFIG_ARCH_SHMOBILE)
+       /* Switch DMA mode on or off - SuperH specific? */
+       sd_ctrl_write16(host, 0xd8, enable ? 2 : 0);
+#endif
+}
+

Uhh.. #ifdefs. =)

Yeah, I know. But that's the only location in the patch and...

Quoted 1 line

Can't this register setting be implented in the SDHI driver?

I'm awaiting comments from Ian, maybe other tmio users. Maybe this register is generic, even though I don't see any other tmio-containing chips implementing DMA.

Quoted 4 lines

In general I realize that you need to extend the logic in the tmio_mmc driver quite a bit to implement DMA support, but I wonder if it is possible to extend the tmio_mmc driver with callbacks and use them to hook in the DMA code?

As you see, this is all generic dmaengine API, nothing SH-specific. The only SH-specific part is filtering of channels, and that's hidden in SH platform code and passed as cookies to tmio. And if DMA is not used, all that code just remqins inactive.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#12 lore raw

PATCH 5/8 SH: Add SDHI DMA support to ecovec

In reply to Guennadi Liakhovetski
---
 arch/sh/boards/mach-ecovec24/setup.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
arch/sh/boards/mach-ecovec24/setup.c +7 -0
index 0e36b04..ff330f0 100644
@@ -11,6 +11,7 @@
 #include <linux/init.h>
 #include <linux/device.h>
 #include <linux/platform_device.h>
+#include <linux/mfd/sh_mobile_sdhi.h>
 #include <linux/mtd/physmap.h>
 #include <linux/gpio.h>
 #include <linux/interrupt.h>
@@ -31,6 +32,7 @@
 #include <media/sh_mobile_ceu.h>
 #include <media/tw9910.h>
 #include <media/mt9t112.h>
+#include <asm/dmaengine.h>
 #include <asm/heartbeat.h>
 #include <asm/sh_eth.h>
 #include <asm/clock.h>
@@ -442,6 +444,8 @@ static void sdhi0_set_pwr(struct platform_device *pdev, int state)
 }
 
 static struct sh_mobile_sdhi_info sdhi0_info = {
+	.dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
+	.dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
 	.set_pwr = sdhi0_set_pwr,
 };
 
@@ -478,6 +482,9 @@ static void sdhi1_set_pwr(struct platform_device *pdev, int state)
 }
 
 static struct sh_mobile_sdhi_info sdhi1_info = {
+	.dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
+	.dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
+	.tmio_flags = TMIO_DEFER_RX_COMPLETE,
 	.set_pwr = sdhi1_set_pwr,
 };
 
Signature · 1 line
1.6.2.4
#13 lore raw

Re: [PATCH 5/8] SH: Add SDHI DMA support to ecovec

Quoted 10 lines · Guennadi Liakhovetski
arch/sh/boards/mach-ecovec24/setup.c +2 -0
@@ -442,6 +444,8 @@ static void sdhi0_set_pwr(struct platform_device *pdev, int state)
  }
 
  static struct sh_mobile_sdhi_info sdhi0_info = {
+       .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
+       .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
        .set_pwr = sdhi0_set_pwr,
  };
 

arch/sh/boards/mach-ecovec24/setup.c static void sdhi1_set_pwr(struct platform_device *pdev, int state) · line 487

Quoted 6 lines
arch/sh/boards/mach-ecovec24/setup.c +3 -0
@@ -478,6 +482,9 @@ static void sdhi1_set_pwr(struct platform_device *pdev, int state)
  }
 
  static struct sh_mobile_sdhi_info sdhi1_info = {
+       .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
+       .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
+       .tmio_flags = TMIO_DEFER_RX_COMPLETE,

This is a bit odd. How come SDHI1 needs this flag and SDHI0 doesn't?

/ magnus

#14 lore raw

PATCH 6/8 SH: Add SDHI DMA support to ms7724se

In reply to Guennadi Liakhovetski
---
 arch/sh/boards/mach-se/7724/setup.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
arch/sh/boards/mach-se/7724/setup.c +19 -0
index 66cdbc3..70ddc92 100644
@@ -14,6 +14,7 @@
 #include <linux/device.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
+#include <linux/mfd/sh_mobile_sdhi.h>
 #include <linux/mtd/physmap.h>
 #include <linux/delay.h>
 #include <linux/smc91x.h>
@@ -24,6 +25,7 @@
 #include <video/sh_mobile_lcdc.h>
 #include <media/sh_mobile_ceu.h>
 #include <sound/sh_fsi.h>
+#include <asm/dmaengine.h>
 #include <asm/io.h>
 #include <asm/heartbeat.h>
 #include <asm/sh_eth.h>
@@ -456,11 +458,20 @@ static struct resource sdhi0_cn7_resources[] = {
 	},
 };
 
+static struct sh_mobile_sdhi_info sh7724_sdhi0_data = {
+	.dma_slave_tx	= SHDMA_SLAVE_SDHI0_TX,
+	.dma_slave_rx	= SHDMA_SLAVE_SDHI0_RX,
+	.tmio_flags	= TMIO_IMMEDIATE_RX_COMPLETE,
+};
+
 static struct platform_device sdhi0_cn7_device = {
 	.name           = "sh_mobile_sdhi",
 	.id		= 0,
 	.num_resources  = ARRAY_SIZE(sdhi0_cn7_resources),
 	.resource       = sdhi0_cn7_resources,
+	.dev = {
+		.platform_data	= &sh7724_sdhi0_data,
+	},
 	.archdata = {
 		.hwblk_id = HWBLK_SDHI0,
 	},
@@ -479,11 +490,19 @@ static struct resource sdhi1_cn8_resources[] = {
 	},
 };
 
+static struct sh_mobile_sdhi_info sh7724_sdhi1_data = {
+	.dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
+	.dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
+};
+
 static struct platform_device sdhi1_cn8_device = {
 	.name           = "sh_mobile_sdhi",
 	.id		= 1,
 	.num_resources  = ARRAY_SIZE(sdhi1_cn8_resources),
 	.resource       = sdhi1_cn8_resources,
+	.dev = {
+		.platform_data	= &sh7724_sdhi1_data,
+	},
 	.archdata = {
 		.hwblk_id = HWBLK_SDHI1,
 	},
Signature · 1 line
1.6.2.4
#15 lore raw

Re: [PATCH 6/8] SH: Add SDHI DMA support to ms7724se

Quoted 22 lines · Guennadi Liakhovetski
arch/sh/boards/mach-se/7724/setup.c +9 -0
@@ -456,11 +458,20 @@ static struct resource sdhi0_cn7_resources[] = {
        },
  };
 
+static struct sh_mobile_sdhi_info sh7724_sdhi0_data = {
+       .dma_slave_tx   = SHDMA_SLAVE_SDHI0_TX,
+       .dma_slave_rx   = SHDMA_SLAVE_SDHI0_RX,
+       .tmio_flags     = TMIO_IMMEDIATE_RX_COMPLETE,
+};
+
  static struct platform_device sdhi0_cn7_device = {
        .name           = "sh_mobile_sdhi",
        .id             = 0,
        .num_resources  = ARRAY_SIZE(sdhi0_cn7_resources),
        .resource       = sdhi0_cn7_resources,
+       .dev = {
+               .platform_data  = &sh7724_sdhi0_data,
+       },
        .archdata = {
                .hwblk_id = HWBLK_SDHI0,
        },

arch/sh/boards/mach-se/7724/setup.c static struct resource sdhi1_cn8_resources[] = { · line 495

Quoted 6 lines
arch/sh/boards/mach-se/7724/setup.c +3 -0
@@ -479,11 +490,19 @@ static struct resource sdhi1_cn8_resources[] = {
        },
  };
 
+static struct sh_mobile_sdhi_info sh7724_sdhi1_data = {
+       .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
+       .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,

And these two are the opposite of Ecovec even though both are sh7724? Hm..

/ magnus

#16 lore raw

Re: [PATCH 6/8] SH: Add SDHI DMA support to ms7724se

Quoted 27 lines · Magnus Damm
Quoted 25 lines · Guennadi Liakhovetski
arch/sh/boards/mach-se/7724/setup.c +9 -0
@@ -456,11 +458,20 @@ static struct resource sdhi0_cn7_resources[] = {
        },
  };
 
+static struct sh_mobile_sdhi_info sh7724_sdhi0_data = {
+       .dma_slave_tx   = SHDMA_SLAVE_SDHI0_TX,
+       .dma_slave_rx   = SHDMA_SLAVE_SDHI0_RX,
+       .tmio_flags     = TMIO_IMMEDIATE_RX_COMPLETE,
+};
+
  static struct platform_device sdhi0_cn7_device = {
        .name           = "sh_mobile_sdhi",
        .id             = 0,
        .num_resources  = ARRAY_SIZE(sdhi0_cn7_resources),
        .resource       = sdhi0_cn7_resources,
+       .dev = {
+               .platform_data  = &sh7724_sdhi0_data,
+       },
        .archdata = {
                .hwblk_id = HWBLK_SDHI0,
        },
@@ -479,11 +490,19 @@ static struct resource sdhi1_cn8_resources[] = {
        },
  };
 
Quoted 5 lines

arch/sh/boards/mach-se/7724/setup.c static struct resource sdhi1_cn8_resources[] = { · line 495

Quoted 3 lines
arch/sh/boards/mach-se/7724/setup.c +3 -0
+static struct sh_mobile_sdhi_info sh7724_sdhi1_data = {
+       .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
+       .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,

And these two are the opposite of Ecovec even though both are sh7724? Hm..

Right, that's wrong. I mean, yes, they did behave differently in my tests. On both boards I only could test one slot, so, I just presume the other one should behave equally. So, this flag should be present on SE and not on ecovec. Will fix in the next revision, thanks.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#17 lore raw

PATCH 7/8 SH: Add SDHI DMA support to kfr2r09

In reply to Guennadi Liakhovetski
---
 arch/sh/boards/mach-kfr2r09/setup.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
arch/sh/boards/mach-kfr2r09/setup.c +10 -0
index b2cd0ed..6e76747 100644
@@ -10,6 +10,7 @@
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
+#include <linux/mfd/sh_mobile_sdhi.h>
 #include <linux/mtd/physmap.h>
 #include <linux/mtd/onenand.h>
 #include <linux/delay.h>
@@ -25,6 +26,7 @@
 #include <video/sh_mobile_lcdc.h>
 #include <asm/suspend.h>
 #include <asm/clock.h>
+#include <asm/dmaengine.h>
 #include <asm/machvec.h>
 #include <asm/io.h>
 #include <cpu/sh7724.h>
@@ -356,10 +358,18 @@ static struct resource kfr2r09_sh_sdhi0_resources[] = {
 	},
 };
 
+static struct sh_mobile_sdhi_info sh7724_sdhi0_data = {
+	.dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
+	.dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
+};
+
 static struct platform_device kfr2r09_sh_sdhi0_device = {
 	.name           = "sh_mobile_sdhi",
 	.num_resources  = ARRAY_SIZE(kfr2r09_sh_sdhi0_resources),
 	.resource       = kfr2r09_sh_sdhi0_resources,
+	.dev = {
+		.platform_data	= &sh7724_sdhi0_data,
+	},
 	.archdata = {
 		.hwblk_id = HWBLK_SDHI0,
 	},
Signature · 1 line
1.6.2.4
#18 lore raw

PATCH 8/8 SH: Add SDHI DMA support to migor

In reply to Guennadi Liakhovetski
---
 arch/sh/boards/mach-migor/setup.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
arch/sh/boards/mach-migor/setup.c +11 -0
index 7da0fc9..242a623 100644
@@ -12,6 +12,7 @@
 #include <linux/interrupt.h>
 #include <linux/input.h>
 #include <linux/input/sh_keysc.h>
+#include <linux/mfd/sh_mobile_sdhi.h>
 #include <linux/mtd/physmap.h>
 #include <linux/mtd/nand.h>
 #include <linux/i2c.h>
@@ -24,6 +25,7 @@
 #include <media/ov772x.h>
 #include <media/tw9910.h>
 #include <asm/clock.h>
+#include <asm/dmaengine.h>
 #include <asm/machvec.h>
 #include <asm/io.h>
 #include <asm/suspend.h>
@@ -402,10 +404,19 @@ static struct resource sdhi_cn9_resources[] = {
 	},
 };
 
+static struct sh_mobile_sdhi_info sh7724_sdhi_data = {
+	.dma_slave_tx	= SHDMA_SLAVE_SDHI0_TX,
+	.dma_slave_rx	= SHDMA_SLAVE_SDHI0_RX,
+	.tmio_flags	= TMIO_IMMEDIATE_RX_COMPLETE,
+};
+
 static struct platform_device sdhi_cn9_device = {
 	.name		= "sh_mobile_sdhi",
 	.num_resources	= ARRAY_SIZE(sdhi_cn9_resources),
 	.resource	= sdhi_cn9_resources,
+	.dev = {
+		.platform_data	= &sh7724_sdhi_data,
+	},
 	.archdata = {
 		.hwblk_id = HWBLK_SDHI,
 	},
Signature · 1 line
1.6.2.4
#19 lore raw
In reply to Guennadi Liakhovetski

Hi Ian

Quoted 6 lines · Guennadi Liakhovetski

This patch series adds DMA support to the tmio_mmc SD/MMC host driver, using the dmaengine API. So far this is only used on SuperH platforms, will also be supported on ARM shmobile boards, both use the sh_mobile_sdhi MFD driver. Other TMIO MFD implementations are unaffected. The patch transparently falls back to PIO if no DMA is configured by the MFD driver, or if DMA initialisation or execution fail.

Do you think you'd be able to comment on this patch-series? Maybe you could give your initial opinion about the way I chose to integrate DMA into tmio_mmc.c: do you agree with it? Or would you prefer it to depend on a config-option? Maybe put it in a separate tmio_dma.c file? I'd then submit a v2 of the series, which you could then review in detail.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/