From patchwork Fri Jan 11 05:48:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Porter X-Patchwork-Id: 1963941 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 7C28FDF2A2 for ; Fri, 11 Jan 2013 05:45:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755039Ab3AKFop (ORCPT ); Fri, 11 Jan 2013 00:44:45 -0500 Received: from mail-qc0-f176.google.com ([209.85.216.176]:52653 "EHLO mail-qc0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755009Ab3AKFom (ORCPT ); Fri, 11 Jan 2013 00:44:42 -0500 Received: by mail-qc0-f176.google.com with SMTP id n41so888685qco.7 for ; Thu, 10 Jan 2013 21:44:41 -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=TUa0G2tg3+snwQvKnoXoimPac9JxkDeCw2q8I6fm44g=; b=0oUQIhDigXqWy0bdt7YVMrSo08E/9Hjf4mK7XdBjrWCA3sV63Pggw3kpb4n5Emlsi1 MNEnHcrTzvMfgswbmw0lp/FS5VQfAvuAt6PTHHR3U4mS6AfdRoPvzS2C78nrTmxljsSJ M7tyOYZpdEh+zEZXXBg51ytBUoaahp1qWt3HrSgHlx21gS1fRDEdKGkUiKC+OBt9qOlf rWCdMdoXWh3R2Xhr4AacTxtz2KTOKvvGJGJO9WemMFK6odbeFYAZBgXVTrUdZi7Akn9L Es6jpg67TGY6jxIL2NP+uVXxSgeZ7CU6gzv9OB7XB+dopVSSk0dEyMVJge6xdchb+E3P aDWw== X-Received: by 10.224.31.209 with SMTP id z17mr59808086qac.28.1357883081682; Thu, 10 Jan 2013 21:44:41 -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 ds8sm1897114qab.18.2013.01.10.21.44.38 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 10 Jan 2013 21:44:40 -0800 (PST) From: Matt Porter To: Tony Lindgren , Sekhar Nori , Grant Likely , Mark Brown , Benoit Cousson , Russell King , Vinod Koul , Rob Landley , Chris Ball Cc: Devicetree Discuss , Linux OMAP List , Linux ARM Kernel List , Linux DaVinci Kernel List , Linux Kernel Mailing List , Linux Documentation List , Linux MMC List , Linux SPI Devel List , Arnd Bergmann , Dan Williams , Rob Herring Subject: [PATCH v4 09/14] mmc: omap_hsmmc: set max_segs based on dma engine limitations Date: Fri, 11 Jan 2013 00:48:45 -0500 Message-Id: <1357883330-5364-10-git-send-email-mporter@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1357883330-5364-1-git-send-email-mporter@ti.com> References: <1357883330-5364-1-git-send-email-mporter@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org 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);