Skip to contentSkip to conversation

qe: run qe_init and qe_ic_init

PATCH In review Zhao Qiang 3 participants 3 messages Oct 10, 2014 – Oct 11, 2014

lore
Share & tools
lore

Zhao Qiang

author
#0 lore raw

PATCH 2/3 qe: run qe_init and qe_ic_init

qe and qe_ic need to be initialized before the
qe app drivers, using subsys_initcall to run
qe_init and qe_ic_init

---
 drivers/soc/qe/qe.c    | 15 +++++++++++++++
 drivers/soc/qe/qe_ic.c | 15 +++++++++++++++
 2 files changed, 30 insertions(+)
drivers/soc/qe/qe.c +15 -0
index 2aaa5b2..bfea0f8 100644
@@ -683,6 +683,21 @@ unsigned int qe_get_num_of_snums(void)
 }
 EXPORT_SYMBOL(qe_get_num_of_snums);
 
+static int __init qe_init(void)
+{
+	struct device_node *np;
+
+	np = of_find_compatible_node(NULL, NULL, "fsl,qe");
+	if (!np) {
+		pr_err("%s: Could not find Quicc Engine node\n", __func__);
+		return -ENODEV;
+	}
+	qe_reset();
+	of_node_put(np);
+	return 0;
+}
+subsys_initcall(qe_init);
+
 #if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC_85xx)
 static int qe_resume(struct platform_device *ofdev)
 {
drivers/soc/qe/qe_ic.c +15 -0
index cc1b8d5..11fe98c 100644
@@ -34,6 +34,7 @@
 #include <linux/fsl/qe_ic.h>
 
 #include "qe_ic.h"
+#include "../../irqchip/irqchip.h"
 
 static DEFINE_RAW_SPINLOCK(qe_ic_lock);
 
@@ -501,4 +502,18 @@ static int __init init_qe_ic_sysfs(void)
 	return 0;
 }
 
+static int __init qeic_of_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);
+	}
+	return 0;
+}
+subsys_initcall(qeic_of_init);
+
 subsys_initcall(init_qe_ic_sysfs);
Signature · 1 line
2.1.0.27.g96db324
#1 lore raw
Quoted 22 lines · Zhao Qiang

qe and qe_ic need to be initialized before the
qe app drivers, using subsys_initcall to run
qe_init and qe_ic_init

---
 drivers/soc/qe/qe.c    | 15 +++++++++++++++
 drivers/soc/qe/qe_ic.c | 15 +++++++++++++++
 2 files changed, 30 insertions(+)
drivers/soc/qe/qe.c +4 -0
index 2aaa5b2..bfea0f8 100644
@@ -683,6 +683,21 @@ unsigned int qe_get_num_of_snums(void)
 }
 EXPORT_SYMBOL(qe_get_num_of_snums);
 
+static int __init qe_init(void)
+{
+	struct device_node *np;
+

drivers/soc/qe/qe.c unsigned int qe_get_num_of_snums(void) · line 699

Quoted 10 lines
drivers/soc/qe/qe.c +10 -0
+	np = of_find_compatible_node(NULL, NULL, "fsl,qe");
+	if (!np) {
+		pr_err("%s: Could not find Quicc Engine node\n", __func__);
+		return -ENODEV;
+	}
+	qe_reset();
+	of_node_put(np);
+	return 0;
+}
+subsys_initcall(qe_init);

It is not an error to enable QE support on hardware that doesn't have QE. Please remove the pr_err().

drivers/soc/qe/qe_ic.c line 37

Quoted 13 lines
drivers/soc/qe/qe.c +1 -0
+
 #if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC_85xx)
 static int qe_resume(struct platform_device *ofdev)
 {
drivers/soc/qe/qe_ic.c +1 -0
index cc1b8d5..11fe98c 100644
@@ -34,6 +34,7 @@
 #include <linux/fsl/qe_ic.h>
 
 #include "qe_ic.h"
+#include "../../irqchip/irqchip.h"

What do you need from here, and can it be moved to include/linux/...?

The only thing I see defined in irqchip.h is IRQCHIP_DECLARE, and you don't use that in this patch...

-Scott

Quoted 21 lines
drivers/soc/qe/qe_ic.c +14 -0
 static DEFINE_RAW_SPINLOCK(qe_ic_lock);
 
@@ -501,4 +502,18 @@ static int __init init_qe_ic_sysfs(void)
 	return 0;
 }
 
