Commit 0ac87fe5 authored by Vladimir Oltean's avatar Vladimir Oltean Committed by David S. Miller

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: 8f73b37c ("phy: add support for the Layerscape SerDes 28G")
Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f200bab3
...@@ -508,11 +508,12 @@ static void lynx_28g_cdr_lock_check(struct work_struct *work) ...@@ -508,11 +508,12 @@ static void lynx_28g_cdr_lock_check(struct work_struct *work)
for (i = 0; i < LYNX_28G_NUM_LANE; i++) { for (i = 0; i < LYNX_28G_NUM_LANE; i++) {
lane = &priv->lane[i]; lane = &priv->lane[i];
if (!lane->init) mutex_lock(&lane->phy->mutex);
continue;
if (!lane->powered_up) if (!lane->init || !lane->powered_up) {
mutex_unlock(&lane->phy->mutex);
continue; continue;
}
rrstctl = lynx_28g_lane_read(lane, LNaRRSTCTL); rrstctl = lynx_28g_lane_read(lane, LNaRRSTCTL);
if (!(rrstctl & LYNX_28G_LNaRRSTCTL_CDR_LOCK)) { if (!(rrstctl & LYNX_28G_LNaRRSTCTL_CDR_LOCK)) {
...@@ -521,6 +522,8 @@ static void lynx_28g_cdr_lock_check(struct work_struct *work) ...@@ -521,6 +522,8 @@ static void lynx_28g_cdr_lock_check(struct work_struct *work)
rrstctl = lynx_28g_lane_read(lane, LNaRRSTCTL); rrstctl = lynx_28g_lane_read(lane, LNaRRSTCTL);
} while (!(rrstctl & LYNX_28G_LNaRRSTCTL_RST_DONE)); } while (!(rrstctl & LYNX_28G_LNaRRSTCTL_RST_DONE));
} }
mutex_unlock(&lane->phy->mutex);
} }
queue_delayed_work(system_power_efficient_wq, &priv->cdr_check, queue_delayed_work(system_power_efficient_wq, &priv->cdr_check,
msecs_to_jiffies(1000)); msecs_to_jiffies(1000));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment