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: 1980751 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 8E69FDF264 for ; Tue, 15 Jan 2013 20:29:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757149Ab3AOU2m (ORCPT ); Tue, 15 Jan 2013 15:28:42 -0500 Received: from mail-qa0-f48.google.com ([209.85.216.48]:55607 "EHLO mail-qa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755769Ab3AOU2c (ORCPT ); Tue, 15 Jan 2013 15:28:32 -0500 Received: by mail-qa0-f48.google.com with SMTP id l8so564741qaq.7 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 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 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> 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);