mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
net: macb: Clear SRTSM outside PTPv2 receive filters
A PTPv2 receive filter sets NCR.SRTSM, but switching to NONE, ALL or a PTPv1 filter leaves it set. As a result, selecting the same filter can produce a different register setting depending on whether PTPv2 was used before. Update SRTSM whenever the RX filter changes, setting it only for PTPv2. Switching away from PTPv2 then clears the old setting, so the bit follows the currently selected filter. Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de> Reviewed-by: Théo Lebrun <theo.lebrun@bootlin.com> Tested-by: Nicolai Buchwitz <nb@tipi-net.de> Signed-off-by: Kim Wooseok <5mghybrid@khu.ac.kr> Link: https://patch.msgid.link/20260923-macb-hwtstamp-rework-v2-3-75c909b2676d@khu.ac.kr Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
059a5a238c
commit
7ca3702d40
|
|
@ -394,8 +394,8 @@ int gem_set_hwtst(struct net_device *netdev,
|
|||
enum macb_bd_control rx_bd_control = TSTAMP_DISABLED;
|
||||
int rx_filter = tstamp_config->rx_filter;
|
||||
struct macb *bp = netdev_priv(netdev);
|
||||
u32 ncr_mask = MACB_BIT(SRTSM);
|
||||
unsigned long flags;
|
||||
u32 ncr_mask = 0;
|
||||
u32 ncr_bits = 0;
|
||||
u32 regval;
|
||||
|
||||
|
|
@ -432,7 +432,6 @@ int gem_set_hwtst(struct net_device *netdev,
|
|||
case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
|
||||
rx_bd_control = TSTAMP_ALL_PTP_FRAMES;
|
||||
rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
|
||||
ncr_mask |= MACB_BIT(SRTSM);
|
||||
ncr_bits |= MACB_BIT(SRTSM);
|
||||
break;
|
||||
case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
|
||||
|
|
@ -447,11 +446,9 @@ int gem_set_hwtst(struct net_device *netdev,
|
|||
}
|
||||
|
||||
spin_lock_irqsave(&bp->lock, flags);
|
||||
if (ncr_mask) {
|
||||
regval = macb_readl(bp, NCR);
|
||||
regval = (regval & ~ncr_mask) | ncr_bits;
|
||||
macb_writel(bp, NCR, regval);
|
||||
}
|
||||
regval = macb_readl(bp, NCR);
|
||||
regval = (regval & ~ncr_mask) | ncr_bits;
|
||||
macb_writel(bp, NCR, regval);
|
||||
|
||||
gem_writel(bp, TXBDCTRL, GEM_BF(TXTSMODE, tx_bd_control));
|
||||
gem_writel(bp, RXBDCTRL, GEM_BF(RXTSMODE, rx_bd_control));
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user