Skip to content

Commit de99e1e

Browse files
HoratiuVulturkuba-moo
authored andcommitted
net: phy: micrel: lan8814: Fix when enabling/disabling 1-step timestamping
There are 2 issues with the blamed commit. 1. When the phy is initialized, it would enable the disabled of UDPv4 checksums. The UDPv6 checksum is already enabled by default. So when 1-step is configured then it would clear these flags. 2. After the 1-step is configured, then if 2-step is configured then the 1-step would be still configured because it is not clearing the flag. So the sync frames will still have origin timestamps set. Fix this by reading first the value of the register and then just change bit 12 as this one determines if the timestamp needs to be inserted in the frame, without changing any other bits. Fixes: ece1950 ("net: phy: micrel: 1588 support for LAN8814 phy") Signed-off-by: Horatiu Vultur <[email protected]> Reviewed-by: Divya Koppera <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent b3da86d commit de99e1e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/net/phy/micrel.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2431,6 +2431,7 @@ static int lan8814_hwtstamp(struct mii_timestamper *mii_ts,
24312431
struct lan8814_ptp_rx_ts *rx_ts, *tmp;
24322432
int txcfg = 0, rxcfg = 0;
24332433
int pkt_ts_enable;
2434+
int tx_mod;
24342435

24352436
ptp_priv->hwts_tx_type = config->tx_type;
24362437
ptp_priv->rx_filter = config->rx_filter;
@@ -2477,9 +2478,14 @@ static int lan8814_hwtstamp(struct mii_timestamper *mii_ts,
24772478
lanphy_write_page_reg(ptp_priv->phydev, 5, PTP_RX_TIMESTAMP_EN, pkt_ts_enable);
24782479
lanphy_write_page_reg(ptp_priv->phydev, 5, PTP_TX_TIMESTAMP_EN, pkt_ts_enable);
24792480

2480-
if (ptp_priv->hwts_tx_type == HWTSTAMP_TX_ONESTEP_SYNC)
2481+
tx_mod = lanphy_read_page_reg(ptp_priv->phydev, 5, PTP_TX_MOD);
2482+
if (ptp_priv->hwts_tx_type == HWTSTAMP_TX_ONESTEP_SYNC) {
24812483
lanphy_write_page_reg(ptp_priv->phydev, 5, PTP_TX_MOD,
2482-
PTP_TX_MOD_TX_PTP_SYNC_TS_INSERT_);
2484+
tx_mod | PTP_TX_MOD_TX_PTP_SYNC_TS_INSERT_);
2485+
} else if (ptp_priv->hwts_tx_type == HWTSTAMP_TX_ON) {
2486+
lanphy_write_page_reg(ptp_priv->phydev, 5, PTP_TX_MOD,
2487+
tx_mod & ~PTP_TX_MOD_TX_PTP_SYNC_TS_INSERT_);
2488+
}
24832489

24842490
if (config->rx_filter != HWTSTAMP_FILTER_NONE)
24852491
lan8814_config_ts_intr(ptp_priv->phydev, true);

0 commit comments

Comments
 (0)