devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Packham <Chris.Packham-6g8wRflRTwXFdCa3tKVlE6U/zSkkHjvu@public.gmane.org>
To: Florian Fainelli <florian-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
Cc: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org"
	<davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
	"linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org"
	<linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Subject: Re: Associating nodes with phandles for pci devices
Date: Mon, 9 Mar 2015 05:19:35 +0000	[thread overview]
Message-ID: <54FD2D66.2080507@alliedtelesis.co.nz> (raw)
In-Reply-To: <CAGVrzcYF266X-mUsfPtAr_jjJ3JW-TTHrKkznsnCCfrCzuf+qw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Hi Florian,

On 03/09/2015 04:40 PM, Florian Fainelli wrote:
> 2015-03-08 16:03 GMT-07:00 Chris Packham <Chris.Packham@alliedtelesis.co.nz>:
>>
>>
>> On 03/09/2015 11:42 AM, Arnd Bergmann wrote:
>>> On Sunday 08 March 2015 22:01:17 Chris Packham wrote:
>>>>
>>>>>
>>>>> BTW, one thing that is high in my TODO list regarding DSA is to stop
>>>>> using this platform device/driver architecture and use the actual device
>>>>> driver model. Your switch driver entry point would be a pci_drive
>>>>> probe's function where you end-up registering a switch the DSA. This
>>>>> should solve portions of your problem although this is a long shot as we
>>>>> need to convert existing drivers as well.
>>>>>
>>>>
>>>> My current problem is that of_find_device_by_node() (called by
>>>> dsa_of_probe) can't find the device. After a bit of debugging I can see
>>>> that the populated platform bus only goes as far as
>>>> /soc/pcie-controller, anything beyond that seems to be missing. I can't
>>>> see anything obvious in of_platform_bus_create() that would actually
>>>> stop it from continuing down the pcie-controller branch provided the dts
>>>> actually enumerates the children.
>>>>
>>>> Any suggestions?
>>>
>>> The PCI devices are not populated by of_platform_bus_create. Instead,
>>> pci_scan_device() calls pci_set_of_node() to set the of_node
>>> pointer for each PCI device.
>>>
>>> This would fail for instance if the root bus does not have a correct
>>> of_node pointer.
>>>
>>
>> Hmm. I instrumented pci_set_of_node and I do see my 2 network devices.
>>
>> devfn = 00000000
>> of_node = bfff3f90 /soc/pcie-controller/pcie@1,0/tg3@01,0
>>
>> devfn = 00000001
>> of_node = bfff4118 /soc/pcie-controller/pcie@1,0/tg3@01,1
>>
>> So at least that's happening. I guess the problem is that ultimately
>> they are devices on the pci bus as opposed to the platform bus and
>> of_find_device_by_node() only looks at the platform bus
>>
>> dev = bus_find_device(&platform_bus_type, NULL, np, of_dev_node_match);
>>
>> What I might have to do for now is get the DSA driver code to go looking
>> on the pci bus if of_find_device_by_node() fails to find the named node.
>
> Could you try these two patches:
> https://github.com/ffainelli/linux/commit/f57b2891e6118f5769c9fe17ed07e32def4c7c74
> https://github.com/ffainelli/linux/commit/1ccd7b38dddd667a6ef6afe1cc3e9bb8c5599b58

Yes they work for me. I had to play with the 2nd one a little due to 
being back on an older kernel.

In the meantime I did go ahead and implement my version of the code 
falling back to PCI but your version is much more generic.

Are either of these in the pipeline for inclusion in Linus' tree? 
(probably not the one that is 2 hrs old).

>
>> Florian mentioned making the DSA code use the device driver model which
>> would help me but I'm kinda stuck with the kernel version I'm using for
>> now at least.
>
> Right, this is still taking a bit more time than I expected, but the
> two patches above remove the restriction for the network device to be
> backed by a platform_device, so hopefully that can get you going. I
> will CC you on the next round of patches so you can keep track of that
> progress.
>

OK thanks. One of these days I'll get the board I'm working on 
upstreamed. Hopefully I can at least keep something minimally working 
against the tip of Linus' tree for testing.

  parent reply	other threads:[~2015-03-09  5:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-23 19:02 Associating nodes with phandles for pci devices Chris Packham
     [not found] ` <9bcf67ede60f4567a396c05578cfceb7-5g7mGxlPNYb6GjIOKuZY+ItlCAj8ZROq@public.gmane.org>
2015-01-23 19:15   ` Arnd Bergmann
2015-01-23 19:38     ` Chris Packham
     [not found]       ` <alpine.DEB.2.10.1501240828280.14228-VJzQ50X1/JKjhWACt5bsBotlCAj8ZROq@public.gmane.org>
2015-01-23 22:40         ` Florian Fainelli
     [not found]           ` <54C2CDE6.8090400-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
2015-03-08 22:01             ` Chris Packham
     [not found]               ` <54FCC6AC.4030202-6g8wRflRTwXFdCa3tKVlE6U/zSkkHjvu@public.gmane.org>
2015-03-08 22:42                 ` Arnd Bergmann
2015-03-08 23:03                   ` Chris Packham
     [not found]                     ` <54FCD53D.7080700-6g8wRflRTwXFdCa3tKVlE6U/zSkkHjvu@public.gmane.org>
2015-03-09  3:40                       ` Florian Fainelli
     [not found]                         ` <CAGVrzcYF266X-mUsfPtAr_jjJ3JW-TTHrKkznsnCCfrCzuf+qw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-09  5:19                           ` Chris Packham [this message]
2015-01-26 10:57         ` Arnd Bergmann

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=54FD2D66.2080507@alliedtelesis.co.nz \
    --to=chris.packham-6g8wrflrtwxfdca3tkvle6u/zskkhjvu@public.gmane.org \
    --cc=arnd-r2nGTMty4D4@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=florian-p3rKhJxN3npAfugRpC6u6w@public.gmane.org \
    --cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    /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;
as well as URLs for NNTP newsgroup(s).