Re: Associating nodes with phandles for pci devices

Chris Packham
2015-03-08T22:01:17Z

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 3080 bytes --]

Hi All,

Back onto this from a brief hiatus

On 01/24/2015 11:40 AM, Florian Fainelli wrote:
> On 23/01/15 11:38, Chris Packham wrote:
>>
>> Hi Arnd,
>>
>> Thanks for the quick response (and sorry for the horribly formatted
>> message, travelling with only a webmail interface at the moment).
>>
>> On Fri, 23 Jan 2015, Arnd Bergmann wrote:
>>
>>> On Friday 23 January 2015 19:02:33 Chris Packham wrote:
>>>> Hi,
>>>>
>>>> I'm working on a new board that has a marvell,dsa switch. Similar to
>>>> the kirkwood-mv88f6281gtw-ge board. However the major difference is
>>>> that instead of being connected to an integrated Ethernet port it is
>>>> connected via a PCI-e Ethernet port (basically a NIC hardwired onto
>>>> the board).
>>>>
>>>> Generally you don't need to define PCI devices in the .dts because
>>>> the bus is scanned at run time and the method for identifying devices
>>>> is well defined. But to satisfy the marvell,dsa binding[1] I need to
>>>> tell it the Ethernet port it is connected to. The answer might be in
>>>> the PCI bindings but the urls in the documentation[2] don't appear to
>>>> be valid anymore.
>>>>
>>>> Is it possible to enumerate PCI devices in the .dts? Or is there a
>>>> way of satisfying the dsa requirements without knowing the Ethernet
>>>> device?
>>>>
>>>
>>> In general, it is possible, and we do that on PowerPC, but it may be that
>>> there are parts missing on ARM and you have to try it out.
>>>
>>> In particular, you need to know the address of the PCI device and then
>>> create a device node that will be associated with the
>>> pci_dev->dev.of_node
>>> pointer.
>>
>> Encouraging to know. I think I can figure out the relevant addresses for
>> my device based on the run-time scan.

With Arnd's help I've figured out the appropriate reg property for my
PCI based Ethernet nodes.

pcie-controller {
pcie@1,0 {
ethernet0: tg3@01,0 {
reg = <0x00000000 0 0 0 0>;
};
ethernet1: tg3@01,1 {
reg = <0x00000100 0 0 0 0>;
};
};
};

>
> 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?N‹§²æìr¸›yúèšØb²X¬¶Ç§vØ^–)Þº{.nÇ+‰·zøœzÚÞz)í…æèw*\x1fjg¬±¨\x1e¶‰šŽŠÝ¢j.ïÛ°\½½MŽúgjÌæa×\x02››–' ™©Þ¢¸\f¢·¦j:+v‰¨ŠwèjØm¶Ÿÿ¾\a«‘êçzZ+ƒùšŽŠÝ¢j"ú!¶i