Skip to contentSkip to conversation

SD1.00 wide-bus fix

PATCH New Alagu Sankar 10 participants 25 messages May 12, 2010 – Oct 25, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 SD1.00 wide-bus fix

Fixed a bug wherein SD version 1.0 cards were not configured for 4-bit mode

---
 drivers/mmc/mmc.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/mmc/mmc.c +3 -3
index cf4ea16..959d8ad 100644
@@ -520,6 +520,9 @@ retry_scr:
 			break;
 	}
 
+	if (mmc->scr[0] & SD_DATA_4BIT)
+		mmc->card_caps |= MMC_MODE_4BIT;
+
 	/* Version 1.0 doesn't support switching */
 	if (mmc->version == SD_VERSION_1_0)
 		return 0;
@@ -537,9 +540,6 @@ retry_scr:
 			break;
 	}
 
-	if (mmc->scr[0] & SD_DATA_4BIT)
-		mmc->card_caps |= MMC_MODE_4BIT;
-
 	/* If high-speed isn't supported, we return */
 	if (!(__be32_to_cpu(switch_status[3]) & SD_HIGHSPEED_SUPPORTED))
 		return 0;
Signature · 1 line
1.6.0.6
#1 lore raw

PATCH 2/4 MMC Card Capacity Bug Fix

Fixed a bug in card capacity calculation for MMC high-capacity cards.

---
 drivers/mmc/mmc.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
drivers/mmc/mmc.c +8 -1
index 959d8ad..e7abf94 100644
@@ -393,6 +393,7 @@ int mmc_change_freq(struct mmc *mmc)
 	char ext_csd[512];
 	char cardtype;
 	int err;
+	unsigned int sec_count;
 
 	mmc->card_caps = 0;
 
@@ -407,8 +408,14 @@ int mmc_change_freq(struct mmc *mmc)
 	if (err)
 		return err;
 
-	if (ext_csd[212] || ext_csd[213] || ext_csd[214] || ext_csd[215])
+	sec_count = ((uint)ext_csd[212] |
+			((uint)ext_csd[213] << 8) |
+			((uint)ext_csd[214] << 16) |
+			((uint)ext_csd[215] << 24));
+	if (sec_count) {
 		mmc->high_capacity = 1;
+		mmc->capacity = sec_count * 512;
+	}
 
 	cardtype = ext_csd[196] & 0xf;
 
Signature · 1 line
1.6.0.6
#2 lore raw

PATCH 3/4 MMC Multi-block Support

Added Multi-Block Read support for Generic MMC. Modified existing multi-block write to limit the maximum number of blocks per transfer. This feature is enabled with CONFIG_MMC_MBLOCK option. A new member is added in the mmc structure for the host controller to specify the maximum number of blocks it supports.

---
 drivers/mmc/mmc.c |  156 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/mmc.h     |    3 +
 2 files changed, 159 insertions(+), 0 deletions(-)
drivers/mmc/mmc.c +156 -0
index e7abf94..3f5a200 100644
@@ -77,6 +77,7 @@ struct mmc *find_mmc_device(int dev_num)
 	return NULL;
 }
 
+#ifndef CONFIG_MMC_MBLOCK
 static ulong
 mmc_bwrite(int dev_num, ulong start, lbaint_t blkcnt, const void*src)
 {
@@ -238,6 +239,156 @@ static ulong mmc_bread(int dev_num, ulong start, lbaint_t blkcnt, void *dst)
 	return blkcnt;
 }
 
+#else
+
+static int mmc_write_blocks(struct mmc *mmc, const char *src, uint start,
+		uint blkcnt)
+{
+	struct mmc_cmd cmd;
+	struct mmc_data data;
+	int err;
+	int blklen;
+
+	blklen = mmc->write_bl_len;
+
+	err = mmc_set_blocklen(mmc, mmc->write_bl_len);
+
+	if (err) {
+		printf("set write bl len failed\n\r");
+		return err;
+	}
+
+	if (blkcnt > 1)
+		cmd.cmdidx = MMC_CMD_WRITE_MULTIPLE_BLOCK;
+	else
+		cmd.cmdidx = MMC_CMD_WRITE_SINGLE_BLOCK;
+
+	if (mmc->high_capacity)
+		cmd.cmdarg = start;
+	else
+		cmd.cmdarg = start * blklen;
+
+	cmd.resp_type = MMC_RSP_R1;
+	cmd.flags = 0;
+
+	data.src = src;
+	data.blocks = blkcnt;
+	data.blocksize = blklen;
+	data.flags = MMC_DATA_WRITE;
+
+	err = mmc_send_cmd(mmc, &cmd, &data);
+
+	if (err) {
+		printf("mmc write failed\n\r");
+		return err;
+	}
+
+	if (blkcnt > 1) {
+		cmd.cmdidx = MMC_CMD_STOP_TRANSMISSION;
+		cmd.cmdarg = 0;
+		cmd.resp_type = MMC_RSP_R1b;
+		cmd.flags = 0;
+		err = mmc_send_cmd(mmc, &cmd, NULL);
+	}
+
+	return err;
+}
+
+static ulong
+mmc_bwrite(int dev_num, ulong start, lbaint_t blkcnt, const void *src)
+{
+	int err;
+	int i;
+	struct mmc *mmc = find_mmc_device(dev_num);
+	uint b_max = mmc->b_max;
+
+	if (!mmc)
+		return 0;
+
+	for (i = blkcnt; i > 0; i -= b_max) {
+		uint blocks = (i > b_max) ? b_max : i;
+
+		err = mmc_write_blocks(mmc, src, start, blocks);
+		if (err)
+			return blkcnt - i;
+		start += blocks;
+		src += (mmc->write_bl_len * blocks);
+	}
+
+	return blkcnt;
+}
+
+int mmc_read_blocks(struct mmc *mmc, void *dst, uint blocknum, uint blkcnt)
+{
+	int err;
+	struct mmc_cmd cmd;
+	struct mmc_data data;
+
+	if (blkcnt > 1)
+		cmd.cmdidx = MMC_CMD_READ_MULTIPLE_BLOCK;
+	else
+		cmd.cmdidx = MMC_CMD_READ_SINGLE_BLOCK;
+
+	if (mmc->high_capacity)
+		cmd.cmdarg = blocknum;
+	else
+		cmd.cmdarg = blocknum * mmc->read_bl_len;
+
+	cmd.resp_type = MMC_RSP_R1;
+	cmd.flags = 0;
+
+	data.dest = dst;
+	data.blocks = blkcnt;
+	data.blocksize = mmc->read_bl_len;
+	data.flags = MMC_DATA_READ;
+
+	err = mmc_send_cmd(mmc, &cmd, &data);
+	if (err)
+		return err;
+
+	if (blkcnt > 1) {
+		cmd.cmdidx = MMC_CMD_STOP_TRANSMISSION;
+		cmd.cmdarg = 0;
+		cmd.resp_type = MMC_RSP_R1b;
+		cmd.flags = 0;
+		err = mmc_send_cmd(mmc, &cmd, NULL);
+	}
+
+	return err;
+}
+
+static ulong mmc_bread(int dev_num, ulong start, lbaint_t blkcnt, void *dst)
+{
+	int err;
+	int i;
+	struct mmc *mmc = find_mmc_device(dev_num);
+	uint b_max = mmc->b_max;
+
+	if (!mmc)
+		return 0;
+
+	/* We always do full block reads from the card */
+	err = mmc_set_blocklen(mmc, mmc->read_bl_len);
+	if (err)
+		return 0;
+
+	for (i = blkcnt; i > 0; i -= b_max) {
+		uint blocks = (i > b_max) ? b_max : i;
+
+		err = mmc_read_blocks(mmc, dst, start, blocks);
+		if (err) {
+			printf("block read failed: %d\n", err);
+			return blkcnt - i;
+		}
+		start += blocks;
+		dst += (mmc->read_bl_len * blocks);
+	}
+
+	return blkcnt;
+}
+
+#endif
+
 int mmc_go_idle(struct mmc* mmc)
 {
 	struct mmc_cmd cmd;
@@ -858,6 +1009,11 @@ int mmc_register(struct mmc *mmc)
 	mmc->block_dev.block_read = mmc_bread;
 	mmc->block_dev.block_write = mmc_bwrite;
 
+#ifdef CONFIG_MMC_MBLOCK
+	if (mmc->b_max == 0)
+		mmc->b_max = 1;
+#endif
+
 	INIT_LIST_HEAD (&mmc->link);
 
 	list_add_tail (&mmc->link, &mmc_devices);
include/mmc.h +3 -0
index 8973bc7..04c7eaf 100644
@@ -264,6 +264,9 @@ 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);
Signature · 1 line
1.6.0.6
#3 lore raw

