[U-Boot] [PATCH v5 00/11] mmc: fixes for HS200/UHS core support

This series applies on top of "[PATCH v2 00/26] mmc: Add support for HS200 and UHS modes"
It fixes a bug with old SD and MMC cards that support only the legacy mode. This series also adresses the problem of increased code size that broke some platform (openrd and omapl138_lcdk) by making more things optional.
It also addresses other comments made on the mailing list: * dump card and host capabilities in debug mode * use 1-bit if the DTS property 'bus-width' is not present. * recognize the "mmc-ddr-1_2v" and "mmc-hs200-1_2v" DTS properties * convert mmc_of_parse to livetree
Tested on DRA72
changes since v4: * use pr_warn() and pr_error() instead of custom macro to output log messages * add a new patch to lower the LOGLEVEL for the platform omapl138_lcdk * Fix typo in patch 'mmc: make optional the support for eMMC hardware partitioning'
changes since v3: * Make UHS support optional. Disabled by default * Make HS200 support optional. Disabled by default * Make eMMC Hardware Partitioning optional. Enabled by default * Display most of the error messages only if MMC_VERBOSE is set (it's set by default)
changes since v2: * use the device-oriented helpers like dev_read_u32_default() instead of using the livetree API * Dump the host and card capabilities only in when debug is enabled. Also dump the capabilities when 'mmc info' is executed if the verbose option is enabled
changes since v1: * convert mmc_of_parse to livetree * squashed all changes to mmc_of_parse in a single patch
Jean-Jacques Hiblot (11): mmc: dump card and host capabilities if debug is enabled dm: mmc: update mmc_of_parse() mmc: Fixed a problem with old sd or mmc that do not support High speed mmc: all hosts support 1-bit bus width and legacy timings mmc: fix for old MMCs (below version 4) mmc: don't use malloc_cache_aligned() mmc: convert most of printf() to pr_err() and pr_warn() mmc: make UHS and HS200 optional mmc: make optional the support for eMMC hardware partitioning configs: openrd: removed support for eMMC hardware partitioning configs: omapl138_lcdk: decrease the loglevel to reduce the size of the SPL
cmd/mmc.c | 8 ++ configs/omapl138_lcdk_defconfig | 1 + configs/openrd_base_defconfig | 1 + configs/openrd_client_defconfig | 1 + configs/openrd_ultimate_defconfig | 1 + drivers/mmc/Kconfig | 58 ++++++++++++-- drivers/mmc/mmc-uclass.c | 40 ++++++---- drivers/mmc/mmc.c | 162 +++++++++++++++++++++++++++++--------- include/mmc.h | 38 +++++++-- 9 files changed, 246 insertions(+), 64 deletions(-)

This is a useful information while debugging the initialization process or performance issues. Also dump this information with the other mmc info if the verbose option is selected
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com --- no changes since v3
cmd/mmc.c | 4 ++++ drivers/mmc/mmc.c | 9 +++++++++ 2 files changed, 13 insertions(+)
diff --git a/cmd/mmc.c b/cmd/mmc.c index 6d48ecb..25795e0 100644 --- a/cmd/mmc.c +++ b/cmd/mmc.c @@ -24,7 +24,11 @@ static void print_mmcinfo(struct mmc *mmc) (mmc->cid[1] >> 8) & 0xff, mmc->cid[1] & 0xff);
printf("Bus Speed: %d\n", mmc->clock); +#if CONFIG_IS_ENABLED(MMC_VERBOSE) printf("Mode : %s\n", mmc_mode_name(mmc->selected_mode)); + mmc_dump_capabilities("card capabilities", mmc->card_caps); + mmc_dump_capabilities("host capabilities", mmc->host_caps); +#endif printf("Rd Block Len: %d\n", mmc->read_bl_len);
printf("%s version %d.%d", IS_SD(mmc) ? "SD" : "MMC", diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index ab2483e..9b5c982 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -1582,6 +1582,10 @@ static int sd_select_mode_and_width(struct mmc *mmc, uint card_caps) bool uhs_en = (mmc->ocr & OCR_S18R) ? true : false; uint caps;
+#ifdef DEBUG + mmc_dump_capabilities("sd card", card_caps); + mmc_dump_capabilities("host", mmc->host_caps | MMC_MODE_1BIT); +#endif
/* Restrict card's capabilities by what the host can do */ caps = card_caps & (mmc->host_caps | MMC_MODE_1BIT); @@ -1764,6 +1768,11 @@ static int mmc_select_mode_and_width(struct mmc *mmc, uint card_caps) const struct mode_width_tuning *mwt; const struct ext_csd_bus_width *ecbw;
+#ifdef DEBUG + mmc_dump_capabilities("mmc", card_caps); + mmc_dump_capabilities("host", mmc->host_caps | MMC_MODE_1BIT); +#endif + /* Restrict card's capabilities by what the host can do */ card_caps &= (mmc->host_caps | MMC_MODE_1BIT);

* convert to livetree API * don't fail because of an invalid bus-width, instead default to 1-bit. * recognize 1.2v DDR and 1.2v HS200 flags
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com --- no changes since v3
drivers/mmc/mmc-uclass.c | 36 ++++++++++++++++++++---------------- include/mmc.h | 11 ++++++++++- 2 files changed, 30 insertions(+), 17 deletions(-)
diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c index e30cde7..bfda942 100644 --- a/drivers/mmc/mmc-uclass.c +++ b/drivers/mmc/mmc-uclass.c @@ -10,7 +10,6 @@ #include <dm.h> #include <dm/device-internal.h> #include <dm/lists.h> -#include <dm/root.h> #include "mmc_private.h"
DECLARE_GLOBAL_DATA_PTR; @@ -120,11 +119,11 @@ int mmc_execute_tuning(struct mmc *mmc, uint opcode) return dm_mmc_execute_tuning(mmc->dev, opcode); }
-int mmc_of_parse(const void *fdt, int node, struct mmc_config *cfg) +int mmc_of_parse(struct udevice *dev, struct mmc_config *cfg) { int val;
- val = fdtdec_get_int(fdt, node, "bus-width", 1); + val = dev_read_u32_default(dev, "bus-width", 1);
switch (val) { case 0x8: @@ -137,30 +136,35 @@ int mmc_of_parse(const void *fdt, int node, struct mmc_config *cfg) cfg->host_caps |= MMC_MODE_1BIT; break; default: - printf("error: %s invalid bus-width property %d\n", - fdt_get_name(fdt, node, NULL), val); - return -ENOENT; + debug("warning: %s invalid bus-width property. using 1-bit\n", + dev_read_name(dev)); + cfg->host_caps |= MMC_MODE_1BIT; + break; }
- cfg->f_max = fdtdec_get_int(fdt, node, "max-frequency", 52000000); + cfg->f_max = dev_read_u32_default(dev, "max-frequency", 52000000);
- if (fdtdec_get_bool(fdt, node, "cap-sd-highspeed")) + if (dev_read_bool(dev, "cap-sd-highspeed")) cfg->host_caps |= MMC_CAP(SD_HS); - if (fdtdec_get_bool(fdt, node, "cap-mmc-highspeed")) + if (dev_read_bool(dev, "cap-mmc-highspeed")) cfg->host_caps |= MMC_CAP(MMC_HS); - if (fdtdec_get_bool(fdt, node, "sd-uhs-sdr12")) + if (dev_read_bool(dev, "sd-uhs-sdr12")) cfg->host_caps |= MMC_CAP(UHS_SDR12); - if (fdtdec_get_bool(fdt, node, "sd-uhs-sdr25")) + if (dev_read_bool(dev, "sd-uhs-sdr25")) cfg->host_caps |= MMC_CAP(UHS_SDR25); - if (fdtdec_get_bool(fdt, node, "sd-uhs-sdr50")) + if (dev_read_bool(dev, "sd-uhs-sdr50")) cfg->host_caps |= MMC_CAP(UHS_SDR50); - if (fdtdec_get_bool(fdt, node, "sd-uhs-sdr104")) + if (dev_read_bool(dev, "sd-uhs-sdr104")) cfg->host_caps |= MMC_CAP(UHS_SDR104); - if (fdtdec_get_bool(fdt, node, "sd-uhs-ddr50")) + if (dev_read_bool(dev, "sd-uhs-ddr50")) cfg->host_caps |= MMC_CAP(UHS_DDR50); - if (fdtdec_get_bool(fdt, node, "mmc-ddr-1_8v")) + if (dev_read_bool(dev, "mmc-ddr-1_8v")) cfg->host_caps |= MMC_CAP(MMC_DDR_52); - if (fdtdec_get_bool(fdt, node, "mmc-hs200-1_8v")) + if (dev_read_bool(dev, "mmc-ddr-1_2v")) + cfg->host_caps |= MMC_CAP(MMC_DDR_52); + if (dev_read_bool(dev, "mmc-hs200-1_8v")) + cfg->host_caps |= MMC_CAP(MMC_HS_200); + if (dev_read_bool(dev, "mmc-hs200-1_2v")) cfg->host_caps |= MMC_CAP(MMC_HS_200);
return 0; diff --git a/include/mmc.h b/include/mmc.h index 6230a32..e3f777f 100644 --- a/include/mmc.h +++ b/include/mmc.h @@ -651,7 +651,16 @@ int mmc_unbind(struct udevice *dev); int mmc_initialize(bd_t *bis); int mmc_init(struct mmc *mmc); int mmc_send_tuning(struct mmc *mmc, u32 opcode, int *cmd_error); -int mmc_of_parse(const void *fdt, int node, struct mmc_config *cfg); + +/** + * mmc_of_parse() - Parse the device tree to get the capabilities of the host + * + * @dev: MMC device + * @cfg: MMC configuration + * @return 0 if OK, -ve on error + */ +int mmc_of_parse(struct udevice *dev, struct mmc_config *cfg); + int mmc_read(struct mmc *mmc, u64 src, uchar *dst, int size);
/**

As the legacy modes were not added to the list of supported modes, old cards that do not support other modes could not be used.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com Reviewed-by: Lukasz Majewski lukma@denx.de Reviewed-by: Simon Glass sjg@chromium.org --- no change since v1
drivers/mmc/mmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 9b5c982..c1f8851 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -818,7 +818,7 @@ static int mmc_get_capabilities(struct mmc *mmc) u8 *ext_csd = mmc->ext_csd; char cardtype;
- mmc->card_caps = MMC_MODE_1BIT; + mmc->card_caps = MMC_MODE_1BIT | MMC_CAP(MMC_LEGACY);
if (mmc_host_is_spi(mmc)) return 0; @@ -1171,7 +1171,7 @@ static int sd_get_capabilities(struct mmc *mmc) int timeout; u32 sd3_bus_mode;
- mmc->card_caps = MMC_MODE_1BIT; + mmc->card_caps = MMC_MODE_1BIT | MMC_CAP(SD_LEGACY);
if (mmc_host_is_spi(mmc)) return 0;

Make sure that those basic capabilities are advertised by the host.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com Reviewed-by: Lukasz Majewski lukma@denx.de Reviewed-by: Simon Glass sjg@chromium.org ---
no change since v1
drivers/mmc/mmc.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index c1f8851..0ebcc45 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -1584,11 +1584,11 @@ static int sd_select_mode_and_width(struct mmc *mmc, uint card_caps)
#ifdef DEBUG mmc_dump_capabilities("sd card", card_caps); - mmc_dump_capabilities("host", mmc->host_caps | MMC_MODE_1BIT); + mmc_dump_capabilities("host", mmc->host_caps); #endif
/* Restrict card's capabilities by what the host can do */ - caps = card_caps & (mmc->host_caps | MMC_MODE_1BIT); + caps = card_caps & mmc->host_caps;
if (!uhs_en) caps &= ~UHS_CAPS; @@ -1770,11 +1770,11 @@ static int mmc_select_mode_and_width(struct mmc *mmc, uint card_caps)
#ifdef DEBUG mmc_dump_capabilities("mmc", card_caps); - mmc_dump_capabilities("host", mmc->host_caps | MMC_MODE_1BIT); + mmc_dump_capabilities("host", mmc->host_caps); #endif
/* Restrict card's capabilities by what the host can do */ - card_caps &= (mmc->host_caps | MMC_MODE_1BIT); + card_caps &= mmc->host_caps;
/* Only version 4 of MMC supports wider bus widths */ if (mmc->version < MMC_VERSION_4) @@ -2389,7 +2389,12 @@ int mmc_start_init(struct mmc *mmc) bool uhs_en = supports_uhs(mmc->cfg->host_caps); int err;
- mmc->host_caps = mmc->cfg->host_caps; + /* + * all hosts are capable of 1 bit bus-width and able to use the legacy + * timings. + */ + mmc->host_caps = mmc->cfg->host_caps | MMC_CAP(SD_LEGACY) | + MMC_CAP(MMC_LEGACY) | MMC_MODE_1BIT;
/* we pretend there's no card when init is NULL */ no_card = mmc_getcd(mmc) == 0;

The ext_csd is allocated only for MMC above version 4. The compare will crash or fail for older MMCs.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com --- no change since v4
drivers/mmc/mmc.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 0ebcc45..2a58031 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -1657,6 +1657,9 @@ static int mmc_read_and_compare_ext_csd(struct mmc *mmc) const u8 *ext_csd = mmc->ext_csd; ALLOC_CACHE_ALIGN_BUFFER(u8, test_csd, MMC_MAX_BLOCK_LEN);
+ if (mmc->version < MMC_VERSION_4) + return 0; + err = mmc_send_ext_csd(mmc, test_csd); if (err) return err;

Not using this function reduces the size of the binary. It's replaces by a standard malloc() and the alignment requirement is handled by an intermediate buffer on the stack.
Also make sure that the allocated buffer is freed in case of error.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com --- no change since v4
drivers/mmc/mmc.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 2a58031..13979a5 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -1867,21 +1867,23 @@ static int mmc_startup_v4(struct mmc *mmc) u64 capacity; bool has_parts = false; bool part_completed; - u8 *ext_csd; + ALLOC_CACHE_ALIGN_BUFFER(u8, ext_csd, MMC_MAX_BLOCK_LEN);
if (IS_SD(mmc) || (mmc->version < MMC_VERSION_4)) return 0;
- ext_csd = malloc_cache_aligned(MMC_MAX_BLOCK_LEN); - if (!ext_csd) - return -ENOMEM; - - mmc->ext_csd = ext_csd; - /* check ext_csd version and capacity */ err = mmc_send_ext_csd(mmc, ext_csd); if (err) - return err; + goto error; + + /* store the ext csd for future reference */ + if (!mmc->ext_csd) + mmc->ext_csd = malloc(MMC_MAX_BLOCK_LEN); + if (!mmc->ext_csd) + return -ENOMEM; + memcpy(mmc->ext_csd, ext_csd, MMC_MAX_BLOCK_LEN); + if (ext_csd[EXT_CSD_REV] >= 2) { /* * According to the JEDEC Standard, the value of @@ -1990,7 +1992,7 @@ static int mmc_startup_v4(struct mmc *mmc) EXT_CSD_ERASE_GROUP_DEF, 1);
if (err) - return err; + goto error;
ext_csd[EXT_CSD_ERASE_GROUP_DEF] = 1; } @@ -2029,6 +2031,12 @@ static int mmc_startup_v4(struct mmc *mmc) mmc->wr_rel_set = ext_csd[EXT_CSD_WR_REL_SET];
return 0; +error: + if (mmc->ext_csd) { + free(mmc->ext_csd); + mmc->ext_csd = NULL; + } + return err; }
static int mmc_startup(struct mmc *mmc)

This allows to compile out the log message by tweaking the LOGLEVEL.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com --- changes since v4: this replaces patch 'mmc: allow to compile out the error messages'. Instead of using a custom macro to compile out the log messages, rely on the existing pr_err() and pr_warn() macros and the LOGLEVEL config option.
drivers/mmc/Kconfig | 7 ------- drivers/mmc/mmc.c | 44 ++++++++++++++++++++++---------------------- 2 files changed, 22 insertions(+), 29 deletions(-)
diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig index dbbef5a..ad3e593 100644 --- a/drivers/mmc/Kconfig +++ b/drivers/mmc/Kconfig @@ -58,13 +58,6 @@ config MMC_VERBOSE Enable the output of more information about the card such as the operating mode.
-config SPL_MMC_VERBOSE - bool "Output more information about the MMC in SPL" - default n - help - Enable the output of more information about the card such as the - operating mode. - config SPL_MMC_TINY bool "Tiny MMC framework in SPL" help diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 13979a5..3fb82d9 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -251,8 +251,8 @@ int mmc_send_status(struct mmc *mmc, int timeout)
if (cmd.response[0] & MMC_STATUS_MASK) { #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT) - printf("Status Error: 0x%08X\n", - cmd.response[0]); + pr_err("Status Error: 0x%08X\n", + cmd.response[0]); #endif return -ECOMM; } @@ -268,7 +268,7 @@ int mmc_send_status(struct mmc *mmc, int timeout) mmc_trace_state(mmc, &cmd); if (timeout <= 0) { #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT) - printf("Timeout waiting card ready\n"); + pr_err("Timeout waiting card ready\n"); #endif return -ETIMEDOUT; } @@ -408,7 +408,7 @@ static int mmc_read_blocks(struct mmc *mmc, void *dst, lbaint_t start, cmd.resp_type = MMC_RSP_R1b; if (mmc_send_cmd(mmc, &cmd, NULL)) { #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT) - printf("mmc fail to send stop cmd\n"); + pr_err("mmc fail to send stop cmd\n"); #endif return 0; } @@ -448,8 +448,8 @@ ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
if ((start + blkcnt) > block_dev->lba) { #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT) - printf("MMC: block number 0x" LBAF " exceeds max(0x" LBAF ")\n", - start + blkcnt, block_dev->lba); + pr_err("MMC: block number 0x" LBAF " exceeds max(0x" LBAF ")\n", + start + blkcnt, block_dev->lba); #endif return 0; } @@ -828,7 +828,7 @@ static int mmc_get_capabilities(struct mmc *mmc) return 0;
if (!ext_csd) { - printf("No ext_csd found!\n"); /* this should enver happen */ + pr_err("No ext_csd found!\n"); /* this should enver happen */ return -ENOTSUPP; }
@@ -946,17 +946,17 @@ int mmc_hwpart_config(struct mmc *mmc, return -EINVAL;
if (IS_SD(mmc) || (mmc->version < MMC_VERSION_4_41)) { - printf("eMMC >= 4.4 required for enhanced user data area\n"); + pr_err("eMMC >= 4.4 required for enhanced user data area\n"); return -EMEDIUMTYPE; }
if (!(mmc->part_support & PART_SUPPORT)) { - printf("Card does not support partitioning\n"); + pr_err("Card does not support partitioning\n"); return -EMEDIUMTYPE; }
if (!mmc->hc_wp_grp_size) { - printf("Card does not define HC WP group size\n"); + pr_err("Card does not define HC WP group size\n"); return -EMEDIUMTYPE; }
@@ -964,7 +964,7 @@ int mmc_hwpart_config(struct mmc *mmc, if (conf->user.enh_size) { if (conf->user.enh_size % mmc->hc_wp_grp_size || conf->user.enh_start % mmc->hc_wp_grp_size) { - printf("User data enhanced area not HC WP group " + pr_err("User data enhanced area not HC WP group " "size aligned\n"); return -EINVAL; } @@ -983,7 +983,7 @@ int mmc_hwpart_config(struct mmc *mmc,
for (pidx = 0; pidx < 4; pidx++) { if (conf->gp_part[pidx].size % mmc->hc_wp_grp_size) { - printf("GP%i partition not HC WP group size " + pr_err("GP%i partition not HC WP group size " "aligned\n", pidx+1); return -EINVAL; } @@ -995,7 +995,7 @@ int mmc_hwpart_config(struct mmc *mmc, }
if (part_attrs && ! (mmc->part_support & ENHNCD_SUPPORT)) { - printf("Card does not support enhanced attribute\n"); + pr_err("Card does not support enhanced attribute\n"); return -EMEDIUMTYPE; }
@@ -1008,7 +1008,7 @@ int mmc_hwpart_config(struct mmc *mmc, (ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT+1] << 8) + ext_csd[EXT_CSD_MAX_ENH_SIZE_MULT]; if (tot_enh_size_mult > max_enh_size_mult) { - printf("Total enhanced size exceeds maximum (%u > %u)\n", + pr_err("Total enhanced size exceeds maximum (%u > %u)\n", tot_enh_size_mult, max_enh_size_mult); return -EMEDIUMTYPE; } @@ -1042,7 +1042,7 @@ int mmc_hwpart_config(struct mmc *mmc,
if (ext_csd[EXT_CSD_PARTITION_SETTING] & EXT_CSD_PARTITION_SETTING_COMPLETED) { - printf("Card already partitioned\n"); + pr_err("Card already partitioned\n"); return -EPERM; }
@@ -1433,7 +1433,7 @@ static inline int bus_width(uint cap) return 4; if (cap == MMC_MODE_1BIT) return 1; - printf("invalid bus witdh capability 0x%x\n", cap); + pr_warn("invalid bus witdh capability 0x%x\n", cap); return 0; }
@@ -1632,7 +1632,7 @@ static int sd_select_mode_and_width(struct mmc *mmc, uint card_caps) if (!err) return 0;
- printf("bad ssr\n"); + pr_warn("bad ssr\n");
error: /* revert to a safer bus speed */ @@ -1856,7 +1856,7 @@ error: } }
- printf("unable to select a mode\n"); + pr_err("unable to select a mode\n");
return -ENOTSUPP; } @@ -2188,7 +2188,7 @@ static int mmc_startup(struct mmc *mmc) cmd.cmdarg = (mmc->dsr & 0xffff) << 16; cmd.resp_type = MMC_RSP_NONE; if (mmc_send_cmd(mmc, &cmd, NULL)) - printf("MMC: SET_DSR failed\n"); + pr_warn("MMC: SET_DSR failed\n"); }
/* Select the card, and put it into Transfer Mode */ @@ -2341,7 +2341,7 @@ static void mmc_set_initial_state(struct mmc *mmc) if (err != 0) err = mmc_set_signal_voltage(mmc, MMC_SIGNAL_VOLTAGE_180); if (err != 0) - printf("mmc: failed to set signal voltage\n"); + pr_warn("mmc: failed to set signal voltage\n");
mmc_select_mode(mmc, MMC_LEGACY); mmc_set_bus_width(mmc, 1); @@ -2490,7 +2490,7 @@ retry:
if (err) { #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT) - printf("Card did not respond to voltage select!\n"); + pr_err("Card did not respond to voltage select!\n"); #endif return -EOPNOTSUPP; } @@ -2596,7 +2596,7 @@ static int mmc_probe(bd_t *bis) uclass_foreach_dev(dev, uc) { ret = device_probe(dev); if (ret) - printf("%s - probe failed: %d\n", dev->name, ret); + pr_err("%s - probe failed: %d\n", dev->name, ret); }
return 0;

On Thu, Nov 30, 2017 at 05:44:00PM +0100, Jean-Jacques Hiblot wrote:
This allows to compile out the log message by tweaking the LOGLEVEL.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com
Reviewed-by: Tom Rini trini@konsulko.com

Supporting USH and HS200 increases the code size as it brings in IO voltage control, tuning and fatter data structures. Use Kconfig configuration to select which of those features should be built in.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com ---
changes since v4: * reordered the options for convenience
drivers/mmc/Kconfig | 46 +++++++++++++++++++++++++++++++++++ drivers/mmc/mmc-uclass.c | 4 +++ drivers/mmc/mmc.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++- include/mmc.h | 27 ++++++++++++++++++--- 4 files changed, 135 insertions(+), 5 deletions(-)
diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig index ad3e593..fe84edd 100644 --- a/drivers/mmc/Kconfig +++ b/drivers/mmc/Kconfig @@ -51,6 +51,52 @@ config MMC_QUIRKS are enabled by default, other may require additionnal flags or are enabled by the host driver.
+config MMC_IO_VOLTAGE + bool "Support IO voltage configuration" + help + IO voltage configuration allows selecting the voltage level of the IO + lines (not the level of main supply). This is required for UHS + support. For eMMC this not mandatory, but not enabling this option may + prevent the driver of using the faster modes. + +config SPL_MMC_IO_VOLTAGE + bool "Support IO voltage configuration in SPL" + default n + help + IO voltage configuration allows selecting the voltage level of the IO + lines (not the level of main supply). This is required for UHS + support. For eMMC this not mandatory, but not enabling this option may + prevent the driver of using the faster modes. + +config MMC_UHS_SUPPORT + bool "enable UHS support" + depends on MMC_IO_VOLTAGE + help + The Ultra High Speed (UHS) bus is available on some SDHC and SDXC + cards. The IO voltage must be switchable from 3.3v to 1.8v. The bus + frequency can go up to 208MHz (SDR104) + +config SPL_MMC_UHS_SUPPORT + bool "enable UHS support in SPL" + depends on SPL_MMC_IO_VOLTAGE + help + The Ultra High Speed (UHS) bus is available on some SDHC and SDXC + cards. The IO voltage must be switchable from 3.3v to 1.8v. The bus + frequency can go up to 208MHz (SDR104) + +config MMC_HS200_SUPPORT + bool "enable HS200 support" + help + The HS200 mode is support by some eMMC. The bus frequency is up to + 200MHz. This mode requires tuning the IO. + + +config SPL_MMC_HS200_SUPPORT + bool "enable HS200 support in SPL" + help + The HS200 mode is support by some eMMC. The bus frequency is up to + 200MHz. This mode requires tuning the IO. + config MMC_VERBOSE bool "Output more information about the MMC" default y diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c index bfda942..793196b 100644 --- a/drivers/mmc/mmc-uclass.c +++ b/drivers/mmc/mmc-uclass.c @@ -63,6 +63,7 @@ void mmc_send_init_stream(struct mmc *mmc) dm_mmc_send_init_stream(mmc->dev); }
+#if CONFIG_IS_ENABLED(MMC_UHS_SUPPORT) int dm_mmc_wait_dat0(struct udevice *dev, int state, int timeout) { struct dm_mmc_ops *ops = mmc_get_ops(dev); @@ -76,6 +77,7 @@ int mmc_wait_dat0(struct mmc *mmc, int state, int timeout) { return dm_mmc_wait_dat0(mmc->dev, state, timeout); } +#endif
int dm_mmc_get_wp(struct udevice *dev) { @@ -105,6 +107,7 @@ int mmc_getcd(struct mmc *mmc) return dm_mmc_get_cd(mmc->dev); }
+#ifdef MMC_SUPPORTS_TUNING int dm_mmc_execute_tuning(struct udevice *dev, uint opcode) { struct dm_mmc_ops *ops = mmc_get_ops(dev); @@ -118,6 +121,7 @@ int mmc_execute_tuning(struct mmc *mmc, uint opcode) { return dm_mmc_execute_tuning(mmc->dev, opcode); } +#endif
int mmc_of_parse(struct udevice *dev, struct mmc_config *cfg) { diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 3fb82d9..400e163 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -59,10 +59,12 @@ struct blk_desc *mmc_get_blk_desc(struct mmc *mmc)
#if !CONFIG_IS_ENABLED(DM_MMC)
+#if CONFIG_IS_ENABLED(MMC_UHS_SUPPORT) static int mmc_wait_dat0(struct mmc *mmc, int state, int timeout) { return -ENOSYS; } +#endif
__weak int board_mmc_getwp(struct mmc *mmc) { @@ -190,14 +192,20 @@ static uint mmc_mode2freq(struct mmc *mmc, enum bus_mode mode) [SD_LEGACY] = 25000000, [MMC_HS] = 26000000, [SD_HS] = 50000000, +#if CONFIG_IS_ENABLED(MMC_UHS_SUPPORT) [UHS_SDR12] = 25000000, [UHS_SDR25] = 50000000, [UHS_SDR50] = 100000000, - [UHS_SDR104] = 208000000, [UHS_DDR50] = 50000000, +#ifdef MMC_SUPPORTS_TUNING + [UHS_SDR104] = 208000000, +#endif +#endif [MMC_HS_52] = 52000000, [MMC_DDR_52] = 52000000, +#if CONFIG_IS_ENABLED(MMC_HS200_SUPPORT) [MMC_HS_200] = 200000000, +#endif };
if (mode == MMC_LEGACY) @@ -308,6 +316,7 @@ int mmc_set_blocklen(struct mmc *mmc, int len) return err; }
+#ifdef MMC_SUPPORTS_TUNING static const u8 tuning_blk_pattern_4bit[] = { 0xff, 0x0f, 0xff, 0x00, 0xff, 0xcc, 0xc3, 0xcc, 0xc3, 0x3c, 0xcc, 0xff, 0xfe, 0xff, 0xfe, 0xef, @@ -375,6 +384,7 @@ int mmc_send_tuning(struct mmc *mmc, u32 opcode, int *cmd_error)
return 0; } +#endif
static int mmc_read_blocks(struct mmc *mmc, void *dst, lbaint_t start, lbaint_t blkcnt) @@ -495,6 +505,7 @@ static int mmc_go_idle(struct mmc *mmc) return 0; }
+#if CONFIG_IS_ENABLED(MMC_UHS_SUPPORT) static int mmc_switch_voltage(struct mmc *mmc, int signal_voltage) { struct mmc_cmd cmd; @@ -554,6 +565,7 @@ static int mmc_switch_voltage(struct mmc *mmc, int signal_voltage)
return 0; } +#endif
static int sd_send_op_cond(struct mmc *mmc, bool uhs_en) { @@ -620,12 +632,14 @@ static int sd_send_op_cond(struct mmc *mmc, bool uhs_en)
mmc->ocr = cmd.response[0];
+#if CONFIG_IS_ENABLED(MMC_UHS_SUPPORT) if (uhs_en && !(mmc_host_is_spi(mmc)) && (cmd.response[0] & 0x41000000) == 0x41000000) { err = mmc_switch_voltage(mmc, MMC_SIGNAL_VOLTAGE_180); if (err) return err; } +#endif
mmc->high_capacity = ((mmc->ocr & OCR_HCS) == OCR_HCS); mmc->rca = 0; @@ -880,6 +894,7 @@ static int mmc_set_capacity(struct mmc *mmc, int part_num) return 0; }
+#if CONFIG_IS_ENABLED(MMC_HS200_SUPPORT) static int mmc_boot_part_access_chk(struct mmc *mmc, unsigned int part_num) { int forbidden = 0; @@ -903,6 +918,13 @@ static int mmc_boot_part_access_chk(struct mmc *mmc, unsigned int part_num)
return 0; } +#else +static inline int mmc_boot_part_access_chk(struct mmc *mmc, + unsigned int part_num) +{ + return 0; +} +#endif
int mmc_switch_part(struct mmc *mmc, unsigned int part_num) { @@ -1169,7 +1191,9 @@ static int sd_get_capabilities(struct mmc *mmc) ALLOC_CACHE_ALIGN_BUFFER(__be32, switch_status, 16); struct mmc_data data; int timeout; +#if CONFIG_IS_ENABLED(MMC_UHS_SUPPORT) u32 sd3_bus_mode; +#endif
mmc->card_caps = MMC_MODE_1BIT | MMC_CAP(SD_LEGACY);
@@ -1251,6 +1275,7 @@ retry_scr: if (__be32_to_cpu(switch_status[3]) & SD_HIGHSPEED_SUPPORTED) mmc->card_caps |= MMC_CAP(SD_HS);
+#if CONFIG_IS_ENABLED(MMC_UHS_SUPPORT) /* Version before 3.0 don't support UHS modes */ if (mmc->version < SD_VERSION_3) return 0; @@ -1266,6 +1291,7 @@ retry_scr: mmc->card_caps |= MMC_CAP(UHS_SDR12); if (sd3_bus_mode & SD_MODE_UHS_DDR50) mmc->card_caps |= MMC_CAP(UHS_DDR50); +#endif
return 0; } @@ -1438,10 +1464,12 @@ static inline int bus_width(uint cap) }
#if !CONFIG_IS_ENABLED(DM_MMC) +#ifdef MMC_SUPPORTS_TUNING static int mmc_execute_tuning(struct mmc *mmc, uint opcode) { return -ENOTSUPP; } +#endif
static void mmc_send_init_stream(struct mmc *mmc) { @@ -1507,9 +1535,12 @@ void mmc_dump_capabilities(const char *text, uint caps) struct mode_width_tuning { enum bus_mode mode; uint widths; +#ifdef MMC_SUPPORTS_TUNING uint tuning; +#endif };
+#if CONFIG_IS_ENABLED(MMC_IO_VOLTAGE) int mmc_voltage_to_mv(enum mmc_voltage voltage) { switch (voltage) { @@ -1535,13 +1566,22 @@ static int mmc_set_signal_voltage(struct mmc *mmc, uint signal_voltage)
return err; } +#else +static inline int mmc_set_signal_voltage(struct mmc *mmc, uint signal_voltage) +{ + return 0; +} +#endif
static const struct mode_width_tuning sd_modes_by_pref[] = { +#if CONFIG_IS_ENABLED(MMC_UHS_SUPPORT) +#ifdef MMC_SUPPORTS_TUNING { .mode = UHS_SDR104, .widths = MMC_MODE_4BIT | MMC_MODE_1BIT, .tuning = MMC_CMD_SEND_TUNING_BLOCK }, +#endif { .mode = UHS_SDR50, .widths = MMC_MODE_4BIT | MMC_MODE_1BIT, @@ -1554,14 +1594,17 @@ static const struct mode_width_tuning sd_modes_by_pref[] = { .mode = UHS_SDR25, .widths = MMC_MODE_4BIT | MMC_MODE_1BIT, }, +#endif { .mode = SD_HS, .widths = MMC_MODE_4BIT | MMC_MODE_1BIT, }, +#if CONFIG_IS_ENABLED(MMC_UHS_SUPPORT) { .mode = UHS_SDR12, .widths = MMC_MODE_4BIT | MMC_MODE_1BIT, }, +#endif { .mode = SD_LEGACY, .widths = MMC_MODE_4BIT | MMC_MODE_1BIT, @@ -1579,7 +1622,11 @@ static int sd_select_mode_and_width(struct mmc *mmc, uint card_caps) int err; uint widths[] = {MMC_MODE_4BIT, MMC_MODE_1BIT}; const struct mode_width_tuning *mwt; +#if CONFIG_IS_ENABLED(MMC_UHS_SUPPORT) bool uhs_en = (mmc->ocr & OCR_S18R) ? true : false; +#else + bool uhs_en = false; +#endif uint caps;
#ifdef DEBUG @@ -1618,6 +1665,7 @@ static int sd_select_mode_and_width(struct mmc *mmc, uint card_caps) mmc_select_mode(mmc, mwt->mode); mmc_set_clock(mmc, mmc->tran_speed, false);
+#ifdef MMC_SUPPORTS_TUNING /* execute tuning if needed */ if (mwt->tuning && !mmc_host_is_spi(mmc)) { err = mmc_execute_tuning(mmc, @@ -1627,6 +1675,7 @@ static int sd_select_mode_and_width(struct mmc *mmc, uint card_caps) goto error; } } +#endif
err = sd_read_ssr(mmc); if (!err) @@ -1680,6 +1729,7 @@ static int mmc_read_and_compare_ext_csd(struct mmc *mmc) return -EBADMSG; }
+#if CONFIG_IS_ENABLED(MMC_IO_VOLTAGE) static int mmc_set_lowest_voltage(struct mmc *mmc, enum bus_mode mode, uint32_t allowed_mask) { @@ -1716,13 +1766,22 @@ static int mmc_set_lowest_voltage(struct mmc *mmc, enum bus_mode mode,
return -ENOTSUPP; } +#else +static inline int mmc_set_lowest_voltage(struct mmc *mmc, enum bus_mode mode, + uint32_t allowed_mask) +{ + return 0; +} +#endif
static const struct mode_width_tuning mmc_modes_by_pref[] = { +#if CONFIG_IS_ENABLED(MMC_HS200_SUPPORT) { .mode = MMC_HS_200, .widths = MMC_MODE_8BIT | MMC_MODE_4BIT, .tuning = MMC_CMD_SEND_TUNING_BLOCK_HS200 }, +#endif { .mode = MMC_DDR_52, .widths = MMC_MODE_8BIT | MMC_MODE_4BIT, @@ -1832,6 +1891,7 @@ static int mmc_select_mode_and_width(struct mmc *mmc, uint card_caps) /* configure the bus mode (host) */ mmc_select_mode(mmc, mwt->mode); mmc_set_clock(mmc, mmc->tran_speed, false); +#ifdef MMC_SUPPORTS_TUNING
/* execute tuning if needed */ if (mwt->tuning) { @@ -1841,6 +1901,7 @@ static int mmc_select_mode_and_width(struct mmc *mmc, uint card_caps) goto error; } } +#endif
/* do a transfer to check the configuration */ err = mmc_read_and_compare_ext_csd(mmc); diff --git a/include/mmc.h b/include/mmc.h index e3f777f..e89ba95 100644 --- a/include/mmc.h +++ b/include/mmc.h @@ -15,6 +15,13 @@ #include <linux/compiler.h> #include <part.h>
+#if CONFIG_IS_ENABLED(MMC_HS200_SUPPORT) +#define MMC_SUPPORTS_TUNING +#endif +#if CONFIG_IS_ENABLED(MMC_UHS_SUPPORT) +#define MMC_SUPPORTS_TUNING +#endif + /* SD/MMC version bits; 8 flags, 8 major, 8 minor, 8 change */ #define SD_VERSION_SD (1U << 31) #define MMC_VERSION_MMC (1U << 30) @@ -425,6 +432,7 @@ struct dm_mmc_ops { */ int (*get_wp)(struct udevice *dev);
+#ifdef MMC_SUPPORTS_TUNING /** * execute_tuning() - Start the tuning process * @@ -433,7 +441,9 @@ struct dm_mmc_ops { * @return 0 if OK, -ve on error */ int (*execute_tuning)(struct udevice *dev, uint opcode); +#endif
+#if CONFIG_IS_ENABLED(MMC_UHS_SUPPORT) /** * wait_dat0() - wait until dat0 is in the target state * (CLK must be running during the wait) @@ -444,6 +454,7 @@ struct dm_mmc_ops { * @return 0 if dat0 is in the target state, -ve on error */ int (*wait_dat0)(struct udevice *dev, int state, int timeout); +#endif };
#define mmc_get_ops(dev) ((struct dm_mmc_ops *)(dev)->driver->ops) @@ -500,13 +511,13 @@ enum bus_mode { SD_LEGACY, MMC_HS, SD_HS, + MMC_HS_52, + MMC_DDR_52, UHS_SDR12, UHS_SDR25, UHS_SDR50, - UHS_SDR104, UHS_DDR50, - MMC_HS_52, - MMC_DDR_52, + UHS_SDR104, MMC_HS_200, MMC_MODES_END }; @@ -516,8 +527,12 @@ void mmc_dump_capabilities(const char *text, uint caps);
static inline bool mmc_is_mode_ddr(enum bus_mode mode) { - if ((mode == MMC_DDR_52) || (mode == UHS_DDR50)) + if (mode == MMC_DDR_52) + return true; +#if CONFIG_IS_ENABLED(MMC_UHS_SUPPORT) + else if (mode == UHS_DDR50) return true; +#endif else return false; } @@ -528,7 +543,11 @@ static inline bool mmc_is_mode_ddr(enum bus_mode mode)
static inline bool supports_uhs(uint caps) { +#if CONFIG_IS_ENABLED(MMC_UHS_SUPPORT) return (caps & UHS_CAPS) ? true : false; +#else + return false; +#endif }
/*

Not all boards have an eMMC and not all users have a need for this. Allow to compile it out. By default it is still included.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com --- no change since v4
cmd/mmc.c | 4 ++++ drivers/mmc/Kconfig | 7 +++++++ drivers/mmc/mmc.c | 2 ++ 3 files changed, 13 insertions(+)
diff --git a/cmd/mmc.c b/cmd/mmc.c index 25795e0..9a95293 100644 --- a/cmd/mmc.c +++ b/cmd/mmc.c @@ -438,6 +438,7 @@ static int do_mmc_list(cmd_tbl_t *cmdtp, int flag, return CMD_RET_SUCCESS; }
+#if CONFIG_IS_ENABLED(MMC_HW_PARTITIONING) static int parse_hwpart_user(struct mmc_hwpart_conf *pconf, int argc, char * const argv[]) { @@ -587,6 +588,7 @@ static int do_mmc_hwpartition(cmd_tbl_t *cmdtp, int flag, return CMD_RET_FAILURE; } } +#endif
#ifdef CONFIG_SUPPORT_EMMC_BOOT static int do_mmc_bootbus(cmd_tbl_t *cmdtp, int flag, @@ -796,7 +798,9 @@ static cmd_tbl_t cmd_mmc[] = { U_BOOT_CMD_MKENT(part, 1, 1, do_mmc_part, "", ""), U_BOOT_CMD_MKENT(dev, 3, 0, do_mmc_dev, "", ""), U_BOOT_CMD_MKENT(list, 1, 1, do_mmc_list, "", ""), +#if CONFIG_IS_ENABLED(MMC_HW_PARTITIONING) U_BOOT_CMD_MKENT(hwpartition, 28, 0, do_mmc_hwpartition, "", ""), +#endif #ifdef CONFIG_SUPPORT_EMMC_BOOT U_BOOT_CMD_MKENT(bootbus, 5, 0, do_mmc_bootbus, "", ""), U_BOOT_CMD_MKENT(bootpart-resize, 4, 0, do_mmc_boot_resize, "", ""), diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig index fe84edd..36137bf 100644 --- a/drivers/mmc/Kconfig +++ b/drivers/mmc/Kconfig @@ -51,6 +51,13 @@ config MMC_QUIRKS are enabled by default, other may require additionnal flags or are enabled by the host driver.
+config MMC_HW_PARTITIONING + bool "Support for HW partitioning command(eMMC)" + default y + help + This adds a command and an API to do hardware partitioning on eMMC + devices. + config MMC_IO_VOLTAGE bool "Support IO voltage configuration" help diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 400e163..67d05c5 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -950,6 +950,7 @@ int mmc_switch_part(struct mmc *mmc, unsigned int part_num) return ret; }
+#if CONFIG_IS_ENABLED(MMC_HW_PARTITIONING) int mmc_hwpart_config(struct mmc *mmc, const struct mmc_hwpart_conf *conf, enum mmc_hwpart_conf_mode mode) @@ -1143,6 +1144,7 @@ int mmc_hwpart_config(struct mmc *mmc,
return 0; } +#endif
#if !CONFIG_IS_ENABLED(DM_MMC) int mmc_getcd(struct mmc *mmc)

builds are broken because the size of the binary exceeds the limit. Make some space by removing support for hardware partitioning as those boards don't have any eMMC.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com --- no change since v4
configs/openrd_base_defconfig | 1 + configs/openrd_client_defconfig | 1 + configs/openrd_ultimate_defconfig | 1 + 3 files changed, 3 insertions(+)
diff --git a/configs/openrd_base_defconfig b/configs/openrd_base_defconfig index efebf82..80f8772 100644 --- a/configs/openrd_base_defconfig +++ b/configs/openrd_base_defconfig @@ -24,6 +24,7 @@ CONFIG_MTDPARTS_DEFAULT="mtdparts=nand_mtd:0x100000@0x000000(uboot),0x400000@0x1 CONFIG_CMD_UBI=y CONFIG_ISO_PARTITION=y CONFIG_ENV_IS_IN_NAND=y +# CONFIG_MMC_HW_PARTITIONING is not set CONFIG_SYS_NS16550=y CONFIG_USB=y CONFIG_USB_EHCI_HCD=y diff --git a/configs/openrd_client_defconfig b/configs/openrd_client_defconfig index 6722e42..000ba1a 100644 --- a/configs/openrd_client_defconfig +++ b/configs/openrd_client_defconfig @@ -24,6 +24,7 @@ CONFIG_MTDPARTS_DEFAULT="mtdparts=nand_mtd:0x100000@0x000000(uboot),0x400000@0x1 CONFIG_CMD_UBI=y CONFIG_ISO_PARTITION=y CONFIG_ENV_IS_IN_NAND=y +# CONFIG_MMC_HW_PARTITIONING is not set CONFIG_SYS_NS16550=y CONFIG_USB=y CONFIG_USB_EHCI_HCD=y diff --git a/configs/openrd_ultimate_defconfig b/configs/openrd_ultimate_defconfig index fb31b11..5b2e690 100644 --- a/configs/openrd_ultimate_defconfig +++ b/configs/openrd_ultimate_defconfig @@ -24,6 +24,7 @@ CONFIG_MTDPARTS_DEFAULT="mtdparts=nand_mtd:0x100000@0x000000(uboot),0x400000@0x1 CONFIG_CMD_UBI=y CONFIG_ISO_PARTITION=y CONFIG_ENV_IS_IN_NAND=y +# CONFIG_MMC_HW_PARTITIONING is not set CONFIG_SYS_NS16550=y CONFIG_USB=y CONFIG_USB_EHCI_HCD=y

The changes in the MMC stack have increased its footprint up to the point were its breaks the generation of the SPL for this platform. Fix this by reducing the loglevel.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com ---
new patch that takes adavntage of "mmc: convert most of printf() to pr_err() and pr_warn()" to reduce the size of the SPL. WIthout this patch the SPL is too big and the build breaks.
configs/omapl138_lcdk_defconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig index 8d6b12f..0d4506e 100644 --- a/configs/omapl138_lcdk_defconfig +++ b/configs/omapl138_lcdk_defconfig @@ -8,6 +8,7 @@ CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_SPL_NAND_SUPPORT=y CONFIG_BOOTDELAY=3 +CONFIG_LOGLEVEL=3 CONFIG_VERSION_VARIABLE=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set

On Thu, Nov 30, 2017 at 05:44:04PM +0100, Jean-Jacques Hiblot wrote:
The changes in the MMC stack have increased its footprint up to the point were its breaks the generation of the SPL for this platform. Fix this by reducing the loglevel.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com
new patch that takes adavntage of "mmc: convert most of printf() to pr_err() and pr_warn()" to reduce the size of the SPL. WIthout this patch the SPL is too big and the build breaks.
configs/omapl138_lcdk_defconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig index 8d6b12f..0d4506e 100644 --- a/configs/omapl138_lcdk_defconfig +++ b/configs/omapl138_lcdk_defconfig @@ -8,6 +8,7 @@ CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_SPL_NAND_SUPPORT=y CONFIG_BOOTDELAY=3 +CONFIG_LOGLEVEL=3 CONFIG_VERSION_VARIABLE=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set
Peter? Thanks!

On Thu, 2017-11-30 at 11:55 -0500, Tom Rini wrote:
On Thu, Nov 30, 2017 at 05:44:04PM +0100, Jean-Jacques Hiblot wrote:
The changes in the MMC stack have increased its footprint up to the point were its breaks the generation of the SPL for this platform. Fix this by reducing the loglevel.
Signed-off-by: Jean-Jacques Hiblot jjhiblot@ti.com
new patch that takes adavntage of "mmc: convert most of printf() to pr_err() and pr_warn()" to reduce the size of the SPL. WIthout this patch the SPL is too big and the build breaks.
configs/omapl138_lcdk_defconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig index 8d6b12f..0d4506e 100644 --- a/configs/omapl138_lcdk_defconfig +++ b/configs/omapl138_lcdk_defconfig @@ -8,6 +8,7 @@ CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_SPL_NAND_SUPPORT=y CONFIG_BOOTDELAY=3 +CONFIG_LOGLEVEL=3 CONFIG_VERSION_VARIABLE=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set
Peter? Thanks!
Sorry, missed it first time. Fine by me.
Reviewed-by: Peter Howard phoward@gme.net.au
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

Hi JJ,
On 12/01/2017 01:43 AM, Jean-Jacques Hiblot wrote:
This series applies on top of "[PATCH v2 00/26] mmc: Add support for HS200 and UHS modes"
It fixes a bug with old SD and MMC cards that support only the legacy mode. This series also adresses the problem of increased code size that broke some platform (openrd and omapl138_lcdk) by making more things optional.
It also addresses other comments made on the mailing list:
- dump card and host capabilities in debug mode
- use 1-bit if the DTS property 'bus-width' is not present.
- recognize the "mmc-ddr-1_2v" and "mmc-hs200-1_2v" DTS properties
- convert mmc_of_parse to livetree
Applied to u-boot-mmc. Sorry for late. Thanks!
Best Regards, Jaehoon Chung
Tested on DRA72
changes since v4:
- use pr_warn() and pr_error() instead of custom macro to output log messages
- add a new patch to lower the LOGLEVEL for the platform omapl138_lcdk
- Fix typo in patch 'mmc: make optional the support for eMMC hardware partitioning'
changes since v3:
- Make UHS support optional. Disabled by default
- Make HS200 support optional. Disabled by default
- Make eMMC Hardware Partitioning optional. Enabled by default
- Display most of the error messages only if MMC_VERBOSE is set (it's set by default)
changes since v2:
- use the device-oriented helpers like dev_read_u32_default() instead of using the livetree API
- Dump the host and card capabilities only in when debug is enabled. Also dump the capabilities when 'mmc info' is executed if the verbose option is enabled
changes since v1:
- convert mmc_of_parse to livetree
- squashed all changes to mmc_of_parse in a single patch
Jean-Jacques Hiblot (11): mmc: dump card and host capabilities if debug is enabled dm: mmc: update mmc_of_parse() mmc: Fixed a problem with old sd or mmc that do not support High speed mmc: all hosts support 1-bit bus width and legacy timings mmc: fix for old MMCs (below version 4) mmc: don't use malloc_cache_aligned() mmc: convert most of printf() to pr_err() and pr_warn() mmc: make UHS and HS200 optional mmc: make optional the support for eMMC hardware partitioning configs: openrd: removed support for eMMC hardware partitioning configs: omapl138_lcdk: decrease the loglevel to reduce the size of the SPL
cmd/mmc.c | 8 ++ configs/omapl138_lcdk_defconfig | 1 + configs/openrd_base_defconfig | 1 + configs/openrd_client_defconfig | 1 + configs/openrd_ultimate_defconfig | 1 + drivers/mmc/Kconfig | 58 ++++++++++++-- drivers/mmc/mmc-uclass.c | 40 ++++++---- drivers/mmc/mmc.c | 162 +++++++++++++++++++++++++++++--------- include/mmc.h | 38 +++++++-- 9 files changed, 246 insertions(+), 64 deletions(-)

On 12/11/2017 08:57 AM, Jaehoon Chung wrote:
Hi JJ,
On 12/01/2017 01:43 AM, Jean-Jacques Hiblot wrote:
This series applies on top of "[PATCH v2 00/26] mmc: Add support for HS200 and UHS modes"
It fixes a bug with old SD and MMC cards that support only the legacy mode. This series also adresses the problem of increased code size that broke some platform (openrd and omapl138_lcdk) by making more things optional.
It also addresses other comments made on the mailing list:
- dump card and host capabilities in debug mode
- use 1-bit if the DTS property 'bus-width' is not present.
- recognize the "mmc-ddr-1_2v" and "mmc-hs200-1_2v" DTS properties
- convert mmc_of_parse to livetree
Applied to u-boot-mmc. Sorry for late. Thanks!
Does that mean this thing will make it for 2018.01 or 2018.03 ?

On 12/11/2017 06:33 PM, Marek Vasut wrote:
On 12/11/2017 08:57 AM, Jaehoon Chung wrote:
Hi JJ,
On 12/01/2017 01:43 AM, Jean-Jacques Hiblot wrote:
This series applies on top of "[PATCH v2 00/26] mmc: Add support for HS200 and UHS modes"
It fixes a bug with old SD and MMC cards that support only the legacy mode. This series also adresses the problem of increased code size that broke some platform (openrd and omapl138_lcdk) by making more things optional.
It also addresses other comments made on the mailing list:
- dump card and host capabilities in debug mode
- use 1-bit if the DTS property 'bus-width' is not present.
- recognize the "mmc-ddr-1_2v" and "mmc-hs200-1_2v" DTS properties
- convert mmc_of_parse to livetree
Applied to u-boot-mmc. Sorry for late. Thanks!
Does that mean this thing will make it for 2018.01 or 2018.03 ?
If it's possible, will make it for 2018.01! Now, i'm checking some issue about SPL size.
Best Regards, Jaehoon Chung
participants (5)
-
Jaehoon Chung
-
Jean-Jacques Hiblot
-
Marek Vasut
-
Peter Howard
-
Tom Rini