linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/pasemi: Seach for PCI root bus by compatible property
@ 2018-07-25 20:55 Darren Stevens
  2018-07-31 11:55 ` Michael Ellerman
  2018-08-08 14:25 ` Michael Ellerman
  0 siblings, 2 replies; 8+ messages in thread
From: Darren Stevens @ 2018-07-25 20:55 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Christian Zigotzky, Olof Johansson

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 <darren@stevens-zone.net>
---

This works on the Amigaone X1000, I don't know if this method of
finding the pci bus was there bcause of earlier firmwares.

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)

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

* Re: [PATCH] powerpc/pasemi: Seach for PCI root bus by compatible property
  2018-07-25 20:55 [PATCH] powerpc/pasemi: Seach for PCI root bus by compatible property Darren Stevens
@ 2018-07-31 11:55 ` Michael Ellerman
  2018-07-31 12:04   ` Michael Ellerman
  2018-08-08 14:25 ` Michael Ellerman
  1 sibling, 1 reply; 8+ messages in thread
From: Michael Ellerman @ 2018-07-31 11:55 UTC (permalink / raw)
  To: Darren Stevens, linuxppc-dev; +Cc: Olof Johansson, Christian Zigotzky

Darren Stevens <darren@stevens-zone.net> writes:

> 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 <darren@stevens-zone.net>
> ---
>
> 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.

cheers

> 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)

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

* Re: [PATCH] powerpc/pasemi: Seach for PCI root bus by compatible property
  2018-07-31 11:55 ` Michael Ellerman
@ 2018-07-31 12:04   ` Michael Ellerman
  2018-07-31 15:34     ` Christian Zigotzky
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Ellerman @ 2018-07-31 12:04 UTC (permalink / raw)
  To: Darren Stevens, linuxppc-dev; +Cc: Olof Johansson, Christian Zigotzky

Michael Ellerman <mpe@ellerman.id.au> writes:
> Darren Stevens <darren@stevens-zone.net> writes:
>
>> 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 <darren@stevens-zone.net>
>> ---
>>
>> 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

>> 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)

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

* [PATCH] powerpc/pasemi: Seach for PCI root bus by compatible property
  2018-07-31 12:04   ` Michael Ellerman
@ 2018-07-31 15:34     ` Christian Zigotzky
  2018-08-01 14:36       ` Michael Ellerman
  0 siblings, 1 reply; 8+ messages in thread
From: Christian Zigotzky @ 2018-07-31 15:34 UTC (permalink / raw)
  To: Michael Ellerman, Darren Stevens, linuxppc-dev; +Cc: Olof Johansson

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 <mpe@ellerman.id.au> writes:
>> Darren Stevens <darren@stevens-zone.net> writes:
>>
>>> 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 <darren@stevens-zone.net>
>>> ---
>>>
>>> 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
>
>>> 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)

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

* Re: [PATCH] powerpc/pasemi: Seach for PCI root bus by compatible property
  2018-07-31 15:34     ` Christian Zigotzky
@ 2018-08-01 14:36       ` Michael Ellerman
  2018-08-01 16:17         ` Olof Johansson
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Ellerman @ 2018-08-01 14:36 UTC (permalink / raw)
  To: Christian Zigotzky, Darren Stevens, linuxppc-dev; +Cc: Olof Johansson

Christian Zigotzky <chzigotzky@xenosoft.de> writes:

> Just for info: I tested it on my Nemo board today and it works.

Awesome thanks.

That's probably sufficient to merge it, and if it breaks anything we can
always revert it.

cheers

> On 31 July 2018 at 2:04PM, Michael Ellerman wrote:
>> Michael Ellerman <mpe@ellerman.id.au> writes:
>>> Darren Stevens <darren@stevens-zone.net> writes:
>>>
>>>> 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 <darren@stevens-zone.net>
>>>> ---
>>>>
>>>> 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
>>
>>>> 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)

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

