linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: andrew@lunn.ch (Andrew Lunn)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 1/3] cpufreq: kirkwood: Add a cpufreq driver for Marvell Kirkwood SoCs
Date: Sun, 27 Jan 2013 19:20:01 +0100	[thread overview]
Message-ID: <20130127182001.GN29973@lunn.ch> (raw)
In-Reply-To: <20130127171111.GG23505@n2100.arm.linux.org.uk>

On Sun, Jan 27, 2013 at 05:11:11PM +0000, Russell King - ARM Linux wrote:
> On Sun, Jan 27, 2013 at 11:07:22AM +0100, Andrew Lunn wrote:
> > +static struct priv
> > +{
> > +	struct clk *cpu_clk;
> > +	struct clk *ddr_clk;
> > +	struct clk *powersave_clk;
> > +	struct device *dev;
> > +	void __iomem *base;
> > +} priv;
> 
> I guess you probably think that the compiler will do something special
> with this

Nope, i expect nothing at all from the compiler. I just know i need
only one of these structures so i statically allocated it. I could
allocate it dynamically, probably get the cleanup wrong in the error
path and get shouted at by Russel King. Oh well...

> > +static unsigned int kirkwood_cpufreq_get_cpu_frequency(unsigned int cpu)
> > +{
> > +	if (__clk_is_enabled(priv.powersave_clk))
> 
> This looks to me to be a layering violation.

Possibly is. Not sure. This is a gated clock, so clk_get_rate()
returns the rate of the parent clock independent of if the gated clock
is enabled or not. So that does not help me. The cpufreq driver needs
to cause a transition on this clock, either disabled->enabled, or
enabled->disabled, then do a WFI, and once the system is stable it
wakes up. If there is no transition, it was already enabled and all
that clk_enable() does is increment the count, the WFI never exits and
the system sleeps forever. I'm assuming here that no other driver is
using this clock, which i think is a sensible assumption. But i've no
idea of the initial state of the clock. Did uboot enable it or not?

Thanks
	Andrew

  parent reply	other threads:[~2013-01-27 18:20 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-27 10:07 [PATCH v3 0/3] Kirkwoode cpufreq driver Andrew Lunn
2013-01-27 10:07 ` [PATCH v3 1/3] cpufreq: kirkwood: Add a cpufreq driver for Marvell Kirkwood SoCs Andrew Lunn
2013-01-27 14:49   ` Viresh Kumar
2013-01-27 15:42     ` Andrew Lunn
2013-01-27 16:03       ` Viresh Kumar
2013-01-27 16:25         ` Andrew Lunn
2013-01-27 16:45           ` Viresh Kumar
2013-01-27 17:17             ` Andrew Lunn
2013-01-28  3:19               ` Viresh Kumar
2013-01-27 17:11   ` Russell King - ARM Linux
2013-01-27 17:23     ` Andrew Lunn
2013-01-28  6:41       ` Shawn Guo
2013-01-27 18:20     ` Andrew Lunn [this message]
2013-01-27 10:07 ` [PATCH v3 2/3] arm: kirkwood: Instantiate cpufreq driver Andrew Lunn
2013-05-26 17:59   ` Jason Cooper
2013-01-27 10:07 ` [PATCH v3 3/3] arm: kirkwood: Enable cpufreq and ondemand on kirkwood_defconfig Andrew Lunn
2013-05-26 18:02   ` Jason Cooper

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=20130127182001.GN29973@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).