Commit c5c01c97 authored by Marian Balakowicz's avatar Marian Balakowicz Committed by Grant Likely

[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: default avatarJan Wrobel <wrr@semihalf.com>
Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
parent c052a22e
...@@ -19,14 +19,12 @@ ...@@ -19,14 +19,12 @@
#include <asm/mpc52xx.h> #include <asm/mpc52xx.h>
void __iomem * static void __iomem *
mpc52xx_find_and_map(const char *compatible) mpc52xx_map_node(struct device_node *ofn)
{ {
struct device_node *ofn;
const u32 *regaddr_p; const u32 *regaddr_p;
u64 regaddr64, size64; u64 regaddr64, size64;
ofn = of_find_compatible_node(NULL, NULL, compatible);
if (!ofn) if (!ofn)
return NULL; return NULL;
...@@ -42,8 +40,23 @@ mpc52xx_find_and_map(const char *compatible) ...@@ -42,8 +40,23 @@ mpc52xx_find_and_map(const char *compatible)
return ioremap((u32)regaddr64, (u32)size64); return ioremap((u32)regaddr64, (u32)size64);
} }
void __iomem *
mpc52xx_find_and_map(const char *compatible)
{
return mpc52xx_map_node(
of_find_compatible_node(NULL, NULL, compatible));
}
EXPORT_SYMBOL(mpc52xx_find_and_map); EXPORT_SYMBOL(mpc52xx_find_and_map);
void __iomem *
mpc52xx_find_and_map_path(const char *path)
{
return mpc52xx_map_node(of_find_node_by_path(path));
}
EXPORT_SYMBOL(mpc52xx_find_and_map_path);
/** /**
* mpc52xx_find_ipb_freq - Find the IPB bus frequency for a device * mpc52xx_find_ipb_freq - Find the IPB bus frequency for a device
......
...@@ -249,6 +249,7 @@ struct mpc52xx_cdm { ...@@ -249,6 +249,7 @@ struct mpc52xx_cdm {
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
extern void __iomem * mpc52xx_find_and_map(const char *); extern void __iomem * mpc52xx_find_and_map(const char *);
extern void __iomem * mpc52xx_find_and_map_path(const char *path);
extern unsigned int mpc52xx_find_ipb_freq(struct device_node *node); extern unsigned int mpc52xx_find_ipb_freq(struct device_node *node);
extern void mpc5200_setup_xlb_arbiter(void); extern void mpc5200_setup_xlb_arbiter(void);
extern void mpc52xx_declare_of_platform_devices(void); extern void mpc52xx_declare_of_platform_devices(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment