imx: mx6: Implement mmc_get_env_part
commit 216d286c7e [imx: mx6: implement
mmc_get_env_dev] introduced selection of the environment device according
to the boot device when booting from SD/MMC.
Extend this functionality for also selecting the device partition.
Signed-off-by: Soeren Moch <smoch@web.de>
This commit is contained in:
parent
c4068dfb31
commit
1a43dc11a3
|
|
@ -21,6 +21,7 @@
|
||||||
#include <asm/arch/crm_regs.h>
|
#include <asm/arch/crm_regs.h>
|
||||||
#include <dm.h>
|
#include <dm.h>
|
||||||
#include <imx_thermal.h>
|
#include <imx_thermal.h>
|
||||||
|
#include <mmc.h>
|
||||||
|
|
||||||
enum ldo_reg {
|
enum ldo_reg {
|
||||||
LDO_ARM,
|
LDO_ARM,
|
||||||
|
|
@ -355,7 +356,7 @@ __weak int board_mmc_get_env_dev(int devno)
|
||||||
return CONFIG_SYS_MMC_ENV_DEV;
|
return CONFIG_SYS_MMC_ENV_DEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mmc_get_env_dev(void)
|
static int mmc_get_boot_dev(void)
|
||||||
{
|
{
|
||||||
struct src *src_regs = (struct src *)SRC_BASE_ADDR;
|
struct src *src_regs = (struct src *)SRC_BASE_ADDR;
|
||||||
u32 soc_sbmr = readl(&src_regs->sbmr1);
|
u32 soc_sbmr = readl(&src_regs->sbmr1);
|
||||||
|
|
@ -370,15 +371,44 @@ int mmc_get_env_dev(void)
|
||||||
*/
|
*/
|
||||||
bootsel = (soc_sbmr & 0x000000FF) >> 6;
|
bootsel = (soc_sbmr & 0x000000FF) >> 6;
|
||||||
|
|
||||||
/* If not boot from sd/mmc, use default value */
|
/* No boot from sd/mmc */
|
||||||
if (bootsel != 1)
|
if (bootsel != 1)
|
||||||
return CONFIG_SYS_MMC_ENV_DEV;
|
return -1;
|
||||||
|
|
||||||
/* BOOT_CFG2[3] and BOOT_CFG2[4] */
|
/* BOOT_CFG2[3] and BOOT_CFG2[4] */
|
||||||
devno = (soc_sbmr & 0x00001800) >> 11;
|
devno = (soc_sbmr & 0x00001800) >> 11;
|
||||||
|
|
||||||
|
return devno;
|
||||||
|
}
|
||||||
|
|
||||||
|
int mmc_get_env_dev(void)
|
||||||
|
{
|
||||||
|
int devno = mmc_get_boot_dev();
|
||||||
|
|
||||||
|
/* If not boot from sd/mmc, use default value */
|
||||||
|
if (devno < 0)
|
||||||
|
return CONFIG_SYS_MMC_ENV_DEV;
|
||||||
|
|
||||||
return board_mmc_get_env_dev(devno);
|
return board_mmc_get_env_dev(devno);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_SYS_MMC_ENV_PART
|
||||||
|
__weak int board_mmc_get_env_part(int devno)
|
||||||
|
{
|
||||||
|
return CONFIG_SYS_MMC_ENV_PART;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint mmc_get_env_part(struct mmc *mmc)
|
||||||
|
{
|
||||||
|
int devno = mmc_get_boot_dev();
|
||||||
|
|
||||||
|
/* If not boot from sd/mmc, use default value */
|
||||||
|
if (devno < 0)
|
||||||
|
return CONFIG_SYS_MMC_ENV_PART;
|
||||||
|
|
||||||
|
return board_mmc_get_env_part(devno);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int board_postclk_init(void)
|
int board_postclk_init(void)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue