From: Andrew Morton <akpm@linux-foundation.org>
To: Anton Vorontsov <avorontsov@mvista.com>
Cc: "Ben Dooks" <ben@simtec.co.uk>,
"Richard Röjfors" <richard.rojfors@pelagicore.com>,
linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] sdhci-pltfm: Add support for CNS3xxx SoC devices
Date: Thu, 1 Jul 2010 13:48:39 -0700 [thread overview]
Message-ID: <20100701134839.d7cb4841.akpm@linux-foundation.org> (raw)
In-Reply-To: <20100625180644.GC18241@oksana.dev.rtsoft.ru>
On Fri, 25 Jun 2010 22:06:44 +0400
Anton Vorontsov <avorontsov@mvista.com> wrote:
> There's nothing special, just SoC-specific ops and quirks.
>
> ...
>
> +static void sdhci_cns3xxx_set_clock(struct sdhci_host *host, unsigned int clock)
> +{
> + struct device *dev = mmc_dev(host->mmc);
> + int div = 1;
> + u16 clk;
> + unsigned long timeout;
> +
> + if (clock == host->clock)
> + return;
I assume that mmc core prevents this function from being exectued twice
at the same time?
> + sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
> +
> + if (clock == 0)
> + goto out;
> +
> + while (host->max_clk / div > clock) {
> + /*
> + * On CNS3xxx divider grows linearly up to 4, and then
> + * exponentially up to 256.
> + */
> + if (div < 4)
> + div += 1;
> + else if (div < 256)
> + div *= 2;
> + else
> + break;
> + }
> +
> + dev_dbg(dev, "desired SD clock: %d, actual: %d\n",
> + clock, host->max_clk / div);
> +
> + /* Divide by 3 is special. */
> + if (div != 3)
> + div >>= 1;
> +
> + clk = div << SDHCI_DIVIDER_SHIFT;
> + clk |= SDHCI_CLOCK_INT_EN;
> + sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
> +
> + timeout = 20;
> + while (!((clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL))
> + & SDHCI_CLOCK_INT_STABLE)) {
> + if (timeout == 0) {
> + dev_warn(dev, "clock is unstable");
> + break;
> + }
> + timeout--;
> + mdelay(1);
Could we have used the more polite msleep() here?
> + }
> +
> + clk |= SDHCI_CLOCK_CARD_EN;
> + sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
> +out:
> + host->clock = clock;
> +}
> +
>
> ...
>
> --- a/drivers/mmc/host/sdhci-pltfm.c
> +++ b/drivers/mmc/host/sdhci-pltfm.c
> @@ -158,6 +158,9 @@ static int __devexit sdhci_pltfm_remove(struct platform_device *pdev)
>
> static const struct platform_device_id sdhci_pltfm_ids[] = {
> { "sdhci", },
> +#ifdef CONFIG_MMC_SDHCI_CNS3XXX
> + { "sdhci-cns3xxx", (kernel_ulong_t)&sdhci_cns3xxx_pdata },
> +#endif
What the heck is this kernel_ulong_t thing and why did `struct
platform_device_id' see a need to invent it??
> { },
> };
> MODULE_DEVICE_TABLE(platform, sdhci_pltfm_ids);
>
> ...
>
next prev parent reply other threads:[~2010-07-01 20:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-25 18:05 [PATCH 0/3] Add support for CNS3xxx SDHCI hosts Anton Vorontsov
2010-06-25 18:06 ` [PATCH 1/3] sdhci-pltfm: Switch to module device table matching Anton Vorontsov
2010-06-25 18:06 ` [PATCH 2/3] sdhci-pltfm: Reorganize Makefile entries to support SoC devices Anton Vorontsov
2010-06-25 18:06 ` [PATCH 3/3] sdhci-pltfm: Add support for CNS3xxx " Anton Vorontsov
2010-07-01 20:48 ` Andrew Morton [this message]
2010-07-08 15:36 ` Anton Vorontsov
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=20100701134839.d7cb4841.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=avorontsov@mvista.com \
--cc=ben@simtec.co.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=richard.rojfors@pelagicore.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;
as well as URLs for NNTP newsgroup(s).