From patchwork Fri May 31 13:56:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 2644111 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id 46CDEDFB79 for ; Fri, 31 May 2013 13:57:26 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UiPpc-0005TT-C0; Fri, 31 May 2013 13:57:24 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UiPpZ-0002Xc-KZ; Fri, 31 May 2013 13:57:21 +0000 Received: from moutng.kundenserver.de ([212.227.17.10]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UiPpX-0002X9-6M for linux-arm-kernel@lists.infradead.org; Fri, 31 May 2013 13:57:20 +0000 Received: from wuerfel.lan (HSI-KBW-095-208-002-043.hsi5.kabel-badenwuerttemberg.de [95.208.2.43]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0M2ndG-1USOdo41n4-00sfXK; Fri, 31 May 2013 15:56:51 +0200 From: Arnd Bergmann To: linux-sh@vger.kernel.org Subject: [PATCH 2/2] ARM: shmobile: sdhi: remove DMA hardware dependencies Date: Fri, 31 May 2013 15:56:45 +0200 Message-Id: <1370008605-3745603-2-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1370008605-3745603-1-git-send-email-arnd@arndb.de> References: <1370008605-3745603-1-git-send-email-arnd@arndb.de> X-Provags-ID: V02:K0:rb83ztCzaVCek4gXF0ndn6mSl6WPAVT3HxM1oHDOm9/ 5zXi0EX0aeNXzaFFtGdQ9tPbOf1lIB+oNXhv9pB2zofgZFNNjm 050n073/TGheq1mnheb4Dx0LOPGQsvzQ5rNcfcmEu5Ip/8g7xR KWajQYfowmoGEmMPlZ8cQb3+M2lSygs1HlpLIjNf/1EAIaT440 IVep/crDR1GNQFb5YBDSw3bFYcS3VWwQC8veew+k5nYl/12E4u UXOR/31NMl9YomNEzeVkd+TprlAhjT++DKUxf/X4Gyo4MyxaFL tRJxD/LZiQ99e7zXWpc7udoH8662TjFO4YMq373wCw+8wPTKoR IU/hsR4y4SZLSgu3JHPSq//MDbprGBcRW5l0l/wbs X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130531_095719_448408_FC1E169C X-CRM114-Status: GOOD ( 20.56 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [212.227.17.10 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Samuel Ortiz , Arnd Bergmann , Guennadi Liakhovetski , Simon Horman , Chris Ball , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The MMC driver should not need to care what the dma engine is that it is using, so it must not rely on the argument to the filter function to be a 'slave_id' value. Passing the slave id in dmaengine_slave_config is not portable, and does not work with DT-enabled systems, so this turns the filter argument into a void pointer that gets set by the platform code and gets passed to the dmaengine code as an opaque value. Signed-off-by: Arnd Bergmann Cc: Guennadi Liakhovetski Cc: Chris Ball Cc: Samuel Ortiz Cc: Simon Horman --- arch/arm/mach-shmobile/board-ag5evm.c | 4 ++-- arch/arm/mach-shmobile/board-ap4evb.c | 8 ++++---- arch/arm/mach-shmobile/board-armadillo800eva.c | 8 ++++---- arch/arm/mach-shmobile/board-kzm9g.c | 8 ++++---- arch/arm/mach-shmobile/board-mackerel.c | 12 ++++++------ drivers/mmc/host/sh_mobile_sdhi.c | 20 +++----------------- drivers/mmc/host/tmio_mmc_dma.c | 6 ++---- include/linux/mfd/tmio.h | 2 -- include/linux/mmc/sh_mobile_sdhi.h | 5 +++-- 9 files changed, 28 insertions(+), 45 deletions(-) diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c index ad01651..cb467fb 100644 --- a/arch/arm/mach-shmobile/board-ag5evm.c +++ b/arch/arm/mach-shmobile/board-ag5evm.c @@ -405,8 +405,8 @@ static struct regulator_consumer_supply fixed2v8_power_consumers[] = /* SDHI0 */ static struct sh_mobile_sdhi_info sdhi0_info = { #ifdef CONFIG_SH_DMAE_BASE - .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, - .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, + .dma_slave_tx = (void *)SHDMA_SLAVE_SDHI0_TX, + .dma_slave_rx = (void *)SHDMA_SLAVE_SDHI0_RX, .dma_filter = shdma_chan_filter, #endif .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD, diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index c900e24..d7ccb2e 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c @@ -357,8 +357,8 @@ static struct platform_device sh_mmcif_device = { /* SDHI0 */ static struct sh_mobile_sdhi_info sdhi0_info = { #ifdef CONFIG_SH_DMAE_BASE - .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, - .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, + .dma_slave_tx = (void *)SHDMA_SLAVE_SDHI0_TX, + .dma_slave_rx = (void *)SHDMA_SLAVE_SDHI0_RX, .dma_filter = shdma_chan_filter, #endif .tmio_caps = MMC_CAP_SDIO_IRQ, @@ -398,8 +398,8 @@ static struct platform_device sdhi0_device = { /* SDHI1 */ static struct sh_mobile_sdhi_info sdhi1_info = { #ifdef CONFIG_SH_DMAE_BASE - .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX, - .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX, + .dma_slave_tx = (void *)SHDMA_SLAVE_SDHI1_TX, + .dma_slave_rx = (void *)SHDMA_SLAVE_SDHI1_RX, .dma_filter = shdma_chan_filter, #endif .tmio_ocr_mask = MMC_VDD_165_195, diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c index e95e5dc..fcea414 100644 --- a/arch/arm/mach-shmobile/board-armadillo800eva.c +++ b/arch/arm/mach-shmobile/board-armadillo800eva.c @@ -690,8 +690,8 @@ static struct platform_device vcc_sdhi1 = { #define IRQ31 irq_pin(31) static struct sh_mobile_sdhi_info sdhi0_info = { #ifdef CONFIG_SH_DMAE_BASE - .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, - .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, + .dma_slave_tx = (void *)SHDMA_SLAVE_SDHI0_TX, + .dma_slave_rx = (void *)SHDMA_SLAVE_SDHI0_RX, .dma_filter = shdma_chan_filter, #endif .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ | @@ -735,8 +735,8 @@ static struct platform_device sdhi0_device = { /* SDHI1 */ static struct sh_mobile_sdhi_info sdhi1_info = { #ifdef CONFIG_SH_DMAE_BASE - .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX, - .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX, + .dma_slave_tx = (void *)SHDMA_SLAVE_SDHI1_TX, + .dma_slave_rx = (void *)SHDMA_SLAVE_SDHI1_RX, .dma_filter = shdma_chan_filter, #endif .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ | diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c index 0434b36..3f3092f 100644 --- a/arch/arm/mach-shmobile/board-kzm9g.c +++ b/arch/arm/mach-shmobile/board-kzm9g.c @@ -444,8 +444,8 @@ static struct platform_device vcc_sdhi2 = { /* SDHI */ static struct sh_mobile_sdhi_info sdhi0_info = { #ifdef CONFIG_SH_DMAE_BASE - .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, - .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, + .dma_slave_tx = (void *)SHDMA_SLAVE_SDHI0_TX, + .dma_slave_rx = (void *)SHDMA_SLAVE_SDHI0_RX, .dma_filter = shdma_chan_filter, #endif .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT, @@ -489,8 +489,8 @@ static struct platform_device sdhi0_device = { /* Micro SD */ static struct sh_mobile_sdhi_info sdhi2_info = { #ifdef CONFIG_SH_DMAE_BASE - .dma_slave_tx = SHDMA_SLAVE_SDHI2_TX, - .dma_slave_rx = SHDMA_SLAVE_SDHI2_RX, + .dma_slave_tx = (void *)SHDMA_SLAVE_SDHI2_TX, + .dma_slave_rx = (void *)SHDMA_SLAVE_SDHI2_RX, .dma_filter = shdma_chan_filter, #endif .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index 49755ff..4522b76 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c @@ -973,8 +973,8 @@ static struct platform_device nand_flash_device = { /* SDHI0 */ static struct sh_mobile_sdhi_info sdhi0_info = { #ifdef CONFIG_SH_DMAE_BASE - .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, - .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, + .dma_slave_tx = (void *)SHDMA_SLAVE_SDHI0_TX, + .dma_slave_rx = (void *)SHDMA_SLAVE_SDHI0_RX, .dma_filter = shdma_chan_filter, #endif .tmio_flags = TMIO_MMC_USE_GPIO_CD, @@ -1015,8 +1015,8 @@ static struct platform_device sdhi0_device = { /* GPIO 41 can trigger IRQ8, but it is used by USBHS1, we have to poll */ static struct sh_mobile_sdhi_info sdhi1_info = { #ifdef CONFIG_SH_DMAE_BASE - .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX, - .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX, + .dma_slave_tx = (void *)SHDMA_SLAVE_SDHI1_TX, + .dma_slave_rx = (void *)SHDMA_SLAVE_SDHI1_RX, .dma_filter = shdma_chan_filter, #endif .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_USE_GPIO_CD, @@ -1061,8 +1061,8 @@ static struct platform_device sdhi1_device = { */ static struct sh_mobile_sdhi_info sdhi2_info = { #ifdef CONFIG_SH_DMAE_BASE - .dma_slave_tx = SHDMA_SLAVE_SDHI2_TX, - .dma_slave_rx = SHDMA_SLAVE_SDHI2_RX, + .dma_slave_tx = (void *)SHDMA_SLAVE_SDHI2_TX, + .dma_slave_rx = (void *)SHDMA_SLAVE_SDHI2_RX, .dma_filter = shdma_chan_filter, #endif .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_USE_GPIO_CD, diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c index efe3386..c4a0aab 100644 --- a/drivers/mmc/host/sh_mobile_sdhi.c +++ b/drivers/mmc/host/sh_mobile_sdhi.c @@ -185,23 +185,9 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev) if (p->get_cd) mmc_data->get_cd = sh_mobile_sdhi_get_cd; - if (p->dma_slave_tx > 0 && p->dma_slave_rx > 0) { - /* - * Yes, we have to provide slave IDs twice to TMIO: - * once as a filter parameter and once for channel - * configuration as an explicit slave ID - */ - dma_priv->chan_priv_tx = (void *)p->dma_slave_tx; - dma_priv->chan_priv_rx = (void *)p->dma_slave_rx; - /* - * This is a layering violation: the slave driver - * should not be aware that the chan_priv_* is the - * slave id. - * We should not really need to set the slave id - * here anyway. -arnd - */ - dma_priv->slave_id_tx = p->dma_slave_tx; - dma_priv->slave_id_rx = p->dma_slave_rx; + if (p->dma_slave_tx && p->dma_slave_rx) { + dma_priv->chan_priv_tx = p->dma_slave_tx; + dma_priv->chan_priv_rx = p->dma_slave_rx; dma_priv->filter = p->dma_filter; } } diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c index 47bdb8f..caad28e 100644 --- a/drivers/mmc/host/tmio_mmc_dma.c +++ b/drivers/mmc/host/tmio_mmc_dma.c @@ -290,8 +290,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat if (!host->chan_tx) return; - if (pdata->dma->chan_priv_tx) - cfg.slave_id = pdata->dma->slave_id_tx; + cfg.slave_id = 0; /* already set */ cfg.direction = DMA_MEM_TO_DEV; cfg.dst_addr = res->start + (CTL_SD_DATA_PORT << host->bus_shift); cfg.src_addr = 0; @@ -308,8 +307,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat if (!host->chan_rx) goto ereqrx; - if (pdata->dma->chan_priv_rx) - cfg.slave_id = pdata->dma->slave_id_rx; + cfg.slave_id = 0; cfg.direction = DMA_DEV_TO_MEM; cfg.src_addr = cfg.dst_addr; cfg.dst_addr = 0; diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h index ce35113..0990d8a 100644 --- a/include/linux/mfd/tmio.h +++ b/include/linux/mfd/tmio.h @@ -86,8 +86,6 @@ struct dma_chan; struct tmio_mmc_dma { void *chan_priv_tx; void *chan_priv_rx; - int slave_id_tx; - int slave_id_rx; int alignment_shift; bool (*filter)(struct dma_chan *chan, void *arg); }; diff --git a/include/linux/mmc/sh_mobile_sdhi.h b/include/linux/mmc/sh_mobile_sdhi.h index 342f07b..66a7d1c 100644 --- a/include/linux/mmc/sh_mobile_sdhi.h +++ b/include/linux/mmc/sh_mobile_sdhi.h @@ -2,6 +2,7 @@ #define LINUX_MMC_SH_MOBILE_SDHI_H #include +#include struct platform_device; @@ -18,8 +19,8 @@ struct sh_mobile_sdhi_ops { }; struct sh_mobile_sdhi_info { - int dma_slave_tx; - int dma_slave_rx; + void *dma_slave_tx; + void *dma_slave_rx; dma_filter_fn dma_filter; unsigned long tmio_flags; unsigned long tmio_caps;