Hi! This patchset introduces the support for DSA in ACPI world. A couple of words about the background and motivation behind those changes: The DSA code is strictly dependent on the Device Tree and Open Firmware (of_*) interface, both in the drivers and the common high-level net/dsa API. The only alternative is to pass the information about the topology via platform data - a legacy approach used by older systems that compiled the board description into the kernel. The above constraint is problematic for the embedded devices based e.g. on x86_64 SoCs, which are described by ACPI tables - to use DSA, some tricks and workarounds have to be applied. Addition of switch description to DSDT/SSDT tables would help to solve many similar cases and use unmodified kernel modules. It also enables this feature for ARM64 ACPI users. The key enablements allowing for adding ACPI support for DSA in Linux were NIC drivers, MDIO, PHY, and phylink modifications – the latter three merged in 2021. I thought it would be worth to experiment with DSA, which seemed to be a natural follow-up challenge. It turned out that without much hassle it is possible to describe DSA-compliant switches as child devices of the MDIO busses, which are responsible for their enumeration based on the standard _ADR fields and description in _DSD objects under 'device properties' UUID [1]. The vast majority of required changes were simple of_* to fwnode_* transition, as the DT and ACPI topolgies are analogous, except for 'ports' and 'mdio' subnodes naming, as they don't conform ACPI namespace constraints [2]. The patchset can be logically split to subsets of commits: * Move a couple of missing routines to fwnode_ equivalents * Rework net/dsa to use fwnode_*/device_* API * Introduce fwnode_mdiobus_register_device() and allow MDIO device probing in ACPI world. * Add necessary ACPI-related modifications to net/dsa and add Documentation entry. * Shift example mv88e6xxx driver to fwnode_*/device_* and add ACPI hooks. The changes details can be found in the commit messages. Note that for now cascade topology remains unsupported in ACPI world (based on "dsa" label and "link" property values). It seems to be feasible, but would extend this patchset due to necessity of of_phandle_iterator migration to fwnode_. Leave it as a possible future step. Testing: * EACH commit was tested against regression with device tree on EspressoBIN and SolidRun CN913x CEx7 Evaluation board. It works as expected throughout entire patchset. * The latter board was used as example ACPI user of the feature - it's 1:1 to what's available when booting with DT. Please check [3] and [4] to compare the DT/ACPI description. For convenience, this patchset is also available on a public branch [5]. I am looking forward to any comments or remarks, your review will be appreciated. Best regards, Marcin [1] http://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf [2] https://uefi.org/specs/ACPI/6.4/05_ACPI_Software_Programming_Model/ACPI_Software_Programming_Model.html#acpi-namespace [3] https://github.com/semihalf-wojtas-marcin/edk2-platforms/commit/6368ee09a232c1348e19729f21c05e9c5410cdb9 [4] https://github.com/tianocore/edk2-non-osi/blob/master/Silicon/Marvell/OcteonTx/DeviceTree/T91/cn9130-cex7.dts#L252 [5] https://github.com/semihalf-wojtas-marcin/Linux-Kernel/commits/dsa-acpi-v1 Marcin Wojtas (12): net: phy: fixed_phy: switch to fwnode_ API net: mdio: switch fixed-link PHYs API to fwnode_ net: dsa: switch to device_/fwnode_ APIs net: mvpp2: initialize port fwnode pointer net: core: switch to fwnode_find_net_device_by_node() net: mdio: introduce fwnode_mdiobus_register_device() net: mdio: allow registering non-PHY devices in ACPI world ACPI: scan: prevent double enumeration of MDIO bus children Documentation: ACPI: DSD: introduce DSA description net: dsa: add ACPI support net: dsa: mv88e6xxx: switch to device_/fwnode_ APIs net: dsa: mv88e6xxx: add ACPI support include/linux/etherdevice.h | 1 + include/linux/fwnode_mdio.h | 22 ++ include/linux/of_net.h | 6 - include/linux/phy_fixed.h | 4 +- include/net/dsa.h | 1 + drivers/acpi/scan.c | 15 + drivers/net/dsa/mv88e6xxx/chip.c | 76 +++-- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 1 + drivers/net/mdio/acpi_mdio.c | 40 ++- drivers/net/mdio/fwnode_mdio.c | 129 +++++++ drivers/net/mdio/of_mdio.c | 105 +----- drivers/net/phy/fixed_phy.c | 37 +- drivers/net/phy/mdio_bus.c | 4 + net/core/net-sysfs.c | 18 +- net/dsa/dsa2.c | 104 ++++-- net/dsa/port.c | 54 ++- net/dsa/slave.c | 6 +- Documentation/firmware-guide/acpi/dsd/dsa.rst | 359 ++++++++++++++++++++ Documentation/firmware-guide/acpi/index.rst | 1 + 19 files changed, 748 insertions(+), 235 deletions(-) create mode 100644 Documentation/firmware-guide/acpi/dsd/dsa.rst -- 2.29.0