[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YEjM2T8rI05F/Fbr@lunn.ch>
Date: Wed, 10 Mar 2021 14:42:49 +0100
From: Andrew Lunn <andrew@...n.ch>
To: "Wyse, Chris" <cwyse@...oga.com>
Cc: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"drichards@...inj.com" <drichards@...inj.com>
Subject: Re: DSA
> The current boot sequence is below:
> 1. i210 driver loads
> 2. Device Tree overlay installed (in addition to ACPI)
> - Includes DSA switch and ports, but master port was incorrectly
> specified as the EMACLite IP module, which had a DT node
> - No DT node for the i210
> 3. MFD driver reads DT overlay and instantiates supporting devices and
> the DSA driver
>
> My thought was to create a DT entry for the i210 in the overlay, even
> though the driver is already loaded via ACPI. The DT overlay node for
> the i210 would provide any needed information to the DSA driver. It
> would be essentially a reference to the already loaded driver.
I don't think what works. The normal sequence is that the PCI bus is
probed and devices found. At that point in time, the PCI core looks in
DT and finds the DT node associated with the device, and assigns
dev->of_node to point to the DT node. The device is then registered
with the device core. It will go off and try to find a driver of the
device, probe it, etc.
Sometime later, the DSA driver will probe. The phandle in device tree
is turned into a pointer. And then all devices registered for the
netdev class are walked to see if any have dev->of_node set to the
node.
So for this sequence to work, the overload needs to be loaded at the
point the PCI bus is scanned for devices. Now, there could be some
magic going on when an overlay is loaded, scanning the DT for devices
which have already loaded, and assigning there dev->of_node? I've no
idea, i've not used overlays. You probably want to add some printk()
into pci_set_of_node().
The idea with hotplug is that i guess it should rescan the PCI bus. So
that should cause pci_set_of_node() to be called, and now there is a
DT node for the device.
So i suggest you scatter some printk() in the PCI code, and
of_find_net_device_by_node() and the functions it calls to see what is
really going on, do i have the sequencing correct.
Andrew
Powered by blists - more mailing lists