* Re: [PATCH] powerpc/pasemi: Seach for PCI root bus by compatible property
  2018-08-01 14:36       ` Michael Ellerman
@ 2018-08-01 16:17         ` Olof Johansson
  2018-08-03 10:20           ` Michael Ellerman
  0 siblings, 1 reply; 8+ messages in thread
From: Olof Johansson @ 2018-08-01 16:17 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: Christian Zigotzky, Darren Stevens, linuxppc-dev

On Wed, Aug 1, 2018 at 7:36 AM, Michael Ellerman <mpe@ellerman.id.au> wrote:
> Christian Zigotzky <chzigotzky@xenosoft.de> writes:
>
>> Just for info: I tested it on my Nemo board today and it works.
>
> Awesome thanks.
>
> That's probably sufficient to merge it, and if it breaks anything we can
> always revert it.

Should be fine, all known boards have the properties in question, and
I doubt anyone has anything but Nemo and Electra/Chitra boards out
there.

It's a virtual root bus, so all boards have it irrespective of what
PCIe is brought out.

(I should hook up my test system and get it into the CI cycle again,
maybe this fall).


Acked-by: Olof Johansson <olof@lixom.net>


-Olof

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

* Re: [PATCH] powerpc/pasemi: Seach for PCI root bus by compatible property
  2018-08-01 16:17         ` Olof Johansson
@ 2018-08-03 10:20           ` Michael Ellerman
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Ellerman @ 2018-08-03 10:20 UTC (permalink / raw)
  To: Olof Johansson; +Cc: Christian Zigotzky, Darren Stevens, linuxppc-dev

Olof Johansson <olof@lixom.net> writes:
> On Wed, Aug 1, 2018 at 7:36 AM, Michael Ellerman <mpe@ellerman.id.au> wrote:
>> Christian Zigotzky <chzigotzky@xenosoft.de> writes:
>>
>>> Just for info: I tested it on my Nemo board today and it works.
>>
>> Awesome thanks.
>>
>> That's probably sufficient to merge it, and if it breaks anything we can
>> always revert it.
>
> Should be fine, all known boards have the properties in question, and
> I doubt anyone has anything but Nemo and Electra/Chitra boards out
> there.
>
> It's a virtual root bus, so all boards have it irrespective of what
> PCIe is brought out.
>
> (I should hook up my test system and get it into the CI cycle again,
> maybe this fall).
>
>
> Acked-by: Olof Johansson <olof@lixom.net>

Thanks.

cheers

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

* Re: powerpc/pasemi: Seach for PCI root bus by compatible property
  2018-07-25 20:55 [PATCH] powerpc/pasemi: Seach for PCI root bus by compatible property Darren Stevens
  2018-07-31 11:55 ` Michael Ellerman
@ 2018-08-08 14:25 ` Michael Ellerman
  1 sibling, 0 replies; 8+ messages in thread
From: Michael Ellerman @ 2018-08-08 14:25 UTC (permalink / raw)
  To: Darren Stevens, linuxppc-dev; +Cc: Olof Johansson, Christian Zigotzky

On Wed, 2018-07-25 at 20:55:18 UTC, Darren Stevens wrote:
> 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 <darren@stevens-zone.net>
> Acked-by: Olof Johansson <olof@lixom.net>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/250a93501d6265bbb9ddf06af25ac9

cheers

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

end of thread, other threads:[~2018-08-08 14:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-25 20:55 [PATCH] powerpc/pasemi: Seach for PCI root bus by compatible property Darren Stevens
2018-07-31 11:55 ` Michael Ellerman
2018-07-31 12:04   ` Michael Ellerman
2018-07-31 15:34     ` Christian Zigotzky
2018-08-01 14:36       ` Michael Ellerman
2018-08-01 16:17         ` Olof Johansson
2018-08-03 10:20           ` Michael Ellerman
2018-08-08 14:25 ` Michael Ellerman

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).