From patchwork Thu Jun 6 15:46:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2681631 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id A14F73FD4E for ; Thu, 6 Jun 2013 15:46:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752803Ab3FFPql (ORCPT ); Thu, 6 Jun 2013 11:46:41 -0400 Received: from moutng.kundenserver.de ([212.227.17.9]:57716 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752757Ab3FFPqk (ORCPT ); Thu, 6 Jun 2013 11:46:40 -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 0MMJXF-1UjnZp3vkj-007iCY; 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 7F22C40BB4; Thu, 6 Jun 2013 17:46:28 +0200 (CEST) Received: from lyakh by 6a.grange with local (Exim 4.72) (envelope-from ) id 1UkcOS-00069o-CH; 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 , Guennadi Liakhovetski Subject: [PATCH 1/4] mmc: sh_mmcif: add support for Device Tree DMA bindings Date: Thu, 6 Jun 2013 17:46:25 +0200 Message-Id: <1370533588-23642-2-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:4VZEvtSfWCSrp0/bJrjUqZTOhN0PcXXQbYuY1KUMM3v 9Exp2IvW5RelLEtGf9ldHA7xBDBx1mFL+q8XYgIhB44KeYOt5J JsibiSC7FcyKCqvOv+1Lal3r2M74tDPFn4scbc0LkAOdci9yrX EblXJAqmUMszBkGicqgurX9al3UY+JwVL2t6qLVezG5x+W/8hJ NYhsUjL4WVwdzcY9KPc7ZdwAmSpei0tDVfMfyIQvJV7iP1lbLq EspA66iod0lTq6cxEQxDGo/LBirC0qwaWowO/vAYrYwm0SSbDL 7hDrOKqSfX8avy+tRyHDe88coEpfPsgyuJ0Q6voH/HCSjugDmF 8KGQ3h3alc4XQAKk0KiI6nMHt2S2Bq2ycKWkn97YgNSmLxjhRc ISPI9gAnOmkog== Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org To use DMA in the Device Tree case the driver has to be modified to use suitable API to obtain DMA channels. Signed-off-by: Guennadi Liakhovetski --- drivers/mmc/host/sh_mmcif.c | 29 ++++++++++++++++++----------- 1 files changed, 18 insertions(+), 11 deletions(-) diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c index 06caaae..a0937ae 100644 --- a/drivers/mmc/host/sh_mmcif.c +++ b/drivers/mmc/host/sh_mmcif.c @@ -386,25 +386,30 @@ static void sh_mmcif_request_dma(struct sh_mmcif_host *host, host->dma_active = false; - if (!pdata) - return; - - if (pdata->slave_id_tx <= 0 || pdata->slave_id_rx <= 0) - return; + if (pdata) { + if (pdata->slave_id_tx <= 0 || pdata->slave_id_rx <= 0) + return; + } else { + if (!host->pd->dev.of_node) + return; + } /* We can only either use DMA for both Tx and Rx or not use it at all */ dma_cap_zero(mask); dma_cap_set(DMA_SLAVE, mask); - host->chan_tx = dma_request_channel(mask, shdma_chan_filter, - (void *)pdata->slave_id_tx); + host->chan_tx = dma_request_slave_channel_compat(mask, shdma_chan_filter, + pdata ? (void *)pdata->slave_id_tx : NULL, + &host->pd->dev, "tx"); dev_dbg(&host->pd->dev, "%s: TX: got channel %p\n", __func__, host->chan_tx); if (!host->chan_tx) return; - cfg.slave_id = pdata->slave_id_tx; + /* In the OF case the driver will get the slave ID from the DT */ + if (pdata) + cfg.slave_id = pdata->slave_id_tx; cfg.direction = DMA_MEM_TO_DEV; cfg.dst_addr = res->start + MMCIF_CE_DATA; cfg.src_addr = 0; @@ -412,15 +417,17 @@ static void sh_mmcif_request_dma(struct sh_mmcif_host *host, if (ret < 0) goto ecfgtx; - host->chan_rx = dma_request_channel(mask, shdma_chan_filter, - (void *)pdata->slave_id_rx); + host->chan_rx = dma_request_slave_channel_compat(mask, shdma_chan_filter, + pdata ? (void *)pdata->slave_id_rx : NULL, + &host->pd->dev, "rx"); dev_dbg(&host->pd->dev, "%s: RX: got channel %p\n", __func__, host->chan_rx); if (!host->chan_rx) goto erqrx; - cfg.slave_id = pdata->slave_id_rx; + if (pdata) + cfg.slave_id = pdata->slave_id_rx; cfg.direction = DMA_DEV_TO_MEM; cfg.dst_addr = 0; cfg.src_addr = res->start + MMCIF_CE_DATA;