mirror of
https://github.com/linux-sunxi/u-boot-sunxi.git
synced 2024-02-12 11:16:03 +08:00
mx6cuboxi: Use mmc_get_op_cond() to check for an eMMC
Previously we had just made broad assumptions with which of our boards had an eMMC or not even though this is a manufacturing time assembly option. This takes the guessing away and actually checks for the existence of an eMMC and sets up the has_emmc environment variable. Signed-off-by: Jon Nettleton <jon@solid-run.com> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
This commit is contained in:

committed by
Stefano Babic

parent
c4abe2863a
commit
19ed6063a5
@ -189,7 +189,7 @@ int board_mmc_getcd(struct mmc *mmc)
|
|||||||
ret = !gpio_get_value(USDHC2_CD_GPIO);
|
ret = !gpio_get_value(USDHC2_CD_GPIO);
|
||||||
break;
|
break;
|
||||||
case USDHC3_BASE_ADDR:
|
case USDHC3_BASE_ADDR:
|
||||||
ret = 1; /* eMMC/uSDHC3 has no CD GPIO */
|
ret = (mmc_get_op_cond(mmc) < 0) ? 0 : 1; /* eMMC/uSDHC3 has no CD GPIO */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -527,6 +527,15 @@ static bool is_rev_15_som(void)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool has_emmc(void)
|
||||||
|
{
|
||||||
|
struct mmc *mmc;
|
||||||
|
mmc = find_mmc_device(1);
|
||||||
|
if (!mmc)
|
||||||
|
return 0;
|
||||||
|
return (mmc_get_op_cond(mmc) < 0) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
int checkboard(void)
|
int checkboard(void)
|
||||||
{
|
{
|
||||||
switch (board_type()) {
|
switch (board_type()) {
|
||||||
@ -579,6 +588,10 @@ int board_late_init(void)
|
|||||||
|
|
||||||
if (is_rev_15_som())
|
if (is_rev_15_som())
|
||||||
env_set("som_rev", "V15");
|
env_set("som_rev", "V15");
|
||||||
|
|
||||||
|
if (has_emmc())
|
||||||
|
env_set("has_emmc", "yes");
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user