[PATCH add immr alias 1/4] powerpc: Teach get_immrbase to use immr alias if it exists.

John Rigby jrigby at freescale.com
Wed Aug 6 06:13:37 EST 2008


This will allow the eventual removal of device_type = "soc"
properties in soc nodes.

Signed-off-by: John Rigby <jrigby at freescale.com>
---
 arch/powerpc/sysdev/fsl_soc.c |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 214388e..2643395 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -45,14 +45,35 @@ extern void init_fec_ioports(struct fs_platform_info*);
 extern void init_smc_ioports(struct fs_uart_platform_info*);
 static phys_addr_t immrbase = -1;
 
+/* 
+ * Some chips call this immr some ccsr, we
+ * use the term immr for both.
+ */
 phys_addr_t get_immrbase(void)
 {
-	struct device_node *soc;
+	struct device_node *soc = NULL;
+	struct device_node *np;
+	const char *path;
+
 
 	if (immrbase != -1)
 		return immrbase;
 
-	soc = of_find_node_by_type(NULL, "soc");
+	/*
+	 * First look for an immr alias
+	 */
+	np = of_find_node_by_name(NULL, "/aliases");
+	if (np) {
+		path = of_get_property(np, "immr", NULL);
+		if (path)
+			soc = of_find_node_by_name(NULL, path);
+	}
+	/*
+	 * If no immr alias then fall back to finding
+	 * it by device_type
+	 */
+	if (!soc)
+		soc = of_find_node_by_type(NULL, "soc");
 	if (soc) {
 		int size;
 		u32 naddr;
-- 





More information about the Linuxppc-dev mailing list