Subject: Re: [PATCH 1/4] maple: match "pcie" name for CPC945

From: Nathan Lynch <[email-masked]>
Date: Mon, 11 Dec 2006 16:38:12 -0600

Segher Boessenkool wrote:
> >Some firmwares have "pcie" for the "name" property of the CPC945 PCI
> >Express host bridge.  Check for "pcie" in addition to "pci" so we
> >don't miss it.
> 
> You shouldn't use "name" but "device_type" and "compatible".

Like this?

(Hmm, does the u3-agp on maple have "pci" for device_type?)

diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c
index 3a32ded..011f0f1 100644
--- a/arch/powerpc/platforms/maple/pci.c
+++ b/arch/powerpc/platforms/maple/pci.c
@@ -560,13 +560,16 @@ void __init maple_pci_init(void)
 		return;
 	}
 	for (np = NULL; (np = of_get_next_child(root, np)) != NULL;) {
-		if (np->name == NULL)
+		if (!np->type)
 			continue;
-		if (strcmp(np->name, "pci") == 0) {
-			if (add_bridge(np) == 0)
-				of_node_get(np);
-		}
-		if (strcmp(np->name, "ht") == 0) {
+		if (strcmp(np->type, "pci") && strcmp(np->type, "ht"))
+			continue;
+		if ((device_is_compatible(np, "u4-pcie") ||
+		     device_is_compatible(np, "u3-agp")) &&
+		    add_bridge(np) == 0)
+			of_node_get(np);
+
+		if (device_is_compatible(np, "u3-ht")) {
 			of_node_get(np);
 			ht = np;
 		}