public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@nokia.com>
To: Philip Rakity <prakity@marvell.com>
Cc: "linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	Chris Ball <cjb@laptop.org>
Subject: Re: sdhci: mmc:  determining card type and dynamic clocks
Date: Thu, 21 Oct 2010 15:08:45 +0300	[thread overview]
Message-ID: <4CC02D4D.8070600@nokia.com> (raw)
In-Reply-To: <AED80D39-301D-490D-8729-C2CAA765F192@marvell.com>

On 21/10/10 14:12, ext Philip Rakity wrote:
>
> Sometimes it is useful for the SD driver to know the type of card that is in use so that dynamic sd bus clocking can be enabled or disabled.
> Dynamic clocks are a feature of sd 3.0 and we can support this in our v2.0 controller.
>
> The problem is that some SDIO cards are not happy when the clocks are dynamically stopped.  I have not seen any issues with SD/mmc/eMMC cards.  I suspect the reason for the SDIO problems is that the cards need the clock since SDIO cards can interrupt the CPU for service and the other card types cannot.
>
> The information about the type of card being used is known by the mmc layer when
>
> mmc_alloc_card(struct mmc_host *host, struct device_type *type) --- core/bus.c
>
> is called but the sd driver cannot get to this information when set_ios() is called by the mmc layer since the host->card field is filled in too late.
>
> I have added host->card = card to
>
> struct mmc_card *mmc_alloc_card(struct mmc_host *host, struct device_type *type)
> {
> 	struct mmc_card *card;
>
> 	card = kzalloc(sizeof(struct mmc_card), GFP_KERNEL);
> 	if (!card)
> 		return ERR_PTR(-ENOMEM);
>
> 	card->host = host;
>
> 	device_initialize(&card->dev);
>
> 	card->dev.parent = mmc_classdev(host);
> 	card->dev.bus =&mmc_bus_type;
> 	card->dev.release = mmc_release_card;
> 	card->dev.type = type;
> +     host->card = card;
> 	return card;
> }
>
> and this works for me provided the sd driver remembers to check for card being NULL  in the driver specific set_clock code.
>
> My pseudo code is
>
> if (host->mmc->card == NULL)
>       dynamic_clocks=FALSE;
> else if host->mmc->card == MMC_TYPE_SDIO)
>      	dynamic_clocks = TRUE;
> else
>      	dynamic_clocks = FALSE;
>
>
> My question is:  Is there a better way to pass the type of card to the sd driver?
>

Have you considered passing the I/O state (dynamic clocks?) instead
of the card type?


  reply	other threads:[~2010-10-21 12:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-21 11:12 sdhci: mmc: determining card type and dynamic clocks Philip Rakity
2010-10-21 12:08 ` Adrian Hunter [this message]
2010-10-21 15:17   ` Philip Rakity
2010-10-21 16:57 ` Nicolas Pitre
2010-10-21 17:37   ` Philip Rakity
2010-10-21 18:04     ` Nicolas Pitre

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=4CC02D4D.8070600@nokia.com \
    --to=adrian.hunter@nokia.com \
    --cc=cjb@laptop.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=prakity@marvell.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox