From patchwork Thu May 5 11:51:06 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 756732 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p45BqVJS021325 for ; Thu, 5 May 2011 11:52:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753483Ab1EELw0 (ORCPT ); Thu, 5 May 2011 07:52:26 -0400 Received: from smtp.nokia.com ([147.243.128.24]:62840 "EHLO mgw-da01.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753178Ab1EELwY (ORCPT ); Thu, 5 May 2011 07:52:24 -0400 Received: from nokia.com (localhost [127.0.0.1]) by mgw-da01.nokia.com (Switch-3.4.4/Switch-3.4.3) with ESMTP id p45BqGTH024961; Thu, 5 May 2011 14:52:17 +0300 Received: from localhost.localdomain ([[172.21.24.109]]) by mgw-da01.nokia.com with RELAY id p45BpO6u023786 ; Thu, 5 May 2011 14:51:48 +0300 From: Adrian Hunter To: Tony Lindgren Cc: Madhusudhan Chikkature , linux-omap Mailing List , linux-mmc Mailing List , linux-arm Mailing List , Adrian Hunter Subject: [PATCH 06/22] mmc: omap_hsmmc: limit scatterlist size for sDMA autoloading Date: Thu, 5 May 2011 14:51:06 +0300 Message-Id: <1304596282-4095-7-git-send-email-adrian.hunter@nokia.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1304596282-4095-1-git-send-email-adrian.hunter@nokia.com> References: <1304596282-4095-1-git-send-email-adrian.hunter@nokia.com> X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Thu, 05 May 2011 11:52:31 +0000 (UTC) The sDMA descriptor autoloading feature uses a fixed size buffer to store descriptors for scatterlist segments. That limits the scatterlist size to the maximum number of descriptors that fit in the buffer. The driver must set this limit for upper layers to obey. Signed-off-by: Adrian Hunter --- drivers/mmc/host/omap_hsmmc.c | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 114cd68..bab25ff 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -2239,9 +2239,18 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev) host->dma_caps |= DMA_TYPE_SDMA_DLOAD; } - /* Since we do only SG emulation, we can have as many segs - * as we want. */ - mmc->max_segs = 1024; + if (host->dma_caps & DMA_TYPE_SDMA_DLOAD) { + unsigned int max = DMA_CTRL_BUF_SIZE / + sizeof(struct omap_dma_sglist_node); + + mmc->max_segs = 1 << (fls(max) - 1); + } else { + /* + * Since we do only SG emulation, we can have as many segs as we + * want. + */ + mmc->max_segs = 1024; + } mmc->max_blk_size = 512; /* Block Length at max can be 1024 */ mmc->max_blk_count = 0xFFFF; /* No. of Blocks is 16 bits */