Skip to content

Commit 235d8b6

Browse files
Sean Andersonvinodkoul
authored andcommitted
phy: zynqmp: Only wait for PLL lock "primary" instances
For PCIe and DisplayPort, the phy instance represents the controller's logical lane. Wait for the instance 0 phy's PLL to lock as other instances will never lock. We do this in xpsgtr_wait_pll_lock so callers don't have to determine the correct lane themselves. The original comment is wrong about cumulative wait times. Since we are just polling a bit, all subsequent waiters will finish immediately. Signed-off-by: Sean Anderson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 6959d23 commit 235d8b6

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

drivers/phy/xilinx/phy-zynqmp.c

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,30 @@ static int xpsgtr_wait_pll_lock(struct phy *phy)
294294
struct xpsgtr_phy *gtr_phy = phy_get_drvdata(phy);
295295
struct xpsgtr_dev *gtr_dev = gtr_phy->dev;
296296
unsigned int timeout = TIMEOUT_US;
297+
u8 protocol = gtr_phy->protocol;
297298
int ret;
298299

299300
dev_dbg(gtr_dev->dev, "Waiting for PLL lock\n");
300301

302+
/*
303+
* For DP and PCIe, only the instance 0 PLL is used. Switch to that phy
304+
* so we wait on the right PLL.
305+
*/
306+
if ((protocol == ICM_PROTOCOL_DP || protocol == ICM_PROTOCOL_PCIE) &&
307+
gtr_phy->instance) {
308+
int i;
309+
310+
for (i = 0; i < NUM_LANES; i++) {
311+
gtr_phy = &gtr_dev->phys[i];
312+
313+
if (gtr_phy->protocol == protocol && !gtr_phy->instance)
314+
goto got_phy;
315+
}
316+
317+
return -EBUSY;
318+
}
319+
320+
got_phy:
301321
while (1) {
302322
u32 reg = xpsgtr_read_phy(gtr_phy, L0_PLL_STATUS_READ_1);
303323

@@ -625,15 +645,7 @@ static int xpsgtr_phy_power_on(struct phy *phy)
625645
/* Skip initialization if not required. */
626646
if (!xpsgtr_phy_init_required(gtr_phy))
627647
return ret;
628-
/*
629-
* Wait for the PLL to lock. For DP, only wait on DP0 to avoid
630-
* cumulating waits for both lanes. The user is expected to initialize
631-
* lane 0 last.
632-
*/
633-
if (gtr_phy->protocol != ICM_PROTOCOL_DP || !gtr_phy->instance)
634-
ret = xpsgtr_wait_pll_lock(phy);
635-
636-
return ret;
648+
return xpsgtr_wait_pll_lock(phy);
637649
}
638650

639651
static int xpsgtr_phy_configure(struct phy *phy, union phy_configure_opts *opts)

0 commit comments

Comments
 (0)