[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
Signed-off-by: Alagu Sankar alagusankar@embwise.com --- drivers/mmc/mmc.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index cf4ea16..959d8ad 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -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;

Fixed a bug in card capacity calculation for MMC high-capacity cards.
Signed-off-by: Alagu Sankar alagusankar@embwise.com --- drivers/mmc/mmc.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 959d8ad..e7abf94 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -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;

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.
Signed-off-by: Alagu Sankar alagusankar@embwise.com --- drivers/mmc/mmc.c | 156 +++++++++++++++++++++++++++++++++++++++++++++++++++++ include/mmc.h | 3 + 2 files changed, 159 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index e7abf94..3f5a200 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -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); diff --git a/include/mmc.h b/include/mmc.h index 8973bc7..04c7eaf 100644 --- a/include/mmc.h +++ b/include/mmc.h @@ -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);

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
Signed-off-by: Alagu Sankar alagusankar@embwise.com --- 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
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index f5660a9..5e7558e 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -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 diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c index 7b09fb5..1008635 100644 --- a/arch/powerpc/lib/board.c +++ b/arch/powerpc/lib/board.c @@ -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: "); diff --git a/common/Makefile b/common/Makefile index dbf7a05..2c37073 100644 --- a/common/Makefile +++ b/common/Makefile @@ -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 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -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 diff --git a/common/env_mmc.c b/common/env_mmc.c new file mode 100644 index 0000000..ef7e5fb --- /dev/null +++ b/common/env_mmc.c @@ -0,0 +1,168 @@ +/* + * (C) Copyright 2008-2009 Freescale Semiconductor, Inc. + * (C) Copyright 2000-2006 + * Wolfgang Denk, DENX Software Engineering, w...@denx.de. + * + * (C) Copyright 2001 Sysgo Real-Time Solutions, GmbH <www.elinos.com> + * Andreas Heppel ahep...@sysgo.de + + * 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 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 */ +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); + 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)) { + 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); + blk_cnt = (size % 512) ? ((size / 512) + 1) : (size / 512); + + n = mmc->block_dev.block_read(0, blk_start, blk_cnt, (uchar *)buffer); + + 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"); + set_default_env(); +} +#endif + diff --git a/include/environment.h b/include/environment.h index b9924fd..aa0e750 100644 --- a/include/environment.h +++ b/include/environment.h @@ -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) && \

Hi Alagu Sankar,
Pls use my latest v5 patch for saving environment data to mmc.
Thanks~~
Yours Terry
-----Original Message----- From: u-boot-bounces@lists.denx.de [mailto:u-boot-bounces@lists.denx.de] On Behalf Of Alagu Sankar Sent: 2010年5月12日 17:38 To: u-boot@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
Signed-off-by: Alagu Sankar alagusankar@embwise.com
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
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index f5660a9..5e7558e 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -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 diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c index 7b09fb5..1008635 100644 --- a/arch/powerpc/lib/board.c +++ b/arch/powerpc/lib/board.c @@ -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: "); diff --git a/common/Makefile b/common/Makefile index dbf7a05..2c37073 100644 --- a/common/Makefile +++ b/common/Makefile @@ -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 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -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 diff --git a/common/env_mmc.c b/common/env_mmc.c new file mode 100644 index 0000000..ef7e5fb --- /dev/null +++ b/common/env_mmc.c @@ -0,0 +1,168 @@ +/*
- (C) Copyright 2008-2009 Freescale Semiconductor, Inc.
- (C) Copyright 2000-2006
- Wolfgang Denk, DENX Software Engineering, w...@denx.de.
- (C) Copyright 2001 Sysgo Real-Time Solutions, GmbH
<www.elinos.com>
- Andreas Heppel ahep...@sysgo.de
- 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
See the
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- 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 +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 +*/ 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);
- 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)) {
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);
- blk_cnt = (size % 512) ? ((size / 512) + 1) : (size / 512);
- n = mmc->block_dev.block_read(0, blk_start, blk_cnt,
(uchar *)buffer);
- 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");
- set_default_env();
+} +#endif
diff --git a/include/environment.h b/include/environment.h index b9924fd..aa0e750 100644 --- a/include/environment.h +++ b/include/environment.h @@ -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) && \ -- 1.6.0.6
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