PATCH 4/4 Environment in MMC

This patch is to save environment data to mmc card. It uses interfaces defined in generic MMC framework. This is enabled with CONFIG_ENV_IS_IN_MMC option. Based on the earlier patch from Terry Lv at Freescale

---
 arch/arm/lib/board.c     |   10 ++--
 arch/powerpc/lib/board.c |   12 ++--
 common/Makefile          |    1 +
 common/cmd_nvedit.c      |    3 +-
 common/env_mmc.c         |  168 ++++++++++++++++++++++++++++++++++++++++++++++
 include/environment.h    |   18 +++++
 6 files changed, 200 insertions(+), 12 deletions(-)
 create mode 100644 common/env_mmc.c
arch/arm/lib/board.c +5 -5
index f5660a9..5e7558e 100644
@@ -338,6 +338,11 @@ void start_armboot (void)
 	nand_init();		/* go init the NAND */
 #endif
 
+#ifdef CONFIG_GENERIC_MMC
+	puts ("MMC:   ");
+	mmc_initialize (gd->bd);
+#endif
+
 #if defined(CONFIG_CMD_ONENAND)
 	onenand_init();
 #endif
@@ -419,11 +424,6 @@ extern void davinci_eth_set_mac_addr (const u_int8_t *addr);
 	board_late_init ();
 #endif
 
-#ifdef CONFIG_GENERIC_MMC
-	puts ("MMC:   ");
-	mmc_initialize (gd->bd);
-#endif
-
 #ifdef CONFIG_BITBANGMII
 	bb_miiphy_init();
 #endif
arch/powerpc/lib/board.c +6 -6
index 7b09fb5..1008635 100644
@@ -783,6 +783,12 @@ void board_init_r (gd_t *id, ulong dest_addr)
 	nand_init();		/* go init the NAND */
 #endif
 
+#ifdef CONFIG_GENERIC_MMC
+	WATCHDOG_RESET ();
+	puts ("MMC:  ");
+	mmc_initialize (bd);
+#endif
+
 	/* relocate environment function pointers etc. */
 	env_relocate ();
 
@@ -939,12 +945,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
 	scsi_init ();
 #endif
 
-#ifdef CONFIG_GENERIC_MMC
-	WATCHDOG_RESET ();
-	puts ("MMC:  ");
-	mmc_initialize (bd);
-#endif
-
 #if defined(CONFIG_CMD_DOC)
 	WATCHDOG_RESET ();
 	puts ("DOC:   ");
common/Makefile +1 -0
index dbf7a05..2c37073 100644
@@ -58,6 +58,7 @@ COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o
 COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_embedded.o
 COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
 COBJS-$(CONFIG_ENV_IS_IN_MG_DISK) += env_mgdisk.o
+COBJS-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o
 COBJS-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o
 COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_nvram.o
 COBJS-$(CONFIG_ENV_IS_IN_ONENAND) += env_onenand.o
common/cmd_nvedit.c +2 -1
index eb89e9e..27e46f7 100644
@@ -63,9 +63,10 @@ DECLARE_GLOBAL_DATA_PTR;
     !defined(CONFIG_ENV_IS_IN_NVRAM)	&& \
     !defined(CONFIG_ENV_IS_IN_ONENAND)	&& \
     !defined(CONFIG_ENV_IS_IN_SPI_FLASH)	&& \
+    !defined(CONFIG_ENV_IS_IN_MMC)	&& \
     !defined(CONFIG_ENV_IS_NOWHERE)
 # error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|DATAFLASH|ONENAND|\
-SPI_FLASH|MG_DISK|NVRAM|NOWHERE}
+SPI_FLASH|MG_DISK|NVRAM|MMC|NOWHERE}
 #endif
 
 #define XMK_STR(x)	#x
common/env_mmc.c new file +168 -0

168 lines not on this page · raw message

include/environment.h +18 -0
index b9924fd..aa0e750 100644
@@ -94,6 +94,24 @@
 # endif
 #endif /* CONFIG_ENV_IS_IN_MG_DISK */
 
