Letux Cortex 15: define third MMC and prepare for uSD/eMMC switch control
authorH. Nikolaus Schaller <hns@goldelico.com>
Sat, 9 Jan 2016 15:00:29 +0000 (16:00 +0100)
committernotaz <notasas@gmail.com>
Sun, 14 Aug 2016 13:09:00 +0000 (16:09 +0300)
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
board/goldelico/letux-cortex15/lc15.c

index a01605e..ffbd9f6 100644 (file)
@@ -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 <mmc.h>
+
+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)