Merge branch 'master' of git://git.denx.de/u-boot-sh

- Various MMC fixes
This commit is contained in:
Tom Rini 2019-02-16 17:05:51 -05:00
commit 7a2ab3778c
5 changed files with 61 additions and 3 deletions

View file

@ -368,6 +368,19 @@ static int mmc_blk_probe(struct udevice *dev)
return 0; return 0;
} }
#if CONFIG_IS_ENABLED(MMC_UHS_SUPPORT) || \
CONFIG_IS_ENABLED(MMC_HS200_SUPPORT) || \
CONFIG_IS_ENABLED(MMC_HS400_SUPPORT)
static int mmc_blk_remove(struct udevice *dev)
{
struct udevice *mmc_dev = dev_get_parent(dev);
struct mmc_uclass_priv *upriv = dev_get_uclass_priv(mmc_dev);
struct mmc *mmc = upriv->mmc;
return mmc_deinit(mmc);
}
#endif
static const struct blk_ops mmc_blk_ops = { static const struct blk_ops mmc_blk_ops = {
.read = mmc_bread, .read = mmc_bread,
#if CONFIG_IS_ENABLED(MMC_WRITE) #if CONFIG_IS_ENABLED(MMC_WRITE)
@ -382,6 +395,12 @@ U_BOOT_DRIVER(mmc_blk) = {
.id = UCLASS_BLK, .id = UCLASS_BLK,
.ops = &mmc_blk_ops, .ops = &mmc_blk_ops,
.probe = mmc_blk_probe, .probe = mmc_blk_probe,
#if CONFIG_IS_ENABLED(MMC_UHS_SUPPORT) || \
CONFIG_IS_ENABLED(MMC_HS200_SUPPORT) || \
CONFIG_IS_ENABLED(MMC_HS400_SUPPORT)
.remove = mmc_blk_remove,
.flags = DM_FLAG_OS_PREPARE,
#endif
}; };
#endif /* CONFIG_BLK */ #endif /* CONFIG_BLK */

View file

@ -2781,6 +2781,32 @@ int mmc_init(struct mmc *mmc)
return err; return err;
} }
#if CONFIG_IS_ENABLED(MMC_UHS_SUPPORT) || \
CONFIG_IS_ENABLED(MMC_HS200_SUPPORT) || \
CONFIG_IS_ENABLED(MMC_HS400_SUPPORT)
int mmc_deinit(struct mmc *mmc)
{
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);
}
}
#endif
int mmc_set_dsr(struct mmc *mmc, u16 val) int mmc_set_dsr(struct mmc *mmc, u16 val)
{ {
mmc->dsr = val; mmc->dsr = val;

View file

@ -148,6 +148,9 @@ static int renesas_sdhi_hs400(struct udevice *dev)
tmio_sd_writel(priv, priv->tap_set, RENESAS_SDHI_SCC_TAPSET); tmio_sd_writel(priv, priv->tap_set, RENESAS_SDHI_SCC_TAPSET);
} }
tmio_sd_writel(priv, hs400 ? 0x704 : 0x300,
RENESAS_SDHI_SCC_DT2FF);
reg = tmio_sd_readl(priv, RENESAS_SDHI_SCC_CKSEL); reg = tmio_sd_readl(priv, RENESAS_SDHI_SCC_CKSEL);
reg |= RENESAS_SDHI_SCC_CKSEL_DTSEL; reg |= RENESAS_SDHI_SCC_CKSEL_DTSEL;
tmio_sd_writel(priv, reg, RENESAS_SDHI_SCC_CKSEL); tmio_sd_writel(priv, reg, RENESAS_SDHI_SCC_CKSEL);

View file

@ -705,10 +705,14 @@ static void tmio_sd_host_init(struct tmio_sd_priv *priv)
* This register dropped backward compatibility at version 0x10. * This register dropped backward compatibility at version 0x10.
* Write an appropriate value depending on the IP version. * Write an appropriate value depending on the IP version.
*/ */
if (priv->version >= 0x10) if (priv->version >= 0x10) {
tmio_sd_writel(priv, 0x101, TMIO_SD_HOST_MODE); if (priv->caps & TMIO_SD_CAP_64BIT)
else tmio_sd_writel(priv, 0x100, TMIO_SD_HOST_MODE);
else
tmio_sd_writel(priv, 0x101, TMIO_SD_HOST_MODE);
} else {
tmio_sd_writel(priv, 0x0, TMIO_SD_HOST_MODE); tmio_sd_writel(priv, 0x0, TMIO_SD_HOST_MODE);
}
if (priv->caps & TMIO_SD_CAP_DMA_INTERNAL) { if (priv->caps & TMIO_SD_CAP_DMA_INTERNAL) {
tmp = tmio_sd_readl(priv, TMIO_SD_DMA_MODE); tmp = tmio_sd_readl(priv, TMIO_SD_DMA_MODE);

View file

@ -690,6 +690,12 @@ int mmc_initialize(bd_t *bis);
int mmc_init(struct mmc *mmc); int mmc_init(struct mmc *mmc);
int mmc_send_tuning(struct mmc *mmc, u32 opcode, int *cmd_error); int mmc_send_tuning(struct mmc *mmc, u32 opcode, int *cmd_error);
#if CONFIG_IS_ENABLED(MMC_UHS_SUPPORT) || \
CONFIG_IS_ENABLED(MMC_HS200_SUPPORT) || \
CONFIG_IS_ENABLED(MMC_HS400_SUPPORT)
int mmc_deinit(struct mmc *mmc);
#endif
/** /**
* mmc_of_parse() - Parse the device tree to get the capabilities of the host * mmc_of_parse() - Parse the device tree to get the capabilities of the host
* *