Re: [PATCH] mmc: sdhci: update card present check code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2013/2/28 Kevin Liu <kliu5@xxxxxxxxxxx>:
> 1. If quirk SDHCI_QUIRK_BROKEN_CARD_DETECTION is selected, there is no
> card detection available and polling must be used. Gpio detect must
> _not_ be supported under this case.
> Change the sequence to check SDHCI_QUIRK_BROKEN_CARD_DETECTION first,
> which make code more clear.
> 2. nonremovable card should be also assumed always present.
>
> Signed-off-by: Kevin Liu <kliu5@xxxxxxxxxxx>
> ---
>  drivers/mmc/host/sdhci.c |   27 ++++++++++++++-------------
>  1 file changed, 14 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index c94fd6c..c0c48dd 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1337,19 +1337,20 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
>
>         host->mrq = mrq;
>
> -       /*
> -        * Firstly check card presence from cd-gpio.  The return could
> -        * be one of the following possibilities:
> -        *     negative: cd-gpio is not available
> -        *     zero: cd-gpio is used, and card is removed
> -        *     one: cd-gpio is used, and card is present
> -        */
> -       present = mmc_gpio_get_cd(host->mmc);
> -       if (present < 0) {
> -               /* If polling, assume that the card is always present. */
> -               if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION)
> -                       present = 1;
> -               else
> +       /* If polling/nonremovable, assume that the card is always present. */
> +       if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) ||
> +                       (host->mmc->caps & MMC_CAP_NONREMOVABLE)) {
> +               present = 1;
> +       } else {
> +               /*
> +                * Firstly check card presence from cd-gpio.  The return could
> +                * be one of the following possibilities:
> +                *     negative: cd-gpio is not available
> +                *     zero: cd-gpio is used, and card is removed
> +                *     one: cd-gpio is used, and card is present
> +                */
> +               present = mmc_gpio_get_cd(host->mmc);
> +               if (IS_ERR_VALUE(present))
>                         present = sdhci_readl(host, SDHCI_PRESENT_STATE) &
>                                         SDHCI_CARD_PRESENT;
>         }

I submitted below patch to replace this one so please ignore this patch.
[PATCH v2] mmc: sdhci: update check code for cd-broken or nonremovable card
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux