Netdev List
 help / color / mirror / Atom feed
From: Parthiban Veerasooran <parthiban.veerasooran@microchip.com>
To: <andrew+netdev@lunn.ch>, <davem@davemloft.net>,
	<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<hkallweit1@gmail.com>, <linux@armlinux.org.uk>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<UNGLinuxDriver@microchip.com>,
	<Parthiban.Veerasooran@microchip.com>,
	Parthiban Veerasooran <parthiban.veerasooran@microchip.com>
Subject: [PATCH net-next v3 0/4] net: microchip_t1s: fix collision detection on PLCA status change
Date: Fri, 18 Sep 2026 20:02:58 +0530	[thread overview]
Message-ID: <20260918143302.76909-1-parthiban.veerasooran@microchip.com> (raw)


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


             reply	other threads:[~2026-09-18 14:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-18 14:32 Parthiban Veerasooran [this message]
2026-09-18 14:32 ` [PATCH net-next v3 1/4] net: phy: microchip_t1s: fix collision detection on PLCA status change 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
2026-09-24 15:33 ` [PATCH net-next v3 0/4] net: microchip_t1s: fix collision detection on PLCA status change Jakub Kicinski
2026-09-25 10:57   ` Parthiban Veerasooran

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260918143302.76909-1-parthiban.veerasooran@microchip.com \
    --to=parthiban.veerasooran@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox