mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net-next v3 0/4] net: microchip_t1s: fix collision detection on PLCA status change
@ 2026-09-18 14:32 Parthiban Veerasooran
  2026-09-18 14:32 ` [PATCH net-next v3 1/4] net: phy: " Parthiban Veerasooran
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Parthiban Veerasooran @ 2026-09-18 14:32 UTC (permalink / raw)
  To: andrew+netdev, davem, edumazet, kuba, pabeni, hkallweit1, linux
  Cc: netdev, linux-kernel, UNGLinuxDriver, Parthiban.Veerasooran,
	Parthiban Veerasooran


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

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

Patch 1 adds a PLCA Status Changed (PSTC) interrupt handler for LAN86XX
PHYs that dynamically enables/disables collision detection based on live
PLCA status. The static CDEN write in lan86xx_plca_set_cfg() is kept as
a baseline for PHYs without a routed interrupt.

Patch 2 delivers the in-band PHY interrupt from the OA TC6 MAC-PHY SPI
driver to phylib as a nested virtual IRQ, gated by a new OA_TC6_PHY_INT
quirk flag. This lets phylib drive the PHY driver's
config_intr/handle_interrupt callbacks for PHYs with no dedicated
interrupt line.

Patch 3 enables this virtual IRQ path for LAN865X, whose internal PHY
has no dedicated interrupt line and relies entirely on the MAC-PHY SPI
interface for interrupt delivery.

Patch 4 fixes collision detection for LAN867X Rev.D0 using its hardware
CCMFC field, which gates collision forwarding to the MAC based on live
PLCA_Status directly, removing the software CDEN toggling delay present
on older revisions. It also accounts for Rev.D0's autonomous PLCA-to-
CSMA/CD fallback (PRSCTL1), so the link status selection stays correct
whether or not that fallback is configured.

Note: Patches 1 and 3 both carry Fixes: 78341049fbcd. Patch 3 is
required for the fix to take effect on LAN865X - without it,
phydev->irq stays PHY_POLL and patch 1's interrupt handler never runs
for that device. Patch 2 is a required prerequisite for patch 3 but
fixes no bug on its own, so it carries no Fixes: tag. Please apply all
three 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                 | 145 ++++++++
 drivers/net/phy/microchip_t1s.c               | 309 +++++++++++++++++-
 include/linux/oa_tc6.h                        |   3 +
 5 files changed, 454 insertions(+), 8 deletions(-)


base-commit: 4bb9710c6a68d35207f123aef55dcd50e7195ec5
-- 
2.43.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-09-22 15:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-18 14:32 [PATCH net-next v3 0/4] net: microchip_t1s: fix collision detection on PLCA status change Parthiban Veerasooran
2026-09-18 14:32 ` [PATCH net-next v3 1/4] net: phy: " Parthiban Veerasooran
2026-09-22 15:08   ` netdev-bot+sashiko
2026-09-18 14:33 ` [PATCH net-next v3 2/4] net: ethernet: oa_tc6: deliver the PHY interrupt to phylib Parthiban Veerasooran
2026-09-22 15:08   ` netdev-bot+sashiko
2026-09-18 14:33 ` [PATCH net-next v3 3/4] microchip: lan865x: enable PHY interrupt via virtual IRQ Parthiban Veerasooran
2026-09-22 15:08   ` netdev-bot+sashiko
2026-09-18 14:33 ` [PATCH net-next v3 4/4] net: phy: microchip_t1s: fix collision detection for LAN867X Rev.D0 Parthiban Veerasooran
2026-09-22 15:08   ` netdev-bot+sashiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®