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

From: Parthiban Veerasooran

Date: Tue Sep 01 2026 - 09:10:19 EST


In a 10BASE-T1S multidrop network, when PLCA mode is configured, the PHY
autonomously transitions between PLCA mode and CSMA/CD mode based on
BEACON availability, without any further user action. The existing
collision detection logic only adjusted on explicit ethtool PLCA
configuration changes, leaving it in the wrong state across these
autonomous mode transitions.

This series fixes that gap, wires up the complete interrupt path, and
improves collision detection handling for LAN867X Rev.D0.

Patch 1 fixes the collision detection handling in the PHY driver. It adds
the PLCA Status Changed (PSTC) interrupt handler for LAN86XX PHYs. On
each PSTC interrupt, the PLCA operational status is checked and collision
detection is adjusted accordingly: disabled when PLCA is online,
re-enabled when PLCA goes offline to restore correct CSMA/CD operation.
The interrupt handler uses a conditional assignment pattern without early
returns for better extensibility. The existing static CDEN write in
lan86xx_plca_set_cfg() is retained as a baseline for PHYs running with
phydev->irq == PHY_POLL on boards where the PHY interrupt is not routed
to the host. PHYs with routed interrupts (including LAN865X and LAN867X
with interrupt support) skip the static write since the interrupt handler
handles CDEN dynamically.

Patch 2 delivers the in-band PHY interrupt to phylib from the 10BASE-T1S
MAC-PHY SPI driver. The integrated PHY has no dedicated interrupt line;
its interrupt arrives as the PHYINT bit in the MAC-PHY STATUS0 register.
A nested virtual IRQ is created and assigned to phydev->irq so phylib
enters interrupt mode and drives the PHY driver's
config_intr/handle_interrupt callbacks.

Patch 3 fixes collision detection for LAN867X Rev.D0 by configuring the
hardware Collision Counting and MAC Forwarding Control field (CCMFC) in
the Collision Detector Control 0 register to the OA default value. The
hardware automatically gates collision forwarding to the MAC based on the
live PLCA_Status: collisions are neither counted nor forwarded when
PLCA_Status is OK, and are counted and forwarded when PLCA_Status is not
OK. This eliminates the inherent delay between a PLCA status change and
the software interrupt handler toggling CDEN, which was a limitation on
older revisions that had no hardware alternative. A dedicated
lan867x_revd0_handle_interrupt() is added to handle two separate interrupt
events: link status change events trigger the phylib state machine for
link re-evaluation; PLCA status change events update the link status
selection. The handler uses the same conditional assignment pattern for
extensibility. Collision detection gating is handled autonomously by
CCMFC in hardware. The .config_intr/.handle_interrupt handlers are wired
up for Rev.D0 using the shared lan86xx_config_intr() and the new handler
to unmask both link status change and PLCA status change interrupts.

Note: Patch 1 carries a Fixes: tag but requires patch 2 to be applied
together -- the interrupt handler in patch 1 cannot fire without the
virtual IRQ wiring in patch 2. This dependency applies to 10BASE-T1S
MAC-PHYs (e.g. LAN8650/1) where the PHY has no dedicated interrupt line
and relies on the MAC-PHY SPI driver to deliver the interrupt.

Parthiban Veerasooran (3):
net: phy: microchip_t1s: fix collision detection on PLCA status change
net: ethernet: oa_tc6: deliver the PHY interrupt to phylib
net: phy: microchip_t1s: fix collision detection for LAN867X Rev.D0

drivers/net/ethernet/oa_tc6.c | 69 +++++++++++++-
drivers/net/phy/microchip_t1s.c | 159 ++++++++++++++++++++++++++++++++
include/linux/oa_tc6.h | 2 +
3 files changed, 227 insertions(+), 3 deletions(-)


base-commit: 25c1f6111034aef7fc06cfbdcf1e4f0d6e5ee74b
--
2.43.0