On Wed, 21 Apr 2010, Magnus Damm wrote: > Hi Guennadi, > > On Wed, Apr 21, 2010 at 11:37 AM, Guennadi Liakhovetski > <g.liakhovetski@xxxxxx> wrote: > > 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. > > > > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@xxxxxx> > > --- > > > > 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] > > > diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c > > index b2b577f..fafd8c9 100644 > > --- a/drivers/mmc/host/tmio_mmc.c > > +++ b/drivers/mmc/host/tmio_mmc.c > > @@ -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" > > > > +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... > 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. > 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/ -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html