linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* qe: fix device tree lookup code in qe_muram_init()
@ 2007-11-29 20:29 Timur Tabi
  2007-11-29 22:54 ` Kumar Gala
  0 siblings, 1 reply; 2+ messages in thread
From: Timur Tabi @ 2007-11-29 20:29 UTC (permalink / raw)
  To: linuxppc-dev, galak; +Cc: Timur Tabi

Function qe_muram_init() was only looking for a node called "data-only",
instead of making sure it is the correct node.  This patch modifies
qe_muram_init() to find the QE node first, then the MURAM node inside it,
and then the data-only node.  It also reports errors.

Signed-off-by: Timur Tabi <timur@freescale.com>
---
 arch/powerpc/sysdev/qe_lib/qe.c |   39 +++++++++++++++++++++++++++++++--------
 1 files changed, 31 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index 3d57d38..298e073 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -282,6 +282,12 @@ static DEFINE_SPINLOCK(qe_muram_lock);
 static rh_block_t qe_boot_muram_rh_block[16];
 static rh_info_t qe_muram_info;
 
+/* Initialize the MURAM remote heap
+ *
+ * This function queries the device tree to obtain the offset within MURAM
+ * to initialize the MURAM remote heap, and then it initializes the remote
+ * heap with that value.
+ */
 static void qe_muram_init(void)
 {
 	struct device_node *np;
@@ -294,15 +300,32 @@ static void qe_muram_init(void)
 		sizeof(qe_boot_muram_rh_block) /
 		sizeof(qe_boot_muram_rh_block[0]), qe_boot_muram_rh_block);
 
-	/* Attach the usable muram area */
-	/* XXX: This is a subset of the available muram. It
-	 * varies with the processor and the microcode patches activated.
-	 */
-	if ((np = of_find_node_by_name(NULL, "data-only")) != NULL) {
-		address = *of_get_address(np, 0, &size, &flags);
-		of_node_put(np);
-		rh_attach_region(&qe_muram_info, address, (int) size);
+	/* Find the data-only node in the QE's muram node */
+	np = of_find_node_by_type(NULL, "qe");
+	if (!np) {
+		printk(KERN_ERR
+			"qe-muram: cannot find 'qe' node in device tree\n");
+		return;
+	}
+
+	np = of_find_node_by_type(np, "muram");
+	if (!np) {
+		printk(KERN_ERR
+			"qe-muram: cannot find 'muram' node in device tree\n");
+		return;
 	}
+
+	np = of_find_node_by_name(np, "data-only");
+	if (!np) {
+		printk(KERN_ERR "qe-muram: "
+			"cannot find 'data-only' node in device tree\n");
+		return;
+	}
+
+	/* Attach the usable muram area */
+	address = *of_get_address(np, 0, &size, &flags);
+	of_node_put(np);
+	rh_attach_region(&qe_muram_info, address, (int) size);
 }
 
 /* This function returns an index into the MURAM area.
-- 
1.5.2.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: qe: fix device tree lookup code in qe_muram_init()
  2007-11-29 20:29 qe: fix device tree lookup code in qe_muram_init() Timur Tabi
@ 2007-11-29 22:54 ` Kumar Gala
  0 siblings, 0 replies; 2+ messages in thread
From: Kumar Gala @ 2007-11-29 22:54 UTC (permalink / raw)
  To: Timur Tabi; +Cc: linuxppc-dev


On Nov 29, 2007, at 2:29 PM, Timur Tabi wrote:

> Function qe_muram_init() was only looking for a node called "data- 
> only",
> instead of making sure it is the correct node.  This patch modifies
> qe_muram_init() to find the QE node first, then the MURAM node  
> inside it,
> and then the data-only node.  It also reports errors.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
> ---
> arch/powerpc/sysdev/qe_lib/qe.c |   39 ++++++++++++++++++++++++++++++ 
> +--------
> 1 files changed, 31 insertions(+), 8 deletions(-)

Add a compatible property in the muram data-only node called "fsl,qe- 
muram-data" and match on that compatible to find the node instead of  
walking the tree like you are. And report an error if there isn't a  
'fsl,qe-muram-data' node

- k

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-11-29 22:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-29 20:29 qe: fix device tree lookup code in qe_muram_init() Timur Tabi
2007-11-29 22:54 ` Kumar Gala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).