Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp22550lqh; Mon, 6 May 2024 10:02:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW8985+PfD2y1MY4mY+CpxIfHghQproWd3NQma8Im+SgO+ZlxfC0avqBoKxb9anXiYlXVH2oaaWtCXh7wApihLvYZNPoQ82XwvQAVXv/A== X-Google-Smtp-Source: AGHT+IF7DvQpHDZxJGtef42UT22RT5RTkH1kN4VXiV0/Vfxl8Ma9jgLY6KqKVyksZTNVIYO4Kn2x X-Received: by 2002:a05:622a:650:b0:43a:fa90:edb6 with SMTP id a16-20020a05622a065000b0043afa90edb6mr13447273qtb.60.1715014920943; Mon, 06 May 2024 10:02:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715014920; cv=pass; d=google.com; s=arc-20160816; b=YA5EDYdfEU8hequKyuoWSAzBFNMil3GFHznWs/jRHaYnehbE4nVhxX3kRdgdwz284F BvayxLCganSIwCfTzEmquRzpBx0q+cNqoQXYEnTcoXJ7dHnfkVRBM1wGXnkzytEqGm1p rVcnLYuIp0xswRcBPqEYMCOBhWNdK+dVJx4Dzdkudp9rSpcB4+wdleVgakBVLYZ37TUe jKwSqn/mnj5tM45siNA6HeZQGzvJY/Q2ofobn3F6M/YnRryLe2InX1YLRnE2qvP1DGc+ D9+/DHhFImvb9crL1qe0WgB1fXs8M4/VgGPdiaJE2+4IGtka4Twiqb+QUrX76mBifBWa /dmQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=f+Np06nET1bUu2fFobpOkXKoyFCkgH94QLr++iblhls=; fh=q7tQHM/3mw530/NG0tnxgRi+88xJuLx0MjFmQlO4hbE=; b=eSa8ASICITN7UcPGtG4ZT88r3KmXoJHxJNQ51fd+jVlCVe+NbAny+OeWHxLckKQcJk EmQ2PniS2R3Ze9fgshNClfm6xybyL6U50uO1E1BNoHs7wPO57RkGyb9OeQQiQuJn0bwx a9Cw9/jECO5uSmXgzT/RZgIQDXgPmc2w0o9KzDe1o/KobgYL3a10fPRlhb6ZzGwdN4S7 pwwoXUd5u5BkbSe/9pBZOATNUH2te16pYZpO5VlgkXVn0yN/Qgg+p+s0gWqplxTkCThA pkFNsc5Hyh3MKPi0h3vbNWcMIDhKsOXSX/8W7yoamHdYtRPNp/6IXeUPqC8LrOpHTbk6 v9kA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=dV2SIsuU; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-170215-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170215-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id u5-20020ac858c5000000b0043ac84e8349si10580280qta.686.2024.05.06.10.02.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 10:02:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170215-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=dV2SIsuU; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-170215-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170215-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 387E31C21CC4 for ; Mon, 6 May 2024 17:01:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C899D156F43; Mon, 6 May 2024 17:01:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="dV2SIsuU" Received: from out-172.mta1.migadu.com (out-172.mta1.migadu.com [95.215.58.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7402715746C for ; Mon, 6 May 2024 17:01:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715014883; cv=none; b=bQYnrYQ2D5w8GFxr7mg9aG8WqFwknrtFEXzQcfSD9TaJOc84HFRDYuckW84unLdMsrO7/wk+rNvIZB/digBd9cp14eb8bw1VQ3owJUyBb5yjOB56v1yEfoz6Zjo2dLW9KCWt8TlqOEQqsYbxh2WZiBl/8x9q1Vp6ktfnq7X2kAE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715014883; c=relaxed/simple; bh=9o9cp9ASuaoo2SeaWcpce2frMMF2qGAGLxQ+yzn2qDs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JITJnTpGozAuO+gWTYYha10J8aXx1KZ+ovCLMm6em4KRrpy/gXjv+up+ZG0lQfbnb2eNo7cdYrPa7tsAfnOwjZscnxS9LbMBwQFLnjKgzsKBt4URTnfJqZQar21ZA9mrRcJB8O1YsoqpMClJVuvVoIFVdEGhMMFfQmhtFi97jMI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=dV2SIsuU; arc=none smtp.client-ip=95.215.58.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1715014879; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=f+Np06nET1bUu2fFobpOkXKoyFCkgH94QLr++iblhls=; b=dV2SIsuUJzOTHHIwYfo2u8cKOEkJF1YDJip1kQ/Y/LYAtU7TZQgBy4HW+SFsjfJQaeLifb FaMEJn4HtemjuPejPPIID7eZ6jWjoDe1UjXILFqC31EHFs/Qc5CEAi6O22KoFUs3N+naHv L4Qa659i6SOozEuEED8H8LT8htgQP5g= From: Sean Anderson To: Laurent Pinchart , linux-phy@lists.infradead.org Cc: Vinod Koul , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Michal Simek , Kishon Vijay Abraham I , Sean Anderson Subject: [PATCH v2 3/4] phy: zynqmp: Only wait for PLL lock "primary" instances Date: Mon, 6 May 2024 13:01:09 -0400 Message-Id: <20240506170110.2874724-4-sean.anderson@linux.dev> In-Reply-To: <20240506170110.2874724-1-sean.anderson@linux.dev> References: <20240506170110.2874724-1-sean.anderson@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT 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 --- Changes in v2: - Move the logic for waiting on PLL lock to xpsgtr_wait_pll_lock drivers/phy/xilinx/phy-zynqmp.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/drivers/phy/xilinx/phy-zynqmp.c b/drivers/phy/xilinx/phy-zynqmp.c index 5a8f81bbeb8d..b86fe2a249a8 100644 --- a/drivers/phy/xilinx/phy-zynqmp.c +++ b/drivers/phy/xilinx/phy-zynqmp.c @@ -294,10 +294,30 @@ static int xpsgtr_wait_pll_lock(struct phy *phy) struct xpsgtr_phy *gtr_phy = phy_get_drvdata(phy); struct xpsgtr_dev *gtr_dev = gtr_phy->dev; unsigned int timeout = TIMEOUT_US; + u8 protocol = gtr_phy->protocol; int ret; dev_dbg(gtr_dev->dev, "Waiting for PLL lock\n"); + /* + * For DP and PCIe, only the instance 0 PLL is used. Switch to that phy + * so we wait on the right PLL. + */ + if ((protocol == ICM_PROTOCOL_DP || protocol == ICM_PROTOCOL_PCIE) && + gtr_phy->instance) { + int i; + + for (i = 0; i < NUM_LANES; i++) { + gtr_phy = >r_dev->phys[i]; + + if (gtr_phy->protocol == protocol && !gtr_phy->instance) + goto got_phy; + } + + return -EBUSY; + } + +got_phy: while (1) { u32 reg = xpsgtr_read_phy(gtr_phy, L0_PLL_STATUS_READ_1); @@ -627,15 +647,7 @@ static int xpsgtr_phy_power_on(struct phy *phy) /* Skip initialization if not required. */ if (!xpsgtr_phy_init_required(gtr_phy)) return ret; - /* - * Wait for the PLL to lock. For DP, only wait on DP0 to avoid - * cumulating waits for both lanes. The user is expected to initialize - * lane 0 last. - */ - if (gtr_phy->protocol != ICM_PROTOCOL_DP || !gtr_phy->instance) - ret = xpsgtr_wait_pll_lock(phy); - - return ret; + return xpsgtr_wait_pll_lock(phy); } static int xpsgtr_phy_configure(struct phy *phy, union phy_configure_opts *opts) -- 2.35.1.1320.gc452695387.dirty