From be91ebdfffc0c00da5e56712f18b685778413850 Mon Sep 17 00:00:00 2001 From: "H. Nikolaus Schaller" Date: Sat, 9 Jan 2016 16:00:29 +0100 Subject: [PATCH] Letux Cortex 15: define third MMC and prepare for uSD/eMMC switch control Signed-off-by: H. Nikolaus Schaller --- board/goldelico/letux-cortex15/lc15.c | 64 ++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 5 deletions(-) diff --git a/board/goldelico/letux-cortex15/lc15.c b/board/goldelico/letux-cortex15/lc15.c index a01605e7c37..ffbd9f6e6b5 100644 --- a/board/goldelico/letux-cortex15/lc15.c +++ b/board/goldelico/letux-cortex15/lc15.c @@ -3,7 +3,8 @@ */ /* move away definition by included file */ -#ifndef sysinfo +#define board_mmc_init board_mmc_init_overwritten +#if !defined(sysinfo) #define sysinfo sysinfo_disabled #include "../../ti/omap5_uevm/evm.c" @@ -19,8 +20,61 @@ const struct omap_sysinfo sysinfo = { #include "../../ti/omap5_uevm/evm.c" #endif +#undef board_mmc_init + +/* U-Boot only code */ +#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_GENERIC_MMC) + +/* + * the Letux Cortex 15 + * supports 3 MMC interfaces + */ + +#include + +int board_mmc_init(bd_t *bis) +{ + int uSD = 0; // ask GPIO3_82 value + debug("special board_mmc_init for LC15\n"); + omap_mmc_init(0, uSD?MMC_MODE_4BIT:0, 0, -1, -1); + omap_mmc_init(1, MMC_MODE_4BIT, 0, -1, -1); +/* FIXME: we might need to modify the HSMMC3_BASE in omap_hsmmc.c to make this work */ + omap_mmc_init(2, MMC_MODE_4BIT, 0, -1, -1); + return 0; +} + +#endif + +/* SPL only code */ +#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_OS_BOOT) + +/* + * add eMMC/uSD switch logic here + * so that we can boot from the internal uSD + * and release the boot button. + * Should be done only in SPL! + */ + +int set_mmc_switch(void) +{ + printf("set_mmc_switch for LC15 called\n"); +// maybe check if GPIO3_82 is already output -> ignore +/* + read GPIO1_WK7 + set GPIO3_82 from high Z to output mode + set GPIO3_82 value to !GPIO1_WK7 value - i.e. make initial button setting persist +*/ + return 0; +} + +/* mis-use as a hook to inject code before U-Boot is started */ + +int spl_start_uboot(void) +{ + printf("spl_start_uboot for LC15 called\n"); + set_mmc_switch(); + return 1; /* no direct Linux boot */ +} + +#endif -// add eMMC/uSD switch logic here -// so that we can boot from the internal uSD -// and release the boot button -// (maybe do it in a way that it is only relevant for MLO) -- 2.39.5