Skip to content

Commit 0ac87fe

Browse files
vladimirolteandavem330
authored andcommitted
phy: lynx-28g: lock PHY while performing CDR lock workaround
lynx_28g_cdr_lock_check() runs once per second in a workqueue to reset the lane receiver if the CDR has not locked onto bit transitions in the RX stream. But the PHY consumer may do stuff with the PHY simultaneously, and that isn't okay. Block concurrent generic PHY calls by holding the PHY mutex from this workqueue. Fixes: 8f73b37 ("phy: add support for the Layerscape SerDes 28G") Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent f200bab commit 0ac87fe

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

drivers/phy/freescale/phy-fsl-lynx-28g.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -508,11 +508,12 @@ static void lynx_28g_cdr_lock_check(struct work_struct *work)
508508
for (i = 0; i < LYNX_28G_NUM_LANE; i++) {
509509
lane = &priv->lane[i];
510510

511-
if (!lane->init)
512-
continue;
511+
mutex_lock(&lane->phy->mutex);
513512

514-
if (!lane->powered_up)
513+
if (!lane->init || !lane->powered_up) {
514+
mutex_unlock(&lane->phy->mutex);
515515
continue;
516+
}
516517

517518
rrstctl = lynx_28g_lane_read(lane, LNaRRSTCTL);
518519
if (!(rrstctl & LYNX_28G_LNaRRSTCTL_CDR_LOCK)) {
@@ -521,6 +522,8 @@ static void lynx_28g_cdr_lock_check(struct work_struct *work)
521522
rrstctl = lynx_28g_lane_read(lane, LNaRRSTCTL);
522523
} while (!(rrstctl & LYNX_28G_LNaRRSTCTL_RST_DONE));
523524
}
525+
526+
mutex_unlock(&lane->phy->mutex);
524527
}
525528
queue_delayed_work(system_power_efficient_wq, &priv->cdr_check,
526529
msecs_to_jiffies(1000));

0 commit comments

Comments
 (0)