From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 48EAAC8302D for ; Mon, 30 Jun 2025 13:57:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lNRSqmYTjMzm/ZVx9Gl5+/0lHkkBW4LiCP9bXG2C6Ec=; b=cKuwmhKvYfdrwM GGiMt0+dC42i/eZANTP8srjbuNEO54G3mDtZdHyliertLxgnhq3CK6JmpM/VjQTgXi9+BnaBwCD8s FtOxhg/4ecRDtxHy9SVskoPhgOB4FwJvoMkUe4zR9wbHjiN+zUPi5VrAU6CsqfjCU2leM+FWQ5NJl 8fEAq+7uy7RrkktnBvh1a82+CmF+ba+gPH6aoXJQiXqPZKtge1xb1ITCg1Gi9RCDJ46nBIoKK0NSp SDOGhutniVmNliWFPCaFR4Q8IKmNvJhBJUjLKaDoXpoN6KLWRSxtKpsQmlLbHWVqCMCeGhHO97Ap4 H6opEMxRvOrlpd4sue4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uWF0f-00000002SXu-3TUH; Mon, 30 Jun 2025 13:57:25 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uWEs4-00000002Qrz-46Sk; Mon, 30 Jun 2025 13:48:34 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2465C1D34; Mon, 30 Jun 2025 06:48:14 -0700 (PDT) Received: from [10.1.196.50] (e121345-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 70DC03F6A8; Mon, 30 Jun 2025 06:48:27 -0700 (PDT) Message-ID: <2affed16-f3c4-47d3-9ca6-e4f48e875367@arm.com> Date: Mon, 30 Jun 2025 14:48:25 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v7 3/4] phy: rockchip-pcie: Enable all four lanes if required To: Geraldo Nascimento , linux-rockchip@lists.infradead.org Cc: Shawn Lin , Lorenzo Pieralisi , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Bjorn Helgaas , Heiko Stuebner , Vinod Koul , Kishon Vijay Abraham I , Rick wertenbroek , linux-phy@lists.infradead.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: From: Robin Murphy Content-Language: en-GB In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250630_064833_065119_04ED1382 X-CRM114-Status: GOOD ( 16.66 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org On 29/06/2025 9:58 pm, Geraldo Nascimento wrote: > Current code enables only Lane 0 because pwr_cnt will be incremented on > first call to the function. Let's reorder the enablement code to enable > all 4 lanes through GRF. As usual the TRM isn't very clear, but the way it describes the GRF_SOC_CON_5_PCIE bits does suggest they're driving external input signals of the phy block, so it seems reasonable that it could be OK to update the register itself without worrying about releasing the phy from reset first. In that case I'd agree this seems the cleanest fix, and if it works empirically then I think I'm now sufficiently convinced too; Reviewed-by: Robin Murphy > Signed-off-by: Geraldo Nascimento > --- > drivers/phy/rockchip/phy-rockchip-pcie.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/phy/rockchip/phy-rockchip-pcie.c b/drivers/phy/rockchip/phy-rockchip-pcie.c > index bd44af36c67a..f22ffb41cdc2 100644 > --- a/drivers/phy/rockchip/phy-rockchip-pcie.c > +++ b/drivers/phy/rockchip/phy-rockchip-pcie.c > @@ -160,6 +160,12 @@ static int rockchip_pcie_phy_power_on(struct phy *phy) > > guard(mutex)(&rk_phy->pcie_mutex); > > + regmap_write(rk_phy->reg_base, > + rk_phy->phy_data->pcie_laneoff, > + HIWORD_UPDATE(!PHY_LANE_IDLE_OFF, > + PHY_LANE_IDLE_MASK, > + PHY_LANE_IDLE_A_SHIFT + inst->index)); > + > if (rk_phy->pwr_cnt++) { > return 0; > } > @@ -176,12 +182,6 @@ static int rockchip_pcie_phy_power_on(struct phy *phy) > PHY_CFG_ADDR_MASK, > PHY_CFG_ADDR_SHIFT)); > > - regmap_write(rk_phy->reg_base, > - rk_phy->phy_data->pcie_laneoff, > - HIWORD_UPDATE(!PHY_LANE_IDLE_OFF, > - PHY_LANE_IDLE_MASK, > - PHY_LANE_IDLE_A_SHIFT + inst->index)); > - > /* > * No documented timeout value for phy operation below, > * so we make it large enough here. And we use loop-break -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy