From patchwork Thu Jun 6 15:46:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2681591 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id AB042DF23A for ; Thu, 6 Jun 2013 15:46:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752600Ab3FFPqk (ORCPT ); Thu, 6 Jun 2013 11:46:40 -0400 Received: from moutng.kundenserver.de ([212.227.17.8]:61057 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752652Ab3FFPqi (ORCPT ); Thu, 6 Jun 2013 11:46:38 -0400 Received: from axis700.grange (dslb-088-077-167-013.pools.arcor-ip.net [88.77.167.13]) by mrelayeu.kundenserver.de (node=mreu1) with ESMTP (Nemesis) id 0Lx3Ub-1UICWC03j7-016RiC; Thu, 06 Jun 2013 17:46:29 +0200 Received: from 6a.grange (6a.grange [192.168.1.11]) by axis700.grange (Postfix) with ESMTPS id A3C0940BB6; Thu, 6 Jun 2013 17:46:28 +0200 (CEST) Received: from lyakh by 6a.grange with local (Exim 4.72) (envelope-from ) id 1UkcOS-00069r-E9; Thu, 06 Jun 2013 17:46:28 +0200 From: Guennadi Liakhovetski To: linux-sh@vger.kernel.org Cc: Vinod Koul , Chris Ball , linux-mmc@vger.kernel.org, devicetree-discuss@lists.ozlabs.org, Rob Herring , Grant Likely , Magnus Damm , Simon Horman , Samuel Ortiz , Guennadi Liakhovetski Subject: [PATCH 2/4] mmc: sdhi/tmio: make DMA filter implementation specific Date: Thu, 6 Jun 2013 17:46:26 +0200 Message-Id: <1370533588-23642-3-git-send-email-g.liakhovetski@gmx.de> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1370533588-23642-1-git-send-email-g.liakhovetski@gmx.de> References: <1370533588-23642-1-git-send-email-g.liakhovetski@gmx.de> X-Provags-ID: V02:K0:nMtVnO8ZZRqLozgfs8NjPdY669KE3jQFg2PLaq2r7v0 5sbAD6I3omvDxOQ1PagAka4nYeAOhWJQwTuQoGuHJijsHFyLNS ZIqyFe1Plfwc+bshcVKBZjsDQnzN2SxtOmQJgPHGp3ue4d44qU jLtWJSMXK8Z7ffzYeeSPjDJtfU4sf4JzVlSLdbbr95WW8x/PGD T8ivsaDpBTsY9dVTi+sluulXzE7QqBjg4CwhQq6vN1oDT4HJDc RtE/Ddos1Mvk8UozBkgRceXmrIfmlj3CaRhIHkBx5MBU06ymaC R8Zi7PaJariYTSUgJLR02TUS3lxzrGoEqB2IXwEd8C7II/sykL NPBI0nbqB3ogJkLg8cQC4kF79zN3IvgAdeUbdOpVXUQsejkDnc xQOBnOi/NARVg== Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org So far only the SDHI implementation uses TMIO MMC with DMA. That way a DMA channel filter function, defined in the TMIO driver wasn't a problem. However, such a filter function is DMA controller specific. Since the SDHI glue is only running on systems with the SHDMA DMA controller, the filter function can safely be provided by it. Move it into SDHI. Cc: Samuel Ortiz Signed-off-by: Guennadi Liakhovetski Acked-by: Samuel Ortiz --- drivers/mmc/host/sh_mobile_sdhi.c | 9 +++++++++ drivers/mmc/host/tmio_mmc_dma.c | 12 ++---------- include/linux/mfd/tmio.h | 3 +++ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c index fe90853..e0088d7 100644 --- a/drivers/mmc/host/sh_mobile_sdhi.c +++ b/drivers/mmc/host/sh_mobile_sdhi.c @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -124,6 +125,13 @@ static void sh_mobile_sdhi_cd_wakeup(const struct platform_device *pdev) mmc_detect_change(dev_get_drvdata(&pdev->dev), msecs_to_jiffies(100)); } +static bool sh_mobile_sdhi_filter(struct dma_chan *chan, void *arg) +{ + dev_dbg(chan->device->dev, "%s: slave data %p\n", __func__, arg); + chan->private = arg; + return true; +} + static const struct sh_mobile_sdhi_ops sdhi_ops = { .cd_wakeup = sh_mobile_sdhi_cd_wakeup, }; @@ -191,6 +199,7 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev) priv->dma_priv.chan_priv_tx = &priv->param_tx.shdma_slave; priv->dma_priv.chan_priv_rx = &priv->param_rx.shdma_slave; priv->dma_priv.alignment_shift = 1; /* 2-byte alignment */ + priv->dma_priv.filter = sh_mobile_sdhi_filter; mmc_data->dma = &priv->dma_priv; } } diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c index fff9286..dc4b10b 100644 --- a/drivers/mmc/host/tmio_mmc_dma.c +++ b/drivers/mmc/host/tmio_mmc_dma.c @@ -261,14 +261,6 @@ out: spin_unlock_irq(&host->lock); } -/* It might be necessary to make filter MFD specific */ -static bool tmio_mmc_filter(struct dma_chan *chan, void *arg) -{ - dev_dbg(chan->device->dev, "%s: slave data %p\n", __func__, arg); - chan->private = arg; - return true; -} - void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdata) { /* We can only either use DMA for both Tx and Rx or not use it at all */ @@ -281,7 +273,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat dma_cap_zero(mask); dma_cap_set(DMA_SLAVE, mask); - host->chan_tx = dma_request_channel(mask, tmio_mmc_filter, + host->chan_tx = dma_request_channel(mask, pdata->dma->filter, pdata->dma->chan_priv_tx); dev_dbg(&host->pdev->dev, "%s: TX: got channel %p\n", __func__, host->chan_tx); @@ -289,7 +281,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat if (!host->chan_tx) return; - host->chan_rx = dma_request_channel(mask, tmio_mmc_filter, + host->chan_rx = dma_request_channel(mask, pdata->dma->filter, pdata->dma->chan_priv_rx); dev_dbg(&host->pdev->dev, "%s: RX: got channel %p\n", __func__, host->chan_rx); diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h index 99bf3e66..0990d8a 100644 --- a/include/linux/mfd/tmio.h +++ b/include/linux/mfd/tmio.h @@ -81,10 +81,13 @@ 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 dma_chan; + struct tmio_mmc_dma { void *chan_priv_tx; void *chan_priv_rx; int alignment_shift; + bool (*filter)(struct dma_chan *chan, void *arg); }; struct tmio_mmc_host;