+static int __init qeic_of_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);
+	}
+	return 0;
+}
+subsys_initcall(qeic_of_init);
+
 subsys_initcall(init_qe_ic_sysfs);
#2 lore raw
Quoted 34 lines · Wood Scott

-----Original Message-----
From: Wood Scott-B07421
Sent: Saturday, October 11, 2014 1:35 AM
To: Zhao Qiang-B45475
Cc: [email protected]; [email protected]; Wood Scott-B07421; Xie Xiaobo-R63061
Subject: Re: [PATCH 2/3] qe: run qe_init and qe_ic_init

Quoted 25 lines · Zhao Qiang

qe and qe_ic need to be initialized before the qe app drivers, using subsys_initcall to run qe_init and qe_ic_init

---
 drivers/soc/qe/qe.c    | 15 +++++++++++++++
 drivers/soc/qe/qe_ic.c | 15 +++++++++++++++
 2 files changed, 30 insertions(+)
drivers/soc/qe/qe.c index renamed from drivers/soc/qe/qe.c +0 -0

2aaa5b2..bfea0f8 100644

drivers/soc/qe/qe.c +9 -0
@@ -683,6 +683,21 @@ unsigned int qe_get_num_of_snums(void)  }
 EXPORT_SYMBOL(qe_get_num_of_snums);
 
+static int __init qe_init(void)
+{
+	struct device_node *np;
+
+	np = of_find_compatible_node(NULL, NULL, "fsl,qe");
+	if (!np) {
+		pr_err("%s: Could not find Quicc Engine node\n", __func__);
+		return -ENODEV;
+	}
Quoted 8 lines

drivers/soc/qe/qe.c unsigned int qe_get_num_of_snums(void) · line 699

Quoted 5 lines
drivers/soc/qe/qe.c +5 -0
+	qe_reset();
+	of_node_put(np);
+	return 0;
+}
+subsys_initcall(qe_init);

It is not an error to enable QE support on hardware that doesn't have QE. Please remove the pr_err().

OK, will be modified on V2.

Quoted 11 lines
Quoted 11 lines
drivers/soc/qe/qe.c +1 -0
+
 #if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC_85xx)  static int

qe_resume(struct platform_device *ofdev) { diff --git a/drivers/soc/qe/qe_ic.c b/drivers/soc/qe/qe_ic.c index cc1b8d5..11fe98c 100644

drivers/soc/qe/qe_ic.c +0 -0
@@ -34,6 +34,7 @@
 #include <linux/fsl/qe_ic.h>
 
Quoted 7 lines

drivers/soc/qe/qe_ic.c line 37

Quoted 2 lines
drivers/soc/qe/qe_ic.c +1 -0
 #include "qe_ic.h"
+#include "../../irqchip/irqchip.h"

What do you need from here, and can it be moved to include/linux/...?

The only thing I see defined in irqchip.h is IRQCHIP_DECLARE, and you don't use that in this patch...

OK, will be modified on V2.

Quoted 9 lines

-Scott

Quoted 6 lines
drivers/soc/qe/qe_ic.c +0 -0
 static DEFINE_RAW_SPINLOCK(qe_ic_lock);
 
@@ -501,4 +502,18 @@ static int __init init_qe_ic_sysfs(void)
 	return 0;
 }
 
Quoted 16 lines
Quoted 5 lines
drivers/soc/qe/qe_ic.c +5 -0
+static int __init qeic_of_init(void)
+{
+	struct device_node *np;
+
+	np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");

drivers/soc/qe/qe_ic.c static int __init init_qe_ic_sysfs(void) · line 519

Quoted 10 lines
drivers/soc/qe/qe_ic.c +9 -0
+	if (np) {
+		qe_ic_init(np, 0, qe_ic_cascade_low_mpic,
+			   qe_ic_cascade_high_mpic);
+		of_node_put(np);
+	}
+	return 0;
+}
+subsys_initcall(qeic_of_init);
+
 subsys_initcall(init_qe_ic_sysfs);

Best Regards
Zhao Qiang ���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m���� ������?�I