[PATCH 05/10] mci: add HS400 Enhanced Strobe (HS400ES) selection

Sascha Hauer s.hauer at pengutronix.de
Mon May 18 06:06:08 PDT 2026


On 2026-05-18 11:54, Ahmad Fatoum wrote:
> Hi,
> 
> On 5/11/26 2:08 PM, Sascha Hauer wrote:
> > HS400ES bypasses HS200 tuning entirely: the eMMC drives a data strobe
> > line which the controller samples on, so the read path doesn't need
> > software-tuned phase. It still ends up in MMC_TIMING_MMC_HS400.
> > 
> > Detection: a card advertises HS400ES via EXT_CSD_STROBE_SUPPORT[184],
> > which sits outside DEVICE_TYPE; record it as a synthetic
> > EXT_CSD_CARD_TYPE_HS400ES bit in mmc_avail_type when the host
> > declares MMC_CAP2_HS400_ES (mmc-hs400-enhanced-strobe in DT) and the
> > card has both STROBE_SUPPORT set and one of the HS400 voltage variants.
> > 
> > Transition (mmc_select_hs400es):
> >   1. Negotiate 8-bit bus in HS mode (HS400 needs 8-bit).
> >   2. CMD6 EXT_CSD_HS_TIMING = HS, host to HS rate.
> >   3. CMD6 EXT_CSD_BUS_WIDTH = 8-bit DDR | STROBE bit, so the card
> >      starts driving the strobe line.
> >   4. CMD6 EXT_CSD_HS_TIMING = HS400, host to HS400 timing at
> >      hs200_max_dtr (200 MHz, DDR-sampled => 400 MT/s).
> >   5. Call host->ops.hs400_enhanced_strobe so the controller enables
> >      enhanced strobe sampling.
> > 
> > mmc_select_timing prefers HS400ES over HS200 + HS400; on any failure
> > it clears the flag and falls back to HS200. mci_startup_mmc returns
> > early when mmc_select_timing already landed us in HS400 (HS400ES has
> > no follow-up tuning step).
> > 
> > mci_ops gains an optional hs400_enhanced_strobe hook for the
> > controller's enhanced-strobe enable.
> > 
> > Assisted-by: Claude Opus 4.7 <noreply at anthropic.com>
> > Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> > ---
> >  drivers/mci/mci-core.c | 108 ++++++++++++++++++++++++++++++++++++++++++++++++-
> >  include/mci.h          |   4 ++
> >  2 files changed, 111 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> > index 58b28ec653..0cfddb8d43 100644
> > --- a/drivers/mci/mci-core.c
> > +++ b/drivers/mci/mci-core.c
> > @@ -1798,6 +1798,16 @@ static void mmc_select_max_dtr(struct mci *mci)
> >  		avail_type |= EXT_CSD_CARD_TYPE_HS400_1_2V;
> >  	}
> >  
> > +	/*
> > +	 * HS400ES capability is reported in EXT_CSD_STROBE_SUPPORT (byte 184),
> > +	 * not in DEVICE_TYPE. Combine with one of the HS400 voltage variants;
> > +	 * which voltage is used follows the same negotiation as HS400.
> > +	 */
> > +	if ((caps2 & MMC_CAP2_HS400_ES) &&
> > +	    mci->ext_csd[EXT_CSD_STROBE_SUPPORT] &&
> 
> Please add to mci_print_caps()

ok.

> 
> Also, please extend mci_timing_tostr() to return "HS400ES" for enhanced
> strobe.

There is no separate mode for HS400ES, it is still MMC_TIMING_MMC_HS400,
that's why it's decoded separately by the caller.

> > +
> > +	/* Step 4: 8-bit DDR with strobe enabled */
> > +	val = EXT_CSD_DDR_BUS_WIDTH_8 | EXT_CSD_BUS_WIDTH_STROBE;
> > +	err = mci_switch(mci, EXT_CSD_BUS_WIDTH, val);
> > +	if (err) {
> > +		dev_err(&mci->dev, "switch to DDR8 with strobe failed: %d\n", err);
> > +		return err;
> > +	}
> > +> +	/* Step 5: switch card to HS400 */
> > +	val = EXT_CSD_TIMING_HS400 | (host->drive_strength << EXT_CSD_DRV_STR_SHIFT);
> 
> The drive_strength is initialized by mmc_select_driver_type() and it
> seems no one will have called it for HS400ES?

Ok, will add it at the same place the kernel has it.

> 
> > +	err = mci_switch(mci, EXT_CSD_HS_TIMING, val);
> > +	if (err) {
> > +		dev_err(&mci->dev, "switch to HS400 for HS400ES failed: %d\n", err);
> > +		return err;
> > +	}
> > +
> > +	/* Step 6: host to HS400 timing and final clock */
> > +	mci_set_timing(mci, MMC_TIMING_MMC_HS400);
> > +	mmc_set_bus_speed(mci);
> > +
> > +	err = mci_switch_status(mci, true);
> > +	if (err)
> > +		return err;
> 
> Should this not be _after_ the enhanced strobe setting, so we are able
> to propagate an error on issues?

Ok.

> > @@ -2698,7 +2803,8 @@ static void mci_info(struct device *dev)
> >  		bw = 1;
> >
> >  	printf("  current buswidth: %d\n", bw);
> > -	printf("  current timing: %s\n", mci_timing_tostr(host->ios.timing));
> > +	printf("  current timing: %s%s\n", mci_timing_tostr(host->ios.timing),
> > +	       host->ios.enhanced_strobe ? " (Enhanced Strobe)" : "");
> 
> I would just append an ES suffix.

Ok.

--
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list