From mboxrd@z Thu Jan 1 00:00:00 1970 From: Przemyslaw Marczak Date: Fri, 04 Jul 2014 10:07:40 +0200 Subject: [U-Boot] [PATCH v4 04/12] board:samsung: check the boot device and init the right mmc driver. In-Reply-To: <53B63F8B.4040904@samsung.com> References: <1403792137-3113-1-git-send-email-p.marczak@samsung.com> <1404301814-3657-1-git-send-email-p.marczak@samsung.com> <1404301814-3657-5-git-send-email-p.marczak@samsung.com> <53B63F8B.4040904@samsung.com> Message-ID: <53B660CC.1030905@samsung.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hello Jaehoon, On 07/04/2014 07:45 AM, Jaehoon Chung wrote: > Hi, Przemyslaw. > > On 07/02/2014 08:50 PM, Przemyslaw Marczak wrote: >> It is possible to boot device using a micro SD or eMMC slots. >> In this situation, boot device should be registered as a block >> device 0 in the MMC framework, because CONFIG_SYS_MMC_ENV_DEV >> is usually set to "0" in the most config cases. >> >> Signed-off-by: Przemyslaw Marczak >> --- >> Changes V3: >> - separate two changes into two commits >> >> Changes V4: >> - board.c: add functions: init_mmc() and init_dwmmc() >> - board_mmc_init(): call get_boot_mode() >> --- >> board/samsung/common/board.c | 37 +++++++++++++++++++++++++++---------- >> 1 file changed, 27 insertions(+), 10 deletions(-) >> >> diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c >> index 9dc7c83..4d3f216 100644 >> --- a/board/samsung/common/board.c >> +++ b/board/samsung/common/board.c >> @@ -240,22 +240,39 @@ int board_eth_init(bd_t *bis) >> } >> >> #ifdef CONFIG_GENERIC_MMC >> -int board_mmc_init(bd_t *bis) >> +static int init_mmc(void) >> +{ >> +#ifdef CONFIG_SDHCI >> + return exynos_mmc_init(gd->fdt_blob); >> +#else >> + return 0; >> +#endif >> +} >> + >> +static int init_dwmmc(void) >> { >> - int ret; >> #ifdef CONFIG_DWMMC >> - /* dwmmc initializattion for available channels */ >> - ret = exynos_dwmmc_init(gd->fdt_blob); >> - if (ret) >> - debug("dwmmc init failed\n"); >> + return exynos_dwmmc_init(gd->fdt_blob); >> +#else >> + return 0; >> #endif >> +} >> + >> +int board_mmc_init(bd_t *bis) >> +{ >> + int ret; >> + >> + if (get_boot_mode() == BOOT_MODE_MMC) { >> + ret = init_mmc(); >> + ret |= init_dwmmc(); >> + } else { >> + ret = init_dwmmc(); >> + ret |= init_mmc(); >> + } > Well, i have some confusion for this. > Did you consider the case like init_dwmmc() is succeed and init_mmc() is failed? > it's hard to control the error for both. > > Best Regards, > Jaehoon Chung In our vendor init code, the value returned by this function has no significant meaning since there is no implementation of function "cpu_mmc_init()". So checking this error is just for a debug purposes: # if (ret) # debug("mmc init failed\n"); and the returned value: mmc | dwmmc -> ret 0 | 1 -> 1 1 | 0 -> 1 1 | 1 -> 1 0 | 0 -> 0 So we have an error message on any error. >> >> -#ifdef CONFIG_SDHCI >> - /* mmc initializattion for available channels */ >> - ret = exynos_mmc_init(gd->fdt_blob); >> if (ret) >> debug("mmc init failed\n"); >> -#endif >> + >> return ret; >> } >> #endif >> > > Thank you, -- Przemyslaw Marczak Samsung R&D Institute Poland Samsung Electronics p.marczak at samsung.com