diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2011-03-28 21:20:53 -0600 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2011-03-28 21:20:53 -0600 |
commit | c3cf74a53764b234937837e8be0a10cdb6d5ca40 (patch) | |
tree | 44406ac6cdfe266b58ca421c57ba6b35e9e28c2e /virt | |
parent | 3a1a90a4cf4f0870bb6ee8065092e2c0ea7d72aa (diff) |
dt: add of_platform_prepare() to match nodes with static platform_devices
This patch implements an alternate method for using device tree data
for populating machine device registration. Traditionally, board
support has directly generated and registered devices based on nodes
in the device tree. The board support code starts at the root of the
tree and begins allocating devices for each device node it finds.
Similarly, bus drivers (i2c, spi, etc.) use their child nodes to
register child devices. This model can be seen in almost all the powerpc
board ports (arch/powerpc/platforms/*).
However, for many of the ARM SoCs, there already exists complete board
support for many SoCs that have their own code for registering the
basic set of platform devices with non-trivial dependencies on clock
structure and machine specific platform code. While starting at the
base of the tree and working up is certainly possible, it requires
modifying a lot of machine support code to get it working.
This patch adds the function of_platform_prepare() to declare which
nodes will be used to create platform_devices without actually
creating them yet. Then it uses a bus notifier to inspect
platform_device registrations. If any match a node declared with
of_platform_prepare(), it will set the of_node pointer before the
device gets bound to a driver, making the device tree data available
at probe time.
After all the static devices are registered, the platform code can
still call either of_platform_populate or of_platform_bus_probe() on
the same nodes that were declared with of_platform_prepare(). Any
nodes that *were not* matched to a static platform_device will get
created in the normal way.
Note: Board ports using this facility are still required to provide a
fully populated device tree blob. It is not a shortcut to providing
an accurate device tree model of the machine to the point that it
would be reasonably possible to switch to a direct registration model
for all devices without change the device tree. ie. The SoC still
needs to be correctly identified and there should be nodes for all the
discrete devices.
v2: Complete revamp to make of_platform_populate() and
of_platform_bus_probe() respect the prepared nodes.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'virt')
0 files changed, 0 insertions, 0 deletions