 +	return 0;
 +#else
 +	struct src *psrc = (struct src *)SRC_BASE_ADDR;
-+	unsigned reg_smbr1 = readl(&psrc->sbmr1);
-+	unsigned reg = readl(&psrc->sbmr1) >> 11;	
-+
-+	printf("mmc port %d\n", reg & 0x3);
-+
-+	if ((reg_smbr1 & 0x0820) == 0x0820) {
++	unsigned int reg_smbr1 = readl(&psrc->sbmr1);
++	unsigned int reg = readl(&psrc->sbmr1) >> 11;	
++	unsigned int port = reg & 0x3;
++
++	if (check_emmc_selected()) 
++	{
 +	   /* Setup eMMC */
++	   printf("[SPL] Selected eMMC as boot medium; port %u \n", port);
 +	   SETUP_IOMUX_PADS(usdhc4_pads);
 +	   usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
 +	   return fsl_esdhc_initialize(bis, &usdhc_cfg[1]);
 +	} else {
 +	   /* Setup uSD */
++	   printf("[SPL] Selected uSD as boot medium; port %u \n", port);
 +	   SETUP_IOMUX_PADS(usdhc3_pads);
 +	   usdhc_cfg[0].esdhc_base = USDHC3_BASE_ADDR;
 +	   usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);

From 1b23a8c02d7ec0118e7bd8803e0284b51d670fa8 Mon Sep 17 00:00:00 2001
From: Christian Ege <k4230r6@gmail.com>
Date: Mon, 10 Oct 2016 21:21:38 +0200
Subject: [PATCH] Added preliminary eMMC support for Seco A62

Signed-off-by: Christian Ege <k4230r6@gmail.com>
---
 board/seco/mx6sbca62/mx6sbca62.c | 160 ++++++++++++++++++++++++++++++++++-----
 include/configs/secomx6sbca62.h  |   1 +
 2 files changed, 142 insertions(+), 19 deletions(-)

diff --git a/board/seco/mx6sbca62/mx6sbca62.c b/board/seco/mx6sbca62/mx6sbca62.c
index b8efedc..5ff4596 100644
--- a/board/seco/mx6sbca62/mx6sbca62.c
+++ b/board/seco/mx6sbca62/mx6sbca62.c
@@ -63,13 +63,38 @@ static iomux_v3_cfg_t const uart2_pads[] = {

 
 int board_eth_init(bd_t *bis)
 {
@@ -283,14 +426,6 @@ free_bus:
 	return ret;
 }
 
