env: mmc: allow support of mmc_get_env_dev with OF_CONTROL
Use the weak function mmc_get_env_dev in mmc_offset_try_partition function to allow dynamic selection of mmc device to use and no more use directly the define CONFIG_SYS_MMC_ENV_DEV. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
This commit is contained in:
parent
acbf93b526
commit
2b2f727500
18
env/mmc.c
vendored
18
env/mmc.c
vendored
@ -24,14 +24,25 @@
|
|||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
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)
|
#if CONFIG_IS_ENABLED(OF_CONTROL)
|
||||||
static inline int mmc_offset_try_partition(const char *str, s64 *val)
|
static inline int mmc_offset_try_partition(const char *str, s64 *val)
|
||||||
{
|
{
|
||||||
struct disk_partition info;
|
struct disk_partition info;
|
||||||
struct blk_desc *desc;
|
struct blk_desc *desc;
|
||||||
int len, i, ret;
|
int len, i, ret;
|
||||||
|
char dev_str[4];
|
||||||
|
|
||||||
ret = blk_get_device_by_str("mmc", STR(CONFIG_SYS_MMC_ENV_DEV), &desc);
|
snprintf(dev_str, sizeof(dev_str), "%d", mmc_get_env_dev());
|
||||||
|
ret = blk_get_device_by_str("mmc", dev_str, &desc);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return (ret);
|
return (ret);
|
||||||
|
|
||||||
@ -114,11 +125,6 @@ __weak int mmc_get_env_addr(struct mmc *mmc, int copy, u32 *env_addr)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
__weak int mmc_get_env_dev(void)
|
|
||||||
{
|
|
||||||
return CONFIG_SYS_MMC_ENV_DEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CONFIG_SYS_MMC_ENV_PART
|
#ifdef CONFIG_SYS_MMC_ENV_PART
|
||||||
__weak uint mmc_get_env_part(struct mmc *mmc)
|
__weak uint mmc_get_env_part(struct mmc *mmc)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user