test: Remove duplicate macro
[pandora-u-boot.git] / env / mmc.c
index aca61b7..09e94f0 100644 (file)
--- a/env/mmc.c
+++ b/env/mmc.c
@@ -6,6 +6,7 @@
 /* #define DEBUG */
 
 #include <common.h>
+#include <asm/global_data.h>
 
 #include <command.h>
 #include <env.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if !defined(CONFIG_SYS_MMC_ENV_DEV)
-#define CONFIG_SYS_MMC_ENV_DEV 0
-#endif
-
-__weak int mmc_get_env_dev(void)
-{
-       return CONFIG_SYS_MMC_ENV_DEV;
-}
-
 #if CONFIG_IS_ENABLED(OF_CONTROL)
 static inline int mmc_offset_try_partition(const char *str, int copy, s64 *val)
 {
@@ -51,7 +43,7 @@ static inline int mmc_offset_try_partition(const char *str, int copy, s64 *val)
                if (ret < 0)
                        return ret;
 
-               if (!strncmp((const char *)info.name, str, sizeof(str)))
+               if (!strncmp((const char *)info.name, str, sizeof(info.name)))
                        break;
        }
 
@@ -241,7 +233,6 @@ fini:
        return ret;
 }
 
-#if defined(CONFIG_CMD_ERASEENV)
 static inline int erase_env(struct mmc *mmc, unsigned long size,
                            unsigned long offset)
 {
@@ -287,7 +278,6 @@ static int env_mmc_erase(void)
 
        return ret;
 }
-#endif /* CONFIG_CMD_ERASEENV */
 #endif /* CONFIG_CMD_SAVEENV && !CONFIG_SPL_BUILD */
 
 static inline int read_env(struct mmc *mmc, unsigned long size,
@@ -338,7 +328,7 @@ static int env_mmc_load(void)
        read2_fail = read_env(mmc, CONFIG_ENV_SIZE, offset2, tmp_env2);
 
        ret = env_import_redund((char *)tmp_env1, read1_fail, (char *)tmp_env2,
-                               read2_fail);
+                               read2_fail, H_EXTERNAL);
 
 fini:
        fini_mmc_for_env(mmc);
@@ -380,7 +370,7 @@ static int env_mmc_load(void)
                goto fini;
        }
 
-       ret = env_import(buf, 1);
+       ret = env_import(buf, 1, H_EXTERNAL);
        if (!ret) {
                ep = (env_t *)buf;
                gd->env_addr = (ulong)&ep->data;
@@ -402,8 +392,6 @@ U_BOOT_ENV_LOCATION(mmc) = {
        .load           = env_mmc_load,
 #ifndef CONFIG_SPL_BUILD
        .save           = env_save_ptr(env_mmc_save),
-#if defined(CONFIG_CMD_ERASEENV)
-       .erase          = env_mmc_erase,
-#endif
+       .erase          = ENV_ERASE_PTR(env_mmc_erase)
 #endif
 };