lkml.org 
[lkml]   [2015]   [Mar]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] mmc: sdhci: fix card presence logic in sdhci_request function
From
On 10 March 2015 at 19:35, Scott Branden <sbranden@broadcom.com> wrote:
> The sdhci_request function should consider a non-removable device
> always present.
> Call the correct logic already available in sdhci_do_get_cd function.
>
> This fixes some logic paths where MMC requests are being made to
> non-removable devices that do not have the card detect pin connected
> on the hardware as it is non-removable.
>
> Signed-off-by: Scott Branden <sbranden@broadcom.com>

Thanks, applied!

Kind regards
Uffe

> ---
> drivers/mmc/host/sdhci.c | 20 +++-----------------
> 1 file changed, 3 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 0ad412a..bafc7ac 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -56,6 +56,7 @@ static void sdhci_enable_preset_value(struct sdhci_host *host, bool enable);
> static int sdhci_pre_dma_transfer(struct sdhci_host *host,
> struct mmc_data *data,
> struct sdhci_host_next *next);
> +static int sdhci_do_get_cd(struct sdhci_host *host);
>
> #ifdef CONFIG_PM
> static int sdhci_runtime_pm_get(struct sdhci_host *host);
> @@ -1356,7 +1357,8 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
>
> sdhci_runtime_pm_get(host);
>
> - present = mmc_gpio_get_cd(host->mmc);
> + /* Firstly check card presence */
> + present = sdhci_do_get_cd(host);
>
> spin_lock_irqsave(&host->lock, flags);
>
> @@ -1379,22 +1381,6 @@ 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
> - */
> - if (present < 0) {
> - /* If polling, assume that the card is always present. */
> - if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION)
> - present = 1;
> - else
> - present = sdhci_readl(host, SDHCI_PRESENT_STATE) &
> - SDHCI_CARD_PRESENT;
> - }
> -
> if (!present || host->flags & SDHCI_DEVICE_DEAD) {
> host->mrq->cmd->error = -ENOMEDIUM;
> tasklet_schedule(&host->finish_tasklet);
> --
> 2.3.0
>


\
 
 \ /
  Last update: 2015-03-13 11:21    [W:0.022 / U:13.312 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site