From patchwork Fri Aug 22 08:37:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 4762171 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 14CEEC0338 for ; Fri, 22 Aug 2014 08:37:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 31E0420122 for ; Fri, 22 Aug 2014 08:37:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DC1D620172 for ; Fri, 22 Aug 2014 08:37:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754354AbaHVIhR (ORCPT ); Fri, 22 Aug 2014 04:37:17 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:52124 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754827AbaHVIhO (ORCPT ); Fri, 22 Aug 2014 04:37:14 -0400 Received: by mail-pa0-f53.google.com with SMTP id rd3so16262074pab.40 for ; Fri, 22 Aug 2014 01:37:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:message-id:subject:user-agent:to:cc:in-reply-to :references:mime-version:content-type; bh=xZUygsUiE+uVRGadHq5tWZ3ad1vFD4q7XhVIZVICmT4=; b=JtZ53O+t0KWZAKtPu3oB12Hb+9/trZxFo/RdZfrZ0FvZuTheySrVDDtAUthV6GZx3B h3bQvcpcgmnIjSMIUZbgh21kLDoFm+VrLnpkI6gkun3+s8HmWCOGsEiUuuuXLU6JT3ZY bgLS1fIei6bWU6oBtGZO6FbtTqMVUn7AlZL73a4Y5/ddXmoXoZXS5NvNdaTBidgTxEJk +zNovlOa+pbJv+NJIiFIcOuMmAw6eEP858u0emBBS/nEv26fyTMsZpykRPFH0sW1fEo0 V9iD/NOhGqMoY8lxObc0LFuNLXNc1Bjwlvs8m+C0ohmnmv0XavOZXZbTIaWFS84yZjO7 Uz7w== X-Received: by 10.66.197.132 with SMTP id iu4mr4644473pac.132.1408696633596; Fri, 22 Aug 2014 01:37:13 -0700 (PDT) Received: from remon.gmail.com (49.14.32.202.bf.2iij.net. [202.32.14.49]) by mx.google.com with ESMTPSA id qw8sm99873510pab.17.2014.08.22.01.37.11 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 22 Aug 2014 01:37:12 -0700 (PDT) Date: Fri, 22 Aug 2014 01:37:12 -0700 (PDT) From: Kuninori Morimoto Message-ID: <8738co7weh.wl%kuninori.morimoto.gx@gmail.com> Subject: [PATCH 02/10 v2 resend] mmc: tmio: care about DMA tx/rx addr offset User-Agent: Wanderlust/2.14.0 Emacs/23.3 Mule/6.0 To: Simon , Chris Ball Cc: Ian Molton , Morimoto , Magnus , Linux-SH , linux-mmc@vger.kernel.org In-Reply-To: <8761hk7wgy.wl%kuninori.morimoto.gx@gmail.com> References: <87simtenpi.wl%kuninori.morimoto.gx@renesas.com> <87pphxe2q0.wl%kuninori.morimoto.gx@renesas.com> <53AD638C.5060907@renesas.com> <87egxehsec.wl%kuninori.morimoto.gx@gmail.com> <8761hk7wgy.wl%kuninori.morimoto.gx@gmail.com> MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kuninori Morimoto Basically, SD_BUF0 Tx/Rx addresses are same in normal TMIO controller, but, it is different on Renesas R-Car SDHI controller if it uses DMAC (Rx address needs to add 0x2000 to Tx address) This patch adds new .dma_rx_offset and cares it Tested-by: Nguyen Xuan Nui Tested-by: Hiep Cao Minh Acked-by: Laurent Pinchart Acked-by: Ben Dooks Signed-off-by: Kuninori Morimoto --- drivers/mmc/host/sh_mobile_sdhi.c | 3 +++ drivers/mmc/host/tmio_mmc_dma.c | 2 +- include/linux/mfd/tmio.h | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c index b3baa83..91c6399 100644 --- a/drivers/mmc/host/sh_mobile_sdhi.c +++ b/drivers/mmc/host/sh_mobile_sdhi.c @@ -39,6 +39,7 @@ struct sh_mobile_sdhi_of_data { unsigned long tmio_flags; unsigned long capabilities; unsigned long capabilities2; + dma_addr_t dma_rx_offset; }; static const struct sh_mobile_sdhi_of_data sh_mobile_sdhi_of_cfg[] = { @@ -56,6 +57,7 @@ static const struct sh_mobile_sdhi_of_data of_rcar_gen2_compatible = { .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_WRPROTECT_DISABLE, .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ, .capabilities2 = MMC_CAP2_NO_2BLKS_READ, + .dma_rx_offset = 0x2000, }; static const struct of_device_id sh_mobile_sdhi_of_match[] = { @@ -228,6 +230,7 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev) mmc_data->flags |= of_data->tmio_flags; mmc_data->capabilities |= of_data->capabilities; mmc_data->capabilities2 |= of_data->capabilities2; + dma_priv->dma_rx_offset = of_data->dma_rx_offset; } /* SD control register space size is 0x100, 0x200 for bus_shift=1 */ diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c index eb8f1d5..bd646b0 100644 --- a/drivers/mmc/host/tmio_mmc_dma.c +++ b/drivers/mmc/host/tmio_mmc_dma.c @@ -312,7 +312,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat if (pdata->dma->chan_priv_rx) cfg.slave_id = pdata->dma->slave_id_rx; cfg.direction = DMA_DEV_TO_MEM; - cfg.src_addr = cfg.dst_addr; + cfg.src_addr = cfg.dst_addr + pdata->dma->dma_rx_offset; cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; cfg.dst_addr = 0; ret = dmaengine_slave_config(host->chan_rx, &cfg); diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h index 8f6f2e9..777e29b 100644 --- a/include/linux/mfd/tmio.h +++ b/include/linux/mfd/tmio.h @@ -96,6 +96,7 @@ struct tmio_mmc_dma { int slave_id_tx; int slave_id_rx; int alignment_shift; + dma_addr_t dma_rx_offset; bool (*filter)(struct dma_chan *chan, void *arg); };