From patchwork Tue Aug 30 16:26:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 1113372 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7UGQc6O024089 for ; Tue, 30 Aug 2011 16:26:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755687Ab1H3Q0m (ORCPT ); Tue, 30 Aug 2011 12:26:42 -0400 Received: from moutng.kundenserver.de ([212.227.126.171]:62193 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754141Ab1H3Q0l (ORCPT ); Tue, 30 Aug 2011 12:26:41 -0400 Received: from axis700.grange (dslb-084-061-109-150.pools.arcor-ip.net [84.61.109.150]) by mrelayeu.kundenserver.de (node=mreu3) with ESMTP (Nemesis) id 0MTact-1QouMq3LXj-00S0pv; Tue, 30 Aug 2011 18:26:39 +0200 Received: by axis700.grange (Postfix, from userid 1000) id 80C6D189B83; Tue, 30 Aug 2011 18:26:39 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id 7B4DD189B6F; Tue, 30 Aug 2011 18:26:39 +0200 (CEST) Date: Tue, 30 Aug 2011 18:26:39 +0200 (CEST) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: linux-mmc@vger.kernel.org cc: linux-sh@vger.kernel.org, Paul Mundt , Chris Ball Subject: [PATCH 1/2] mmc: sh_mmcif: simplify platform data In-Reply-To: Message-ID: References: MIME-Version: 1.0 X-Provags-ID: V02:K0:rdA6IzbErsqELQlOBk/h6Kj5Wb5IVhJIBhI2vkqZKa9 mPwH8viKEc2zu2fBD620mSLn9EXy5A9SNUpgl+TtF12onoBVUv HTQBjUUFxXOST1zcEZ181V77WbkbiyXuIAQ12TAdzVh0DqCuMg vBGFfDxiZGT6xwiSj/L8eJZF/YJzqzBgtG9rZjnLTaZGqGpsQl xt6vj8V2afriAL0ccUlRS66OYUO4SE+VPioC5ZUNV/pbNx2Cet UhANxPIYz2FdCPV8LtDr0ZSCDMzftVzB3LzUiYTl+9osBE7hfZ 0CcV6fD2sD9HOPif8t3Zu/Kh8sZj2HYckbDvI+qt93WhZ9/iCl whem2lAvaSne30vnBsbao/7rhWrRY2M4Y/cne1tYgm62k4YC2P D+B4MSS0ldiaA== Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 30 Aug 2011 16:26:42 +0000 (UTC) Provide platforms with a simplified way to specify MMCIF DMA slave IDs in a way, similar to SDHI and other sh_dma clients. Signed-off-by: Guennadi Liakhovetski --- drivers/mmc/host/sh_mmcif.c | 20 ++++++++++++++++---- include/linux/mmc/sh_mmcif.h | 4 +++- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c index 557886b..bd91c94 100644 --- a/drivers/mmc/host/sh_mmcif.c +++ b/drivers/mmc/host/sh_mmcif.c @@ -165,6 +165,8 @@ struct sh_mmcif_host { struct mmc_host *mmc; struct mmc_data *data; struct platform_device *pd; + struct sh_dmae_slave dma_slave_tx; + struct sh_dmae_slave dma_slave_rx; struct clk *hclk; unsigned int clk; int bus_width; @@ -323,25 +325,35 @@ static bool sh_mmcif_filter(struct dma_chan *chan, void *arg) static void sh_mmcif_request_dma(struct sh_mmcif_host *host, struct sh_mmcif_plat_data *pdata) { + struct sh_dmae_slave *tx, *rx; host->dma_active = false; /* We can only either use DMA for both Tx and Rx or not use it at all */ if (pdata->dma) { + dev_warn(&host->pd->dev, + "Update your platform to use embedded DMA slave IDs\n"); + tx = &pdata->dma->chan_priv_tx; + rx = &pdata->dma->chan_priv_rx; + } else { + tx = &host->dma_slave_tx; + tx->slave_id = pdata->slave_id_tx; + rx = &host->dma_slave_rx; + rx->slave_id = pdata->slave_id_rx; + } + if (tx->slave_id > 0 && rx->slave_id > 0) { dma_cap_mask_t mask; dma_cap_zero(mask); dma_cap_set(DMA_SLAVE, mask); - host->chan_tx = dma_request_channel(mask, sh_mmcif_filter, - &pdata->dma->chan_priv_tx); + host->chan_tx = dma_request_channel(mask, sh_mmcif_filter, tx); dev_dbg(&host->pd->dev, "%s: TX: got channel %p\n", __func__, host->chan_tx); if (!host->chan_tx) return; - host->chan_rx = dma_request_channel(mask, sh_mmcif_filter, - &pdata->dma->chan_priv_rx); + host->chan_rx = dma_request_channel(mask, sh_mmcif_filter, rx); dev_dbg(&host->pd->dev, "%s: RX: got channel %p\n", __func__, host->chan_rx); diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h index 0222cd8..04ff452 100644 --- a/include/linux/mmc/sh_mmcif.h +++ b/include/linux/mmc/sh_mmcif.h @@ -41,7 +41,9 @@ struct sh_mmcif_plat_data { void (*set_pwr)(struct platform_device *pdev, int state); void (*down_pwr)(struct platform_device *pdev); int (*get_cd)(struct platform_device *pdef); - struct sh_mmcif_dma *dma; + struct sh_mmcif_dma *dma; /* Deprecated. Instead */ + unsigned int slave_id_tx; /* use embedded slave_id_[tr]x */ + unsigned int slave_id_rx; u8 sup_pclk; /* 1 :SH7757, 0: SH7724/SH7372 */ unsigned long caps; u32 ocr;