Patchwork [V3,1/2] powerpc/85xx: Add QE common init functions

login
register
mail settings
Submitter Xiaobo Xie
Date Sept. 2, 2013, 10:11 a.m.
Message ID <1378116699-18826-1-git-send-email-X.Xie@freescale.com>
Download mbox | patch
Permalink /patch/271854/
State Superseded
Headers show

Comments

Xiaobo Xie - Sept. 2, 2013, 10:11 a.m.
Define two QE init functions in common file, and avoid
the same codes being duplicated in board files.

Signed-off-by: Xie Xiaobo <X.Xie@freescale.com>
---
V3 -> V2: Nochange

 arch/powerpc/platforms/85xx/common.c  | 47 +++++++++++++++++++++++++++++++++++
 arch/powerpc/platforms/85xx/mpc85xx.h |  8 ++++++
 2 files changed, 55 insertions(+)
Scott Wood - Sept. 4, 2013, 4:26 p.m.
On Mon, 2013-09-02 at 18:11 +0800, Xie Xiaobo wrote:
> Define two QE init functions in common file, and avoid
> the same codes being duplicated in board files.
> 
> Signed-off-by: Xie Xiaobo <X.Xie@freescale.com>
> ---
> V3 -> V2: Nochange
> 
>  arch/powerpc/platforms/85xx/common.c  | 47 +++++++++++++++++++++++++++++++++++
>  arch/powerpc/platforms/85xx/mpc85xx.h |  8 ++++++
>  2 files changed, 55 insertions(+)

Don't just copy it; remove it from the place you copied from and have
that code call the common version.

-Scott
Xie Xiaobo-R63061 - Sept. 6, 2013, 9:52 a.m.
Hi Scott,

I already remove these code from the P1025TWR platform file(see the 2/2 patch). Do you means I also need to remove these codes from the others platforms and use the common call instead? 
Thank you.

Best Regards
Xie Xiaobo
-----Original Message-----
From: Wood Scott-B07421 
Sent: Thursday, September 05, 2013 12:27 AM
To: Xie Xiaobo-R63061
Cc: linuxppc-dev@lists.ozlabs.org; galak@kernel.crashing.org
Subject: Re: [PATCH V3 1/2] powerpc/85xx: Add QE common init functions

On Mon, 2013-09-02 at 18:11 +0800, Xie Xiaobo wrote:
> Define two QE init functions in common file, and avoid the same codes 
> being duplicated in board files.
> 
> Signed-off-by: Xie Xiaobo <X.Xie@freescale.com>
> ---
> V3 -> V2: Nochange
> 
>  arch/powerpc/platforms/85xx/common.c  | 47 
> +++++++++++++++++++++++++++++++++++
>  arch/powerpc/platforms/85xx/mpc85xx.h |  8 ++++++
>  2 files changed, 55 insertions(+)

Don't just copy it; remove it from the place you copied from and have that code call the common version.

-Scott
Scott Wood - Sept. 6, 2013, 3:24 p.m.
On Fri, 2013-09-06 at 04:52 -0500, Xie Xiaobo-R63061 wrote:
> Hi Scott,
> 
> I already remove these code from the P1025TWR platform file(see the 2/2 patch). Do you means I also need to remove these codes from the others platforms and use the common call instead? 
> Thank you.

Yes.

-Scott
Xie Xiaobo-R63061 - Sept. 10, 2013, 8:55 a.m.
Hi,

Thank you very much. I will submit updated patch soon.

Best Regards
Xie Xiaobo
-----Original Message-----
From: Wood Scott-B07421 
Sent: Friday, September 06, 2013 11:25 PM
To: Xie Xiaobo-R63061
Cc: Wood Scott-B07421; linuxppc-dev@lists.ozlabs.org; galak@kernel.crashing.org
Subject: Re: [PATCH V3 1/2] powerpc/85xx: Add QE common init functions

On Fri, 2013-09-06 at 04:52 -0500, Xie Xiaobo-R63061 wrote:
> Hi Scott,
> 
> I already remove these code from the P1025TWR platform file(see the 2/2 patch). Do you means I also need to remove these codes from the others platforms and use the common call instead? 
> Thank you.

Yes.

-Scott

Patch

diff --git a/arch/powerpc/platforms/85xx/common.c b/arch/powerpc/platforms/85xx/common.c
index d0861a0..fb3f5e6 100644
--- a/arch/powerpc/platforms/85xx/common.c
+++ b/arch/powerpc/platforms/85xx/common.c
@@ -7,6 +7,8 @@ 
  */
 #include <linux/of_platform.h>
 
+#include <asm/qe.h>
+#include <asm/qe_ic.h>
 #include <sysdev/cpm2_pic.h>
 
 #include "mpc85xx.h"
@@ -80,3 +82,48 @@  void __init mpc85xx_cpm2_pic_init(void)
 	irq_set_chained_handler(irq, cpm2_cascade);
 }
 #endif
+
+#ifdef CONFIG_QUICC_ENGINE
+void __init mpc85xx_qe_pic_init(void)
+{
+	struct device_node *np;
+
+	np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
+	if (np) {
+		qe_ic_init(np, 0, qe_ic_cascade_low_mpic,
+				qe_ic_cascade_high_mpic);
+		of_node_put(np);
+	} else
+		pr_err("%s: Could not find qe-ic node\n", __func__);
+}
+
+void __init mpc85xx_qe_init(void)
+{
+	struct device_node *np;
+
+	np = of_find_compatible_node(NULL, NULL, "fsl,qe");
+	if (!np) {
+		np = of_find_node_by_name(NULL, "qe");
+		if (!np) {
+			pr_err("%s: Could not find Quicc Engine node\n",
+					__func__);
+			return;
+		}
+	}
+
+	qe_reset();
+	of_node_put(np);
+
+	np = of_find_node_by_name(NULL, "par_io");
+	if (np) {
+		struct device_node *ucc;
+
+		par_io_init(np);
+		of_node_put(np);
+
+		for_each_node_by_name(ucc, "ucc")
+			par_io_of_config(ucc);
+
+	}
+}
+#endif
diff --git a/arch/powerpc/platforms/85xx/mpc85xx.h b/arch/powerpc/platforms/85xx/mpc85xx.h
index 2aa7c5d..1d39095 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx.h
+++ b/arch/powerpc/platforms/85xx/mpc85xx.h
@@ -8,4 +8,12 @@  extern void mpc85xx_cpm2_pic_init(void);
 static inline void __init mpc85xx_cpm2_pic_init(void) {}
 #endif /* CONFIG_CPM2 */
 
+#ifdef CONFIG_QUICC_ENGINE
+extern void mpc85xx_qe_pic_init(void);
+extern void mpc85xx_qe_init(void);
+#else
+static inline void __init mpc85xx_qe_pic_init(void) {}
+static inline void __init mpc85xx_qe_init(void) {}
+#endif
+
 #endif