From: "Chaithrika U S" <chaithrika@ti.com>
To: "'Linus Walleij'" <linus.ml.walleij@gmail.com>
Cc: <linux-kernel@vger.kernel.org>, <akpm@linux-foundation.org>,
<davinci-linux-open-source@linux.davincidsp.com>,
<vipin.bhandari@ti.com>, <khilman@deeprootsystems.com>
Subject: RE: [PATCH] davinci: MMC: add cpufreq support
Date: Wed, 21 Oct 2009 14:15:58 +0530 [thread overview]
Message-ID: <029801ca522a$e8dd1ef0$ba975cd0$@com> (raw)
In-Reply-To: <63386a3d0910201514r2680bbeei13a770a3d7e4a323@mail.gmail.com>
On Wed, Oct 21, 2009 at 03:44:51, Linus Walleij wrote:
> 2009/10/20 Chaithrika U S <chaithrika@ti.com>:
>
> > Add cpufreq support to MMC driver. The clock divider value has to be
> > modified according to the controller input frequency.
> > (...)
> > @@ -1040,6 +1052,52 @@ static struct mmc_host_ops mmc_davinci_ops = {
> >
> > /*----------------------------------------------------------------------*/
> >
> > +#ifdef CONFIG_CPU_FREQ
> > +static int mmc_davinci_cpufreq_transition(struct notifier_block *nb,
> > + unsigned long val, void *data)
> > +{
> > + struct mmc_davinci_host *host;
> > + unsigned int mmc_pclk;
> > + struct mmc_host *mmc;
> > + unsigned long flags;
> > +
> > + host = container_of(nb, struct mmc_davinci_host, freq_transition);
> > + mmc = host->mmc;
> > + mmc_pclk = clk_get_rate(host->clk);
> > +
> > + if (val == CPUFREQ_POSTCHANGE) {
> > + spin_lock_irqsave(&mmc->lock, flags);
> > + host->mmc_input_clk = mmc_pclk;
> > + calculate_clk_divider(mmc, &mmc->ios);
> > + spin_unlock_irqrestore(&mmc->lock, flags);
> > + }
> > +
> > + return 0;
> > +}
>
> Now the way I understand it CPUfreq is about rising/lowering the
> frequency of the *CPU* when the load of the system goes up/down.
>
> I highly suspect that there is no general rule that davinci's host->clk
> will actually change just because the CPU changes frequency?
>
In this case, the PLL controller which supplies clock to the CPU also
provides clock to the MMC/SD peripheral. Hence, the host->clk changes
with the CPU frequency changes.
> I don't know enough about davinci to tell but I suspect there are
> system-wide operating points hidden behind this and CPUfreq
> is being (ab)used for changing and notifying the system frequency
> overall. Some of these transitions include changing the MMC clock
> so if you simply broadcast them all?
>
> I really believe this is just masking the problem that the clk
> framework need support of real clk notifiers that can notify clk
> users pre/post a clk change. This is really what you want for a
> driver like this.
>
> Now I don't know the davinci consensus around these things,
> do you always use CPUfreq like this, for changing frequencies
> of clocks that are not CPU clocks at all?
>
In the case where the module clock is dependent on CPU clock, cpufreq
is used to adjust the peripheral clock based on the CPU clock. Similar
implementation is present in Samsung S3C MCI driver too.
> I have similar code boiling for the MMCI/PL180 PrimeCell but
> I just cannot submit that because the PrimeCell is generic and
> there is no way I can implicitly correlate the CPU clk with the
> MMCI host clk like this, so I have to wait for real clock notifiers
> (or implement them myself...)
>
> Linus Walleij
>
>
Regards,
Chaithrika
next prev parent reply other threads:[~2009-10-21 8:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-20 12:10 [PATCH] davinci: MMC: add cpufreq support Chaithrika U S
2009-10-20 22:14 ` Linus Walleij
2009-10-21 8:45 ` Chaithrika U S [this message]
2009-11-04 4:22 ` Chaithrika U S
2009-11-24 4:33 ` Chaithrika U S
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='029801ca522a$e8dd1ef0$ba975cd0$@com' \
--to=chaithrika@ti.com \
--cc=akpm@linux-foundation.org \
--cc=davinci-linux-open-source@linux.davincidsp.com \
--cc=khilman@deeprootsystems.com \
--cc=linus.ml.walleij@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=vipin.bhandari@ti.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