• Kevin Liu's avatar
    mmc: sdhci: enhance preset value function · 52983382
    Kevin Liu authored
    4d55c5a1 ("mmc: sdhci: enable preset value after uhs initialization")
    added preset value support and enabled it by default during sd card init.
    
    Below are the enhancements introduced by this patch:
    
    1. In current code, preset value is enabled after setting clock finished,
    which means the clock is manually set by driver firstly and then suddenly
    switched to preset value at this point. So the first setting is useless
    and unnecessary. What's more, the first clock setting may differ from the
    preset one.  The better way is enable preset value just after switch to
    UHS mode so the preset value can take effect immediately. So move preset
    value enable from mmc_sd_init_card to sdhci_set_ios which will be called
    during set timing.
    
    2. In current code, preset value is disabled at the beginning of
    mmc_attach_sd.  It's too late since low freq (400khz) should be set in
    mmc_power_up.  So move preset value disable to sdhci_set_ios which will
    be called during power up.
    
    3. host->clock and ios->drv_type should also be updated according to the
    preset value if it's enabled. Current code missed this.
    
    4. This patch also introduce a quirk to disable preset value in case
    preset value doesn't work.
    
    This patch has been verified on sdhci-pxav3 platform with both preset
    enabled and disabled.
    Signed-off-by: default avatarKevin Liu <kliu5@marvell.com>
    Reviewed-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: default avatarChris Ball <cjb@laptop.org>
    52983382
sd.c 27.3 KB