[PATCH 1/2] [POWERPC] fsl_soc: add support for "fsl, soc" compatible matching
Anton Vorontsov
avorontsov at ru.mvista.com
Wed Mar 12 04:10:40 EST 2008
As we've seen, fsl,immr isn't good name for the generic purposes,
because some SOCs use ccsr term. So, for generic matching, "fsl,soc"
is used, whereas "fsl,immr" and "fsl,ccsr" is used for more specific
matching.
Signed-off-by: Anton Vorontsov <avorontsov at ru.mvista.com>
---
Documentation/powerpc/booting-without-of.txt | 20 +++++------
arch/powerpc/sysdev/fsl_soc.c | 51 +++++++++++++++-----------
2 files changed, 39 insertions(+), 32 deletions(-)
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt
index 7b4e8a7..be41a5c 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -32,7 +32,7 @@ Table of Contents
c) The /cpus/* nodes
d) the /memory node(s)
e) The /chosen node
- f) the /soc<SOCname> node
+ f) the /soc node
IV - "dtc", the device tree compiler
@@ -961,20 +961,17 @@ compatibility.
under /chosen called interrupt-controller which had a phandle value
that pointed to the main interrupt controller)
- f) the /soc<SOCname> node
+ f) the /soc node
This node is used to represent a system-on-a-chip (SOC) and must be
present if the processor is a SOC. The top-level soc node contains
- information that is global to all devices on the SOC. The node name
- should contain a unit address for the SOC, which is the base address
- of the memory-mapped register set for the SOC. The name of an soc
- node should start with "soc", and the remainder of the name should
- represent the part number for the soc. For example, the MPC8540's
- soc node would be called "soc8540".
+ information that is global to all devices on the SOC. The name of an
+ soc node should be "soc".
Required properties:
- - device_type : Should be "soc"
+ - compatible : Should be "<cpu>-<immr or ccsr>", "fsl,<immr or ccsr>",
+ "fsl,soc", "simple-bus".
- ranges : Should be defined as specified in 1) to describe the
translation of SOC addresses for memory mapped SOC registers.
- bus-frequency: Contains the bus frequency for the SOC node.
@@ -2913,11 +2910,12 @@ Note that the #address-cells and #size-cells for the SoC node
in this example have been explicitly listed; these are likely
not necessary as they are usually the same as the root node.
- soc8540 at e0000000 {
+ soc at e0000000 {
#address-cells = <1>;
#size-cells = <1>;
#interrupt-cells = <2>;
- device_type = "soc";
+ compatible = "fsl,mpc8540-ccsr", "fsl,ccsr", "fsl,soc",
+ "simple-bus";
ranges = <00000000 e0000000 00100000>
reg = <e0000000 00003000>;
bus-frequency = <0>;
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 2c5388c..7ad9bce 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -48,27 +48,31 @@ static phys_addr_t immrbase = -1;
phys_addr_t get_immrbase(void)
{
struct device_node *soc;
+ int size;
+ u32 naddr;
+ const u32 *prop;
if (immrbase != -1)
return immrbase;
- soc = of_find_node_by_type(NULL, "soc");
- if (soc) {
- int size;
- u32 naddr;
- const u32 *prop = of_get_property(soc, "#address-cells", &size);
+ soc = of_find_compatible_node(NULL, NULL, "fsl,soc");
+ if (!soc) {
+ soc = of_find_node_by_type(NULL, "soc");
+ if (!soc)
+ return immrbase;
+ }
- if (prop && size == 4)
- naddr = *prop;
- else
- naddr = 2;
+ prop = of_get_property(soc, "#address-cells", &size);
+ if (prop && size == 4)
+ naddr = *prop;
+ else
+ naddr = 2;
- prop = of_get_property(soc, "ranges", &size);
- if (prop)
- immrbase = of_translate_address(soc, prop + naddr);
+ prop = of_get_property(soc, "ranges", &size);
+ if (prop)
+ immrbase = of_translate_address(soc, prop + naddr);
- of_node_put(soc);
- }
+ of_node_put(soc);
return immrbase;
}
@@ -528,11 +532,13 @@ static int __init mpc83xx_wdt_init(void)
goto nodev;
}
- soc = of_find_node_by_type(NULL, "soc");
-
+ soc = of_find_compatible_node(NULL, NULL, "fsl,soc");
if (!soc) {
- ret = -ENODEV;
- goto nosoc;
+ soc = of_find_node_by_type(NULL, "soc");
+ if (!soc) {
+ ret = -ENODEV;
+ goto nosoc;
+ }
}
freq = of_get_property(soc, "bus-frequency", NULL);
@@ -1375,9 +1381,12 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,
const u32 *freq;
int size;
- np = of_find_node_by_type(NULL, "soc");
- if (!np)
- return -ENODEV;
+ np = of_find_compatible_node(NULL, NULL, "fsl,soc");
+ if (!np) {
+ np = of_find_node_by_type(NULL, "soc");
+ if (!np)
+ return -ENODEV;
+ }
freq = of_get_property(np, "clock-frequency", &size);
if (!freq || size != sizeof(*freq) || *freq == 0) {
--
1.5.2.2
More information about the Linuxppc-dev
mailing list