+#if defined(CONFIG_ENV_IS_IN_MMC)
+# ifndef CONFIG_ENV_OFFSET
+#  error "Need to define CONFIG_ENV_OFFSET when using CONFIG_ENV_IS_IN_MMC"
+# endif
+# ifndef CONFIG_ENV_ADDR
+#  define CONFIG_ENV_ADDR      (CONFIG_ENV_OFFSET)
+# endif
+# ifndef CONFIG_ENV_OFFSET
+#  define CONFIG_ENV_OFFSET (CONFIG_ENV_ADDR)
+# endif
+# ifdef CONFIG_ENV_OFFSET_REDUND
+#  define CONFIG_SYS_REDUNDAND_ENVIRONMENT
+# endif
+# ifdef CONFIG_ENV_IS_EMBEDDED
+#  define ENV_IS_EMBEDDED      1
+# endif
+#endif /* CONFIG_ENV_IS_IN_MMC */
+
 /* Embedded env is only supported for some flash types */
 #ifdef CONFIG_ENV_IS_EMBEDDED
 # if !defined(CONFIG_ENV_IS_IN_FLASH) && \
Signature · 1 line
1.6.0.6
#4 lore raw

PATCH 4/4 Environment in MMC

Hi Alagu Sankar,

Pls use my latest v5 patch for saving environment data to mmc.

Thanks~~

Yours
Terry

Quoted 317 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Alagu Sankar
Sent: 2010?5?12? 17:38
To: u-boot at lists.denx.de
Subject: [U-Boot] [PATCH 4/4] Environment in MMC

This patch is to save environment data to mmc card. It uses interfaces defined in generic MMC framework. This is enabled with CONFIG_ENV_IS_IN_MMC option.
Based on the earlier patch from Terry Lv at Freescale

---
 arch/arm/lib/board.c     |   10 ++--
 arch/powerpc/lib/board.c |   12 ++--
 common/Makefile          |    1 +
 common/cmd_nvedit.c      |    3 +-
 common/env_mmc.c         |  168 
++++++++++++++++++++++++++++++++++++++++++++++
 include/environment.h    |   18 +++++
 6 files changed, 200 insertions(+), 12 deletions(-)  create 

mode 100644 common/env_mmc.c

arch/arm/lib/board.c +5 -5
index f5660a9..5e7558e 100644
@@ -338,6 +338,11 @@ void start_armboot (void)
 	nand_init();		/* go init the NAND */
 #endif
 
+#ifdef CONFIG_GENERIC_MMC
+	puts ("MMC:   ");
+	mmc_initialize (gd->bd);
+#endif
+
 #if defined(CONFIG_CMD_ONENAND)
 	onenand_init();
 #endif
@@ -419,11 +424,6 @@ extern void davinci_eth_set_mac_addr 
 (const u_int8_t *addr);
 	board_late_init ();
 #endif
 
-#ifdef CONFIG_GENERIC_MMC
-	puts ("MMC:   ");
-	mmc_initialize (gd->bd);
-#endif
-
 #ifdef CONFIG_BITBANGMII
 	bb_miiphy_init();

#endif

(quoted diff) +0 -0

b/arch/powerpc/lib/board.c index 7b09fb5..1008635 100644

arch/powerpc/lib/board.c +6 -6
@@ -783,6 +783,12 @@ void board_init_r (gd_t *id, ulong dest_addr)
 	nand_init();		/* go init the NAND */
 #endif
 
+#ifdef CONFIG_GENERIC_MMC
+	WATCHDOG_RESET ();
+	puts ("MMC:  ");
+	mmc_initialize (bd);
+#endif
+
 	/* relocate environment function pointers etc. */
 	env_relocate ();
 
@@ -939,12 +945,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
 	scsi_init ();
 #endif
 
-#ifdef CONFIG_GENERIC_MMC
-	WATCHDOG_RESET ();
-	puts ("MMC:  ");
-	mmc_initialize (bd);
-#endif
-
 #if defined(CONFIG_CMD_DOC)
 	WATCHDOG_RESET ();
 	puts ("DOC:   ");
common/Makefile index renamed from common/Makefile +0 -0

dbf7a05..2c37073 100644

common/Makefile +1 -1
@@ -58,6 +58,7 @@ COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o
 COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_embedded.o
 COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
 COBJS-$(CONFIG_ENV_IS_IN_MG_DISK) += env_mgdisk.o
+COBJS-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o
 COBJS-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o
 COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_nvram.o
 COBJS-$(CONFIG_ENV_IS_IN_ONENAND) += env_onenand.o diff 
--git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index 

eb89e9e..27e46f7 100644

common/cmd_nvedit.c +2 -1
@@ -63,9 +63,10 @@ DECLARE_GLOBAL_DATA_PTR;
     !defined(CONFIG_ENV_IS_IN_NVRAM)	&& \
     !defined(CONFIG_ENV_IS_IN_ONENAND)	&& \
     !defined(CONFIG_ENV_IS_IN_SPI_FLASH)	&& \
+    !defined(CONFIG_ENV_IS_IN_MMC)	&& \
     !defined(CONFIG_ENV_IS_NOWHERE)
 # error Define one of 
 CONFIG_ENV_IS_IN_{EEPROM|FLASH|DATAFLASH|ONENAND|\
-SPI_FLASH|MG_DISK|NVRAM|NOWHERE}
+SPI_FLASH|MG_DISK|NVRAM|MMC|NOWHERE}
 #endif
 

#define XMK_STR(x) #x

common/env_mmc.c new file renamed from common/env_mmc.c +0 -0

mode 100644 index 0000000..ef7e5fb

common/env_mmc.c new file +6 -0
@@ -0,0 +1,168 @@
+/*
+ * (C) Copyright 2008-2009 Freescale Semiconductor, Inc.
+ * (C) Copyright 2000-2006
+ * Wolfgang Denk, DENX Software Engineering, w... at denx.de.
+ *
+ * (C) Copyright 2001 Sysgo Real-Time Solutions, GmbH 

<www.elinos.com>
+ * Andreas Heppel <[email protected]>

common/env_mmc.c new file +32 -0
+
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.      
   See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/* #define DEBUG */
+
+#include <common.h>
+
+#include <command.h>
+#include <environment.h>
+#include <linux/stddef.h>
+#include <malloc.h>
+#include <mmc.h>
+
+#if defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_MMC) #define 
+CMD_SAVEENV #elif defined(CONFIG_ENV_OFFSET_REDUND) #error 

Cannot use

common/env_mmc.c new file +16 -0
+CONFIG_ENV_OFFSET_REDUND without \
+	CONFIG_CMD_ENV & CONFIG_CMD_MMC
+#endif
+
+#if defined(CONFIG_ENV_SIZE_REDUND) && \
+	(CONFIG_ENV_SIZE_REDUND < CONFIG_ENV_SIZE) #error 
+CONFIG_ENV_SIZE_REDUND should not be less then CONFIG_ENV_SIZE #endif
+
+/* references to names in env_common.c */ extern uchar 
+default_environment[];
+
+char *env_name_spec = "MMC";
+
+#ifdef ENV_IS_EMBEDDED
+extern uchar environment[];
+env_t *env_ptr = (env_t *)(&environment[0]); #else /* ! 

