[PATCH] powerpc/pasemi: Seach for PCI root bus by compatible property

From
Christian Zigotzky <hidden>
Date
2018-07-31 15:34:25
Reply to
Michael Ellerman, 2018-07-31
Just for info: I tested it on my Nemo board today and it works.

-- Christian

On 31 July 2018 at 2:04PM, Michael Ellerman wrote:
Michael Ellerman [off-list ref] writes:
quoted
Darren Stevens [off-list ref] writes:
quoted
Pasemi arch code finds the root of the PCI-e bus by searching the
device-tree for a node called 'pxp'. But the root bus has a
compatible property of 'pasemi,rootbus' so search for that instead.

Signed-off-by: Darren Stevens <redacted>
---

This works on the Amigaone X1000, I don't know if this method of
finding the pci bus was there bcause of earlier firmwares.
Does anyone have another pasemi board they can test this on?

The last time I plugged mine in it popped the power supply and took out
power to half the office :) - I haven't had a chance to try it since.
I actually I remembered I have a device tree lying around from an electra.

It has:

   [I] home:pxp@0,80000000(7)(I)> lsprop name compatible
   name             "pxp"
   compatible       "pasemi,rootbus"
                    "pa-pxp"


So it looks like the patch would work fine on it at least.

cheers
quoted
quoted
diff --git a/arch/powerpc/platforms/pasemi/pci.c b/arch/powerpc/platforms/pasemi/pci.c
index c7c8607..be62380 100644
--- a/arch/powerpc/platforms/pasemi/pci.c
+++ b/arch/powerpc/platforms/pasemi/pci.c
@@ -216,6 +216,7 @@ static int __init pas_add_bridge(struct device_node *dev)
  void __init pas_pci_init(void)
  {
     struct device_node *np, *root;
+   int res;
  
     root = of_find_node_by_path("/");
     if (!root) {
@@ -226,11 +227,11 @@ void __init pas_pci_init(void)
  
     pci_set_flags(PCI_SCAN_ALL_PCIE_DEVS);
  
-   for (np = NULL; (np = of_get_next_child(root, np)) != NULL;)
-       if (np->name && !strcmp(np->name, "pxp") && !pas_add_bridge(np))
-           of_node_get(np);
-
-   of_node_put(root);
+   np = of_find_compatible_node(root, NULL, "pasemi,rootbus");
+   if (np) {
+       res = pas_add_bridge(np);
+       of_node_put(np);
+   }
  }
  
  void __iomem *pasemi_pci_getcfgaddr(struct pci_dev *dev, int offset)
Thread (8 messages) 8 messages, 5 authors, 2018-08-08
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help