• Ulf Hansson's avatar
    mmc: core: Fixup busy detection for mmc switch operations · b9ec2616
    Ulf Hansson authored
    If the host controller supports busy detection in HW, we expect the
    MMC_CAP_WAIT_WHILE_BUSY to be set. Likewise the corresponding
    host->max_busy_timeout should reflect the maximum busy detection
    timeout supported by the host.
    
    Previously we expected a host that supported MMC_CAP_WAIT_WHILE_BUSY to
    cope with any timeout, which just isn't feasible due to HW limitations.
    
    For most switch operations, R1B responses are expected and thus we need
    to check for busy detection completion. To cope with cases where the
    requested busy detection timeout is greater than what the host are able
    to support, we fallback to use a R1 response instead. This will prevent
    the host from doing HW busy detection.
    
    In those cases, busy detection completion is handled by polling the for
    the card's status using CMD13. This is the same mechanism used when the
    host doesn't support MMC_CAP_WAIT_WHILE_BUSY.
    
    Do note, a host->max_busy_timeout set to zero, is interpreted by the
    mmc core as it don't know what the host supports. It will then provide
    the host with whatever timeout the mmc core finds suitable.
    
    For some cases the mmc core has unfurtunate no clue of what timeout to
    use. In these cases we provide the host with a timeout value of zero,
    which the host may interpret as use whatever timeout it finds suitable.
    Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: default avatarChris Ball <chris@printf.net>
    b9ec2616
mmc_ops.c 14.4 KB