All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Gregory CLEMENT <gregory.clement@free-electrons.com>
Cc: Lior Amsalem <alior@marvell.com>, Andrew Lunn <andrew@lunn.ch>,
	Ike Pan <ike.pan@canonical.com>,
	Will Deacon <will.deacon@arm.com>,
	Nadav Haklai <nadavh@marvell.com>,
	Ian Molton <ian.molton@codethink.co.uk>,
	David Marlin <dmarlin@redhat.com>,
	Yehuda Yitschak <yehuday@marvell.com>,
	Jani Monoses <jani.monoses@canonical.com>,
	Russell King <linux@arm.linux.org.uk>,
	Tawfik Bayouk <tawfik@marvell.com>,
	Dan Frazier <dann.frazier@canonical.com>,
	Eran Ben-Avi <benavi@marvell.com>, Li Li <li.li@canonical.com>,
	Leif Lindholm <leif.lindholm@arm.com>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
	Jason Cooper <jason@lakedaemon.net>,
	Arnd Bergmann <arnd@arndb.de>, Jon Masters <jcm@redhat.com>,
	devicetree-discuss@lists.ozlabs.org,
	Rob Herring <rob.herring@calxeda.com>,
	Ben Dooks <ben-linux@fluff.org>,
	Mike Turquette <mturquette@linaro.org>,
	linux-arm-kernel@lists.infradead.or
Subject: Re: [PATCH 5/5] arm: mvebu: Added SMP support for Armada XP
Date: Tue, 23 Oct 2012 11:30:29 +0200	[thread overview]
Message-ID: <20121023093029.GY11837@lunn.ch> (raw)
In-Reply-To: <50865F59.8000507@free-electrons.com>

