From patchwork Tue Jan 15 20:32:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Porter X-Patchwork-Id: 1981251 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by patchwork2.kernel.org (Postfix) with ESMTP id 4A566DF264 for ; Tue, 15 Jan 2013 20:36:49 +0000 (UTC) Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id r0FKX6Le014462; Tue, 15 Jan 2013 14:33:06 -0600 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r0FKX6u8008760; Tue, 15 Jan 2013 14:33:06 -0600 Received: from dlelxv23.itg.ti.com (172.17.1.198) by dfle72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.1.323.3; Tue, 15 Jan 2013 14:33:05 -0600 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlelxv23.itg.ti.com (8.13.8/8.13.8) with ESMTP id r0FKX5Im019192; Tue, 15 Jan 2013 14:33:05 -0600 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 345FA8062C; Tue, 15 Jan 2013 14:33:05 -0600 (CST) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp52.itg.ti.com (dflp52.itg.ti.com [128.247.22.96]) by linux.omap.com (Postfix) with ESMTP id 968DD80627 for ; Tue, 15 Jan 2013 14:28:33 -0600 (CST) Received: from medina.ext.ti.com (medina.ext.ti.com [192.91.81.31]) by dflp52.itg.ti.com (8.13.7/8.13.8) with ESMTP id r0FKSXZR017450 for ; Tue, 15 Jan 2013 14:28:33 -0600 (CST) Received: from mail6.bemta8.messagelabs.com (mail6.bemta8.messagelabs.com [216.82.243.55]) by medina.ext.ti.com (8.13.7/8.13.7) with ESMTP id r0FKSWWH018941 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 15 Jan 2013 14:28:33 -0600 Received: from [216.82.242.131:53209] by server-15.bemta-8.messagelabs.com id 48/60-03075-0FBB5F05; Tue, 15 Jan 2013 20:28:32 +0000 X-Env-Sender: ohiomdp@gmail.com X-Msg-Ref: server-12.tower-76.messagelabs.com!1358281711!27607816!1 X-Originating-IP: [209.85.216.50] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 6.6.1.8; banners=-,-,- X-VirusChecked: Checked Received: (qmail 19066 invoked from network); 15 Jan 2013 20:28:32 -0000 Received: from mail-qa0-f50.google.com (HELO mail-qa0-f50.google.com) (209.85.216.50) by server-12.tower-76.messagelabs.com with RC4-SHA encrypted SMTP; 15 Jan 2013 20:28:32 -0000 Received: by mail-qa0-f50.google.com with SMTP id cr7so571404qab.9 for ; Tue, 15 Jan 2013 12:28:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=1Nfm0eRQOq1wGNcCxIylc8GlhMsXEtk6aI2dDju6W/A=; b=mSPNyt6ZXvP0/3rO4j1OintSNGpX1qR27zIrLdaMyqY1DTb1k+WYm688ic4/UfZ7bn F5BiZaiQ8/DlNN3BLE9qZ1p8s54iKuzIZFGEW2W91iSKKWiNv/aCzfBfu2UnwWvntjec zWglID/4lUckAEUGN5Z5fL018lVowsdRX/5+gKZqsPf3cqby83Wnq2fdo/ZheT5nYtKX r122nSADCgtfMSuvoV3iLI1+nhn1N3S3E0ReXbwDkxO4FqdRoV0/tgDWZ4DHvFpOmcvV Hnnq5sUEA0n1jWxiOwHldkZx/QTJAIq6k75Km0LydSsvIYK+3BOC7rJ5z65oKB1epmig eqbQ== X-Received: by 10.224.184.70 with SMTP id cj6mr18080053qab.98.1358281711373; Tue, 15 Jan 2013 12:28:31 -0800 (PST) Received: from beef.ohporter.com (cpe-24-166-64-7.neo.res.rr.com. [24.166.64.7]) by mx.google.com with ESMTPS id gw9sm4308048qab.10.2013.01.15.12.28.28 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 15 Jan 2013 12:28:30 -0800 (PST) From: Matt Porter To: Tony Lindgren , Sekhar Nori , Grant Likely , Mark Brown , Benoit Cousson , Russell King , Vinod Koul , Rob Landley , Chris Ball Subject: [PATCH v5 09/14] mmc: omap_hsmmc: set max_segs based on dma engine limitations Date: Tue, 15 Jan 2013 15:32:49 -0500 Message-ID: <1358281974-8411-10-git-send-email-mporter@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1358281974-8411-1-git-send-email-mporter@ti.com> References: <1358281974-8411-1-git-send-email-mporter@ti.com> CC: Linux DaVinci Kernel List , Arnd Bergmann , Linux Documentation List , Devicetree Discuss , Linux MMC List , Linux Kernel Mailing List , Rob Herring , Dan Williams , Linux SPI Devel List , Linux OMAP List , Linux ARM Kernel List X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com The EDMA DMAC has a hardware limitation that prevents supporting scatter gather lists with any number of segments. The DMA Engine API reports the maximum number of segments a channel can support via the optional dma_get_channel_caps() API. If the nr_segs capability is present, the value is used to configure mmc->max_segs appropriately. Signed-off-by: Matt Porter Acked-by: Tony Lindgren --- drivers/mmc/host/omap_hsmmc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index e79b12d..f74bd69 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -1769,6 +1769,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev) const struct of_device_id *match; dma_cap_mask_t mask; unsigned tx_req, rx_req; + struct dmaengine_chan_caps *dma_chan_caps; struct pinctrl *pinctrl; match = of_match_device(of_match_ptr(omap_mmc_of_match), &pdev->dev); @@ -1935,6 +1936,11 @@ static int omap_hsmmc_probe(struct platform_device *pdev) goto err_irq; } + /* Some DMA Engines only handle a limited number of SG segments */ + dma_chan_caps = dma_get_channel_caps(host->rx_chan, DMA_DEV_TO_MEM); + if (dma_chan_caps && dma_chan_caps->seg_nr) + mmc->max_segs = dma_chan_caps->seg_nr; + /* Request IRQ for MMC operations */ ret = request_irq(host->irq, omap_hsmmc_irq, 0, mmc_hostname(mmc), host);