From patchwork Mon Jun 24 12:36:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2770781 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 E00F4C0AB1 for ; Mon, 24 Jun 2013 12:36:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C7F812012F for ; Mon, 24 Jun 2013 12:36:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8D63820154 for ; Mon, 24 Jun 2013 12:36:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750900Ab3FXMgk (ORCPT ); Mon, 24 Jun 2013 08:36:40 -0400 Received: from moutng.kundenserver.de ([212.227.17.10]:51309 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750830Ab3FXMgi (ORCPT ); Mon, 24 Jun 2013 08:36:38 -0400 Received: from axis700.grange (dslb-178-001-231-216.pools.arcor-ip.net [178.1.231.216]) by mrelayeu.kundenserver.de (node=mrbap3) with ESMTP (Nemesis) id 0M8zxV-1Uz1RO1DjR-00CR6s; Mon, 24 Jun 2013 14:36:35 +0200 Received: by axis700.grange (Postfix, from userid 1000) id DCAC540BB4; Mon, 24 Jun 2013 14:36:34 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id D178B40BB3; Mon, 24 Jun 2013 14:36:34 +0200 (CEST) Date: Mon, 24 Jun 2013 14:36:34 +0200 (CEST) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: linux-mmc@vger.kernel.org cc: linux-sh@vger.kernel.org, Chris Ball , Magnus Damm Subject: [PATCH v2] mmc: sh_mmcif: add support for Device Tree DMA bindings Message-ID: MIME-Version: 1.0 X-Provags-ID: V02:K0:E1XaTQ/DVfUZ7APEDcrcorfGW7LvKGVsY/KeoMmWoiz fZ7KFlRvXSrZPBP0g6JsasGoAM67fNRtkLM2KMrA7jibNkpknv V/bfKRy8+0BUrp1DelDgHB6mj41LbOcBZBjFUPNzjK5FhVPSyK almMUk2RZn9Hz2AMSkblKf1/O7KLj4jfahsZCZU/2vGokRw+5W jIA/5gFfZU9omC9BhuQ2out/YwW57aZpdhPPVBsiB0gBb6yN3T ufbUAunhwJAm9gmybWq4lqLqwVPsDr/+ecWdhblbEW8hEauyK/ SloA38Q9GsOcHHZoAHewUz2YHytspU2x8OTwM2ckSs+w80VMcu bCqQSnxJe+lTFtKM+WxHW1wuWp/WpvRbizpk8eofbJFTANRc8i aVl92s/311+pw== Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 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 --- v2: use an "else if" drivers/mmc/host/sh_mmcif.c | 26 ++++++++++++++++---------- 1 files changed, 16 insertions(+), 10 deletions(-) diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c index ba76a53..4fff404 100644 --- a/drivers/mmc/host/sh_mmcif.c +++ b/drivers/mmc/host/sh_mmcif.c @@ -386,25 +386,29 @@ 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) + 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 +416,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;