Re: [PATCH v2 00/19] Add support for the LAN966x PCI device using a DT overlay

Rob Herring
2024-06-11T19:33:53Z

On Mon, May 27, 2024 at 06:14:27PM +0200, Herve Codina wrote:
> Hi,
>
> This series adds support for the LAN966x chip when used as a PCI
> device.
>
> For reference, the LAN996x chip is a System-on-chip that integrates an
> Ethernet switch and a number of other traditional hardware blocks such
> as a GPIO controller, I2C controllers, SPI controllers, etc. The
> LAN996x can be used in two different modes:
>
> - With Linux running on its Linux built-in ARM cores.
> This mode is already supported by the upstream Linux kernel, with the
> LAN996x described as a standard ARM Device Tree in
> arch/arm/boot/dts/microchip/lan966x.dtsi. Thanks to this support,
> all hardware blocks in the LAN996x already have drivers in the
> upstream Linux kernel.
>
> - As a PCI device, thanks to its built-in PCI endpoint controller.
> In this case, the LAN996x ARM cores are not used, but all peripherals
> of the LAN996x can be accessed by the PCI host using memory-mapped
> I/O through the PCI BARs.
>
> This series aims at supporting this second use-case. As all peripherals
> of the LAN996x already have drivers in the Linux kernel, our goal is to
> re-use them as-is to support this second use-case.
>
> Therefore, this patch series introduces a PCI driver that binds on the
> LAN996x PCI VID/PID, and when probed, instantiates all devices that are
> accessible through the PCI BAR. As the list and characteristics of such
> devices are non-discoverable, this PCI driver loads a Device Tree
> overlay that allows to teach the kernel about which devices are
> available, and allows to probe the relevant drivers in kernel, re-using
> all existing drivers with no change.
>
> This patch series for now adds a Device Tree overlay that describes an
> initial subset of the devices available over PCI in the LAN996x, and
> follow-up patch series will add support for more once this initial
> support has landed.
>
> In order to add this PCI driver, a number of preparation changes are
> needed:
>
> - Patches 1 to 5 allow the reset driver used for the LAN996x to be
> built as a module. Indeed, in the case where Linux runs on the ARM
> cores, it is common to have the reset driver built-in. However, when
> the LAN996x is used as a PCI device, it makes sense that all its
> drivers can be loaded as modules.
>
> - Patches 6 and 7 improve the MDIO controller driver to properly
> handle its reset signal.
>
> - Patches 8 to 12 introduce the internal interrupt controller used in
> the LAN996x. It is one of the few peripherals in the LAN996x that
> are only relevant when the LAN996x is used as a PCI device, which is
> why this interrupt controller did not have a driver so far.
>
> - Patches 13 to 16 make some small additions to the OF core and
> PCI/OF core to consider the PCI device as an interrupt controller.
> This topic was previously mentioned in [1] to avoid the need of
> phandle interrupt parents which are not available at some points.
>
> - Patches 17 and 18 introduce the LAN996x PCI driver itself, together
> with its DT bindings.
>
> We believe all items from the above list can be merged separately, with
> no build dependencies. We expect:
>
> - Patches 1 to 5 to be taken by reset maintainers
>
> - Patches 6 and 7 to be taken by network driver maintainers
>
> - Patches 8 to 12 to be taken by irqchip maintainers
>
> - Patch 13 to 17 to be taken by DT/PCI maintainers

I've applied patches 13-17.

Rob