From 8c03ad06da7f79be55a723dc77d22465111a65b2 Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Wed, 16 Apr 2014 15:22:01 +0200 Subject: colibri_t20: fix/hack sd boot environment We wrongly set an obsolete define so the U-Boot environment ended up at the wrong location on the SD card. Add a hack introducing a short delays before doing MMC_CMD_SET_BLOCKLEN as otherwise all 4GB Kingston or SanDisk cards I have failed. While at it fix the USB port naming in the device tree comments to adhere to the standard Colibri convention. --- board/toradex/colibri_t20/colibri_t20.dts | 4 ++-- drivers/mmc/mmc.c | 6 ++++++ include/configs/colibri_t20_sdboot.h | 9 ++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/board/toradex/colibri_t20/colibri_t20.dts b/board/toradex/colibri_t20/colibri_t20.dts index 9270557540..678300edd3 100644 --- a/board/toradex/colibri_t20/colibri_t20.dts +++ b/board/toradex/colibri_t20/colibri_t20.dts @@ -103,7 +103,7 @@ panel-timings = <0 0 0 0>; }; - /* EHCI instance 0: USB1_DP/N -> USBOTG_P/N */ + /* EHCI instance 0: USB1_DP/N -> USBC_P/N */ usb@0xc5000000 { status = "ok"; host-mode = <1>; @@ -120,7 +120,7 @@ status = "ok"; }; - /* EHCI instance 2: USB3_DP/N -> USBH1_P/N */ + /* EHCI instance 2: USB3_DP/N -> USBH_P/N */ usb@0xc5008000 { status = "ok"; utmi = <&usbphy>; diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 76eaf15c7f..f197ab84ca 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -318,6 +318,12 @@ static ulong mmc_bread(int dev_num, ulong start, lbaint_t blkcnt, void *dst) return 0; } +#if (defined(CONFIG_ENV_IS_IN_MMC) && defined(CONFIG_COLIBRI_T20)) + /* Hack: All 4GB Kingston or SanDisk cards I have require a short delay + otherwise the next command fails. */ + udelay(1000); +#endif + if (mmc_set_blocklen(mmc, mmc->read_bl_len)) return 0; diff --git a/include/configs/colibri_t20_sdboot.h b/include/configs/colibri_t20_sdboot.h index 588419a5f9..6629f42c2f 100644 --- a/include/configs/colibri_t20_sdboot.h +++ b/include/configs/colibri_t20_sdboot.h @@ -34,7 +34,7 @@ SD-BOOT The sd sector numbers are used as follows: u-boot needs to find ENV and LNX to get to the environment and the kernel, the kernel needs to find the APP partition for the rootfs. ENV: colibri_t20_sdboot.h -Set CONFIG_ENV_MMC_OFFSET to the byte start address of ENV, take the sector address of Partid 6 (which is in 2048 byte sectors) +Set CONFIG_ENV_OFFSET to the byte start address of ENV, take the sector address of Partid 6 (which is in 2048 byte sectors) LNX: colibri_t20.h Set the u-boot environment SDBOOTCMD below, mmc read RAMloadaddr, 512byte sector start, 512byte copy length. @@ -86,8 +86,11 @@ sector start address 6784 * 2048 -> 27137 * 512 -> GPT start sector is 27137. #if defined(CONFIG_ENV_IS_IN_MMC) #define CONFIG_SYS_MMC_ENV_DEV 0 /* use MMC0, slot on eval board and Iris */ -/* once the eMMC is detected the corresponding setting is taken */ -#define CONFIG_ENV_MMC_OFFSET (gd->env_offset * 512) +#ifdef CONFIG_ENV_OFFSET +#undef CONFIG_ENV_OFFSET +#endif +/* once the SD card is detected the corresponding setting is taken */ +#define CONFIG_ENV_OFFSET (gd->env_offset * 512) #endif #endif /* __CONFIG_H */ -- cgit v1.2.3