From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 1/4] dt: early platform devices support
Date: Mon, 27 Jun 2011 10:54:30 +0100 [thread overview]
Message-ID: <4E085356.7060407@arm.com> (raw)
In-Reply-To: <20110625204435.GA15026@ponder.secretlab.ca>
On 25/06/11 21:44, Grant Likely wrote:
> On Sat, Jun 25, 2011 at 12:11:42PM +0100, Marc Zyngier wrote:
>> On Fri, 24 Jun 2011 22:49:56 -0600
>> The current ARM code relies on the timers *not* being a standard
>> device, and being directly setup by an board specific method. The SMP
>> timers are even worse, as they are directly called by the core code,
>> meaning that we can only have *one* implementation at a time in the
>> kernel.
>>
>> So the early platform stuff is a potential solution for that, though
>> there is no way it would handle any kind of dependency. What I dream of
>> is to have the full device/driver infrastructure available much
>> earlier, before the rest of the kernel starts relying on some hardware
>> being up and running...
>
> My suggestion: don't use platform_device for this. I think it is
> entirely the wrong model. Keep the timers *not* standard devices.
>
> Instead, use a timer setup function that accepts a list of compatible
> properties and an initialization hook for each timer type. Since
> timers have exist, have to be called by core code, and cannot ever be
> built as modules, the Linux device model really doesn't offer much
> advantage.
>
> It is completely valid and often done to access device tree data from
> early setup code without any context of a struct device.
Grant,
There's a few conflicting aspects we need to reconcile here:
- We want to keep the early setup code as simple as possible so it
doesn't rely on anything (well, as little as possible)
- We want to move driver code out of arch/arm (they often are generic,
not specific to a particular architecture)
- We want to support DT and non-DT in a similar way (some ARM platforms
will never see a DT port)
If I follow your advice, I end up with something like the following
thing in the core code:
extern int timerx_probe(struct of_device_id *id);
struct of_device_id timerx_ids[] = {
...
};
extern int timery_probe(struct of_device_id *id);
struct of_device_id timery_ids[] = {
...
};
extern int timerz_probe(struct of_device_id *id);
struct of_device_id timerz_ids[] = {
...
};
struct arm_timer_probe {
struct of_device_if **ids;
int (*probe)(struct of_device_id *);
};
struct arm_timer_probe arm_timer_probe_list[] = {
{ .ids = timerx_ids, probe = timerx_probe, },
{ .ids = timery_ids, probe = timery_probe, },
{ .ids = timerz_ids, probe = timerz_probe, },
{ },
};
... with some additional #ifdef-ery to make that work. This could solve
the first two points above, though each timer_probe function has to
parse the tree itself to gather resources (code duplication).
If you add the non-DT support in the picture, you get an additional,
completely separate code path, where the platform code directly calls
into the driver code, each platform inventing its own stuff. Again.
I think we all agree that early_platform_device are distasteful. They
abuse the platform_device and command line. They give you a false sense
of infrastructure.
But they also offer you:
- a clean separation between core code and drivers, with a standardized
interface
- drivers shared across architectures (sh & shmobile, for example)
- use of common code (fetching resources from DT)
- a relative independence from the level of DT support (the driver only
knows about platform devices).
If there are issues in the early platform stuff, I'd rather tackle them
instead of just inventing yet another custom mechanism. And if we decide
that it is terminally broken, I hope we can agree on something generic
enough to satisfy the above requirements.
Cheers,
M.
--
Jazz is not dead. It just smells funny...
next prev parent reply other threads:[~2011-06-27 9:54 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-24 14:10 [RFC PATCH 0/4] DT support for ARM GIC and TWD Marc Zyngier
2011-06-24 14:10 ` [RFC PATCH 1/4] dt: early platform devices support Marc Zyngier
2011-06-25 4:49 ` Grant Likely
2011-06-25 11:11 ` Marc Zyngier
2011-06-25 20:44 ` Grant Likely
2011-06-27 9:54 ` Marc Zyngier [this message]
2011-06-24 14:10 ` [RFC PATCH 2/4] ARM: dt: register local timers as early platform devices Marc Zyngier
2011-06-25 20:47 ` Grant Likely
2011-06-25 21:20 ` Rob Herring
2011-06-26 7:00 ` Grant Likely
[not found] ` <4E0786FF.9010002@firmworks.com>
2011-06-26 21:24 ` "Early" devices and the DT glikely@secretlab.ca
2011-06-24 14:10 ` [RFC PATCH 3/4] ARM: dt: add GIC bindings and driver support Marc Zyngier
2011-06-26 8:01 ` Grant Likely
2011-06-27 10:27 ` Marc Zyngier
2011-06-27 15:02 ` Grant Likely
2011-06-24 14:10 ` [RFC PATCH 4/4] ARM: dt: Add TWD " Marc Zyngier
2011-06-26 8:09 ` Grant Likely
2011-06-27 10:39 ` Marc Zyngier
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=4E085356.7060407@arm.com \
--to=marc.zyngier@arm.com \
--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).