ENV_IS_EMBEDDED

common/env_mmc.c new file +43 -0
+*/ env_t *env_ptr; #endif /* ENV_IS_EMBEDDED */
+
+/* local functions */
+#if !defined(ENV_IS_EMBEDDED)
+static void use_default(void);
+#endif
+
+DECLARE_GLOBAL_DATA_PTR;
+
+uchar env_get_char_spec(int index)
+{
+	return *((uchar *)(gd->env_addr + index)); }
+
+int env_init(void)
+{
+	/* use default */
+	gd->env_addr = (ulong)&default_environment[0];
+	gd->env_valid = 1;
+
+	return 0;
+}
+
+inline int init_mmc_for_env(struct mmc *mmc) {
+	if (!mmc) {
+		puts("No MMC card found\n");
+		return -1;
+	}
+
+	if (mmc_init(mmc)) {
+		puts("MMC init failed\n");
+		return  -1;
+	}
+
+	return 0;
+}
+
+#ifdef CMD_SAVEENV
+
+inline int write_env(struct mmc *mmc, unsigned long size,
+		unsigned long offset, const void *buffer) {
+	uint blk_start = 0, blk_cnt = 0, n = 0;
+
+	blk_start = (offset % 512) ? ((offset / 512) + 1) : 

(offset / 512);

common/env_mmc.c new file +16 -0
+	blk_cnt = (size % 512) ? ((size / 512) + 1) : (size / 512);
+	n = mmc->block_dev.block_write(0, blk_start , blk_cnt,
+			(u_char *)buffer);
+
+	return (n == blk_cnt) ? 0 : -1;
+}
+
+int saveenv(void)
+{
+	struct mmc *mmc = find_mmc_device(0);
+
+	if (init_mmc_for_env(mmc))
+		return 1;
+
+	puts("Writing to MMC... ");
+	if (write_env(mmc, CONFIG_ENV_SIZE, CONFIG_ENV_OFFSET, 

env_ptr)) {

common/env_mmc.c new file +14 -0
+		puts("failed\n");
+		return 1;
+	}
+
+	puts("done\n");
+	return 0;
+}
+#endif /* CMD_SAVEENV */
+
+inline int read_env(struct mmc *mmc, unsigned long size,
+		unsigned long offset, const void *buffer) {
+	uint blk_start = 0, blk_cnt = 0, n = 0;
+
+	blk_start = (offset % 512) ? ((offset / 512) + 1) : 

(offset / 512);

common/env_mmc.c new file +3 -0
+	blk_cnt = (size % 512) ? ((size / 512) + 1) : (size / 512);
+
+	n = mmc->block_dev.block_read(0, blk_start, blk_cnt, 

(uchar *)buffer);

common/env_mmc.c new file +25 -0
+
+	return (n == blk_cnt) ? 0 : -1;
+}
+
+void env_relocate_spec(void)
+{
+#if !defined(ENV_IS_EMBEDDED)
+	struct mmc *mmc = find_mmc_device(0);
+
+	if (init_mmc_for_env(mmc))
+		return;
+
+	if (read_env(mmc, CONFIG_ENV_SIZE, CONFIG_ENV_OFFSET, env_ptr))
+		return use_default();
+
+	if (crc32(0, env_ptr->data, ENV_SIZE) != env_ptr->crc)
+		return use_default();
+
+#endif /* ! ENV_IS_EMBEDDED */
+}
+
+#if !defined(ENV_IS_EMBEDDED)
+static void use_default()
+{
+	puts ("*** Warning - bad CRC or MMC, using default 

environment\n\n");

common/env_mmc.c new file +4 -0
+	set_default_env();
+}
+#endif
+
include/environment.h +3 -0
index b9924fd..aa0e750 100644
@@ -94,6 +94,24 @@
 # endif
 #endif /* CONFIG_ENV_IS_IN_MG_DISK */
 
+#if defined(CONFIG_ENV_IS_IN_MMC)
+# ifndef CONFIG_ENV_OFFSET
+#  error "Need to define CONFIG_ENV_OFFSET when using 

CONFIG_ENV_IS_IN_MMC"

include/environment.h +7 -0
+# endif
+# ifndef CONFIG_ENV_ADDR
+#  define CONFIG_ENV_ADDR      (CONFIG_ENV_OFFSET)
+# endif
+# ifndef CONFIG_ENV_OFFSET
+#  define CONFIG_ENV_OFFSET (CONFIG_ENV_ADDR) # endif # ifdef 
+CONFIG_ENV_OFFSET_REDUND #  define 

CONFIG_SYS_REDUNDAND_ENVIRONMENT #

include/environment.h +5 -0
+endif # ifdef CONFIG_ENV_IS_EMBEDDED
+#  define ENV_IS_EMBEDDED      1
+# endif
+#endif /* CONFIG_ENV_IS_IN_MMC */
+
 /* Embedded env is only supported for some flash types */  

#ifdef CONFIG_ENV_IS_EMBEDDED # if
!defined(CONFIG_ENV_IS_IN_FLASH) && \
--
1.6.0.6

Quoted 6 lines

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

-------------- next part --------------
An embedded message was scrubbed...
From: "Lv Terry-R65388" <[email protected]>
Subject: [PATCH] [PATCH v5]Save environment data to mmc.
Date: Fri, 7 May 2010 13:22:00 +0800
Size: 8262
Url: http://lists.denx.de/pipermail/u-boot/attachments/20100513/60446626/attachment.eml

#5 lore raw

PATCH 4/4 Environment in MMC

In reply to Alagu Sankar

Hi Alagu,

Quoted 20 lines · Alagu Sankar

This patch is to save environment data to mmc card. It uses interfaces defined in generic MMC framework. This is enabled with CONFIG_ENV_IS_IN_MMC option. Based on the earlier patch from Terry Lv at Freescale

---
 arch/arm/lib/board.c     |   10 ++--
 arch/powerpc/lib/board.c |   12 ++--
 common/Makefile          |    1 +
 common/cmd_nvedit.c      |    3 +-
 common/env_mmc.c         |  168 ++++++++++++++++++++++++++++++++++++++++++++++
 include/environment.h    |   18 +++++
 6 files changed, 200 insertions(+), 12 deletions(-)
 create mode 100644 common/env_mmc.c
arch/arm/lib/board.c +0 -0
index f5660a9..5e7558e 100644

arch/arm/lib/board.c void start_armboot (void) · line 345

Quoted 8 lines
arch/arm/lib/board.c +5 -0
@@ -338,6 +338,11 @@ void start_armboot (void)
 	nand_init();		/* go init the NAND */
 #endif
 
+#ifdef CONFIG_GENERIC_MMC
+	puts ("MMC:   ");
+	mmc_initialize (gd->bd);
+#endif
+

Why this has been moved up? If there is any genuine reason for this, then you can mention it in patch description.

Quoted 20 lines
arch/arm/lib/board.c +0 -5
 #if defined(CONFIG_CMD_ONENAND)
 	onenand_init();
 #endif
@@ -419,11 +424,6 @@ extern void davinci_eth_set_mac_addr (const u_int8_t *addr);
 	board_late_init ();
 #endif
 
-#ifdef CONFIG_GENERIC_MMC
-	puts ("MMC:   ");
-	mmc_initialize (gd->bd);
-#endif
-
 #ifdef CONFIG_BITBANGMII
 	bb_miiphy_init();
 #endif
arch/powerpc/lib/board.c +0 -0
index 7b09fb5..1008635 100644

arch/powerpc/lib/board.c void board_init_r (gd_t *id, ulong dest_addr) · line 791

Quoted 9 lines
arch/powerpc/lib/board.c +6 -0
@@ -783,6 +783,12 @@ void board_init_r (gd_t *id, ulong dest_addr)
 	nand_init();		/* go init the NAND */
 #endif
 
+#ifdef CONFIG_GENERIC_MMC
+	WATCHDOG_RESET ();
+	puts ("MMC:  ");
+	mmc_initialize (bd);
+#endif
+

The above comment applies here as well.

Quoted 50 lines
arch/powerpc/lib/board.c +0 -6
 	/* relocate environment function pointers etc. */
 	env_relocate ();
 
@@ -939,12 +945,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
 	scsi_init ();
 #endif
 
-#ifdef CONFIG_GENERIC_MMC
-	WATCHDOG_RESET ();
-	puts ("MMC:  ");
-	mmc_initialize (bd);
-#endif
-
 #if defined(CONFIG_CMD_DOC)
 	WATCHDOG_RESET ();
 	puts ("DOC:   ");
common/Makefile +1 -0
index dbf7a05..2c37073 100644
@@ -58,6 +58,7 @@ COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o
 COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_embedded.o
 COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
 COBJS-$(CONFIG_ENV_IS_IN_MG_DISK) += env_mgdisk.o
+COBJS-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o
 COBJS-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o
 COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_nvram.o
 COBJS-$(CONFIG_ENV_IS_IN_ONENAND) += env_onenand.o
common/cmd_nvedit.c +2 -1
index eb89e9e..27e46f7 100644
@@ -63,9 +63,10 @@ DECLARE_GLOBAL_DATA_PTR;
     !defined(CONFIG_ENV_IS_IN_NVRAM)	&& \
     !defined(CONFIG_ENV_IS_IN_ONENAND)	&& \
     !defined(CONFIG_ENV_IS_IN_SPI_FLASH)	&& \
+    !defined(CONFIG_ENV_IS_IN_MMC)	&& \
     !defined(CONFIG_ENV_IS_NOWHERE)
 # error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|DATAFLASH|ONENAND|\
-SPI_FLASH|MG_DISK|NVRAM|NOWHERE}
+SPI_FLASH|MG_DISK|NVRAM|MMC|NOWHERE}
 #endif
 
 #define XMK_STR(x)	#x
