[PATCH v2 2/2] phy: nxp-c45-tja11xx: read the tx timestamp without lock
From: Radu Pirea (NXP OSS)
Date: Wed Dec 22 2021 - 16:35:22 EST
Reading the tx timestamps can be done in parallel with adjusting the LTC
value.
Calls to nxp_c45_get_hwtxts() are always serialised. If the phy
interrupt is enabled, .do_aux_work() will not call nxp_c45_get_hwtxts.
Signed-off-by: Radu Pirea (NXP OSS) <radu-nicolae.pirea@xxxxxxxxxxx>
---
drivers/net/phy/nxp-c45-tja11xx.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/net/phy/nxp-c45-tja11xx.c b/drivers/net/phy/nxp-c45-tja11xx.c
index 06fdbae509a79..24285a528fec9 100644
--- a/drivers/net/phy/nxp-c45-tja11xx.c
+++ b/drivers/net/phy/nxp-c45-tja11xx.c
@@ -216,7 +216,7 @@ struct nxp_c45_phy {
struct ptp_clock_info caps;
struct sk_buff_head tx_queue;
struct sk_buff_head rx_queue;
- /* used to access the PTP registers atomic */
+ /* used to access the LTC registers atomically */
struct mutex ptp_lock;
int hwts_tx;
int hwts_rx;
@@ -386,7 +386,6 @@ static bool nxp_c45_get_hwtxts(struct nxp_c45_phy *priv,
bool valid;
u16 reg;
- mutex_lock(&priv->ptp_lock);
phy_write_mmd(priv->phydev, MDIO_MMD_VEND1, VEND1_EGR_RING_CTRL,
RING_DONE);
reg = phy_read_mmd(priv->phydev, MDIO_MMD_VEND1, VEND1_EGR_RING_DATA_0);
@@ -406,7 +405,6 @@ static bool nxp_c45_get_hwtxts(struct nxp_c45_phy *priv,
hwts->sec |= (reg & RING_DATA_3_SEC_1_0) >> 14;
nxp_c45_get_hwtxts_out:
- mutex_unlock(&priv->ptp_lock);
return valid;
}
--
2.34.1