[U-Boot] [PATCH 1/2] mmc: add HS400 support

Simon Glass sjg at chromium.org
Tue Mar 6 17:41:50 UTC 2018


Hi Peng,

On 5 March 2018 at 02:11, Peng Fan <peng.fan at nxp.com> wrote:
> Add HS400 support.
> Selecting HS400 needs first select HS199 according to spec, so use
> a dedicated function for HS400.
> Add HS400 related macros.
> Remove the restriction of only using the low 6 bits of
> EXT_CSD_CARD_TYPE, using all the 8 bits.
>
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
> Cc: Jaehoon Chung <jh80.chung at samsung.com>
> Cc: Jean-Jacques Hiblot <jjhiblot at ti.com>
> Cc: Stefano Babic <sbabic at denx.de>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Kishon Vijay Abraham I <kishon at ti.com>
> Cc: Bin Meng <bmeng.cn at gmail.com>
> ---
>  drivers/mmc/Kconfig |   7 +++
>  drivers/mmc/mmc.c   | 133 ++++++++++++++++++++++++++++++++++++++++++----------
>  include/mmc.h       |  12 +++++
>  3 files changed, 127 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
> index 5f67e336db..e9be18b333 100644
> --- a/drivers/mmc/Kconfig
> +++ b/drivers/mmc/Kconfig
> @@ -104,6 +104,13 @@ config SPL_MMC_UHS_SUPPORT
>           cards. The IO voltage must be switchable from 3.3v to 1.8v. The bus
>           frequency can go up to 208MHz (SDR104)
>
> +config MMC_HS400_SUPPORT
> +       bool "enable HS400 support"
> +       select MMC_HS200_SUPPORT
> +       help
> +         The HS400 mode is support by some eMMC. The bus frequency is up to
> +         200MHz. This mode requires tuning the IO.
> +
>  config MMC_HS200_SUPPORT
>         bool "enable HS200 support"
>         help
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index 92ea78b8af..eef229c8b4 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -169,6 +169,7 @@ const char *mmc_mode_name(enum bus_mode mode)
>               [MMC_HS_52]       = "MMC High Speed (52MHz)",
>               [MMC_DDR_52]      = "MMC DDR52 (52MHz)",
>               [MMC_HS_200]      = "HS200 (200MHz)",
> +             [MMC_HS_400]      = "HS400 (200MHz)",
>         };
>
>         if (mode >= MMC_MODES_END)
> @@ -193,6 +194,7 @@ static uint mmc_mode2freq(struct mmc *mmc, enum bus_mode mode)
>               [UHS_DDR50]       = 50000000,
>               [UHS_SDR104]      = 208000000,
>               [MMC_HS_200]      = 200000000,
> +             [MMC_HS_400]      = 200000000,
>         };
>
>         if (mode == MMC_LEGACY)
> @@ -790,6 +792,11 @@ static int mmc_set_card_speed(struct mmc *mmc, enum bus_mode mode)
>         case MMC_HS_200:
>                 speed_bits = EXT_CSD_TIMING_HS200;
>                 break;
> +#endif
> +#if CONFIG_IS_ENABLED(MMC_HS400_SUPPORT)
> +       case MMC_HS_400:
> +               speed_bits = EXT_CSD_TIMING_HS400;
> +               break;
>  #endif
>         case MMC_LEGACY:
>                 speed_bits = EXT_CSD_TIMING_LEGACY;
> @@ -837,7 +844,7 @@ static int mmc_get_capabilities(struct mmc *mmc)
>
>         mmc->card_caps |= MMC_MODE_4BIT | MMC_MODE_8BIT;
>
> -       cardtype = ext_csd[EXT_CSD_CARD_TYPE] & 0x3f;
> +       cardtype = ext_csd[EXT_CSD_CARD_TYPE];
>         mmc->cardtype = cardtype;
>
>  #if CONFIG_IS_ENABLED(MMC_HS200_SUPPORT)
> @@ -845,6 +852,12 @@ static int mmc_get_capabilities(struct mmc *mmc)
>                         EXT_CSD_CARD_TYPE_HS200_1_8V)) {
>                 mmc->card_caps |= MMC_MODE_HS200;
>         }
> +#endif
> +#if CONFIG_IS_ENABLED(MMC_HS400_SUPPORT)

Is it possible to use if () instead of #if

Regards,
Simon


More information about the U-Boot mailing list