[PATCH 1/2] 83xx: ioremap() the entire IMMR for misc register blocks.
From: Scott Wood <hidden>
Date: 2007-02-05 20:43:51
Rather than add each component of the IMMR to the device tree as a separate device, the entire IMMR is made available for code which wants to access registers at known locations. This is intended to be used for simple things are very unlikely to be moved or duplicated, such as reset registers. To avoid accidentally touching another soc family in the event that support for multiple families is built into the kernel (at some future date where that is supported), a compatible property is added to the device tree soc node. Signed-off-by: Scott Wood <redacted> --- arch/powerpc/boot/dts/mpc8349emds.dts | 1 + arch/powerpc/boot/dts/mpc8349emitx.dts | 1 + arch/powerpc/boot/dts/mpc8360emds.dts | 1 + arch/powerpc/sysdev/fsl_soc.c | 29 +++++++++++++++++++++++++++++ arch/powerpc/sysdev/fsl_soc.h | 3 +++ 5 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/boot/dts/mpc8349emds.dts b/arch/powerpc/boot/dts/mpc8349emds.dts
index efceb34..c7ff2f1 100644
--- a/arch/powerpc/boot/dts/mpc8349emds.dts
+++ b/arch/powerpc/boot/dts/mpc8349emds.dts@@ -47,6 +47,7 @@ ranges = <0 e0000000 00100000>; reg = <e0000000 00000200>; bus-frequency = <0>; + compatible = "mpc8349\0mpc834x\0mpc83xx"; wdt@200 { device_type = "watchdog";
diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts b/arch/powerpc/boot/dts/mpc8349emitx.dts
index 27807fc..0a3dde8 100644
--- a/arch/powerpc/boot/dts/mpc8349emitx.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitx.dts@@ -46,6 +46,7 @@ ranges = <0 e0000000 00100000>; reg = <e0000000 00000200>; bus-frequency = <0>; // from bootloader + compatible = "mpc8349\0mpc834x\0mpc83xx"; wdt@200 { device_type = "watchdog";
diff --git a/arch/powerpc/boot/dts/mpc8360emds.dts b/arch/powerpc/boot/dts/mpc8360emds.dts
index 9022192..6e3f708 100644
--- a/arch/powerpc/boot/dts/mpc8360emds.dts
+++ b/arch/powerpc/boot/dts/mpc8360emds.dts@@ -62,6 +62,7 @@ ranges = <0 e0000000 00100000>; reg = <e0000000 00000200>; bus-frequency = <FBC5200>; + compatible = "mpc8360\0mpc836x\0mpc83xx"; wdt@200 { device_type = "watchdog";
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index ad31e56..e395936 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c@@ -63,6 +63,35 @@ phys_addr_t get_immrbase(void) EXPORT_SYMBOL(get_immrbase); +#ifdef CONFIG_83xx +void __iomem *mpc83xx_immr; +#endif + +static int __init map_immr(void) +{ + struct device_node *soc; + + soc = of_find_node_by_type(NULL, "soc"); + if (soc) { + struct resource res; + int ret = of_address_to_resource(soc, 0, &res); + if (ret) + return ret; + +#ifdef CONFIG_83xx + if (device_is_compatible(soc, "mpc83xx")) + mpc83xx_immr = ioremap(res.start, + res.end - res.start + 1); +#endif + + of_node_put(soc); + }; + + return 0; +} + +arch_initcall(map_immr); + #ifdef CONFIG_CPM2 static u32 brgfreq = -1;
diff --git a/arch/powerpc/sysdev/fsl_soc.h b/arch/powerpc/sysdev/fsl_soc.h
index 04e145b..a02978e 100644
--- a/arch/powerpc/sysdev/fsl_soc.h
+++ b/arch/powerpc/sysdev/fsl_soc.h@@ -2,11 +2,14 @@ #define __PPC_FSL_SOC_H #ifdef __KERNEL__ +#include <linux/compiler.h> #include <asm/mmu.h> extern phys_addr_t get_immrbase(void); extern u32 get_brgfreq(void); extern u32 get_baudrate(void); +extern void __iomem *mpc83xx_immr; + #endif #endif
--
1.4.4