From patchwork Thu Apr 14 15:46:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Rigby X-Patchwork-Id: 1027 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:48:25 -0000 Delivered-To: patches@linaro.org Received: by 10.68.59.138 with SMTP id z10cs58796pbq; Thu, 14 Apr 2011 08:46:46 -0700 (PDT) Received: by 10.231.67.201 with SMTP id s9mr753869ibi.176.1302796006254; Thu, 14 Apr 2011 08:46:46 -0700 (PDT) Received: from mail-iw0-f178.google.com (mail-iw0-f178.google.com [209.85.214.178]) by mx.google.com with ESMTPS id v15si5146903ibm.83.2011.04.14.08.46.45 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 14 Apr 2011 08:46:46 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.214.178 is neither permitted nor denied by best guess record for domain of john.rigby@linaro.org) client-ip=209.85.214.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.214.178 is neither permitted nor denied by best guess record for domain of john.rigby@linaro.org) smtp.mail=john.rigby@linaro.org Received: by iwn9 with SMTP id 9so4524471iwn.37 for ; Thu, 14 Apr 2011 08:46:45 -0700 (PDT) Received: by 10.231.199.77 with SMTP id er13mr782114ibb.52.1302796005555; Thu, 14 Apr 2011 08:46:45 -0700 (PDT) Received: from localhost.localdomain (c-76-23-54-220.hsd1.ut.comcast.net [76.23.54.220]) by mx.google.com with ESMTPS id f28sm1271336ibh.16.2011.04.14.08.46.43 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 14 Apr 2011 08:46:44 -0700 (PDT) From: John Rigby To: u-boot@lists.denx.de, Andy Fleming , patches@linaro.org Cc: John Rigby Subject: [PATCHv2] MMC: disable multiblock rw on old rev OMAP3 silicon Date: Thu, 14 Apr 2011 09:46:11 -0600 Message-Id: <1302795971-31659-1-git-send-email-john.rigby@linaro.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1302753839-17316-1-git-send-email-john.rigby@linaro.org> References: <1302753839-17316-1-git-send-email-john.rigby@linaro.org> Make existing field b_max field in struct mmc unconditional and use it instead of CONFIG_SYS_MMC_MAX_BLK_COUNT in mmc_bread and mmc_bwrite. Initialize b_max to CONFIG_SYS_MMC_MAX_BLK_COUNT in mmc_register if it has not been initialized by the hw driver. Initialize b_max to 1 in omap_hsmmc.c for old rev silicon OMAP3 to disable multi block rw. Signed-off-by: John Rigby --- v2: Test cpu family and rev drivers/mmc/mmc.c | 8 ++++---- drivers/mmc/omap_hsmmc.c | 8 ++++++++ include/mmc.h | 2 -- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index d69eaa1..59ca4df 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -144,8 +144,7 @@ mmc_bwrite(int dev_num, ulong start, lbaint_t blkcnt, const void*src) return 0; do { - cur = (blocks_todo > CONFIG_SYS_MMC_MAX_BLK_COUNT) ? - CONFIG_SYS_MMC_MAX_BLK_COUNT : blocks_todo; + cur = (blocks_todo > mmc->b_max) ? mmc->b_max : blocks_todo; if(mmc_write_blocks(mmc, start, cur, src) != cur) return 0; blocks_todo -= cur; @@ -217,8 +216,7 @@ static ulong mmc_bread(int dev_num, ulong start, lbaint_t blkcnt, void *dst) return 0; do { - cur = (blocks_todo > CONFIG_SYS_MMC_MAX_BLK_COUNT) ? - CONFIG_SYS_MMC_MAX_BLK_COUNT : blocks_todo; + cur = (blocks_todo > mmc->b_max) ? mmc->b_max : blocks_todo; if(mmc_read_blocks(mmc, dst, start, cur) != cur) return 0; blocks_todo -= cur; @@ -852,6 +850,8 @@ int mmc_register(struct mmc *mmc) mmc->block_dev.removable = 1; mmc->block_dev.block_read = mmc_bread; mmc->block_dev.block_write = mmc_bwrite; + if (!mmc->b_max) + mmc->b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT; INIT_LIST_HEAD (&mmc->link); diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c index 6f2280a..685ff74 100644 --- a/drivers/mmc/omap_hsmmc.c +++ b/drivers/mmc/omap_hsmmc.c @@ -465,6 +465,14 @@ int omap_mmc_init(int dev_index) mmc->f_min = 400000; mmc->f_max = 52000000; +#if defined(CONFIG_OMAP34XX) + /* + * 34XX silicon revs 2.1 and older do not support multiblock transfers. + */ + if ((get_cpu_family() == CPU_OMAP34XX) && (get_cpu_rev() <= CPU_3XX_ES21)) + mmc->b_max = 1; +#endif + mmc_register(mmc); return 0; diff --git a/include/mmc.h b/include/mmc.h index fcd0fd1..91d0495 100644 --- a/include/mmc.h +++ b/include/mmc.h @@ -274,9 +274,7 @@ struct mmc { struct mmc_cmd *cmd, struct mmc_data *data); void (*set_ios)(struct mmc *mmc); int (*init)(struct mmc *mmc); -#ifdef CONFIG_MMC_MBLOCK uint b_max; -#endif }; int mmc_register(struct mmc *mmc);