[PATCH net-next V2 5/7] net: enetc: look up VF ptp-timer from its PF device node

From: xiaoning . wang

Date: Fri Nov 27 2026 - 04:51:52 EST


From: Clark Wang <xiaoning.wang@xxxxxxx>

ENETC VFs do not have their own DT nodes, so enetc_get_phc_index()
currently skips the 'ptp-timer' phandle lookup for VFs and always falls
back to enetc_get_phc_index_by_pdev(), which only searches the VF's own
PCI domain and bus.

On platforms where a PF with VFs uses a shared PTP timer on a different
PCI domain/bus via the 'ptp-timer' property (such as ENETC 1 on i.MX952),
this causes the VF to fail to find the PHC and fall back to software TX
timestamping.

Use pci_physfn() to obtain the PF's device_node so VFs inherit the
'ptp-timer' phandle configured on their PF before falling back to the
PCI bus lookup.

Signed-off-by: Clark Wang <xiaoning.wang@xxxxxxx>
---
drivers/net/ethernet/freescale/enetc/enetc_ethtool.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
index 7965dfd06f5f..dd0654683b09 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
@@ -1168,7 +1168,8 @@ static int enetc_get_phc_index_by_pdev(struct enetc_si *si)

static int enetc_get_phc_index(struct enetc_si *si)
{
- struct device_node *np = si->pdev->dev.of_node;
+ struct pci_dev *pdev = pci_physfn(si->pdev);
+ struct device_node *np = pdev->dev.of_node;
struct device_node *timer_np;
int phc_index;

--
2.43.0