aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/platforms/52xx/lite5200.c10
-rw-r--r--arch/powerpc/platforms/52xx/lite5200_pm.c6
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_common.c51
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_pic.c8
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_pm.c8
-rw-r--r--drivers/spi/mpc52xx_psc_spi.c9
-rw-r--r--include/asm-powerpc/mpc52xx.h2
7 files changed, 40 insertions, 54 deletions
diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c
index ce903bef004e..5a8d190f53e4 100644
--- a/arch/powerpc/platforms/52xx/lite5200.c
+++ b/arch/powerpc/platforms/52xx/lite5200.c
@@ -42,10 +42,13 @@
42static void __init 42static void __init
43lite5200_fix_clock_config(void) 43lite5200_fix_clock_config(void)
44{ 44{
45 struct device_node *np;
45 struct mpc52xx_cdm __iomem *cdm; 46 struct mpc52xx_cdm __iomem *cdm;
46 47
47 /* Map zones */ 48 /* Map zones */
48 cdm = mpc52xx_find_and_map("mpc5200-cdm"); 49 np = of_find_compatible_node(NULL, NULL, "mpc5200-cdm");
50 cdm = of_iomap(np, 0);
51 of_node_put(np);
49 if (!cdm) { 52 if (!cdm) {
50 printk(KERN_ERR "%s() failed; expect abnormal behaviour\n", 53 printk(KERN_ERR "%s() failed; expect abnormal behaviour\n",
51 __FUNCTION__); 54 __FUNCTION__);
@@ -74,10 +77,13 @@ lite5200_fix_clock_config(void)
74static void __init 77static void __init
75lite5200_fix_port_config(void) 78lite5200_fix_port_config(void)
76{ 79{
80 struct device_node *np;
77 struct mpc52xx_gpio __iomem *gpio; 81 struct mpc52xx_gpio __iomem *gpio;
78 u32 port_config; 82 u32 port_config;
79 83
80 gpio = mpc52xx_find_and_map("mpc5200-gpio"); 84 np = of_find_compatible_node(NULL, NULL, "mpc5200-gpio");
85 gpio = of_iomap(np, 0);
86 of_node_put(np);
81 if (!gpio) { 87 if (!gpio) {
82 printk(KERN_ERR "%s() failed. expect abnormal behavior\n", 88 printk(KERN_ERR "%s() failed. expect abnormal behavior\n",
83 __FUNCTION__); 89 __FUNCTION__);
diff --git a/arch/powerpc/platforms/52xx/lite5200_pm.c b/arch/powerpc/platforms/52xx/lite5200_pm.c
index ffa14aff5248..c3ada1e340d2 100644
--- a/arch/powerpc/platforms/52xx/lite5200_pm.c
+++ b/arch/powerpc/platforms/52xx/lite5200_pm.c
@@ -42,6 +42,8 @@ static int lite5200_pm_set_target(suspend_state_t state)
42 42
43static int lite5200_pm_prepare(void) 43static int lite5200_pm_prepare(void)
44{ 44{
45 struct device_node *np;
46
45 /* deep sleep? let mpc52xx code handle that */ 47 /* deep sleep? let mpc52xx code handle that */
46 if (lite5200_pm_target_state == PM_SUSPEND_STANDBY) 48 if (lite5200_pm_target_state == PM_SUSPEND_STANDBY)
47 return mpc52xx_pm_prepare(); 49 return mpc52xx_pm_prepare();
@@ -50,7 +52,9 @@ static int lite5200_pm_prepare(void)
50 return -EINVAL; 52 return -EINVAL;
51 53
52 /* map registers */ 54 /* map registers */
53 mbar = mpc52xx_find_and_map("mpc5200"); 55 np = of_find_compatible_node(NULL, NULL, "mpc5200");
56 mbar = of_iomap(np, 0);
57 of_node_put(np);
54 if (!mbar) { 58 if (!mbar) {
55 printk(KERN_ERR "%s:%i Error mapping registers\n", __func__, __LINE__); 59 printk(KERN_ERR "%s:%i Error mapping registers\n", __func__, __LINE__);
56 return -ENOSYS; 60 return -ENOSYS;
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index e626d103f52a..66955937be2a 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -26,45 +26,6 @@
26 */ 26 */
27static volatile struct mpc52xx_gpt *mpc52xx_wdt = NULL; 27static volatile struct mpc52xx_gpt *mpc52xx_wdt = NULL;
28 28
29static void __iomem *
30mpc52xx_map_node(struct device_node *ofn)
31{
32 const u32 *regaddr_p;
33 u64 regaddr64, size64;
34
35 if (!ofn)
36 return NULL;
37
38 regaddr_p = of_get_address(ofn, 0, &size64, NULL);
39 if (!regaddr_p) {
40 of_node_put(ofn);
41 return NULL;
42 }
43
44 regaddr64 = of_translate_address(ofn, regaddr_p);
45
46 of_node_put(ofn);
47
48 return ioremap((u32)regaddr64, (u32)size64);
49}
50
51void __iomem *
52mpc52xx_find_and_map(const char *compatible)
53{
54 return mpc52xx_map_node(
55 of_find_compatible_node(NULL, NULL, compatible));
56}
57
58EXPORT_SYMBOL(mpc52xx_find_and_map);
59
60void __iomem *
61mpc52xx_find_and_map_path(const char *path)
62{
63 return mpc52xx_map_node(of_find_node_by_path(path));
64}
65
66EXPORT_SYMBOL(mpc52xx_find_and_map_path);
67
68/** 29/**
69 * mpc52xx_find_ipb_freq - Find the IPB bus frequency for a device 30 * mpc52xx_find_ipb_freq - Find the IPB bus frequency for a device
70 * @node: device node 31 * @node: device node
@@ -101,9 +62,12 @@ EXPORT_SYMBOL(mpc52xx_find_ipb_freq);
101void __init 62void __init
102mpc5200_setup_xlb_arbiter(void) 63mpc5200_setup_xlb_arbiter(void)
103{ 64{
65 struct device_node *np;
104 struct mpc52xx_xlb __iomem *xlb; 66 struct mpc52xx_xlb __iomem *xlb;
105 67
106 xlb = mpc52xx_find_and_map("mpc5200-xlb"); 68 np = of_find_compatible_node(NULL, NULL, "mpc5200-xlb");
69 xlb = of_iomap(np, 0);
70 of_node_put(np);
107 if (!xlb) { 71 if (!xlb) {
108 printk(KERN_ERR __FILE__ ": " 72 printk(KERN_ERR __FILE__ ": "
109 "Error mapping XLB in mpc52xx_setup_cpu(). " 73 "Error mapping XLB in mpc52xx_setup_cpu(). "
@@ -156,16 +120,19 @@ mpc52xx_map_wdt(void)
156 for_each_compatible_node(np, NULL, "fsl,mpc5200-gpt") { 120 for_each_compatible_node(np, NULL, "fsl,mpc5200-gpt") {
157 has_wdt = of_get_property(np, "fsl,has-wdt", NULL); 121 has_wdt = of_get_property(np, "fsl,has-wdt", NULL);
158 if (has_wdt) { 122 if (has_wdt) {
159 mpc52xx_wdt = mpc52xx_map_node(np); 123 mpc52xx_wdt = of_iomap(np, 0);
124 of_node_put(np);
160 return; 125 return;
161 } 126 }
162 } 127 }
163 for_each_compatible_node(np, NULL, "mpc5200-gpt") { 128 for_each_compatible_node(np, NULL, "mpc5200-gpt") {
164 has_wdt = of_get_property(np, "has-wdt", NULL); 129 has_wdt = of_get_property(np, "has-wdt", NULL);
165 if (has_wdt) { 130 if (has_wdt) {
166 mpc52xx_wdt = mpc52xx_map_node(np); 131 mpc52xx_wdt = of_iomap(np, 0);
132 of_node_put(np);
167 return; 133 return;
168 } 134 }
135
169 } 136 }
170} 137}
171 138
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pic.c b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
index 61100f270c68..07e89876d582 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pic.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
@@ -364,16 +364,18 @@ void __init mpc52xx_init_irq(void)
364{ 364{
365 u32 intr_ctrl; 365 u32 intr_ctrl;
366 struct device_node *picnode; 366 struct device_node *picnode;
367 struct device_node *np;
367 368
368 /* Remap the necessary zones */ 369 /* Remap the necessary zones */
369 picnode = of_find_compatible_node(NULL, NULL, "mpc5200-pic"); 370 picnode = of_find_compatible_node(NULL, NULL, "mpc5200-pic");
370 371 intr = of_iomap(picnode, 0);
371 intr = mpc52xx_find_and_map("mpc5200-pic");
372 if (!intr) 372 if (!intr)
373 panic(__FILE__ ": find_and_map failed on 'mpc5200-pic'. " 373 panic(__FILE__ ": find_and_map failed on 'mpc5200-pic'. "
374 "Check node !"); 374 "Check node !");
375 375
376 sdma = mpc52xx_find_and_map("mpc5200-bestcomm"); 376 np = of_find_compatible_node(NULL, NULL, "mpc5200-bestcomm");
377 sdma = of_iomap(np, 0);
378 of_node_put(np);
377 if (!sdma) 379 if (!sdma)
378 panic(__FILE__ ": find_and_map failed on 'mpc5200-bestcomm'. " 380 panic(__FILE__ ": find_and_map failed on 'mpc5200-bestcomm'. "
379 "Check node !"); 381 "Check node !");
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pm.c b/arch/powerpc/platforms/52xx/mpc52xx_pm.c
index 7ffa7babf254..52f027789c8f 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pm.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pm.c
@@ -59,10 +59,14 @@ int mpc52xx_set_wakeup_gpio(u8 pin, u8 level)
59 59
60int mpc52xx_pm_prepare(void) 60int mpc52xx_pm_prepare(void)
61{ 61{
62 struct device_node *np;
63
62 /* map the whole register space */ 64 /* map the whole register space */
63 mbar = mpc52xx_find_and_map("mpc5200"); 65 np = of_find_compatible_node(NULL, NULL, "mpc5200");
66 mbar = of_iomap(np, 0);
67 of_node_put(np);
64 if (!mbar) { 68 if (!mbar) {
65 printk(KERN_ERR "%s:%i Error mapping registers\n", __func__, __LINE__); 69 pr_err("mpc52xx_pm_prepare(): could not map registers\n");
66 return -ENOSYS; 70 return -ENOSYS;
67 } 71 }
68 /* these offsets are from mpc5200 users manual */ 72 /* these offsets are from mpc5200 users manual */
diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c
index 7051e6c5edc3..d398c93195e6 100644
--- a/drivers/spi/mpc52xx_psc_spi.c
+++ b/drivers/spi/mpc52xx_psc_spi.c
@@ -330,6 +330,7 @@ static void mpc52xx_psc_spi_cleanup(struct spi_device *spi)
330 330
331static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps) 331static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps)
332{ 332{
333 struct device_node *np;
333 struct mpc52xx_cdm __iomem *cdm; 334 struct mpc52xx_cdm __iomem *cdm;
334 struct mpc52xx_gpio __iomem *gpio; 335 struct mpc52xx_gpio __iomem *gpio;
335 struct mpc52xx_psc __iomem *psc = mps->psc; 336 struct mpc52xx_psc __iomem *psc = mps->psc;
@@ -338,8 +339,12 @@ static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps)
338 int ret = 0; 339 int ret = 0;
339 340
340#if defined(CONFIG_PPC_MERGE) 341#if defined(CONFIG_PPC_MERGE)
341 cdm = mpc52xx_find_and_map("mpc5200-cdm"); 342 np = of_find_compatible_node(NULL, NULL, "mpc5200-cdm");
342 gpio = mpc52xx_find_and_map("mpc5200-gpio"); 343 cdm = of_iomap(np, 0);
344 of_node_put(np);
345 np = of_find_compatible_node(NULL, NULL, "mpc5200-gpio");
346 gpio = of_iomap(np, 0);
347 of_node_put(np);
343#else 348#else
344 cdm = ioremap(MPC52xx_PA(MPC52xx_CDM_OFFSET), MPC52xx_CDM_SIZE); 349 cdm = ioremap(MPC52xx_PA(MPC52xx_CDM_OFFSET), MPC52xx_CDM_SIZE);
345 gpio = ioremap(MPC52xx_PA(MPC52xx_GPIO_OFFSET), MPC52xx_GPIO_SIZE); 350 gpio = ioremap(MPC52xx_PA(MPC52xx_GPIO_OFFSET), MPC52xx_GPIO_SIZE);
diff --git a/include/asm-powerpc/mpc52xx.h b/include/asm-powerpc/mpc52xx.h
index d7efbe09f93b..1c48c6d16335 100644
--- a/include/asm-powerpc/mpc52xx.h
+++ b/include/asm-powerpc/mpc52xx.h
@@ -248,8 +248,6 @@ struct mpc52xx_cdm {
248 248
249#ifndef __ASSEMBLY__ 249#ifndef __ASSEMBLY__
250 250
251extern void __iomem * mpc52xx_find_and_map(const char *);
252extern void __iomem * mpc52xx_find_and_map_path(const char *path);
253extern unsigned int mpc52xx_find_ipb_freq(struct device_node *node); 251extern unsigned int mpc52xx_find_ipb_freq(struct device_node *node);
254extern void mpc5200_setup_xlb_arbiter(void); 252extern void mpc5200_setup_xlb_arbiter(void);
255extern void mpc52xx_declare_of_platform_devices(void); 253extern void mpc52xx_declare_of_platform_devices(void);