summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorTom Rini <trini@ti.com>2013-06-14 16:06:49 -0400
committerTom Rini <trini@ti.com>2013-06-14 16:06:49 -0400
commitdfdb3d37dd0fa8bdabdf7b5ffb597af470e74621 (patch)
treed18616299f81b663fb2cda18f30423df796121f3 /common
parent216a793cc1702227fd4ad624080f585038d1fa45 (diff)
parent91171091c6733cd290e18bf25a8aedbe682d2430 (diff)
downloadu-boot-imx-dfdb3d37dd0fa8bdabdf7b5ffb597af470e74621.zip
u-boot-imx-dfdb3d37dd0fa8bdabdf7b5ffb597af470e74621.tar.gz
u-boot-imx-dfdb3d37dd0fa8bdabdf7b5ffb597af470e74621.tar.bz2
Merge branch 'master' of git://www.denx.de/git/u-boot-mmc
Diffstat (limited to 'common')
-rw-r--r--common/env_mmc.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/common/env_mmc.c b/common/env_mmc.c
index 9ca098f..5d3a769 100644
--- a/common/env_mmc.c
+++ b/common/env_mmc.c
@@ -53,11 +53,19 @@ DECLARE_GLOBAL_DATA_PTR;
__weak int mmc_get_env_addr(struct mmc *mmc, int copy, u32 *env_addr)
{
- *env_addr = CONFIG_ENV_OFFSET;
+ s64 offset;
+
+ offset = CONFIG_ENV_OFFSET;
#ifdef CONFIG_ENV_OFFSET_REDUND
if (copy)
- *env_addr = CONFIG_ENV_OFFSET_REDUND;
+ offset = CONFIG_ENV_OFFSET_REDUND;
#endif
+
+ if (offset < 0)
+ offset += mmc->capacity;
+
+ *env_addr = offset;
+
return 0;
}