aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXie Xiaobo <X.Xie@freescale.com>2013-11-06 04:08:02 -0500
committerScott Wood <scottwood@freescale.com>2014-01-07 20:08:53 -0500
commit72c916ae97ff503b01fa21efe91d4328439ab004 (patch)
tree3281ef98ab14ea28d806eb34c729b28bb8b4f69d
parent3d73eb69fb6dca340e027b9b7a063b2892756a57 (diff)
powerpc/85xx: Add QE common init function
Define a QE init function in common file, and avoid the same codes being duplicated in board files. Signed-off-by: Xie Xiaobo <X.Xie@freescale.com> Signed-off-by: Scott Wood <scottwood@freescale.com>
-rw-r--r--arch/powerpc/platforms/85xx/common.c38
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx.h6
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_mds.c29
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_rdb.c25
4 files changed, 48 insertions, 50 deletions
diff --git a/arch/powerpc/platforms/85xx/common.c b/arch/powerpc/platforms/85xx/common.c
index eba78c85303f..3b085c7ee539 100644
--- a/arch/powerpc/platforms/85xx/common.c
+++ b/arch/powerpc/platforms/85xx/common.c
@@ -9,6 +9,7 @@
9#include <linux/of_irq.h> 9#include <linux/of_irq.h>
10#include <linux/of_platform.h> 10#include <linux/of_platform.h>
11 11
12#include <asm/qe.h>
12#include <sysdev/cpm2_pic.h> 13#include <sysdev/cpm2_pic.h>
13 14
14#include "mpc85xx.h" 15#include "mpc85xx.h"
@@ -82,3 +83,40 @@ void __init mpc85xx_cpm2_pic_init(void)
82 irq_set_chained_handler(irq, cpm2_cascade); 83 irq_set_chained_handler(irq, cpm2_cascade);
83} 84}
84#endif 85#endif
86
87#ifdef CONFIG_QUICC_ENGINE
88void __init mpc85xx_qe_init(void)
89{
90 struct device_node *np;
91
92 np = of_find_compatible_node(NULL, NULL, "fsl,qe");
93 if (!np) {
94 np = of_find_node_by_name(NULL, "qe");
95 if (!np) {
96 pr_err("%s: Could not find Quicc Engine node\n",
97 __func__);
98 return;
99 }
100 }
101
102 if (!of_device_is_available(np)) {
103 of_node_put(np);
104 return;
105 }
106
107 qe_reset();
108 of_node_put(np);
109
110 np = of_find_node_by_name(NULL, "par_io");
111 if (np) {
112 struct device_node *ucc;
113
114 par_io_init(np);
115 of_node_put(np);
116
117 for_each_node_by_name(ucc, "ucc")
118 par_io_of_config(ucc);
119
120 }
121}
122#endif
diff --git a/arch/powerpc/platforms/85xx/mpc85xx.h b/arch/powerpc/platforms/85xx/mpc85xx.h
index 2aa7c5dc2c7f..fc51dd4092e5 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx.h
+++ b/arch/powerpc/platforms/85xx/mpc85xx.h
@@ -8,4 +8,10 @@ extern void mpc85xx_cpm2_pic_init(void);
8static inline void __init mpc85xx_cpm2_pic_init(void) {} 8static inline void __init mpc85xx_cpm2_pic_init(void) {}
9#endif /* CONFIG_CPM2 */ 9#endif /* CONFIG_CPM2 */
10 10
11#ifdef CONFIG_QUICC_ENGINE
12extern void mpc85xx_qe_init(void);
13#else
14static inline void __init mpc85xx_qe_init(void) {}
15#endif
16
11#endif 17#endif
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index a7b3621a8df5..34f3c5eb3bee 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2006-2010, 2012 Freescale Semiconductor, Inc. 2 * Copyright (C) 2006-2010, 2012-2013 Freescale Semiconductor, Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Author: Andy Fleming <afleming@freescale.com> 5 * Author: Andy Fleming <afleming@freescale.com>
@@ -238,32 +238,7 @@ static void __init mpc85xx_mds_qe_init(void)
238{ 238{
239 struct device_node *np; 239 struct device_node *np;
240 240
241 np = of_find_compatible_node(NULL, NULL, "fsl,qe"); 241 mpc85xx_qe_init();
242 if (!np) {
243 np = of_find_node_by_name(NULL, "qe");
244 if (!np)
245 return;
246 }
247
248 if (!of_device_is_available(np)) {
249 of_node_put(np);
250 return;
251 }
252
253 qe_reset();
254 of_node_put(np);
255
256 np = of_find_node_by_name(NULL, "par_io");
257 if (np) {
258 struct device_node *ucc;
259
260 par_io_init(np);
261 of_node_put(np);
262
263 for_each_node_by_name(ucc, "ucc")
264 par_io_of_config(ucc);
265 }
266
267 mpc85xx_mds_reset_ucc_phys(); 242 mpc85xx_mds_reset_ucc_phys();
268 243
269 if (machine_is(p1021_mds)) { 244 if (machine_is(p1021_mds)) {
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
index 53b6fb0a3d56..e15bdd18fdb2 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * MPC85xx RDB Board Setup 2 * MPC85xx RDB Board Setup
3 * 3 *
4 * Copyright 2009,2012 Freescale Semiconductor Inc. 4 * Copyright 2009,2012-2013 Freescale Semiconductor Inc.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the 7 * under the terms of the GNU General Public License as published by the
@@ -98,26 +98,7 @@ static void __init mpc85xx_rdb_setup_arch(void)
98 fsl_pci_assign_primary(); 98 fsl_pci_assign_primary();
99 99
100#ifdef CONFIG_QUICC_ENGINE 100#ifdef CONFIG_QUICC_ENGINE
101 np = of_find_compatible_node(NULL, NULL, "fsl,qe"); 101 mpc85xx_qe_init();
102 if (!np) {
103 pr_err("%s: Could not find Quicc Engine node\n", __func__);
104 goto qe_fail;
105 }
106
107 qe_reset();
108 of_node_put(np);
109
110 np = of_find_node_by_name(NULL, "par_io");
111 if (np) {
112 struct device_node *ucc;
113
114 par_io_init(np);
115 of_node_put(np);
116
117 for_each_node_by_name(ucc, "ucc")
118 par_io_of_config(ucc);
119
120 }
121#if defined(CONFIG_UCC_GETH) || defined(CONFIG_SERIAL_QE) 102#if defined(CONFIG_UCC_GETH) || defined(CONFIG_SERIAL_QE)
122 if (machine_is(p1025_rdb)) { 103 if (machine_is(p1025_rdb)) {
123 104
@@ -148,8 +129,6 @@ static void __init mpc85xx_rdb_setup_arch(void)
148 129
149 } 130 }
150#endif 131#endif
151
152qe_fail:
153#endif /* CONFIG_QUICC_ENGINE */ 132#endif /* CONFIG_QUICC_ENGINE */
154 133
155 printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n"); 134 printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n");