Re: [PATCH/RFC 4/5] mmc: renesas_sdhi: add support for R-Car Gen3 SDHI DMAC
On Fri, Jun 16, 2017 at 09:21:04AM +0200, Geert Uytterhoeven wrote: > Hi Simon, > > On Fri, Jun 16, 2017 at 9:12 AM, Simon Hormanwrote: > > On Fri, Jun 09, 2017 at 09:39:49AM +0200, Geert Uytterhoeven wrote: > >> On Thu, Jun 8, 2017 at 3:13 PM, Simon Horman > >> wrote: > >> > R-Car Gen3 has a dedicated DMA controller for SDHI module. Since > >> > the DMAC is in a part of SDHI module and is not suitable as dmaengine, > > >> > --- a/drivers/mmc/host/Kconfig > >> > +++ b/drivers/mmc/host/Kconfig > > >> > +config MMC_SDHI_SYS_DMAC > >> > + tristate "DMA support use of SYS DMAC with SDHI SD/SDIO > >> > controller" > >> > >> DMA support for SYS_DMAC? > > > > How about this? > > > > config MMC_SDHI_SYS_DMAC > > tristate "DMA for SDHI SD/SDIO controllers using SYS-DMAC" > > Better! > > > ... > > help > >This provides DMA support for the SDHI SD/SDIO controllers > >using SYS-DMAC via DMA Engine. This supports the controllers > > I would drop "the". Will do, thanks. > >found in SuperH and Renesas ARM based SoCs. > > > > config MMC_SDHI_INTERNAL_DMAC > > tristate "DMA for SDHI SD/SDIO controllers using on-chip bus > > mastering" > > ... > > help > >This provides DMA support for the SDHI SD/SDIO controllers > >using on-chip bus mastering. This supports the controllers > > Likewise. > > >found in arm64 based SoCs. > > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- > ge...@linux-m68k.org > > In personal conversations with technical people, I call myself a hacker. But > when I'm talking to journalists I just say "programmer" or something like > that. > -- Linus Torvalds >
Re: [PATCH/RFC 4/5] mmc: renesas_sdhi: add support for R-Car Gen3 SDHI DMAC
On Fri, Jun 09, 2017 at 09:39:49AM +0200, Geert Uytterhoeven wrote: > Hi Simon, > > On Thu, Jun 8, 2017 at 3:13 PM, Simon Horman> wrote: > > R-Car Gen3 has a dedicated DMA controller for SDHI module. Since > > the DMAC is in a part of SDHI module and is not suitable as dmaengine, > > the DMAC is part of the SDHI module? > > > this patch adds a different code as tmio_mmc_dma_gen3.c. > > adds different code? > > > --- a/drivers/mmc/host/Kconfig > > +++ b/drivers/mmc/host/Kconfig > > @@ -575,10 +575,27 @@ config MMC_SDHI > > depends on SUPERH || ARM || ARM64 > > depends on SUPERH || ARCH_RENESAS || COMPILE_TEST > > select MMC_TMIO_CORE > > + select MMC_SDHI_SYS_DMAC if (SUPERH || ARM) > > + select MMC_SDHI_INTERNAL_DMAC if ARM64 > > help > > This provides support for the SDHI SD/SDIO controller found in > > Renesas SuperH, ARM and ARM64 based SoCs > > > > +config MMC_SDHI_SYS_DMAC > > + tristate "DMA support use of SYS DMAC with SDHI SD/SDIO controller" > > DMA support for SYS_DMAC? How about this? config MMC_SDHI_SYS_DMAC tristate "DMA for SDHI SD/SDIO controllers using SYS-DMAC" ... help This provides DMA support for the SDHI SD/SDIO controllers using SYS-DMAC via DMA Engine. This supports the controllers found in SuperH and Renesas ARM based SoCs. config MMC_SDHI_INTERNAL_DMAC tristate "DMA for SDHI SD/SDIO controllers using on-chip bus mastering" ... help This provides DMA support for the SDHI SD/SDIO controllers using on-chip bus mastering. This supports the controllers found in arm64 based SoCs. > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- > ge...@linux-m68k.org > > In personal conversations with technical people, I call myself a hacker. But > when I'm talking to journalists I just say "programmer" or something like > that. > -- Linus Torvalds >
Re: [PATCH/RFC 4/5] mmc: renesas_sdhi: add support for R-Car Gen3 SDHI DMAC
Hi Simon, On Thu, Jun 8, 2017 at 3:13 PM, Simon Hormanwrote: > R-Car Gen3 has a dedicated DMA controller for SDHI module. Since > the DMAC is in a part of SDHI module and is not suitable as dmaengine, the DMAC is part of the SDHI module? > this patch adds a different code as tmio_mmc_dma_gen3.c. adds different code? > --- a/drivers/mmc/host/Kconfig > +++ b/drivers/mmc/host/Kconfig > @@ -575,10 +575,27 @@ config MMC_SDHI > depends on SUPERH || ARM || ARM64 > depends on SUPERH || ARCH_RENESAS || COMPILE_TEST > select MMC_TMIO_CORE > + select MMC_SDHI_SYS_DMAC if (SUPERH || ARM) > + select MMC_SDHI_INTERNAL_DMAC if ARM64 > help > This provides support for the SDHI SD/SDIO controller found in > Renesas SuperH, ARM and ARM64 based SoCs > > +config MMC_SDHI_SYS_DMAC > + tristate "DMA support use of SYS DMAC with SDHI SD/SDIO controller" DMA support for SYS_DMAC? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
[PATCH/RFC 4/5] mmc: renesas_sdhi: add support for R-Car Gen3 SDHI DMAC
R-Car Gen3 has a dedicated DMA controller for SDHI module. Since the DMAC is in a part of SDHI module and is not suitable as dmaengine, this patch adds a different code as tmio_mmc_dma_gen3.c. Clearing of DM_CM_INFO1 after DMA thanks to Dirk Behme Cc: Dirk BehmeSigned-off-by: Yoshihiro Shimoda Signed-off-by: Ai Kyuse --- drivers/mmc/host/Kconfig | 17 ++ drivers/mmc/host/Makefile | 8 +- drivers/mmc/host/renesas_sdhi_internal_dmac.c | 275 ++ drivers/mmc/host/renesas_sdhi_sys_dmac.c | 2 +- drivers/mmc/host/tmio_mmc.h | 1 + 5 files changed, 301 insertions(+), 2 deletions(-) create mode 100644 drivers/mmc/host/renesas_sdhi_internal_dmac.c diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index 5755b69f2f72..e813d420d7b3 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -575,10 +575,27 @@ config MMC_SDHI depends on SUPERH || ARM || ARM64 depends on SUPERH || ARCH_RENESAS || COMPILE_TEST select MMC_TMIO_CORE + select MMC_SDHI_SYS_DMAC if (SUPERH || ARM) + select MMC_SDHI_INTERNAL_DMAC if ARM64 help This provides support for the SDHI SD/SDIO controller found in Renesas SuperH, ARM and ARM64 based SoCs +config MMC_SDHI_SYS_DMAC + tristate "DMA support use of SYS DMAC with SDHI SD/SDIO controller" + depends on MMC_SDHI + help + This provides DMA support for the SDHI SD/SDIO controller + found in SuperH and Renesas ARM based SoCs. + +config MMC_SDHI_INTERNAL_DMAC + tristate "DMA support for Internal DMAC with SDHI SD/SDIO controller" + depends on ARM64 || COMPILE_TEST + depends on MMC_SDHI + help + This provides DMA support for the SDHI SD/SDIO controller + found in Renesas arm64 based SoCs. + config MMC_CB710 tristate "ENE CB710 MMC/SD Interface support" depends on PCI diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile index 4d4547116311..8c46766c000c 100644 --- a/drivers/mmc/host/Makefile +++ b/drivers/mmc/host/Makefile @@ -36,7 +36,13 @@ obj-$(CONFIG_MMC_S3C)+= s3cmci.o obj-$(CONFIG_MMC_SDRICOH_CS) += sdricoh_cs.o obj-$(CONFIG_MMC_TMIO) += tmio_mmc.o obj-$(CONFIG_MMC_TMIO_CORE)+= tmio_mmc_core.o -obj-$(CONFIG_MMC_SDHI) += renesas_sdhi_core.o renesas_sdhi_sys_dmac.o +obj-$(CONFIG_MMC_SDHI) += renesas_sdhi_core.o +ifeq ($(subst m,y,$(CONFIG_MMC_SDHI_SYS_DMAC)),y) +obj-$(CONFIG_MMC_SDHI) += renesas_sdhi_sys_dmac.o +endif +ifeq ($(subst m,y,$(CONFIG_MMC_SDHI_INTERNAL_DMAC)),y) +obj-$(CONFIG_MMC_SDHI) += renesas_sdhi_internal_dmac.o +endif obj-$(CONFIG_MMC_CB710)+= cb710-mmc.o obj-$(CONFIG_MMC_VIA_SDMMC)+= via-sdmmc.o obj-$(CONFIG_SDH_BFIN) += bfin_sdh.o diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c new file mode 100644 index ..a16b616a2c96 --- /dev/null +++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c @@ -0,0 +1,275 @@ +/* + * DMA support for Internal DMAC with SDHI SD/SDIO controller + * + * Copyright (C) 2016-17 Renesas Electronics Corporation + * Copyright (C) 2016-17 Horms Solutions, Simon Horman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "renesas_sdhi.h" +#include "tmio_mmc.h" + +#define DM_CM_DTRAN_MODE 0x820 +#define DM_CM_DTRAN_CTRL 0x828 +#define DM_CM_RST 0x830 +#define DM_CM_INFO10x840 +#define DM_CM_INFO1_MASK 0x848 +#define DM_CM_INFO20x850 +#define DM_CM_INFO2_MASK 0x858 +#define DM_DTRAN_ADDR 0x880 + +/* DM_CM_DTRAN_MODE */ +#define DTRAN_MODE_CH_NUM_CH0 0 /* "downstream" = for write commands */ +#define DTRAN_MODE_CH_NUM_CH1 BIT(16) /* "uptream" = for read commands */ +#define DTRAN_MODE_BUS_WID_TH (BIT(5) | BIT(4)) +#define DTRAN_MODE_ADDR_MODE BIT(0) /* 1 = Increment address */ + +/* DM_CM_DTRAN_CTRL */ +#define DTRAN_CTRL_DM_STARTBIT(0) + +/* DM_CM_RST */ +#define RST_DTRANRST1 BIT(9) +#define RST_DTRANRST0 BIT(8) +#define RST_RESERVED_BITS GENMASK_ULL(32, 0) + +/* DM_CM_INFO1 and DM_CM_INFO1_MASK */ +#define INFO1_CLEAR0 +#define INFO1_DTRANEND1BIT(17) +#define INFO1_DTRANEND0BIT(16) + +/* DM_CM_INFO2 and DM_CM_INFO2_MASK */ +#define INFO2_DTRANERR1BIT(17) +#define INFO2_DTRANERR0BIT(16) + +/* + * Specification of this driver: + * - host->chan_{rx,tx} will be used as a flag of enabling/disabling the dma +