From: Adrian Hunter <adrian.hunter@nokia.com>
To: Philip Rakity <prakity@marvell.com>
Cc: Wolfram Sang <w.sang@pengutronix.de>,
"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
Mark Brown <markb@marvell.com>
Subject: Re: [PATCH] sdhci: allow for eMMC 74 clock generation by controller
Date: Wed, 22 Sep 2010 10:57:28 +0300 [thread overview]
Message-ID: <4C99B6E8.2050008@nokia.com> (raw)
In-Reply-To: <F0EF1C13-8902-4839-9D76-C3045018660E@marvell.com>
On 21/09/10 18:06, Philip Rakity wrote:
>
> Our hardware needs to be programmed to handle this case. The host-ops option is only needed from h/w that does not handle this.
>
> If you can suggest a way to do this in the mmc layer I would welcome implementing it.
No, I misunderstood sorry :(. The 74-clocks requirement is standard and
drivers handle it via set_ios.
>
> I looked and the solution requires a call into the driver from the mmc layer after the all setting POWER_ON call. This was more intrusive than doing it in the driver but if you think this makes sense I can do a patch for that.
>
> eg
>
> /*
> * Apply power to the MMC stack. This is a two-stage process.
> * First, we enable power to the card without the clock running.
> * We then wait a bit for the power to stabilise. Finally,
> * enable the bus drivers and clock to the card.
> *
> * We must _NOT_ enable the clock prior to power stablising.
> *
> * If a host does all the power sequencing itself, ignore the
> * initial MMC_POWER_UP stage.
> */
> static void mmc_power_up(struct mmc_host *host)
> {
> int bit = fls(host->ocr_avail) - 1;
>
> host->ios.vdd = bit;
> if (mmc_host_is_spi(host)) {
> host->ios.chip_select = MMC_CS_HIGH;
> host->ios.bus_mode = MMC_BUSMODE_PUSHPULL;
> } else {
> host->ios.chip_select = MMC_CS_DONTCARE;
> host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN;
> }
> host->ios.power_mode = MMC_POWER_UP;
> host->ios.bus_width = MMC_BUS_WIDTH_1;
> host->ios.timing = MMC_TIMING_LEGACY;
> mmc_set_ios(host);
>
> /* CALL INTO DRIVER HERE TO SEND 74 CLOCKS */<==========
> Philip
>
>
> On Sep 20, 2010, at 11:04 PM, Adrian Hunter wrote:
>
>> On 21/09/10 08:43, ext Philip Rakity wrote:
>>>
>>> Wolfram,
>>>
>>> I generated the patch for eMMC 74 clocks. I do not know if you want to incorporate into your submission or let it stand on its own.
>>
>> Wouldn't it be better to fix it in MMC core rather than duplicate it in every driver?
>>
>>>
>>> regards,
>>>
>>> Philip
>>>
>>>
>>>
>>> From: Philip Rakity<prakity@marvell.com>
>>> Subject: [PATCH] sdhci: allow for eMMC 74 clock generation by controller
>>> Signed-off-by: Philip Rakity<prakity@marvell.com>
>>>
>>> Patch is below and sample usage in sdhci-xxxx.c adaption code is below.
>>>
>>> /*
>>> * eMMC spec calls for the host to send 74 clocks to the card
>>> * during initialization, right after voltage stabilization.
>>> * create the clocks manually right here.
>>> */
>>> void generate_init_clocks_A0(struct sdhci_host *host, u8 power_mode)
>>> {
>>> struct sdhci_mmc_slot *slot = sdhci_priv(host);
>>>
>>> DBG ("%s: ENTER %s: slot->power_mode = %d, ios->power_mode = %d\n",
>>> __func__,
>>> mmc_hostname(host->mmc),
>>> slot->power_mode,
>>> power_mode);
>>>
>>> if (slot->power_mode == MMC_POWER_UP
>>> && power_mode == MMC_POWER_ON) {
>>>
>>> /* controller specific code here */
>>> /* slot->power_mode holds previous power setting */
>>>
>>> }
>>> slot->power_mode = power_mode;
>>> }
>>>
>>>
>>>
>>> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
>>> index 401527d..6aadd0f 100644
>>> --- a/drivers/mmc/host/sdhci.c
>>> +++ b/drivers/mmc/host/sdhci.c
>>> @@ -1168,6 +1168,9 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>>> else
>>> sdhci_set_power(host, ios->vdd);
>>>
>>> + if (host->ops->platform_generate_initial_74_clocks)
>>> + host->ops->platform_generate_initial_74_clocks(host, ios->power_mode);
>>> +
>>> ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
>>>
>>> if (ios->bus_width == MMC_BUS_WIDTH_8)
>>> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
>>> index d316bc7..70c5806 100644
>>> --- a/drivers/mmc/host/sdhci.h
>>> +++ b/drivers/mmc/host/sdhci.h
>>> @@ -323,6 +323,8 @@ struct sdhci_ops {
>>> unsigned int (*get_max_clock)(struct sdhci_host *host);
>>> unsigned int (*get_min_clock)(struct sdhci_host *host);
>>> unsigned int (*get_timeout_clock)(struct sdhci_host *host);
>>> + void (*platform_generate_initial_74_clocks)(struct sdhci_host *host,
>>> + u8 power_mode);
>>> };
>>>
>>> #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
>>>
>>> --
>>> 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
>>>
>>
>
>
next prev parent reply other threads:[~2010-09-22 7:57 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-12 5:17 RE: Bug in mmc.c == stops eMMC toshiba from working - sector check not good (PATCH) Philip Rakity
2010-03-13 5:09 ` Patch: eMMC boot partition needs to be deactivated for linux to find user partitions Philip Rakity
2010-03-15 8:08 ` Adrian Hunter
2010-03-15 18:32 ` Features vs versions (Was: Patch: eMMC boot partition needs to be deactivated for linux to find user partitions) Edward Falk
2010-03-15 18:54 ` Johnson, Charles F
2010-03-16 1:44 ` Patch: eMMC boot partition needs to be deactivated for linux to find user partitions Philip Rakity
2010-03-20 5:12 ` Philip Rakity
2010-03-22 8:25 ` Adrian Hunter
[not found] ` <639D1595-D908-473C-9A41-71B493DCD0C0@marvell.com>
2010-03-29 7:12 ` Adrian Hunter
2010-09-19 21:46 ` [PATCH] sdhci: add quirk for controllers that don't support write only detect Philip Rakity
2010-09-20 6:14 ` Wolfram Sang
2010-09-20 16:00 ` Philip Rakity
2010-09-21 5:43 ` [PATCH] sdhci: allow for eMMC 74 clock generation by controller Philip Rakity
2010-09-21 6:04 ` Adrian Hunter
2010-09-21 15:06 ` Philip Rakity
2010-09-21 16:58 ` Wolfram Sang
[not found] ` <15EE115E-4B8A-4314-BD7A-3FB24A1F1BB6@marvell.com>
2010-09-22 8:56 ` Wolfram Sang
2010-09-22 7:57 ` Adrian Hunter [this message]
2010-09-22 22:25 ` [PATCH] sdhci: print out controller name for register debug Philip Rakity
2010-09-22 23:08 ` Chris Ball
2010-09-23 8:39 ` Wolfram Sang
2010-09-23 16:12 ` Chris Ball
2010-09-23 17:11 ` Wolfram Sang
2010-09-21 6:48 ` [PATCH] sdhci: allow for eMMC 74 clock generation by controller Wolfram Sang
2010-09-23 15:24 ` Philip Rakity
2010-09-23 15:49 ` Subject: [PATCH] sdhci: Show SD Command when doing debug printks Philip Rakity
2010-10-07 23:58 ` [PATCH] sdhci: allow for eMMC 74 clock generation by controller Chris Ball
[not found] ` <763CD352-8557-46F1-89D6-5596C40C435E@marvell.com>
2010-09-24 4:49 ` [PATCH] sdhci: add quirk for controllers that don't support write only detect Wolfram Sang
2010-09-24 9:34 ` Philip Rakity
2010-03-16 20:25 ` Bug in mmc.c == stops eMMC toshiba from working - sector check not good (REPOST) (PATCH) Philip Rakity
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=4C99B6E8.2050008@nokia.com \
--to=adrian.hunter@nokia.com \
--cc=linux-mmc@vger.kernel.org \
--cc=markb@marvell.com \
--cc=prakity@marvell.com \
--cc=w.sang@pengutronix.de \
/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