aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/phy/bcm-phy-ptp.c
diff options
context:
space:
mode:
authorGravatar Kory Maincent <kory.maincent@bootlin.com> 2023-11-14 12:28:41 +0100
committerGravatar David S. Miller <davem@davemloft.net> 2023-11-18 14:52:57 +0000
commit0f7f463d4821a4f52fa5c0a961389e651d50c384 (patch)
tree76d682494226939dac8adba05bf57ae34b827357 /drivers/net/phy/bcm-phy-ptp.c
parentnet: Replace hwtstamp_source by timestamping layer (diff)
downloadlinux-0f7f463d4821a4f52fa5c0a961389e651d50c384.tar.gz
linux-0f7f463d4821a4f52fa5c0a961389e651d50c384.tar.bz2
linux-0f7f463d4821a4f52fa5c0a961389e651d50c384.zip
net: Change the API of PHY default timestamp to MAC
Change the API to select MAC default time stamping instead of the PHY. Indeed the PHY is closer to the wire therefore theoretically it has less delay than the MAC timestamping but the reality is different. Due to lower time stamping clock frequency, latency in the MDIO bus and no PHC hardware synchronization between different PHY, the PHY PTP is often less precise than the MAC. The exception is for PHY designed specially for PTP case but these devices are not very widespread. For not breaking the compatibility I introduce a default_timestamp flag in phy_device that is set by the phy driver to know we are using the old API behavior. The phy_set_timestamp function is called at each call of phy_attach_direct. In case of MAC driver using phylink this function is called when the interface is turned up. Then if the interface goes down and up again the last choice of timestamp will be overwritten by the default choice. A solution could be to cache the timestamp status but it can bring other issues. In case of SFP, if we change the module, it doesn't make sense to blindly re-set the timestamp back to PHY, if the new module has a PHY with mediocre timestamping capabilities. Signed-off-by: Kory Maincent <kory.maincent@bootlin.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/bcm-phy-ptp.c')
-rw-r--r--drivers/net/phy/bcm-phy-ptp.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/phy/bcm-phy-ptp.c b/drivers/net/phy/bcm-phy-ptp.c
index 617d384d4551..d3e825c951ee 100644
--- a/drivers/net/phy/bcm-phy-ptp.c
+++ b/drivers/net/phy/bcm-phy-ptp.c
@@ -931,6 +931,9 @@ struct bcm_ptp_private *bcm_ptp_probe(struct phy_device *phydev)
return ERR_CAST(clock);
priv->ptp_clock = clock;
+ /* Timestamp selected by default to keep legacy API */
+ phydev->default_timestamp = true;
+
priv->phydev = phydev;
bcm_ptp_init(priv);