Commit 687d2073741bf9518247cb3ffb289f428fba2413

Authored by Jean-Jacques Hiblot
Committed by Tom Rini
1 parent 01abae4d04

env_mmc: Allow SPL to use any MMC device to load/save the environment

SPL has been restricted to use only dev 0 based on the assumption that only
one MMC device is registered. This is not always the case and many
platforms now register several devices as expected by the spl mmc boot code
For those platform SPL_ENV_SUPPORT is broken if dev is forced to 0.

A word of warning: this commit may break SPL_ENV_SUPPORT on platforms that
do not register the same MMC controllers in SPL and in u-boot (mostly iMX6
based platforms). Fortunately none of those activate SPL_ENV_SUPPORT in
their default configuration.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>

Showing 1 changed file with 0 additions and 15 deletions Side-by-side Diff

... ... @@ -82,10 +82,6 @@
82 82 int dev = mmc_get_env_dev();
83 83 int ret = 0;
84 84  
85   -#ifdef CONFIG_SPL_BUILD
86   - dev = 0;
87   -#endif
88   -
89 85 env_mmc_orig_hwpart = mmc_get_blk_desc(mmc)->hwpart;
90 86 ret = blk_select_hwpart_devnum(IF_TYPE_MMC, dev, part);
91 87 if (ret)
... ... @@ -116,9 +112,6 @@
116 112 #ifdef CONFIG_SYS_MMC_ENV_PART
117 113 int dev = mmc_get_env_dev();
118 114  
119   -#ifdef CONFIG_SPL_BUILD
120   - dev = 0;
121   -#endif
122 115 blk_select_hwpart_devnum(IF_TYPE_MMC, dev, env_mmc_orig_hwpart);
123 116 #endif
124 117 }
... ... @@ -223,10 +216,6 @@
223 216 ALLOC_CACHE_ALIGN_BUFFER(env_t, tmp_env1, 1);
224 217 ALLOC_CACHE_ALIGN_BUFFER(env_t, tmp_env2, 1);
225 218  
226   -#ifdef CONFIG_SPL_BUILD
227   - dev = 0;
228   -#endif
229   -
230 219 mmc = find_mmc_device(dev);
231 220  
232 221 errmsg = init_mmc_for_env(mmc);
... ... @@ -305,10 +294,6 @@
305 294 int ret;
306 295 int dev = mmc_get_env_dev();
307 296 const char *errmsg;
308   -
309   -#ifdef CONFIG_SPL_BUILD
310   - dev = 0;
311   -#endif
312 297  
313 298 mmc = find_mmc_device(dev);
314 299