From 11b24a7e89986809b6bccd7fb73ab35404a8af37 Mon Sep 17 00:00:00 2001 From: Klaus Goger Date: Thu, 15 Sep 2016 08:55:15 +0200 Subject: ARM: sunxi: add emmcboot command command that returns true if the first mmc device is the on-board emmc. Signed-off-by: Klaus Goger --- board/sunxi/board.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/board/sunxi/board.c b/board/sunxi/board.c index d486c66243..ca67368ec2 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -26,6 +26,7 @@ #include #include #include +#include #if defined CONFIG_VIDEO_LCD_PANEL_I2C && !(defined CONFIG_SPL_BUILD) /* So that we can use pin names in Kconfig and sunxi_name_to_gpio() */ @@ -684,3 +685,32 @@ int ft_board_setup(void *blob, bd_t *bd) #endif return 0; } + +#ifdef CONFIG_SUNXI_ARMADILLO +static int do_emmcboot(cmd_tbl_t *cmdtp, int flag, int argc, + char * const argv[]) +{ + struct mmc *mmc0; + struct sunxi_mmc_host { + unsigned mmc_no; + uint32_t *mclkreg; + unsigned fatal_err; + struct sunxi_mmc *reg; + struct mmc_config cfg; + }; + + mmc0 = find_mmc_device(0); + /* lookup if first mmc device maps to the emmc */ + struct sunxi_mmc_host *mmchost = mmc0->priv; + if(mmchost->mmc_no == 2) + return 0; + else + return 1; +} + +U_BOOT_CMD( + emmcboot, CONFIG_SYS_MAXARGS, 1, do_emmcboot, + "returns true if booted from eMMC", + NULL + ); +#endif -- cgit v1.2.3