Re: [PATCH 10/21] net: phy: add X-Powers AC200 EPHY control driver
James Hilliard <[email protected]> Tue, 4 Aug 2026 12:29:48 -0600
| Newsgroups | gmane.linux.drivers.devicetree,gmane.linux.network,gmane.linux.ports.arm.kernel,gmane.linux.kernel,gmane.linux.ports.arm.rockchip |
|---|---|
| Message-ID | <CADvTj4pdZN4Jmx0D4Yh0KDPkh_-zJ5iXCM=vUybGn0aFAAqAgg@mail.gmail.com> |
On Tue, Aug 4, 2026 at 12:04=E2=80=AFPM Andrew Lunn <[email protected]> wrote: > > > > No they don't. There are extra registers in different address domains= . > > > > The block diagrams make the distinction clearer. Both diagrams depict > > an EPHY block with the same internal organization: MII/RMII, auto > > negotiation, auto-MDIX, 10/100 TX and RX PCS/PMA blocks, LED logic, > > clock/reset, PLL and EPHY AFE. > > The block diagram is a vendor diagram, the vendor can draw whatever > diagram they want. What does the Mainline Linux networking block > diagram look like? I agree that a vendor block diagram is not normative for the Linux device model. I cited it as corroborating evidence, not as the sole basis for the design. The stronger evidence is the observable interface: after the required control sequence, both link endpoints report PHY ID 0x00441400 and provide the same link-side paged registers and behavior. The additional registers are not extra registers at that Clause 22 endpoint. AC200 exposes the corresponding package controls through its MFD regmap, whereas AC300 exposes them through a separately addressed non-PHY MDIO device. The Linux device model follows those addressable devices and their dependencies rather than treating a physical package as one indivisible driver. I think the relevant Linux diagram is: MAC / phylink | | MDIO v +-----------------------+ | link phy_device | | common ACx00 PHY | | driver | +-----------+-----------+ | | required control provider | one of: +-----------+-----------+ | | +---------v----------+ +---------v----------+ | AC200 MFD child | | AC300 mdio_device | | TWI/RSB regmap | | control address | +--------------------+ +--------------------+ For AC200, the surrounding MFD topology is additionally: +----------------------+ TWI/RSB ->| AC200 MFD core | +----------+-----------+ | +-------------+-------------+----------+ | | | | EPHY ctl audio RTC TVE Only the selected EPHY control provider is connected to the link phy_device. With a fixed AC200 or AC300 description, that topology is entirely static and does not require CONFIG_OF_DYNAMIC. The common PHY driver already drives the PHY in the phylib sense: it owns the link-side reset and initialization, auto-negotiation, link status, MDI/MDI-X, analog tuning, interrupts, statistics, EEE, LEDs, Wake-on-LAN and suspend/resume behavior. The provider owns only the package-specific operation needed to make that MDIO endpoint usable through the bus which actually exposes the relevant registers. This is similar to other places in mainline where EPHY clocks, resets, power and address selection are outside the link-PHY driver, including dwmac-sun8i and dwmac-rk. It is also consistent with the general MFD model, where a function driver accesses its portion of a parent regmap without taking ownership of the entire multifunction device. CONFIG_OF_DYNAMIC is not what motivates this split. It is only an optional way to select which of the two provider devices exists on a dual-source system. If runtime selection were removed and the bootloader always selected the package, the Linux diagram above would remain the same. > O.K. I've somewhat had enough of this discussion. > > For the Networking parts: NACK > > To get that revoked, make the PHY driver drive the PHY. I am not clear which concrete ownership problem in the diagram above is resolved by moving the provider implementations into the link-PHY driver. The link-PHY driver already drives all common link-PHY functionality. Making it directly access the other control devices would instead make one driver bound to one MDIO address also operate: - an AC200 MFD child and its parent regmap on fixed AC200 systems; or - another mdio_device at a different address on fixed AC300 systems. That does not remove either device. It bypasses their normal bus ownership and combines different device lifetimes inside the driver bound to the link endpoint. It is especially problematic for AC200 because the AC200 is an MFD, not an Ethernet PHY. Its parent clock, supplies, interrupt controller, regmap and global state can be shared by audio, RTC and TVE children. The link-PHY driver should not assume ownership of that parent or perform operations which may affect its sibling functions. If the objection is specifically to the private provider interface, I am open to discussing whether some operations can instead use existing clock, reset, power-sequencing or generic-PHY abstractions. That would still leave the AC200 MFD child and AC300 MDIO control device as separately owned devices, however. Likewise, if the objection is specifically to the MDIO OF_DYNAMIC changes, those can be reviewed or narrowed independently. Rejecting runtime DT selection would mean that firmware must resolve dual-source systems. It would not remove the justification for separate AC200 and AC300 control drivers on fixed systems or justify duplicating their common link-PHY implementation. > Hide away as much of this bad networking design in the bootloader. The bootloader can identify the package, perform the initial power-up sequence and enable the selected provider node. That is fully compatible with this model, but it cannot replace the Linux control path. Linux still needs to reapply the package configuration after PHY reset, system suspend, provider power loss or driver reprobe. It also needs to coordinate Wake-on-LAN, interrupts, LEDs and power management with the selected control device. Relying on undocumented bootloader state for those operations would make the driver less self-contained and more fragile. Even when the bootloader resolves the variant, Linux still sees either an AC200 MFD control function or an AC300 MDIO control endpoint plus the common link PHY. The bootloader can select the left or right branch in the diagram; it cannot make those devices become registers of the link phy_device. Again, this remains true with CONFIG_OF_DYNAMIC disabled. Dynamic OF handling only allows Linux to make the same deterministic selection from SID when firmware has not already done so. > You are free to continue working on the MFD and other parts which are > not networking, because i'm not a Maintainer there. I can separate the MFD, fixed AC200 networking, fixed AC300 networking and optional runtime-selection work so that each part can be reviewed on its own merits. However, the MFD and networking portions necessarily meet at the AC200 EPHY function. I do not think the correct way to avoid that cross-subsystem dependency is to make a driver bound to an MDIO phy_device take ownership of registers and resources belonging to an MFD device. I would therefore like clarification on whether the NACK is against: - the common link-PHY implementation; - the existence of separately bound control devices; - the private interface between the PHY and those devices; or - only the optional CONFIG_OF_DYNAMIC selection mechanism. Those are independent design choices. In particular, removing CONFIG_OF_DYNAMIC does not collapse the fixed AC200 MFD child or fixed AC300 MDIO control endpoint into the link phy_device. > Andrew