From: Florian Fainelli <florian.fainelli@broadcom.com>
To: Abylay Ospan <aospan@netup.ru>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
Scott Branden <sbranden@broadcom.com>,
Jon Mason <jonmason@broadcom.com>, Ray Jui <rjui@broadcom.com>,
zajec5@gmail.com, linux-kernel@vger.kernel.org,
Ray Jui <ray.jui@broadcom.com>,
linux-pci@vger.kernel.org, Bjorn Helgaas <bhelgaas@google.com>,
bcm-kernel-feedback-list@broadcom.com,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] PCI: iproc: fix kernel crash if dev->of_node not defined
Date: Mon, 16 Jan 2017 14:47:18 -0800 [thread overview]
Message-ID: <c5080024-d58c-7b7d-1602-36b2d4511bef@broadcom.com> (raw)
In-Reply-To: <CAK3bHNVQ9Rbuwf1i54h7uLLdkUvyGibmfJpD6zRjt1gYiQD7Hw@mail.gmail.com>
+Rafal,
On 01/12/2017 08:55 PM, Abylay Ospan wrote:
> Hi Florian,
>
>> Still, upstream Linux support for Northstar is Device Tree, and BCMA bus
>> should fill in of_nodes accordingly, if not, that's a bug that must be
>> fixed at the BCMA layer.
>
> yes, this is a source of the problem. Devices allocated in
> 'bcma_bus_scan' but of_node doesn't assigned.
> Is some code missing in drivers/bcma/ which should assign of_node ?
bcma_of_fill_device() is responsible for assigning the core of_node
pointer based on the core discovered. It sounds like we may have to add
an entry under the "axi" bus node for the PCIe RC, very much like these
ones already exist:
gmac0: ethernet@24000 {
reg = <0x24000 0x800>;
};
gmac1: ethernet@25000 {
reg = <0x25000 0x800>;
};
gmac2: ethernet@26000 {
reg = <0x26000 0x800>;
};
gmac3: ethernet@27000 {
reg = <0x27000 0x800>;
};
Without that, you indeed do not have a proper linkage between the BCMA
discovered device and its of_node pointer.
Can you give it a spin?
>
> I can suggest following "hacky" patch for this (works for me):
>
> Author: Abylay Ospan <aospan@netup.ru>
> Date: Fri Jan 13 07:24:13 2017 +0300
>
> bcma: force assign 'of_node' for devices on the bus
>
> prevent other code to fail if no 'of_node' defined
>
> Signed-off-by: Abylay Ospan <aospan@netup.ru>
>
> diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
> index 2c1798e..4fe1c92 100644
> --- a/drivers/bcma/main.c
> +++ b/drivers/bcma/main.c
> @@ -301,6 +301,11 @@ void bcma_init_bus(struct bcma_bus *bus)
> static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core)
> {
> int err;
> + struct device * dev;
> +
> + dev = bcma_bus_get_host_dev(bus);
> + if (dev && !core->dev.of_node)
> + core->dev.of_node = dev->of_node;
>
>
> if it's ok I will send this patch in separate email.
>
>>
>>>
>>>>
>>>>>
>>>>> Signed-off-by: Abylay Ospan <aospan@netup.ru>
>>>>> ---
>>>>> drivers/pci/host/pcie-iproc.c | 3 +++
>>>>> 1 file changed, 3 insertions(+)
>>>>>
>>>>> diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
>>>>> index 3ebc025..f2836a9 100644
>>>>> --- a/drivers/pci/host/pcie-iproc.c
>>>>> +++ b/drivers/pci/host/pcie-iproc.c
>>>>> @@ -952,6 +952,9 @@ static int pci_dma_range_parser_init(struct of_pci_range_parser *parser,
>>>>> const int na = 3, ns = 2;
>>>>> int rlen;
>>>>>
>>>>> + if (!node)
>>>>> + return -ENOENT;
>>>>> +
>>>>> parser->node = node;
>>>>> parser->pna = of_n_addr_cells(node);
>>>>> parser->np = parser->pna + na + ns;
>>>>>
>>>>
>>>>
>>
>>
>> --
>> Florian
>
>
>
--
Florian
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2017-01-16 22:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-13 0:20 [PATCH] PCI: iproc: fix kernel crash if dev->of_node not defined Abylay Ospan
2017-01-13 0:22 ` Florian Fainelli
2017-01-13 0:48 ` Ray Jui
2017-01-13 1:20 ` Florian Fainelli
2017-01-13 4:55 ` Abylay Ospan
2017-01-16 22:47 ` Florian Fainelli [this message]
2017-01-13 5:58 ` Abylay Ospan
2017-01-13 0:45 ` Ray Jui
2017-01-28 20:44 ` Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c5080024-d58c-7b7d-1602-36b2d4511bef@broadcom.com \
--to=florian.fainelli@broadcom.com \
--cc=aospan@netup.ru \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=bhelgaas@google.com \
--cc=f.fainelli@gmail.com \
--cc=jonmason@broadcom.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=ray.jui@broadcom.com \
--cc=rjui@broadcom.com \
--cc=sbranden@broadcom.com \
--cc=zajec5@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox