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 0D4A5C5478C for ; Fri, 1 Mar 2024 06:42:51 +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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:CC:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SfoaPQOEE+gfkiJy7VH9E6nBvPMqGOE3PvV+1mkHGjg=; b=gidiJQH9doWu2/ Xl4waSpsFYSGg4D3Ogk4BGVM6eHImeCqA8lgcL5gqo8unjlq6YUCOJGhi1p9Gy4SZm18BW9t3Q7Br 92U1ETWat8cifl3Qqu6C7xS18Ios/oYaxWdtipUpH/9uGxF0LX/m30R+aaFoHSARTWmpjBjOH3aLB WfPc5Th6FskZFlHbTGVFHbsEVWVgCOIL26zfaxl3A8ATG/HhkzuP2D+DSuCamj1CHTv1VZJdLg7UI 4VdQB0XeGk2N3Pa8q6uVM9RddF0rMK/6agyIZjaxegmdmPLnFtxVwbvVAMlQQVOsmliSSCX/PYl6y 5FP1RLsA6sDy+n7sVEjg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rfwbR-0000000GbmY-0r9n; Fri, 01 Mar 2024 06:42:41 +0000 Received: from fllv0015.ext.ti.com ([198.47.19.141]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rfwbO-0000000Gbko-2krp; Fri, 01 Mar 2024 06:42:40 +0000 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 4216gQfL079737; Fri, 1 Mar 2024 00:42:26 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1709275346; bh=cymxrUKXsjmmgn8eIcQnHhWpzzzveFDfdOGvsAceMAM=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=gtm8E90rRo5IOpeq1A5f6w52t9saLWSkUnRfMsTBTHAwFk1Sdnu7+8nf/OAlsUyuB H+Er29EMLJp1qwbfLhBx8HBzwAOFfKyIXhLDKjFEULDOIO8oByKnVFN6ZNtGEx4bDO 2uBix7mKZArgnG6uvzxyjyQbOzIAVCtQe8ZUkdsw= Received: from DLEE107.ent.ti.com (dlee107.ent.ti.com [157.170.170.37]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 4216gQDh096743 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 1 Mar 2024 00:42:26 -0600 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Fri, 1 Mar 2024 00:42:26 -0600 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Fri, 1 Mar 2024 00:42:26 -0600 Received: from localhost (uda0492258.dhcp.ti.com [172.24.227.9]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 4216gPaR010515; Fri, 1 Mar 2024 00:42:26 -0600 Date: Fri, 1 Mar 2024 12:12:25 +0530 From: Siddharth Vadapalli To: AngeloGioacchino Del Regno CC: , , , , , , , , , , , , , , , Subject: Re: [PATCH v2] PCI: mediatek-gen3: Assert MAC reset only if PHY reset also present Message-ID: References: <20240229092449.580971-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240229092449.580971-1-angelogioacchino.delregno@collabora.com> X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240229_224238_849071_3B452E6D X-CRM114-Status: GOOD ( 23.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Feb 29, 2024 at 10:24:49AM +0100, AngeloGioacchino Del Regno wrote: > Some SoCs have two PCI-Express controllers: in the case of MT8195, > one of them is using a dedicated PHY, but the other uses a combo PHY > that is shared with USB and in that case the PHY cannot be reset > from the PCIe driver, or USB functionality will be unable to resume. > > Resetting the PCIe MAC without also resetting the PHY will result in > a full system lockup at PCIe resume time and the only option to > resume operation is to hard reboot the system (with a PMIC cut-off). > > To resolve this issue, check if we've got both a PHY and a MAC reset > and, if not, never assert resets at PM suspend time: in that case, > the link is still getting powered down as both the clocks and the > power domains will go down anyway. > > Fixes: d537dc125f07 ("PCI: mediatek-gen3: Add system PM support") > Signed-off-by: AngeloGioacchino Del Regno > --- > > Changes in v2: > - Rebased over next-20240229 > > drivers/pci/controller/pcie-mediatek-gen3.c | 25 ++++++++++++++------- > 1 file changed, 17 insertions(+), 8 deletions(-) > > diff --git a/drivers/pci/controller/pcie-mediatek-gen3.c b/drivers/pci/controller/pcie-mediatek-gen3.c > index 975b3024fb08..99b5d7a49be1 100644 > --- a/drivers/pci/controller/pcie-mediatek-gen3.c > +++ b/drivers/pci/controller/pcie-mediatek-gen3.c > @@ -874,17 +874,26 @@ static int mtk_pcie_power_up(struct mtk_gen3_pcie *pcie) > return err; > } > > -static void mtk_pcie_power_down(struct mtk_gen3_pcie *pcie) > +static void mtk_pcie_power_down(struct mtk_gen3_pcie *pcie, bool is_suspend) > { > + bool suspend_reset_supported = pcie->mac_reset && pcie->phy_reset; > + > clk_bulk_disable_unprepare(pcie->num_clks, pcie->clks); > > pm_runtime_put_sync(pcie->dev); > pm_runtime_disable(pcie->dev); > - reset_control_assert(pcie->mac_reset); > + > + /* > + * Assert MAC reset only if we also got a PHY reset, otherwise > + * the system will lockup at PM resume time. > + */ > + if (is_suspend && suspend_reset_supported) > + reset_control_assert(pcie->mac_reset); > > phy_power_off(pcie->phy); > phy_exit(pcie->phy); Wouldn't this power off the shared PHY? Or will the PHY driver make this NO-OP if the PHY is shared, in which case the above two statements could be combined with the other statements in the: if (is_suspend && suspend_reset_supported) condition to get a single block of code that also combines the reset_control_assert(pcie->phy_reset) present below. > - reset_control_assert(pcie->phy_reset); > + if (is_suspend && suspend_reset_supported) > + reset_control_assert(pcie->phy_reset); > } > ... Regards, Siddharth. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel