From patchwork Fri Feb 25 02:35:23 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: matt.waddel@linaro.org X-Patchwork-Id: 84501 X-Patchwork-Delegate: afleming@freescale.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id D1DB0B70D1 for ; Fri, 25 Feb 2011 13:36:22 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 494C4282F0; Fri, 25 Feb 2011 03:36:18 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sy35Fitz+wbl; Fri, 25 Feb 2011 03:36:18 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 119B228302; Fri, 25 Feb 2011 03:36:15 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 309B52830E for ; Fri, 25 Feb 2011 03:36:14 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id caTIuGLpLq3B for ; Fri, 25 Feb 2011 03:36:13 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-iw0-f172.google.com (mail-iw0-f172.google.com [209.85.214.172]) by theia.denx.de (Postfix) with ESMTPS id 30C48282F0 for ; Fri, 25 Feb 2011 03:36:10 +0100 (CET) Received: by mail-iw0-f172.google.com with SMTP id 42so708994iwl.3 for ; Thu, 24 Feb 2011 18:36:09 -0800 (PST) Received: by 10.231.39.199 with SMTP id h7mr2490219ibe.157.1298601369791; Thu, 24 Feb 2011 18:36:09 -0800 (PST) Received: from localhost.localdomain (c-98-202-116-201.hsd1.ut.comcast.net [98.202.116.201]) by mx.google.com with ESMTPS id z4sm168686ibg.13.2011.02.24.18.36.08 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 24 Feb 2011 18:36:09 -0800 (PST) From: matt.waddel@linaro.org To: u-boot@lists.denx.de Date: Thu, 24 Feb 2011 19:35:23 -0700 Message-Id: <1298601325-12112-2-git-send-email-matt.waddel@linaro.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1298601325-12112-1-git-send-email-matt.waddel@linaro.org> References: <1298601325-12112-1-git-send-email-matt.waddel@linaro.org> Cc: Matt Waddel , patches@linaro.org Subject: [U-Boot] [PATCH 1/3] MMC: Max blocks value adjustable X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Matt Waddel The maximum blocks value was hardcoded to 65535 due to a 16 bit register length. The value can change for different platforms. This patch makes the default the current value of 65535, but it is configurable for other platforms. Signed-off-by: Matt Waddel --- drivers/mmc/mmc.c | 19 +++++++++---------- 1 files changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 6805b33..d69eaa1 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -33,6 +33,11 @@ #include #include +/* Set block count limit because of 16 bit register limit on some hardware*/ +#ifndef CONFIG_SYS_MMC_MAX_BLK_COUNT +#define CONFIG_SYS_MMC_MAX_BLK_COUNT 65535 +#endif + static struct list_head mmc_devices; static int cur_dev_num = -1; @@ -139,11 +144,8 @@ mmc_bwrite(int dev_num, ulong start, lbaint_t blkcnt, const void*src) return 0; do { - /* - * The 65535 constraint comes from some hardware has - * only 16 bit width block number counter - */ - cur = (blocks_todo > 65535) ? 65535 : blocks_todo; + cur = (blocks_todo > CONFIG_SYS_MMC_MAX_BLK_COUNT) ? + CONFIG_SYS_MMC_MAX_BLK_COUNT : blocks_todo; if(mmc_write_blocks(mmc, start, cur, src) != cur) return 0; blocks_todo -= cur; @@ -215,11 +217,8 @@ static ulong mmc_bread(int dev_num, ulong start, lbaint_t blkcnt, void *dst) return 0; do { - /* - * The 65535 constraint comes from some hardware has - * only 16 bit width block number counter - */ - cur = (blocks_todo > 65535) ? 65535 : blocks_todo; + cur = (blocks_todo > CONFIG_SYS_MMC_MAX_BLK_COUNT) ? + CONFIG_SYS_MMC_MAX_BLK_COUNT : blocks_todo; if(mmc_read_blocks(mmc, dst, start, cur) != cur) return 0; blocks_todo -= cur;