[PATCH net-next v4 0/4] net: microchip_t1s: fix collision detection on PLCA status change

From: Parthiban Veerasooran

Date: Tue Sep 29 2026 - 09:02:34 EST



In a 10BASE-T1S multidrop network, the PHY can autonomously change its PLCA
state based on BEACON availability. The existing collision detection logic
only synchronized CDEN on explicit PLCA configuration changes, leaving it
stale across autonomous PLCA status transitions.

This series fixes that gap by tracking PLCA status changes through the PHY
interrupt path, providing a polling fallback for PHYs without a routed
interrupt, and improving collision detection and link-status handling for
LAN867X Rev.D0.

The OA TC6 MAC-PHY SPI driver delivers the in-band PHY interrupt to phylib
through a nested virtual IRQ. LAN865X enables this path for its internal
PHY, which has no dedicated interrupt line. This allows the PHY driver to
receive PLCA status change interrupts through the MAC-PHY SPI interface.

For LAN86XX PHYs, collision detection state is synchronized across explicit
PLCA configuration changes, PHY interrupt handling, and the polling status
path. A per-PHY mutex serializes collision-detection control updates
between PHY configuration and interrupt handling.

LAN867X Rev.D0 uses its hardware CCMFC mechanism to autonomously gate
collision forwarding based on live PLCA_Status, avoiding the software CDEN
toggling used on older revisions. Its link-status handling also accounts
for the optional PRSCTL1 CSMA/CD fallback, selecting the semaphore source
when the PHY can autonomously fall back to CSMA/CD.

Changes in v4:
Addresses Sashiko AI review feedback on v3.
- Add a polling fallback to synchronize CDEN from the live PLCA status for
PHYs without a routed PHY interrupt.
- Serialize accesses to the collision-detection control register across
PLCA configuration, interrupt configuration, interrupt handling, and
status polling to avoid races.
- Preserve the tri-state semantics of plca_cfg->enabled, so an ethtool
request with the attribute set to -1 does not unintentionally modify CDEN
or Rev.D0 link-status configuration.
- Fix the OA TC6 virtual IRQ masking path so disabling the nested PHY IRQ
also masks the in-band PHY interrupt source, and retain deferred dispatch
to phylib.
- Enable the OA TC6 virtual PHY interrupt for LAN865X and clarify that this
completes the collision-detection fix for LAN865X. Add the corresponding
Fixes tag.
- Update LAN867X Rev.D0 interrupt handling to use the cached PLCA enable
state and current CSMA/CD fallback configuration instead of re-reading
the complete PLCA configuration on every PLCA status change.
- Preserve cable-test polling when the Rev.D0 PHY interrupt path is
enabled.
- Clarify the Rev.D0 CDEN/CCMFC behavior and document that CDEN remains
enabled by default while CCMFC autonomously gates collision forwarding
from PLCA_Status.
- Correct commit-message and register-comment details identified during
review.

The LAN865X fix depends on the OA TC6 virtual IRQ support, so the series
should be applied together.

Changes in v3:
Addresses Sashiko AI review feedback on v2.
- Patch 1: Synchronize CDEN with live PLCA status before unmasking
PSTCM, closing a window where a status change could be silently
dropped. Use phy_interrupt_is_valid() instead of testing PHY_POLL
alone. Treat plca_cfg->enabled as tri-state so an ethtool call that
omits the enable attribute no longer disables collision detection.
Factor shared STS1/IMSK1 sequences into helpers reused by patch 4.
- Patch 2: Replace dummy_irq_chip with a proper irq_chip implementing
mask/unmask via bus_lock/bus_sync_unlock, closing an interrupt-storm
risk. Select IRQ_DOMAIN in Kconfig. Defer PHY interrupt dispatch to a
workqueue so the chunk-processing thread stays independent of
phydev->lock.
- Patch 3: Add Fixes: 78341049fbcd, since this patch is required for
the fix to take effect on LAN865X. Document that CDEN correctness
relies on the hardware reset default.
- Patch 4: Give Rev.D0 its own config_intr() instead of branching
inside the shared one, so CCMFC-owned CDEN can never be touched by
the shared resync. Skip link-status updates when enabled == -1.
Correct the AN1760 -> AN1699 reference. Resync Rev.D0 link status on
interrupt (re-)enable, closing the same dropped-edge window as patch
1. Account for Rev.D0's autonomous PLCA-to-CSMA/CD fallback
(PRSCTL1): force semaphore mode when that fallback is enabled, since
PLCA_Status is meaningless once the PHY has already fallen back.

Changes in v2:
- Patch 2: Introduce OA_TC6_PHY_INT quirk flag to guard the virtual IRQ
infrastructure; PHYINT is optional per the OA TC6 standard. Move
oa_tc6_phy_irq_setup()/oa_tc6_phy_irq_teardown() into
oa_tc6_mdiobus_register()/oa_tc6_mdiobus_unregister(). Populate all
mii_bus->irq[] entries with the virtual IRQ before mdiobus_register()
so phy_device_create() picks it up regardless of the PHY's MDIO
address, keeping mii_bus->irq[] and phydev->irq consistent.
- Patch 3 (new): Pass OA_TC6_PHY_INT quirk flag from the LAN865X driver
to enable the virtual IRQ infrastructure for LAN865X.


Parthiban Veerasooran (4):
net: phy: microchip_t1s: fix collision detection on PLCA status change
net: ethernet: oa_tc6: deliver the PHY interrupt to phylib
microchip: lan865x: enable PHY interrupt via virtual IRQ
net: phy: microchip_t1s: fix collision detection for LAN867X Rev.D0

drivers/net/ethernet/Kconfig | 1 +
.../net/ethernet/microchip/lan865x/lan865x.c | 4 +-
drivers/net/ethernet/oa_tc6.c | 227 +++++++++++
drivers/net/phy/microchip_t1s.c | 365 +++++++++++++++++-
include/linux/oa_tc6.h | 3 +
5 files changed, 587 insertions(+), 13 deletions(-)


base-commit: c66d93e68728cfb5f40b40d0f24129d7768faf43
--
2.43.0