Re: [U-Boot] [PATCH 4/4] Environment in MMC

2010-05-17 Thread Lv Terry-R65388
Hi,

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

Thanks~~

Yours
Terry 

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

  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.
 
   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.
 
   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: 
 off...@denx.de 
 =
 
 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 4/4] Environment in MMC

2010-05-14 Thread Sudhakar Rajashekhara
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 alagusan...@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 000..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


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


Re: [U-Boot] [PATCH 4/4] Environment in MMC

2010-05-14 Thread Wolfgang Denk
Dear Sudhakar Rajashekhara,

In message 014f01caf33f$17c731a0$475594...@raj@ti.com you wrote:
 
  --- /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.

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

-- 
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: w...@denx.de
A child is a person who can't understand why someone would give away
a perfectly good kitten.   - Doug Larson
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 4/4] Environment in MMC

2010-05-14 Thread Stefano Babic
Sudhakar Rajashekhara wrote:
 Hi Alagu,
 
Hi,

 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

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 ?

 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

-- 
=
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: off...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 4/4] Environment in MMC

2010-05-14 Thread Alagu Sankar
Stefano Babic wrote:
 Sudhakar Rajashekhara wrote:
   
 Hi Alagu,

 
 Hi,

   
 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
   

 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 ?

   
 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

   
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
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 4/4] Environment in MMC

2010-05-14 Thread Stefano Babic
Alagu Sankar wrote:

   
 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.

  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.

  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: off...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 4/4] Environment in MMC

2010-05-14 Thread Alagu Sankar
Stefano Babic wrote:
 Alagu Sankar wrote:

   
   
   
 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.

   
  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.

   
  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

   
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
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 4/4] Environment in MMC

2010-05-13 Thread Lv Terry-R65388
Hi Alagu Sankar,

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

Thanks~~

Yours
Terry 

 -Original Message-
 From: u-boot-boun...@lists.denx.de 
 [mailto:u-boot-boun...@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 alagusan...@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 000..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

[U-Boot] [PATCH 4/4] Environment in MMC

2010-05-12 Thread 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

Signed-off-by: Alagu Sankar alagusan...@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 000..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