• Adrian Hunter's avatar
    mmc: sdhci: Fix override of timeout clk wrt max_busy_timeout · 112958c5
    Adrian Hunter authored
    [ Upstream commit 99513624 ]
    
    Normally the timeout clock frequency is read from the capabilities
    register.  It is also possible to set the value prior to calling
    sdhci_add_host() in which case that value will override the
    capabilities register value.  However that was being done after
    calculating max_busy_timeout so that max_busy_timeout was being
    calculated using the wrong value of timeout_clk.
    
    Fix that by moving the override before max_busy_timeout is
    calculated.
    
    The result is that the max_busy_timeout and max_discard
    increase for BSW devices so that, for example, the time for
    mkfs.ext4 on a 64GB eMMC drops from about 1 minute 40 seconds
    to about 20 seconds.
    
    Note, in the future, the capabilities setting will be tidied up
    and this override won't be used anymore.  However this fix is
    needed for stable.
    Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
    Cc: stable@vger.kernel.org # v3.18+
    Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
    112958c5
sdhci.c 92.9 KB