[Bug 231713] mmc_calculate_clock() does not work properly for cards with bus_timing_normal only

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Sep 25 12:35:19 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231713

            Bug ID: 231713
           Summary: mmc_calculate_clock() does not work properly for cards
                    with bus_timing_normal only
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs at FreeBSD.org
          Reporter: sebastian.huber at embedded-brains.de

We have

static int
mmc_calculate_clock(struct mmc_softc *sc)
{
...
        /*
         * HS400 must be tuned in HS200 mode, so in case of HS400 we begin
         * with HS200 following the sequence as described in "6.6.2.2 HS200
         * timing mode selection" of the eMMC specification v5.1, too, and
         * switch to max_timing later.  HS400ES requires no tuning and, thus,
         * can be switch to directly, but requires the same detour via high
         * speed mode as does HS400 (see mmc_switch_to_hs400()).
         */
        hs400 = max_timing == bus_timing_mmc_hs400;
        timing = hs400 == true ? bus_timing_mmc_hs200 : max_timing;
        for (i = 0; i < sc->child_count; i++) {
                ivar = device_get_ivars(sc->child_list[i]);
                if ((ivar->timings & ~(1 << bus_timing_normal)) == 0)
                        continue;
...
                /* Set clock (must be done before initial tuning). */
                mmcbr_set_clock(dev, max_dtr);
                mmcbr_update_ios(dev);
...
        }
        (void)mmc_select_card(sc, 0);
        return (max_dtr);
}

So, for cards with ivar->timings == bus_timing_normal the mmcbr_set_clock(dev,
max_dtr) is not called. This way the clock stays at SD_MMC_CARD_ID_FREQUENCY ==
400kHz. I think this problem was introduced with:

commit 398d5fc6afb7ce20f0cf9ecc4fe286e72afdbf29
Author: marius <marius at FreeBSD.org>
Date:   Sun Jul 23 16:11:47 2017 +0000

    o Add support for eMMC HS200 and HS400 bus speed modes at 200 MHz to
      sdhci(4), mmc(4) and mmcsd(4). For the most part, this consists of:

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list