mmc: Export {sd,mmc}_select_mode_and_width()
PATCH 1/2 mmc: Export {sd,mmc}_select_mode_and_width()
Make {sd,mmc}_select_mode_and_width() functions available to drivers, so that they can call these functions to reconfigure SD/MMC mode if necessary.
Signed-off-by Marek Vasut <[email protected]>
--- drivers/mmc/mmc.c | 8 ++------ drivers/mmc/mmc_private.h | 4 ++++ 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/mmc/mmc.c +2 -6
@@ -23,10 +23,6 @@static int mmc_set_signal_voltage (struct mmc *mmc,uint signal_voltage);static int mmc_power_cycle (struct mmc *mmc); -#if !CONFIG_IS_ENABLED (MMC_TINY ) -static int mmc_select_mode_and_width (struct mmc *mmc,uint card_caps); -#endif -#if !CONFIG_IS_ENABLED (DM_MMC )#if CONFIG_IS_ENABLED (MMC_UHS_SUPPORT )
@@ -1643,7 +1639,7 @@ static const struct mode_width_tuning sd_modes_by_pref[] = { mwt++) \if (caps &MMC_CAP (mwt->mode)) -static int sd_select_mode_and_width(struct mmc *mmc, uint card_caps) +int sd_select_mode_and_width(struct mmc *mmc, uint card_caps) { int err;uint widths[] = {MMC_MODE_4BIT ,MMC_MODE_1BIT };
@@ -1912,7 +1908,7 @@ static int mmc_select_hs400(struct mmc *mmc) ecbv++) \if ((ddr == ecbv->is_ddr) && (caps & ecbv->cap)) -static int mmc_select_mode_and_width(struct mmc *mmc, uint card_caps) +int mmc_select_mode_and_width(struct mmc *mmc, uint card_caps) {int err;const struct mode_width_tuning *mwt;
drivers/mmc/mmc_private.h +4 -0
@@ -18,6 +18,10 @@ extern int mmc_set_blocklen(struct mmc *mmc, int len);#ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT void mmc_adapter_card_type_ident (void );#endif +#if !CONFIG_IS_ENABLED (MMC_TINY ) +int sd_select_mode_and_width (struct mmc *mmc,uint card_caps); +int mmc_select_mode_and_width (struct mmc *mmc,uint card_caps); +#endif #if CONFIG_IS_ENABLED (BLK ) ulong mmc_bread(struct udevice *dev, lbaint_t start, lbaint_t blkcnt,
Signature · 1 line
2.19.2
PATCH 2/2 mmc: tmio: renesas: Downgrade SD/MMC from UHS/HS200/HS400 modes before boot
Older kernel versions cannot handle situation where either the eMMC is left in HS200/HS400 mode or SD in UHS modes by the bootloader and can misbehave. Downgrade the eMMC to HS/HS52 mode and/or SD to non-UHS mode before boot to allow such older kernels to work with modern U-Boot.
Signed-off-by Marek Vasut <[email protected]>
Cc Masahiro Yamada <[email protected]>
--- drivers/mmc/renesas-sdhi.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
drivers/mmc/renesas-sdhi.c +26 -0
@@ -15,6 +15,7 @@#include <power/regulator.h> #include <asm/unaligned.h> +#include "mmc_private.h" #include "tmio-common.h" #if CONFIG_IS_ENABLED(MMC_UHS_SUPPORT) || \
@@ -530,13 +531,38 @@ static int renesas_sdhi_probe(struct udevice *dev)return ret; } +int renesas_sdhi_remove (struct udevice *dev) +{ +struct mmc *mmc =mmc_get_mmc_dev (dev); +u32 caps_filtered; + +if (!mmc->has_init) +return 0 ; + +if (IS_SD (mmc)) { + caps_filtered = mmc->card_caps & + ~(MMC_CAP (UHS_SDR12 ) |MMC_CAP (UHS_SDR25 ) | +MMC_CAP (UHS_SDR50 ) |MMC_CAP (UHS_DDR50 ) | +MMC_CAP (UHS_SDR104 )); + +return sd_select_mode_and_width (mmc, caps_filtered); + }else { + caps_filtered = mmc->card_caps & + ~(MMC_CAP (MMC_HS_200 ) |MMC_CAP (MMC_HS_400 )); + +return mmc_select_mode_and_width (mmc, caps_filtered); + } +} +U_BOOT_DRIVER (renesas_sdhi) = { .name ="renesas-sdhi" , .id =UCLASS_MMC , .of_match = renesas_sdhi_match, .bind = tmio_sd_bind, .probe = renesas_sdhi_probe, + .remove = renesas_sdhi_remove, .priv_auto_alloc_size =sizeof (struct tmio_sd_priv ), .platdata_auto_alloc_size =sizeof (struct tmio_sd_plat ), .ops = &renesas_sdhi_ops, + .flags =DM_FLAG_OS_PREPARE , };
Signature · 1 line
2.19.2