* machine_is_dt() ?
@ 2013-01-06 13:18 Andrew Lunn
[not found] ` <20130106131805.GQ17242-g2DYL2Zd6BY@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2013-01-06 13:18 UTC (permalink / raw)
To: linux ARM, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
Hi Folks
I'm moving the cpuidle code for Kirkwood into drivers/cpuidle. I'm
following the way cpuidle-calxeda.c instantiates the driver, it uses
module_init(calxeda_cpuidle_init) and calxeda_cpuidle_init() uses
of_machine_is_compatible("calxeda,highbank") so only loading the
driver in a ARCH_MULTIPLATFORM kernel when needed.
I can follow this model for when kirkwood is booted using device
tree. However, i would also like to use the driver for those boards
which are not yet converted to DT. In that situation, we have a kernel
dedicate to kirkwood and the cpuidle driver is always relevant.
Thus i need to code something like:
(of_machine_is_compatible("marvell, kirkwood") ||
!machine_is_dt())
However, there is no macro machine_is_dt().
Is there a way to tell if a machine has been booted using a machine
number as opposed to DT?
Thanks
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: machine_is_dt() ?
[not found] ` <20130106131805.GQ17242-g2DYL2Zd6BY@public.gmane.org>
@ 2013-01-06 13:41 ` Russell King - ARM Linux
[not found] ` <20130106134113.GD2631-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2013-01-08 0:48 ` Shawn Guo
1 sibling, 1 reply; 6+ messages in thread
From: Russell King - ARM Linux @ 2013-01-06 13:41 UTC (permalink / raw)
To: Andrew Lunn; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linux ARM
On Sun, Jan 06, 2013 at 02:18:05PM +0100, Andrew Lunn wrote:
> I'm moving the cpuidle code for Kirkwood into drivers/cpuidle. I'm
> following the way cpuidle-calxeda.c instantiates the driver, it uses
> module_init(calxeda_cpuidle_init) and calxeda_cpuidle_init() uses
> of_machine_is_compatible("calxeda,highbank") so only loading the
> driver in a ARCH_MULTIPLATFORM kernel when needed.
>
> I can follow this model for when kirkwood is booted using device
> tree. However, i would also like to use the driver for those boards
> which are not yet converted to DT. In that situation, we have a kernel
> dedicate to kirkwood and the cpuidle driver is always relevant.
>
> Thus i need to code something like:
>
> (of_machine_is_compatible("marvell, kirkwood") ||
> !machine_is_dt())
>
> However, there is no macro machine_is_dt().
>
> Is there a way to tell if a machine has been booted using a machine
> number as opposed to DT?
This doesn't seem to me to be the right way to deal with this. What
you're suggesting would mean that if you built a multiplatform kernel
which included this driver, and booted it on a non-DT platform, you'd
have this driver registered.
It looks to me like many of the CPUFREQ drivers just register themselves
if they've been built into the kernel. No one's thought about making
them platform drivers or similar, so the current "if it's built-in, then
we use it" approach seems to have persisted. As many of them are
initialized via a late_initcall(), I don't see any problem with them
being platform drivers, which will solve the problem in a way that's
well established.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: machine_is_dt() ?
[not found] ` <20130106134113.GD2631-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
@ 2013-01-06 14:08 ` Andrew Lunn
[not found] ` <20130106140821.GR17242-g2DYL2Zd6BY@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2013-01-06 14:08 UTC (permalink / raw)
To: Russell King - ARM Linux
Cc: Andrew Lunn, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linux ARM
On Sun, Jan 06, 2013 at 01:41:13PM +0000, Russell King - ARM Linux wrote:
> On Sun, Jan 06, 2013 at 02:18:05PM +0100, Andrew Lunn wrote:
> > I'm moving the cpuidle code for Kirkwood into drivers/cpuidle. I'm
> > following the way cpuidle-calxeda.c instantiates the driver, it uses
> > module_init(calxeda_cpuidle_init) and calxeda_cpuidle_init() uses
> > of_machine_is_compatible("calxeda,highbank") so only loading the
> > driver in a ARCH_MULTIPLATFORM kernel when needed.
> >
> > I can follow this model for when kirkwood is booted using device
> > tree. However, i would also like to use the driver for those boards
> > which are not yet converted to DT. In that situation, we have a kernel
> > dedicate to kirkwood and the cpuidle driver is always relevant.
> >
> > Thus i need to code something like:
> >
> > (of_machine_is_compatible("marvell, kirkwood") ||
> > !machine_is_dt())
> >
> > However, there is no macro machine_is_dt().
> >
> > Is there a way to tell if a machine has been booted using a machine
> > number as opposed to DT?
>
> This doesn't seem to me to be the right way to deal with this. What
> you're suggesting would mean that if you built a multiplatform kernel
> which included this driver, and booted it on a non-DT platform, you'd
> have this driver registered.
Hi Russel
Yes, not what i want. I would need to limit it further to non-DT
platform on Kirkwood.
> It looks to me like many of the CPUFREQ drivers just register themselves
> if they've been built into the kernel. No one's thought about making
> them platform drivers or similar, so the current "if it's built-in, then
> we use it" approach seems to have persisted. As many of them are
> initialized via a late_initcall(), I don't see any problem with them
> being platform drivers, which will solve the problem in a way that's
> well established.
I actually went towards a platform driver to start with. See the
discussion here:
https://patchwork.kernel.org/patch/1915171/
About 1/2 way down, Rob Herring says:
Don't do a platform driver and just check the machine compatible
property which is what I did for highbank.
What Rob mostly seems to be objecting to is that
+ cpuidle@1418 {
+ compatible = "marvell,kirkwood-cpuidle";
+ reg = <0x1418 0x4>;
+ };
does not describe hardware, so it does not belong in DT. Hence i will
check of_machine_is_compatible() to see if its a marvell,kirkwood. But
that does not help with old style boots.
Should i make it both a platform driver for old style boots and check
of_machine_is_compatible() for DT boots?
Thanks
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: machine_is_dt() ?
[not found] ` <20130106140821.GR17242-g2DYL2Zd6BY@public.gmane.org>
@ 2013-01-07 14:59 ` Rob Herring
[not found] ` <50EAE2DD.805-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Rob Herring @ 2013-01-07 14:59 UTC (permalink / raw)
To: Andrew Lunn
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
Russell King - ARM Linux, linux ARM
On 01/06/2013 08:08 AM, Andrew Lunn wrote:
> On Sun, Jan 06, 2013 at 01:41:13PM +0000, Russell King - ARM Linux wrote:
>> On Sun, Jan 06, 2013 at 02:18:05PM +0100, Andrew Lunn wrote:
>>> I'm moving the cpuidle code for Kirkwood into drivers/cpuidle. I'm
>>> following the way cpuidle-calxeda.c instantiates the driver, it uses
>>> module_init(calxeda_cpuidle_init) and calxeda_cpuidle_init() uses
>>> of_machine_is_compatible("calxeda,highbank") so only loading the
>>> driver in a ARCH_MULTIPLATFORM kernel when needed.
>>>
>>> I can follow this model for when kirkwood is booted using device
>>> tree. However, i would also like to use the driver for those boards
>>> which are not yet converted to DT. In that situation, we have a kernel
>>> dedicate to kirkwood and the cpuidle driver is always relevant.
>>>
>>> Thus i need to code something like:
>>>
>>> (of_machine_is_compatible("marvell, kirkwood") ||
>>> !machine_is_dt())
>>>
>>> However, there is no macro machine_is_dt().
>>>
>>> Is there a way to tell if a machine has been booted using a machine
>>> number as opposed to DT?
>>
>> This doesn't seem to me to be the right way to deal with this. What
>> you're suggesting would mean that if you built a multiplatform kernel
>> which included this driver, and booted it on a non-DT platform, you'd
>> have this driver registered.
>
> Hi Russel
>
> Yes, not what i want. I would need to limit it further to non-DT
> platform on Kirkwood.
>
>> It looks to me like many of the CPUFREQ drivers just register themselves
>> if they've been built into the kernel. No one's thought about making
>> them platform drivers or similar, so the current "if it's built-in, then
>> we use it" approach seems to have persisted. As many of them are
>> initialized via a late_initcall(), I don't see any problem with them
>> being platform drivers, which will solve the problem in a way that's
>> well established.
> I actually went towards a platform driver to start with. See the
> discussion here:
>
> https://patchwork.kernel.org/patch/1915171/
>
> About 1/2 way down, Rob Herring says:
>
> Don't do a platform driver and just check the machine compatible
> property which is what I did for highbank.
>
> What Rob mostly seems to be objecting to is that
>
> + cpuidle@1418 {
> + compatible = "marvell,kirkwood-cpuidle";
> + reg = <0x1418 0x4>;
> + };
>
> does not describe hardware, so it does not belong in DT. Hence i will
> check of_machine_is_compatible() to see if its a marvell,kirkwood. But
> that does not help with old style boots.
>
> Should i make it both a platform driver for old style boots and check
> of_machine_is_compatible() for DT boots?
You could make the platform code create the platform device in the DT
case as well. Not all platform devices have to come from a DT node and
putting virtual devices in DT is wrong.
Rob
> Thanks
> Andrew
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: machine_is_dt() ?
[not found] ` <50EAE2DD.805-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2013-01-07 23:14 ` Linus Walleij
0 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2013-01-07 23:14 UTC (permalink / raw)
To: Rob Herring, Andrew Lunn
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
Russell King - ARM Linux, linux ARM
On Mon, Jan 7, 2013 at 3:59 PM, Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> You could make the platform code create the platform device in the DT
> case as well. Not all platform devices have to come from a DT node and
> putting virtual devices in DT is wrong.
For the ux500 cpufreq we do exactly this.
When the PRCMU probes in drivers/mfd/db8500-prcmu.c it spawns
a db8500-cpufreq MFD child, and the db8500-cpufreq driver then
probes as a platform device.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: machine_is_dt() ?
[not found] ` <20130106131805.GQ17242-g2DYL2Zd6BY@public.gmane.org>
2013-01-06 13:41 ` Russell King - ARM Linux
@ 2013-01-08 0:48 ` Shawn Guo
1 sibling, 0 replies; 6+ messages in thread
From: Shawn Guo @ 2013-01-08 0:48 UTC (permalink / raw)
To: Andrew Lunn; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linux ARM
On Sun, Jan 06, 2013 at 02:18:05PM +0100, Andrew Lunn wrote:
> Hi Folks
>
> I'm moving the cpuidle code for Kirkwood into drivers/cpuidle. I'm
> following the way cpuidle-calxeda.c instantiates the driver, it uses
> module_init(calxeda_cpuidle_init) and calxeda_cpuidle_init() uses
> of_machine_is_compatible("calxeda,highbank") so only loading the
> driver in a ARCH_MULTIPLATFORM kernel when needed.
A little bit off the topic, but I want to understand if moving cpuidle
driver out of arch/arm is the right direction. From what I have seen,
more or less, cpuidle drivers generally have dependency on platform
code. Looking at cpuidle-calxeda.c, I found though it does not include
any <mach/*> header, the following two extern declarations tell that
it actually needs to.
extern void highbank_set_cpu_jump(int cpu, void *jump_addr);
extern void *scu_base_addr;
Shawn
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-01-08 0:48 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-06 13:18 machine_is_dt() ? Andrew Lunn
[not found] ` <20130106131805.GQ17242-g2DYL2Zd6BY@public.gmane.org>
2013-01-06 13:41 ` Russell King - ARM Linux
[not found] ` <20130106134113.GD2631-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2013-01-06 14:08 ` Andrew Lunn
[not found] ` <20130106140821.GR17242-g2DYL2Zd6BY@public.gmane.org>
2013-01-07 14:59 ` Rob Herring
[not found] ` <50EAE2DD.805-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-01-07 23:14 ` Linus Walleij
2013-01-08 0:48 ` Shawn Guo
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).