]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
of: Allow busses with #size-cells=0
authorStephen Warren <swarren@nvidia.com>
Wed, 25 Jul 2012 23:34:37 +0000 (17:34 -0600)
committerRob Herring <rob.herring@calxeda.com>
Fri, 3 Aug 2012 13:01:46 +0000 (08:01 -0500)
commit5d61b165c892853f2daf6220d2ec6577487e273a
tree3bcff9b185383c768b702461c1194cb8eb9d0002
parent0d7614f09c1ebdbaa1599a5aba7593f147bf96ee
of: Allow busses with #size-cells=0

It's quite legitimate for a DT node to specify #size-cells=0. One example
is a node that's used to collect a number of non-memory-mapped devices.
In that scenario, there may be multiple child nodes with the same name
(type) thus necessitating the use of unit addresses in node names, and
reg properties:

/ {
regulators {
compatible = "simple-bus";
#address-cells = <1>;
#size-cells = <0>;

regulator@0 {
compatible = "regulator-fixed";
reg = <0>;
...
};

regulator@1 {
compatible = "regulator-fixed";
reg = <1>;
...
};

...
};
};

However, #size-cells=0 prevents translation of reg property values into
the parent node's address space. In turn, this triggers the kernel to
emit error messages during boot, such as:

    prom_parse: Bad cell count for /regulators/regulator@0

To prevent printing these error messages for legitimate DT content, a
number of changes are made:

1) of_get_address()/of_get_pci_address() are modified only to validate
   the value of #address-cells, and not #size-cells.

2) of_can_translate_address() is added to indicate whether address
   translation is possible.

3) of_device_make_bus_id() is modified to name devices based on the
   translated address only where possible, and otherwise fall back to
   using the (first cell of the) raw untranslated address.

4) of_device_alloc() is modified to create memory resources for a device
   only if the address can be translated into the CPU's address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
drivers/of/address.c
drivers/of/platform.c
include/linux/of_address.h