Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <sean.anderson@linux.dev>
Link: https://lore.kernel.org/r/20240628205540.3098010-4-sean.anderson@linux.dev
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Sean Anderson and committed by
Vinod Koul
235d8b66 6959d236

+21 -9
+21 -9
drivers/phy/xilinx/phy-zynqmp.c
··· 294 294 struct xpsgtr_phy *gtr_phy = phy_get_drvdata(phy); 295 295 struct xpsgtr_dev *gtr_dev = gtr_phy->dev; 296 296 unsigned int timeout = TIMEOUT_US; 297 + u8 protocol = gtr_phy->protocol; 297 298 int ret; 298 299 299 300 dev_dbg(gtr_dev->dev, "Waiting for PLL lock\n"); 300 301 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: 301 321 while (1) { 302 322 u32 reg = xpsgtr_read_phy(gtr_phy, L0_PLL_STATUS_READ_1); 303 323 ··· 645 625 /* Skip initialization if not required. */ 646 626 if (!xpsgtr_phy_init_required(gtr_phy)) 647 627 return ret; 648 - /* 649 - * Wait for the PLL to lock. For DP, only wait on DP0 to avoid 650 - * cumulating waits for both lanes. The user is expected to initialize 651 - * lane 0 last. 652 - */ 653 - if (gtr_phy->protocol != ICM_PROTOCOL_DP || !gtr_phy->instance) 654 - ret = xpsgtr_wait_pll_lock(phy); 655 - 656 - return ret; 628 + return xpsgtr_wait_pll_lock(phy); 657 629 } 658 630 659 631 static int xpsgtr_phy_configure(struct phy *phy, union phy_configure_opts *opts)