The driver currently sets rx_filter to a combination of
HWTSTAMP_FILTER_PTP_V2_EVENT and HWTSTAMP_FILTER_PTP_V1_L4_EVENT flags
for PTP v2 filters. This causes ptp4l to fail during initialization with
the error: 'The current filter does not match the required', leading to
port state transition to FAULTY.
The issue occurs because:
1. The combined filter flags are not a valid single filter value
2. PTP applications expect a specific single filter to be returned
3. The filter capability reported doesn't match what's actually configured
Fix this by:
- Separating PTP v1 and PTP v2 filter handling into distinct cases
- Adding proper handling for PTP v1 filters with dedicated break statement
- Using only HWTSTAMP_FILTER_PTP_V2_EVENT for PTP v2 filters
This ensures that each filter type returns the appropriate single filter
value, allowing PTP applications to work correctly.
Tested with ptp4l on TI J722S platform - PTP synchronization now
works correctly without filter mismatch errors.
Fixes: 82dc37251c01 ("FROMLIST: net: ti: am65-cpsw: Update hw timestamping
filter for PTPv1 RX packets")
Signed-off-by: Xulin Sun <[email protected]>
---
drivers/net/ethernet/ti/am65-cpsw-nuss.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
index 8ef85ef57014..3ea0c1440625 100644
--- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
+++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
@@ -2216,6 +2216,9 @@ static int am65_cpsw_nuss_hwtstamp_set(struct net_device
*ndev,
case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
+ port->rx_ts_enabled = true;
+ cfg.rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_EVENT;
+ break;
case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
@@ -2226,7 +2229,7 @@ static int am65_cpsw_nuss_hwtstamp_set(struct net_device
*ndev,
case HWTSTAMP_FILTER_PTP_V2_SYNC:
case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
port->rx_ts_enabled = true;
- cfg.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT |
HWTSTAMP_FILTER_PTP_V1_L4_EVENT;
+ cfg.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
break;
case HWTSTAMP_FILTER_ALL:
case HWTSTAMP_FILTER_SOME:
--
2.34.1
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#16177):
https://lists.yoctoproject.org/g/linux-yocto/message/16177
Mute This Topic: https://lists.yoctoproject.org/mt/117148798/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-