• Ulf Hansson's avatar
    mmc: core: Enable __mmc_switch() to change bus speed timing for the host · aa33ce3c
    Ulf Hansson authored
    In cases when a speed mode change is requested for mmc cards, a CMD6 is
    sent by calling __mmc_switch() during the card initialization. The CMD6
    leads to the card entering a busy period. When that is completed, the host
    must parse the CMD6 status to find out whether the change of the speed mode
    succeeded.
    
    To enable the mmc core to poll the card by using CMD13 to find out when the
    busy period is completed, it's reasonable to make sure polling is done by
    having the mmc host and the mmc card, being configured to operate at the
    same selected bus speed timing.
    
    Therefore, let's extend __mmc_switch() to take yet another parameter, which
    allow its callers to update the bus speed timing of the mmc host. In this
    way, __mmc_switch() also becomes capable of reading and validating the CMD6
    status by sending a CMD13, in cases when that's desired.
    
    If __mmc_switch() encounters a failure, we make sure to restores the old
    bus speed timing for the mmc host, before propagating the error code.
    Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
    Tested-by: default avatarLinus Walleij <linus.walleij@linaro.org>
    Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
    aa33ce3c
core.c 76.3 KB