common/env_mmc.c new file +0 -0
new file mode 100644
index 0000000..ef7e5fb

common/env_mmc.c line 5

Quoted 5 lines
common/env_mmc.c new file +5 -0
@@ -0,0 +1,168 @@
+/*
+ * (C) Copyright 2008-2009 Freescale Semiconductor, Inc.
+ * (C) Copyright 2000-2006
+ * Wolfgang Denk, DENX Software Engineering, w... at denx.de.
+ *

I do not see your copyright here.

Regards,
Sudhakar

#6 lore raw

PATCH 4/4 Environment in MMC

Dear "Sudhakar Rajashekhara",

Quoted 11 lines · In message <014f01caf33f$17c731a0$475594e0$@[email protected]> you wrote:

common/env_mmc.c line 5

Quoted 9 lines
common/env_mmc.c new file +5 -0
@@ -0,0 +1,168 @@
+/*
+ * (C) Copyright 2008-2009 Freescale Semiconductor, Inc.
+ * (C) Copyright 2000-2006
+ * Wolfgang Denk, DENX Software Engineering, w... at denx.de.
+ *

I do not see your copyright here.

We do not add Copyright entries to the source files for relatively small patches; proper attribution is guaranteed through the
Signed-off-by: lines and committer entries in the git repository.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"A child is a person who can't understand why someone would give away
a perfectly good kitten."                               - Doug Larson
#7 lore raw

PATCH 4/4 Environment in MMC

In reply to Sudhakar Rajashekhara
Quoted 2 lines · Sudhakar Rajashekhara

Hi Alagu,

Hi,

Quoted 4 lines · Alagu Sankar
Quoted 3 lines

This patch is to save environment data to mmc card. It uses interfaces defined in generic MMC framework. This is enabled with CONFIG_ENV_IS_IN_MMC option. Based on the earlier patch from Terry Lv at Freescale

Should be not better you send your comments to Terry as to generate a new patch? His patch had already passed some reviews and he can integrate your comments. I miss here what you changed respect Terry, and you miss some comments in the previous reviews, for example regarding the usage of the ALIGN macro. Why do you need two patches for the same purpose ?

Quoted 2 lines

Why this has been moved up? If there is any genuine reason for this, then you can mention it in patch description.

That is correct. The mmc must be initialized before env_init to get the environment working.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================
#8 lore raw

PATCH 4/4 Environment in MMC

Quoted 27 lines · Stefano Babic
Quoted 3 lines · Sudhakar Rajashekhara

Hi Alagu,

Hi,

Quoted 6 lines · Alagu Sankar
Quoted 5 lines

This patch is to save environment data to mmc card. It uses interfaces defined in generic MMC framework. This is enabled with CONFIG_ENV_IS_IN_MMC option. Based on the earlier patch from Terry Lv at Freescale

Should be not better you send your comments to Terry as to generate a new patch? His patch had already passed some reviews and he can integrate your comments. I miss here what you changed respect Terry, and you miss some comments in the previous reviews, for example regarding the usage of the ALIGN macro. Why do you need two patches for the same purpose ?

Quoted 3 lines

Why this has been moved up? If there is any genuine reason for this, then you can mention it in patch description.

Quoted 7 lines

That is correct. The mmc must be initialized before env_init to get the environment working.

Best regards,
Stefano Babic

When I searched for the Environment support in MMC, I came across Terry's earlier patches, but they were not cleanly getting applied to the current tree. There is no value add here except fixing the patch errors and generating a new patch for the current tree. So there is no question of adding any copyright here. Terry has indicated an update to his patch already. I will be resubmitting my other patches with reference to Terry's latest patch.

- Alagu Sankar

#9 lore raw

PATCH 4/4 Environment in MMC

Quoted 4 lines · Alagu Sankar
Quoted 1 line

When I searched for the Environment support in MMC, I came across Terry's earlier patches, but they were not cleanly getting applied to the current tree.

I have tried to apply again last Terry's patch, I see only a couple of coding-style problems, no errors at all:

Applying: Save environment data to mmc. /home/stefano/Projects/imx/u-boot-imx/.git/rebase-apply/patch:21:
trailing whitespace.
* Thus It is required that operations like pin multiplexer
/home/stefano/Projects/imx/u-boot-imx/.git/rebase-apply/patch:54:
trailing whitespace.
* Thus It is required that operations like pin multiplexer
warning: 2 lines add whitespace errors.

Quoted 2 lines

There is no value add here except fixing the patch
errors and generating a new patch for the current tree.

Probably not needed. I have not seen the errors you reported. Are you sure you have tested with Terry's last patch ? It seems you submit an earlier version.

Quoted 2 lines

So there is no
question of adding any copyright here.

Yes, Wolfgang has already answered. No need to add a copyright for small patches.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================
#10 lore raw

PATCH 4/4 Environment in MMC

Quoted 36 lines · Stefano Babic
Quoted 6 lines · Alagu Sankar
Quoted 2 lines

When I searched for the Environment support in MMC, I came across Terry's earlier patches, but they were not cleanly getting applied to the current tree.

I have tried to apply again last Terry's patch, I see only a couple of coding-style problems, no errors at all:

Applying: Save environment data to mmc. /home/stefano/Projects/imx/u-boot-imx/.git/rebase-apply/patch:21:
trailing whitespace.
* Thus It is required that operations like pin multiplexer
/home/stefano/Projects/imx/u-boot-imx/.git/rebase-apply/patch:54:
trailing whitespace.
* Thus It is required that operations like pin multiplexer
warning: 2 lines add whitespace errors.

Quoted 3 lines

There is no value add here except fixing the patch
errors and generating a new patch for the current tree.

Probably not needed. I have not seen the errors you reported. Are you sure you have tested with Terry's last patch ? It seems you submit an earlier version.

Quoted 3 lines

So there is no
question of adding any copyright here.

Quoted 7 lines

Yes, Wolfgang has already answered. No need to add a copyright for small patches.

Best regards,
Stefano Babic

I was referring to Terry's old patches, and not the v5 patch he has submitted recently. I started on this some time back. Its a mistake that I did not check the updates that happened recently, before submitting the patches.

Best Regards,
Alagu Sankar

#11 lore raw

PATCH 4/4 Environment in MMC

In reply to Stefano Babic

Hi,

I've just send v6 version for review which fixes the coding-style problems.

Thanks~~

Yours
Terry

Quoted 53 lines

-----Original Message-----
From: Stefano Babic [mailto:sbabic at denx.de]
Sent: 2010?5?14? 19:41
To: Alagu Sankar
Cc: Stefano Babic; Sudhakar Rajashekhara; u-boot at lists.denx.de; Lv Terry-R65388
Subject: Re: [U-Boot] [PATCH 4/4] Environment in MMC

Quoted 3 lines · Alagu Sankar
Quoted 1 line

When I searched for the Environment support in MMC, I came across Terry's earlier patches, but they were not cleanly getting

applied to

Quoted 1 line

the current tree.

I have tried to apply again last Terry's patch, I see only a couple of coding-style problems, no errors at all:

Applying: Save environment data to mmc. /home/stefano/Projects/imx/u-boot-imx/.git/rebase-apply/patch:21:
trailing whitespace.
* Thus It is required that operations like pin multiplexer
/home/stefano/Projects/imx/u-boot-imx/.git/rebase-apply/patch:54:
trailing whitespace.
* Thus It is required that operations like pin multiplexer
warning: 2 lines add whitespace errors.

Quoted 2 lines

There is no value add here except fixing the patch errors and
generating a new patch for the current tree.

Probably not needed. I have not seen the errors you reported. Are you sure you have tested with Terry's last patch ? It seems you submit an earlier version.

Quoted 2 lines

So there is no
question of adding any copyright here.

Yes, Wolfgang has already answered. No need to add a copyright for small patches.

Best regards,
Stefano Babic

--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email:
office at denx.de
=====================================================================

#12 lore raw

PATCH 3/4 MMC Multi-block Support

In reply to Alagu Sankar
Quoted 7 lines · Alagu Sankar

Added Multi-Block Read support for Generic MMC. Modified existing multi-block write to limit the maximum number of blocks per transfer. ?This feature is enabled with CONFIG_MMC_MBLOCK option. ?A new member is added in the mmc structure for the host controller to specify the maximum number of blocks it supports.

I removed the config option, and just made this always how it works. Applied.

Thanks!

#13 lore raw

PATCH 3/4 MMC Multi-block Support

Hi,

Has this changed been merged into uboot mainline?
Current mmc framework read is rather slow comparing with the write...

If we could get the multiply-read behavior, that would be nice. :-)

Thanks,
Lei

Quoted 18 lines · Andy Fleming
Quoted 7 lines · Alagu Sankar

Added Multi-Block Read support for Generic MMC. Modified existing multi-block write to limit the maximum number of blocks per transfer. ?This feature is enabled with CONFIG_MMC_MBLOCK option. ?A new member is added in the mmc structure for the host controller to specify the maximum number of blocks it supports.

I removed the config option, and just made this always how it works. ?Applied.

Thanks!
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#14 lore raw

PATCH 3/4 MMC Multi-block Support

In reply to Andy Fleming

Alagu,

This never made it into Andy's tree nor upstream. Could you submit a new patch to current upstream with the config option removed as Andy said he did back in May? Maybe we can get it commited via some other maintainer. Steve Sakoman seems to have done some MMC work lately.

Thanks,
John

Quoted 18 lines · Andy Fleming
Quoted 7 lines · Alagu Sankar

Added Multi-Block Read support for Generic MMC. Modified existing multi-block write to limit the maximum number of blocks per transfer. ?This feature is enabled with CONFIG_MMC_MBLOCK option. ?A new member is added in the mmc structure for the host controller to specify the maximum number of blocks it supports.

I removed the config option, and just made this always how it works. ?Applied.

Thanks!
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#15 lore raw

PATCH 3/4 MMC Multi-block Support

Quoted 6 lines · John Rigby

Alagu,

This never made it into Andy's tree nor upstream. ?Could you submit a new patch to current upstream with the config option removed as Andy said he did back in May? ?Maybe we can get it commited via some other maintainer. ?Steve Sakoman seems to have done some MMC work lately.

I've done some testing with this patch on OMAP3 and OMAP4, in the "always enabled" version.

I compared the old legacy mmc driver vs the new generic mmc driver vs new generic mmc driver with multiblock read support added.

The good news is that the generic mmc driver for OMAP is almost twice as fast as the old legacy driver. These patches should be in the next u-boot-ti pull request and so will be in mainline shortly.

The bad news is that multiblock reads seem to make no difference :-(

For reading a 45MB file from an ext3 partition using ext2load I get:

legacy:              62 seconds
generic:             35 seconds
generic w/ multi: 35 seconds

I'm happy to resubmit the multi-block read patch because it does seem to work properly and may even yield improvements on other architectures.

Would you like me to do that?

Steve

#16 lore raw

PATCH 3/4 MMC Multi-block Support

Quoted 29 lines · John Rigby
Quoted 6 lines

Alagu,

This never made it into Andy's tree nor upstream. ?Could you submit a new patch to current upstream with the config option removed as Andy said he did back in May? ?Maybe we can get it commited via some other maintainer. ?Steve Sakoman seems to have done some MMC work lately.

I've done some testing with this patch on OMAP3 and OMAP4, in the "always enabled" version.

I compared the old legacy mmc driver vs the new generic mmc driver vs new generic mmc driver with multiblock read support added.

The good news is that the generic mmc driver for OMAP is almost twice as fast as the old legacy driver. These patches should be in the next u-boot-ti pull request and so will be in mainline shortly.

The bad news is that multiblock reads seem to make no difference :-(

For reading a 45MB file from an ext3 partition using ext2load I get:

legacy:              62 seconds
generic:             35 seconds
generic w/ multi: 35 seconds
Quoted 7 lines

I'm happy to resubmit the multi-block read patch because it does seem to work properly and may even yield improvements on other architectures.

Would you like me to do that?

Steve

Yes please submit updated patches if you have them in your tree. Others might want to participate in a new round of review.

Sandeep

#17 lore raw

PATCH 3/4 MMC Multi-block Support

In reply to Steve Sakoman
Quoted 36 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Steve Sakoman
Sent: Friday, October 15, 2010 3:14 AM
To: John Rigby
Cc: u-boot at lists.denx.de; Alagu Sankar; Andy Fleming
Subject: Re: [U-Boot] [PATCH 3/4] MMC Multi-block Support

Quoted 6 lines · John Rigby

Alagu,

This never made it into Andy's tree nor upstream. ?Could you submit a new patch to current upstream with the config option removed as Andy said he did back in May? ?Maybe we can get it commited via some other maintainer. ?Steve Sakoman seems to have done some MMC work lately.

I've done some testing with this patch on OMAP3 and OMAP4, in the "always enabled" version.

I compared the old legacy mmc driver vs the new generic mmc driver vs new generic mmc driver with multiblock read support added.

The good news is that the generic mmc driver for OMAP is almost twice as fast as the old legacy driver. These patches should be in the next u-boot-ti pull request and so will be in mainline shortly.

The bad news is that multiblock reads seem to make no difference :-(

For reading a 45MB file from an ext3 partition using ext2load I get:

legacy:              62 seconds
generic:             35 seconds
generic w/ multi: 35 seconds
Quoted 5 lines

I'm happy to resubmit the multi-block read patch because it does seem to work properly and may even yield improvements on other architectures.

Would you like me to do that?

[Ghorai]
would you please try with additional change?
$>git diff drivers/mmc/omap_hsmmc.c

drivers/mmc/omap_hsmmc.c +1 -0
index f8b9840..7f3f968 100644
@@ -401,6 +401,7 @@ int omap_mmc_init(int dev_index)
 
        mmc->f_min = 400000;
        mmc->f_max = 52000000;
+       mmc->b_max = 0xFFFF;
 
        mmc_register(mmc);
 
Quoted 6 lines

Steve
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#18 lore raw

PATCH 3/4 MMC Multi-block Support

Quoted 36 lines · Sukumar
Quoted 36 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Steve Sakoman
Sent: Friday, October 15, 2010 3:14 AM
To: John Rigby
Cc: u-boot at lists.denx.de; Alagu Sankar; Andy Fleming
Subject: Re: [U-Boot] [PATCH 3/4] MMC Multi-block Support

Quoted 6 lines · John Rigby

Alagu,

This never made it into Andy's tree nor upstream. ?Could you submit a new patch to current upstream with the config option removed as Andy said he did back in May? ?Maybe we can get it commited via some other maintainer. ?Steve Sakoman seems to have done some MMC work lately.

I've done some testing with this patch on OMAP3 and OMAP4, in the "always enabled" version.

I compared the old legacy mmc driver vs the new generic mmc driver vs new generic mmc driver with multiblock read support added.

The good news is that the generic mmc driver for OMAP is almost twice as fast as the old legacy driver. ?These patches should be in the next u-boot-ti pull request and so will be in mainline shortly.

The bad news is that multiblock reads seem to make no difference :-(

For reading a 45MB file from an ext3 partition using ext2load I get:

legacy: ? ? ? ? ? ? ?62 seconds
generic: ? ? ? ? ? ? 35 seconds
generic w/ multi: 35 seconds

Quoted 8 lines
Quoted 5 lines

I'm happy to resubmit the multi-block read patch because it does seem to work properly and may even yield improvements on other architectures.

Would you like me to do that?

[Ghorai]
would you please try with additional change?

Yes! That is much better!

Now multiblock reads are faster :-)

The results (including the old legacy mmc driver for reference):

legacy:              62 seconds
generic:             35 seconds
generic w/ multi: 9 seconds

I will add my "Acked-by" and "Tested-by" and submit the final patch to the list later today.

Steve

Quoted 21 lines

$>git diff drivers/mmc/omap_hsmmc.c

drivers/mmc/omap_hsmmc.c +1 -0
index f8b9840..7f3f968 100644
@@ -401,6 +401,7 @@ int omap_mmc_init(int dev_index)
 
 ? ? ? ?mmc->f_min = 400000;
 ? ? ? ?mmc->f_max = 52000000;
+ ? ? ? mmc->b_max = 0xFFFF;
 
 ? ? ? ?mmc_register(mmc);
 
Quoted 6 lines

Steve
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#19 lore raw

PATCH 3/4 MMC Multi-block Support

Quoted 60 lines

-----Original Message-----
From: Steve Sakoman [mailto:sakoman at gmail.com]
Sent: Monday, October 25, 2010 11:00 PM
To: Ghorai, Sukumar
Cc: John Rigby; u-boot at lists.denx.de; Alagu Sankar; Andy Fleming
Subject: Re: [U-Boot] [PATCH 3/4] MMC Multi-block Support

Quoted 4 lines · Sukumar
Quoted 4 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot-

bounces at lists.denx.de]

Quoted 32 lines
Quoted 32 lines

On Behalf Of Steve Sakoman
Sent: Friday, October 15, 2010 3:14 AM
To: John Rigby
Cc: u-boot at lists.denx.de; Alagu Sankar; Andy Fleming
Subject: Re: [U-Boot] [PATCH 3/4] MMC Multi-block Support

Quoted 6 lines · John Rigby

Alagu,

This never made it into Andy's tree nor upstream. ?Could you submit a new patch to current upstream with the config option removed as Andy said he did back in May? ?Maybe we can get it commited via some other maintainer. ?Steve Sakoman seems to have done some MMC work lately.

I've done some testing with this patch on OMAP3 and OMAP4, in the "always enabled" version.

I compared the old legacy mmc driver vs the new generic mmc driver vs new generic mmc driver with multiblock read support added.

The good news is that the generic mmc driver for OMAP is almost twice as fast as the old legacy driver. ?These patches should be in the next u-boot-ti pull request and so will be in mainline shortly.

The bad news is that multiblock reads seem to make no difference :-(

For reading a 45MB file from an ext3 partition using ext2load I get:

legacy: ? ? ? ? ? ? ?62 seconds
generic: ? ? ? ? ? ? 35 seconds
generic w/ multi: 35 seconds

Quoted 8 lines
Quoted 5 lines

I'm happy to resubmit the multi-block read patch because it does seem to work properly and may even yield improvements on other architectures.

Would you like me to do that?

[Ghorai]
would you please try with additional change?

Yes! That is much better!

Now multiblock reads are faster :-)

Quoted 8 lines

The results (including the old legacy mmc driver for reference):

legacy:              62 seconds
generic:             35 seconds
generic w/ multi: 9 seconds

I will add my "Acked-by" and "Tested-by" and submit the final patch to the list later today.

[Ghorai] please add

And will submit a separate patch as mentioned below.

Quoted 25 lines

Steve

Quoted 21 lines

$>git diff drivers/mmc/omap_hsmmc.c

drivers/mmc/omap_hsmmc.c +1 -0
index f8b9840..7f3f968 100644
@@ -401,6 +401,7 @@ int omap_mmc_init(int dev_index)
 
 ? ? ? ?mmc->f_min = 400000;
 ? ? ? ?mmc->f_max = 52000000;
+ ? ? ? mmc->b_max = 0xFFFF;
 
 ? ? ? ?mmc_register(mmc);
 
Quoted 6 lines

Steve
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#20 lore raw

PATCH 2/4 MMC Card Capacity Bug Fix

In reply to Alagu Sankar

Hi Alagu,

Quoted 12 lines · Alagu Sankar

Fixed a bug in card capacity calculation for MMC high-capacity cards.

---
 drivers/mmc/mmc.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
drivers/mmc/mmc.c +0 -0
index 959d8ad..e7abf94 100644

drivers/mmc/mmc.c int mmc_change_freq(struct mmc *mmc) · line 397

Quoted 5 lines
drivers/mmc/mmc.c +1 -0
@@ -393,6 +393,7 @@ int mmc_change_freq(struct mmc *mmc)
 	char ext_csd[512];
 	char cardtype;
 	int err;
+	unsigned int sec_count;
 

This can be uint too or you can use unsigned int to typecast below.

Regards,
Sudhakar

Quoted 26 lines
drivers/mmc/mmc.c +7 -1
 	mmc->card_caps = 0;
 
@@ -407,8 +408,14 @@ int mmc_change_freq(struct mmc *mmc)
 	if (err)
 		return err;
 
-	if (ext_csd[212] || ext_csd[213] || ext_csd[214] || ext_csd[215])
+	sec_count = ((uint)ext_csd[212] |
+			((uint)ext_csd[213] << 8) |
+			((uint)ext_csd[214] << 16) |
+			((uint)ext_csd[215] << 24));
+	if (sec_count) {
 		mmc->high_capacity = 1;
+		mmc->capacity = sec_count * 512;
+	}
 
 	cardtype = ext_csd[196] & 0xf;
 
Signature · 6 lines
1.6.0.6

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
#22 lore raw

PATCH 1/4 SD1.00 wide-bus fix

In reply to Alagu Sankar

Andy,

Can you be kind enough to review these MMC patches.

I believe there are 2 sets of patches.

Thanks,
Sandeep

Quoted 37 lines

Subject: [U-Boot] [PATCH 1/4] SD1.00 wide-bus fix

Fixed a bug wherein SD version 1.0 cards were not configured for 4-bit mode

---
 drivers/mmc/mmc.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/mmc/mmc.c +3 -4
index cf4ea16..959d8ad 100644
@@ -520,6 +520,9 @@ retry_scr:
 			break;
 	}
 
+	if (mmc->scr[0] & SD_DATA_4BIT)
+		mmc->card_caps |= MMC_MODE_4BIT;
+
 	/* Version 1.0 doesn't support switching */
 	if (mmc->version == SD_VERSION_1_0)
 		return 0;
@@ -537,9 +540,6 @@ retry_scr:
 			break;
 	}
 
-	if (mmc->scr[0] & SD_DATA_4BIT)
-		mmc->card_caps |= MMC_MODE_4BIT;
-
 	/* If high-speed isn't supported, we return */
 	if (!(__be32_to_cpu(switch_status[3]) & SD_HIGHSPEED_SUPPORTED))
 		return 0;
--

1.6.0.6

#24 lore raw

PATCH 1/4 SD1.00 wide-bus fix

Quoted 11 lines · Andy Fleming
Quoted 3 lines · Alagu Sankar

Fixed a bug wherein SD version 1.0 cards were not configured for 4-bit mode

Applied, thanks!
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Andy,

You responded with an "Applied, thanks!" to this and two other patches from Alagu but I can't find them in your mmc tree or Wolfgang's tree on git.denx.de. Am I missing something, or did they get dropped?

Thanks
John