On Tue, Oct 23, 2012 at 11:11:53AM +0200, Gregory CLEMENT wrote:
> On 10/22/2012 08:45 PM, Andrew Lunn wrote:
> > Hi Gregory
> > 
> >> +void __init set_secondary_cpus_clock(void)
> >> +{
> >> +	int cpu;
> >> +	unsigned long rate;
> >> +	struct clk *cpu_clk = NULL;
> >> +	struct device_node *np = NULL;
> >> +
> >> +	cpu = smp_processor_id();
> >> +	np = of_find_node_by_type(np, "cpu");
> >> +	np = NULL;
> >> +	while ((np = of_find_node_by_type(np, "cpu"))) {
> >> +		const u32 *reg;
> >> +		int len;
> >> +		reg = of_get_property(np, "reg", &len);
> >> +		if (!reg || len != 4) {
> >> +			pr_err("%s missing reg property\n", np->full_name);
> >> +			continue;
> >> +		}
> >> +		if (be32_to_cpup(reg) == cpu) {
> >> +			cpu_clk = of_clk_get(np, 0);
> >> +			break;
> >> +		}
> >> +	}
> >> +	WARN_ON(IS_ERR(cpu_clk));
> >> +	rate = clk_get_rate(cpu_clk);
> >> +
> >> +	/* set all the other CPU clk to the same rate than the boot CPU */
> >> +	np = NULL;
> >> +	while ((np = of_find_node_by_type(np, "cpu"))) {
> >> +		const u32 *reg;
> >> +		int len;
> >> +		reg = of_get_property(np, "reg", &len);
> >> +		if (!reg || len != 4) {
> >> +			pr_err("%s missing reg property\n", np->full_name);
> >> +			continue;
> >> +		}
> >> +		if (be32_to_cpup(reg) != cpu) {
> >> +			cpu_clk = of_clk_get(np, 0);
> >> +			clk_set_rate(cpu_clk, rate);
> >> +		}
> > 
> > Maybe its hiding somewhere, but where is the clk_prepare_enable() for
> > this cpu_clk clock?
> > 
> 
> Well the clocks are always enable. In the clock framework, the cpu clocks
> don't provide an enable function.

Is it possible in the hardware to disable them? Turning them off might
save some power. If these chips end up in some data center server, it
might be that CPU hotplugging is used.

> But maybe it is cleaner to call clk_prepare_enable() even if it does
> nothing except update the usage count.

You also have to watch out for the late_initcall which will disable
all clocks which are running but nobody has claimed. This will become
an issue if you do have enable/disable function in later versions of
the clock functions.

	Andrew

WARNING: multiple messages have this Message-ID (diff)
From: andrew@lunn.ch (Andrew Lunn)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/5] arm: mvebu: Added SMP support for Armada XP
Date: Tue, 23 Oct 2012 11:30:29 +0200	[thread overview]
Message-ID: <20121023093029.GY11837@lunn.ch> (raw)
In-Reply-To: <50865F59.8000507@free-electrons.com>

On Tue, Oct 23, 2012 at 11:11:53AM +0200, Gregory CLEMENT wrote:
> On 10/22/2012 08:45 PM, Andrew Lunn wrote:
> > Hi Gregory
> > 
> >> +void __init set_secondary_cpus_clock(void)
> >> +{
> >> +	int cpu;
> >> +	unsigned long rate;
> >> +	struct clk *cpu_clk = NULL;
> >> +	struct device_node *np = NULL;
> >> +
> >> +	cpu = smp_processor_id();
> >> +	np = of_find_node_by_type(np, "cpu");
> >> +	np = NULL;
> >> +	while ((np = of_find_node_by_type(np, "cpu"))) {
> >> +		const u32 *reg;
> >> +		int len;
> >> +		reg = of_get_property(np, "reg", &len);
> >> +		if (!reg || len != 4) {
> >> +			pr_err("%s missing reg property\n", np->full_name);
> >> +			continue;
> >> +		}
> >> +		if (be32_to_cpup(reg) == cpu) {
> >> +			cpu_clk = of_clk_get(np, 0);
> >> +			break;
> >> +		}
> >> +	}
> >> +	WARN_ON(IS_ERR(cpu_clk));
> >> +	rate = clk_get_rate(cpu_clk);
> >> +
> >> +	/* set all the other CPU clk to the same rate than the boot CPU */
> >> +	np = NULL;
> >> +	while ((np = of_find_node_by_type(np, "cpu"))) {
> >> +		const u32 *reg;
> >> +		int len;
> >> +		reg = of_get_property(np, "reg", &len);
> >> +		if (!reg || len != 4) {
> >> +			pr_err("%s missing reg property\n", np->full_name);
> >> +			continue;
> >> +		}
> >> +		if (be32_to_cpup(reg) != cpu) {
> >> +			cpu_clk = of_clk_get(np, 0);
> >> +			clk_set_rate(cpu_clk, rate);
> >> +		}
> > 
> > Maybe its hiding somewhere, but where is the clk_prepare_enable() for
> > this cpu_clk clock?
> > 
> 
> Well the clocks are always enable. In the clock framework, the cpu clocks
> don't provide an enable function.

Is it possible in the hardware to disable them? Turning them off might
save some power. If these chips end up in some data center server, it
might be that CPU hotplugging is used.

> But maybe it is cleaner to call clk_prepare_enable() even if it does
> nothing except update the usage count.

You also have to watch out for the late_initcall which will disable
all clocks which are running but nobody has claimed. This will become
an issue if you do have enable/disable function in later versions of
the clock functions.

	Andrew

  reply	other threads:[~2012-10-23  9:30 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-22 17:02 [PATCH 0/5] SMP support for Armada XP Gregory CLEMENT
2012-10-22 17:02 ` Gregory CLEMENT
2012-10-22 17:02 ` [PATCH 1/5] arm: mvebu: Added support for coherency fabric in mach-mvebu Gregory CLEMENT
2012-10-22 17:02   ` Gregory CLEMENT
2012-10-22 17:02 ` [PATCH 2/5] arm: mvebu: Added initial support for power managmement service unit Gregory CLEMENT
2012-10-22 17:02   ` Gregory CLEMENT
2012-10-22 17:02 ` [PATCH 3/5] arm: mvebu: Added IPI support via doorbells Gregory CLEMENT
2012-10-22 17:02   ` Gregory CLEMENT
2012-10-22 17:30   ` Andrew Lunn
2012-10-22 17:30     ` Andrew Lunn
2012-10-22 19:07     ` Gregory CLEMENT
2012-10-22 19:07       ` Gregory CLEMENT
2012-10-22 20:07       ` Andrew Lunn
2012-10-22 20:07         ` Andrew Lunn
2012-10-22 21:11         ` Gregory CLEMENT
2012-10-22 21:11           ` Gregory CLEMENT
2012-10-23  5:14           ` Thomas Petazzoni
2012-10-23  5:14             ` Thomas Petazzoni
2012-10-23  5:44             ` Andrew Lunn
2012-10-23  5:44               ` Andrew Lunn
2012-10-23  5:50               ` Thomas Petazzoni
2012-10-23  5:50                 ` Thomas Petazzoni
2012-10-22 17:02 ` [PATCH 4/5] arm: mm: Added support for PJ4B cpu and init routines Gregory CLEMENT
2012-10-22 17:02   ` Gregory CLEMENT
2012-10-22 17:02 ` [PATCH 5/5] arm: mvebu: Added SMP support for Armada XP Gregory CLEMENT
2012-10-22 17:02   ` Gregory CLEMENT
2012-10-22 18:45   ` Andrew Lunn
2012-10-22 18:45     ` Andrew Lunn
2012-10-23  9:11     ` Gregory CLEMENT
2012-10-23  9:11       ` Gregory CLEMENT
2012-10-23  9:30       ` Andrew Lunn [this message]
2012-10-23  9:30         ` Andrew Lunn
2012-10-23 10:43         ` Gregory CLEMENT
2012-10-23 10:43           ` Gregory CLEMENT

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=20121023093029.GY11837@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=alior@marvell.com \
    --cc=arnd@arndb.de \
    --cc=ben-linux@fluff.org \
    --cc=benavi@marvell.com \
    --cc=dann.frazier@canonical.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=dmarlin@redhat.com \
    --cc=gregory.clement@free-electrons.com \
    --cc=ian.molton@codethink.co.uk \
    --cc=ike.pan@canonical.com \
    --cc=jani.monoses@canonical.com \
    --cc=jason@lakedaemon.net \
    --cc=jcm@redhat.com \
    --cc=leif.lindholm@arm.com \
    --cc=li.li@canonical.com \
    --cc=linux-arm-kernel@lists.infradead.or \
    --cc=linux@arm.linux.org.uk \
    --cc=mturquette@linaro.org \
    --cc=nadavh@marvell.com \
    --cc=rob.herring@calxeda.com \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=tawfik@marvell.com \
    --cc=will.deacon@arm.com \
    --cc=yehuday@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.