LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Philip Rakity <prakity@marvell.com>
To: Pierre Tardy <tardyp@gmail.com>
Cc: "linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/3] mmc: add MMC_QUIRK_BROKEN_CLK_GATING
Date: Mon, 10 Jan 2011 07:58:30 -0800	[thread overview]
Message-ID: <ADE0108D-6DF1-4230-B7FB-39D7AC7F63D1@marvell.com> (raw)
In-Reply-To: <4663ceeebbd267abb11515570ac17702a6a482f4.1294588491.git.tardyp@gmail.com>


On Jan 9, 2011, at 8:26 AM, Pierre Tardy wrote:

> Some sdio card are not following sdio standard, and does not work
> when the sdio bus's clock is gated
> 
> To keep functionnality for all legacy driver, we turn this quirk on
> for every sdio card.
> Drivers needs to disable the quirk manually when someone verified that their
> supported card works with clock gating.
> 
> Signed-off-by: Pierre Tardy <tardyp@gmail.com>
> ---
> drivers/mmc/core/host.c   |    5 +----
> drivers/mmc/core/quirks.c |   11 +++++++++++
> include/linux/mmc/card.h  |    1 +
> 3 files changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> index b3ac6c5..461e6a1 100644
> --- a/drivers/mmc/core/host.c
> +++ b/drivers/mmc/core/host.c
> @@ -160,10 +160,7 @@ static bool mmc_host_may_gate_card(struct mmc_card *card)
> 	 * gate the clock, because there is somebody out there that may still
> 	 * be using it.
> 	 */
> -	if (mmc_card_sdio(card))
> -		return false;
> -
> -	return true;
> +	return !(card->quirks & MMC_QUIRK_BROKEN_CLK_GATING);
> }


Since the code is not called that often could you change the above code to:  

> 	if (mmc_card_sdio(card))
> 		return !(card->quirks & MMC_QUIRK_BROKEN_CLK_GATING);
	return true;

more obvious that quirk only applies to sdio.

> 
> /**
> diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.c
> index d8a5fec..fe467c8 100644
> --- a/drivers/mmc/core/quirks.c
> +++ b/drivers/mmc/core/quirks.c
> @@ -32,7 +32,18 @@ static void add_quirk(struct mmc_card *card, int data)
> 	card->quirks |= data;
> }
> 
> +/*
> + * This hook just adds a quirk for all sdio devices
> + */
> +static void add_quirk_for_sdio_devices(struct mmc_card *card, int data)
> +{
> +	if (mmc_card_sdio(card))
> +		card->quirks |= data;
> +}
> +
> static const struct mmc_fixup mmc_fixup_methods[] = {
> +	{ SDIO_ANY_ID, SDIO_ANY_ID,
> +		add_quirk_for_sdio_devices, MMC_QUIRK_BROKEN_CLK_GATING }
> 	{ 0 }
> };
> 
> diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
> index a498d53..3fe9db0 100644
> --- a/include/linux/mmc/card.h
> +++ b/include/linux/mmc/card.h
> @@ -121,6 +121,7 @@ struct mmc_card {
> 						/* for byte mode */
> #define MMC_QUIRK_NONSTD_SDIO	(1<<2)		/* non-standard SDIO card attached */
> 						/* (missing CIA registers) */
> +#define MMC_QUIRK_BROKEN_CLK_GATING (1<<3)	/* clock gating the sdio bus will make card fail */
> 
> 	unsigned int		erase_size;	/* erase size in sectors */
>  	unsigned int		erase_shift;	/* if erase unit is power 2 */
> -- 
> 1.7.1
> 
> --
> 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


  reply	other threads:[~2011-01-10 15:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-09 16:26 [PATCH 0/3] mmc: add quirks.c file and CLK_GATING users Pierre Tardy
2011-01-09 16:26 ` [PATCH 1/3] mmc: add per device quirk placeholder Pierre Tardy
2011-01-10 16:04   ` Philip Rakity
2011-01-10 17:02     ` Pierre Tardy
2011-01-22 22:55   ` Ohad Ben-Cohen
2011-01-09 16:26 ` [PATCH 2/3] mmc: add MMC_QUIRK_BROKEN_CLK_GATING Pierre Tardy
2011-01-10 15:58   ` Philip Rakity [this message]
2011-01-10 16:57     ` Pierre Tardy
2011-01-10 17:18       ` Philip Rakity
2011-01-09 16:26 ` [PATCH 3/3] mmc: remove anti clock gating quirk for wl1271 Pierre Tardy
2011-01-20  4:14   ` Chris Ball
2011-01-20  7:17     ` Pierre Tardy
2011-01-22 14:47       ` Chris Ball
2011-01-10 22:01 ` [PATCH 0/3] mmc: add quirks.c file and CLK_GATING users Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ADE0108D-6DF1-4230-B7FB-39D7AC7F63D1@marvell.com \
    --to=prakity@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=tardyp@gmail.com \
    --subject='Re: [PATCH 2/3] mmc: add MMC_QUIRK_BROKEN_CLK_GATING' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).