Hi Alagu,
On Wed, May 12, 2010 at 15:08:27, Alagu Sankar wrote:
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
Signed-off-by: Alagu Sankar alagusankar@embwise.com
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
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index f5660a9..5e7558e 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -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.
#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 diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c index 7b09fb5..1008635 100644 --- a/arch/powerpc/lib/board.c +++ b/arch/powerpc/lib/board.c @@ -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.
/* 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: "); diff --git a/common/Makefile b/common/Makefile index dbf7a05..2c37073 100644 --- a/common/Makefile +++ b/common/Makefile @@ -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 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -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 diff --git a/common/env_mmc.c b/common/env_mmc.c new file mode 100644 index 0000000..ef7e5fb --- /dev/null +++ b/common/env_mmc.c @@ -0,0 +1,168 @@ +/*
- (C) Copyright 2008-2009 Freescale Semiconductor, Inc.
- (C) Copyright 2000-2006
- Wolfgang Denk, DENX Software Engineering, w...@denx.de.
I do not see your copyright here.
Regards, Sudhakar

On Wed, May 12, 2010 at 4:38 AM, Alagu Sankar alagusankar@embwise.com wrote:
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.
Signed-off-by: Alagu Sankar alagusankar@embwise.com
I removed the config option, and just made this always how it works. Applied.
Thanks!

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
On Sat, May 15, 2010 at 1:37 AM, Andy Fleming afleming@gmail.com wrote:
On Wed, May 12, 2010 at 4:38 AM, Alagu Sankar alagusankar@embwise.com wrote:
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.
Signed-off-by: Alagu Sankar alagusankar@embwise.com
I removed the config option, and just made this always how it works. Applied.
Thanks! _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

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
On Fri, May 14, 2010 at 11:37 AM, Andy Fleming afleming@gmail.com wrote:
On Wed, May 12, 2010 at 4:38 AM, Alagu Sankar alagusankar@embwise.com wrote:
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.
Signed-off-by: Alagu Sankar alagusankar@embwise.com
I removed the config option, and just made this always how it works. Applied.
Thanks! _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

On Mon, Oct 4, 2010 at 1:32 PM, John Rigby jcrigby@gmail.com wrote:
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

On Mon, Oct 4, 2010 at 1:32 PM, John Rigby jcrigby@gmail.com wrote:
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
Yes please submit updated patches if you have them in your tree. Others might want to participate in a new round of review.
Sandeep

-----Original Message----- From: u-boot-bounces@lists.denx.de [mailto:u-boot-bounces@lists.denx.de] On Behalf Of Steve Sakoman Sent: Friday, October 15, 2010 3:14 AM To: John Rigby Cc: u-boot@lists.denx.de; Alagu Sankar; Andy Fleming Subject: Re: [U-Boot] [PATCH 3/4] MMC Multi-block Support
On Mon, Oct 4, 2010 at 1:32 PM, John Rigby jcrigby@gmail.com wrote:
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?
[Ghorai] would you please try with additional change? $>git diff drivers/mmc/omap_hsmmc.c
diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c index f8b9840..7f3f968 100644 --- a/drivers/mmc/omap_hsmmc.c +++ b/drivers/mmc/omap_hsmmc.c @@ -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);
Steve _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

On Sat, Oct 23, 2010 at 8:14 AM, Ghorai, Sukumar s-ghorai@ti.com wrote:
-----Original Message----- From: u-boot-bounces@lists.denx.de [mailto:u-boot-bounces@lists.denx.de] On Behalf Of Steve Sakoman Sent: Friday, October 15, 2010 3:14 AM To: John Rigby Cc: u-boot@lists.denx.de; Alagu Sankar; Andy Fleming Subject: Re: [U-Boot] [PATCH 3/4] MMC Multi-block Support
On Mon, Oct 4, 2010 at 1:32 PM, John Rigby jcrigby@gmail.com wrote:
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?
[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
$>git diff drivers/mmc/omap_hsmmc.c
diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c index f8b9840..7f3f968 100644 --- a/drivers/mmc/omap_hsmmc.c +++ b/drivers/mmc/omap_hsmmc.c @@ -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);
Steve _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

-----Original Message----- From: Steve Sakoman [mailto:sakoman@gmail.com] Sent: Monday, October 25, 2010 11:00 PM To: Ghorai, Sukumar Cc: John Rigby; u-boot@lists.denx.de; Alagu Sankar; Andy Fleming Subject: Re: [U-Boot] [PATCH 3/4] MMC Multi-block Support
On Sat, Oct 23, 2010 at 8:14 AM, Ghorai, Sukumar s-ghorai@ti.com wrote:
-----Original Message----- From: u-boot-bounces@lists.denx.de [mailto:u-boot-
bounces@lists.denx.de]
On Behalf Of Steve Sakoman Sent: Friday, October 15, 2010 3:14 AM To: John Rigby Cc: u-boot@lists.denx.de; Alagu Sankar; Andy Fleming Subject: Re: [U-Boot] [PATCH 3/4] MMC Multi-block Support
On Mon, Oct 4, 2010 at 1:32 PM, John Rigby jcrigby@gmail.com wrote:
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?
[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.
[Ghorai] please add Tested-by: Sukumar Ghorai s-ghorai@ti.com
And will submit a separate patch as mentioned below.
Steve
$>git diff drivers/mmc/omap_hsmmc.c
diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c index f8b9840..7f3f968 100644 --- a/drivers/mmc/omap_hsmmc.c +++ b/drivers/mmc/omap_hsmmc.c @@ -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);
Steve _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

Hi Alagu,
On Wed, May 12, 2010 at 15:08:25, Alagu Sankar wrote:
Fixed a bug in card capacity calculation for MMC high-capacity cards.
Signed-off-by: Alagu Sankar alagusankar@embwise.com
drivers/mmc/mmc.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 959d8ad..e7abf94 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -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
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;
-- 1.6.0.6
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

On Wed, May 12, 2010 at 4:38 AM, Alagu Sankar alagusankar@embwise.com wrote:
Fixed a bug in card capacity calculation for MMC high-capacity cards.
Signed-off-by: Alagu Sankar alagusankar@embwise.com
Applied, thanks!

Andy,
Can you be kind enough to review these MMC patches.
I believe there are 2 sets of patches.
Thanks, Sandeep
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
Signed-off-by: Alagu Sankar alagusankar@embwise.com
drivers/mmc/mmc.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index cf4ea16..959d8ad 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -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

On Wed, May 12, 2010 at 4:38 AM, Alagu Sankar alagusankar@embwise.com wrote:
Fixed a bug wherein SD version 1.0 cards were not configured for 4-bit mode
Signed-off-by: Alagu Sankar alagusankar@embwise.com
Applied, thanks!

On Fri, May 14, 2010 at 11:30 AM, Andy Fleming afleming@gmail.com wrote:
On Wed, May 12, 2010 at 4:38 AM, Alagu Sankar alagusankar@embwise.com wrote:
Fixed a bug wherein SD version 1.0 cards were not configured for 4-bit mode
Signed-off-by: Alagu Sankar alagusankar@embwise.com
Applied, thanks! _______________________________________________ U-Boot mailing list U-Boot@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
participants (9)
-
Alagu Sankar
-
Andy Fleming
-
Ghorai, Sukumar
-
John Rigby
-
Lei Wen
-
Lv Terry-R65388
-
Paulraj, Sandeep
-
Steve Sakoman
-
Sudhakar Rajashekhara