aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarian Balakowicz <m8@semihalf.com>2007-10-18 14:44:14 -0400
committerGrant Likely <grant.likely@secretlab.ca>2007-10-21 14:42:47 -0400
commitc5c01c9700e59a5b20d7bdd15808d33ab9d9e877 (patch)
tree4c49b4e38dea900acffbc65dc91012b4b819ea02
parentc052a22e808fc1f9b78b9a2fe7065f2026815128 (diff)
[POWERPC] Add mpc52xx_find_and_map_path(), refactor utility functions
Add helper routine mpc52xx_find_and_map_path(). Extract common code to mpc52xx_map_node() and refactor mpc52xx_find_and_map(). Signed-off-by: Jan Wrobel <wrr@semihalf.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_common.c21
-rw-r--r--include/asm-powerpc/mpc52xx.h1
2 files changed, 18 insertions, 4 deletions
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index 3bc201e07e6b..74b4b4183842 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -19,14 +19,12 @@
19#include <asm/mpc52xx.h> 19#include <asm/mpc52xx.h>
20 20
21 21
22void __iomem * 22static void __iomem *
23mpc52xx_find_and_map(const char *compatible) 23mpc52xx_map_node(struct device_node *ofn)
24{ 24{
25 struct device_node *ofn;
26 const u32 *regaddr_p; 25 const u32 *regaddr_p;
27 u64 regaddr64, size64; 26 u64 regaddr64, size64;
28 27
29 ofn = of_find_compatible_node(NULL, NULL, compatible);
30 if (!ofn) 28 if (!ofn)
31 return NULL; 29 return NULL;
32 30
@@ -42,8 +40,23 @@ mpc52xx_find_and_map(const char *compatible)
42 40
43 return ioremap((u32)regaddr64, (u32)size64); 41 return ioremap((u32)regaddr64, (u32)size64);
44} 42}
43
44void __iomem *
45mpc52xx_find_and_map(const char *compatible)
46{
47 return mpc52xx_map_node(
48 of_find_compatible_node(NULL, NULL, compatible));
49}
50
45EXPORT_SYMBOL(mpc52xx_find_and_map); 51EXPORT_SYMBOL(mpc52xx_find_and_map);
46 52
53void __iomem *
54mpc52xx_find_and_map_path(const char *path)
55{
56 return mpc52xx_map_node(of_find_node_by_path(path));
57}
58
59EXPORT_SYMBOL(mpc52xx_find_and_map_path);
47 60
48/** 61/**
49 * mpc52xx_find_ipb_freq - Find the IPB bus frequency for a device 62 * mpc52xx_find_ipb_freq - Find the IPB bus frequency for a device
diff --git a/include/asm-powerpc/mpc52xx.h b/include/asm-powerpc/mpc52xx.h
index 764d997b4cde..8e428466a60f 100644
--- a/include/asm-powerpc/mpc52xx.h
+++ b/include/asm-powerpc/mpc52xx.h
@@ -249,6 +249,7 @@ struct mpc52xx_cdm {
249#ifndef __ASSEMBLY__ 249#ifndef __ASSEMBLY__
250 250
251extern void __iomem * mpc52xx_find_and_map(const char *); 251extern void __iomem * mpc52xx_find_and_map(const char *);
252extern void __iomem * mpc52xx_find_and_map_path(const char *path);
252extern unsigned int mpc52xx_find_ipb_freq(struct device_node *node); 253extern unsigned int mpc52xx_find_ipb_freq(struct device_node *node);
253extern void mpc5200_setup_xlb_arbiter(void); 254extern void mpc5200_setup_xlb_arbiter(void);
254extern void mpc52xx_declare_of_platform_devices(void); 255extern void mpc52xx_declare_of_platform_devices(void);