All of lore.kernel.org
 help / color / mirror / Atom feed
* mmc: core: Add check for card type before mmc_hw_reset_for_init
@ 2013-08-12  7:02 Prasanna NAVARATNA
  2013-08-23 11:04 ` Ulf Hansson
  0 siblings, 1 reply; 3+ messages in thread
From: Prasanna NAVARATNA @ 2013-08-12  7:02 UTC (permalink / raw)
  To: linux-mmc

Almost all the places, before calling hw_reset ops, the card type is checked
to make sure it is eMMC but missed during mmc_rescan_try_freq.
The below patch adds the check for card type before calling hardware reset
for init as double safety measure.

>From e7941c5b3b4999318feb59fa83b78c15c13493b3 Mon Sep 17 00:00:00 2001
From: Prasanna NAVARATNA <prasanna.navaratna@broadcom.com>
Date: Mon, 12 Aug 2013 12:26:57 +0530
Subject: [PATCH] mmc: core: add check for card type before
 mmc_hw_reset_for_init

During mmc_hw_reset_for_init, the card type is not checked before
calling hw_reset ops.
Add check for the card type as emmc before issuing hw_reset during init.

Signed-off-by: Prasanna NAVARATNA <prasanna.navaratna@broadcom.com>
---
 drivers/mmc/core/core.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 49a5bca..2dad69a 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2196,7 +2196,8 @@ EXPORT_SYMBOL(mmc_set_blockcount);
 
 static void mmc_hw_reset_for_init(struct mmc_host *host)
 {
-	if (!(host->caps & MMC_CAP_HW_RESET) || !host->ops->hw_reset)
+	if (!(host->caps & MMC_CAP_HW_RESET) || !host->ops->hw_reset ||
+			!mmc_card_mmc(host->card))
 		return;
 	mmc_host_clk_hold(host);
 	host->ops->hw_reset(host);
-- 
1.7.6





^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: mmc: core: Add check for card type before mmc_hw_reset_for_init
  2013-08-12  7:02 mmc: core: Add check for card type before mmc_hw_reset_for_init Prasanna NAVARATNA
@ 2013-08-23 11:04 ` Ulf Hansson
  2013-08-23 14:12   ` Prasanna NAVARATNA
  0 siblings, 1 reply; 3+ messages in thread
From: Ulf Hansson @ 2013-08-23 11:04 UTC (permalink / raw)
  To: Prasanna NAVARATNA; +Cc: linux-mmc

On 12 August 2013 09:02, Prasanna NAVARATNA
<prasanna.navaratna@gmail.com> wrote:
> Almost all the places, before calling hw_reset ops, the card type is checked
> to make sure it is eMMC but missed during mmc_rescan_try_freq.
> The below patch adds the check for card type before calling hardware reset
> for init as double safety measure.
>
> From e7941c5b3b4999318feb59fa83b78c15c13493b3 Mon Sep 17 00:00:00 2001
> From: Prasanna NAVARATNA <prasanna.navaratna@broadcom.com>
> Date: Mon, 12 Aug 2013 12:26:57 +0530
> Subject: [PATCH] mmc: core: add check for card type before
>  mmc_hw_reset_for_init
>
> During mmc_hw_reset_for_init, the card type is not checked before
> calling hw_reset ops.
> Add check for the card type as emmc before issuing hw_reset during init.
>
> Signed-off-by: Prasanna NAVARATNA <prasanna.navaratna@broadcom.com>
> ---
>  drivers/mmc/core/core.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 49a5bca..2dad69a 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -2196,7 +2196,8 @@ EXPORT_SYMBOL(mmc_set_blockcount);
>
>  static void mmc_hw_reset_for_init(struct mmc_host *host)
>  {
> -       if (!(host->caps & MMC_CAP_HW_RESET) || !host->ops->hw_reset)
> +       if (!(host->caps & MMC_CAP_HW_RESET) || !host->ops->hw_reset ||
> +                       !mmc_card_mmc(host->card))

No, this does not work.

At this point we don't know the card type yet since we have not
initialized it. We can only trust the host->ops is performing what we
expect.

Kind regards
Ulf Hansson

>                 return;
>         mmc_host_clk_hold(host);
>         host->ops->hw_reset(host);
> --
> 1.7.6
>
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: mmc: core: Add check for card type before mmc_hw_reset_for_init
  2013-08-23 11:04 ` Ulf Hansson
@ 2013-08-23 14:12   ` Prasanna NAVARATNA
  0 siblings, 0 replies; 3+ messages in thread
From: Prasanna NAVARATNA @ 2013-08-23 14:12 UTC (permalink / raw)
  To: linux-mmc

Ah, yes you are right. Thanks for the feedback.





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-08-23 14:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-12  7:02 mmc: core: Add check for card type before mmc_hw_reset_for_init Prasanna NAVARATNA
2013-08-23 11:04 ` Ulf Hansson
2013-08-23 14:12   ` Prasanna NAVARATNA

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.