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 9D329C5478C for ; Fri, 1 Mar 2024 09:56:07 +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=iMucFIcT7PIy5NtKlE7kdjNyrzOAJDNR8KWHtCxYdPM=; b=E5Q9RX07BIIO4r OIoQRsT1Z+WsRX67o+xXC3DWUnjoKKGZSf3DUgmNOCw+FLY/kWgZdWx7/Lsq0RsZUhWHQe6GrBcW9 4J9t2nt2IXjLiY8Qx7lMJV5ubsDXO3YONk4qy5Op5HgkLeFg37M1yW5uHFdKWjr6KkoPdKMILOAEv Wo4Uaq/kzaYyh4FAC75HgUbU/3nKXKFlCvuG42NF1PQynFGnLgWK8aZflRpYzgQMy75V/DqIzYe0N VseOMcUShpqypWbORXRS11UBd2swH/TR7k7VHvwtoSLzRWCznXGUrC75eIUZ3L7nPPGXU6RNV6ZPf 9TedpiwdJJAWmlaqOmMA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rfzcO-0000000HGI2-1liG; Fri, 01 Mar 2024 09:55:52 +0000 Received: from lelv0142.ext.ti.com ([198.47.23.249]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rfzcL-0000000HGGw-01EA; Fri, 01 Mar 2024 09:55:50 +0000 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 4219tPbo107280; Fri, 1 Mar 2024 03:55:25 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1709286925; bh=vDfr0yp6C7xDyyNdToZD3gwq3T9ELQ+xwGdPREZ00cI=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=xrGghXaBtr4kZR8rMV6MgYmVuHmN8laIPpUPrIMjve/sWCx81rBH5N+YejowBj9jm DKbiwOaExltjW7e/GsZb9g7IyAcZTlBGGCRekCYzmnr99kmNibTC0mEMaKbCP5f5to BXd62pdCoIX0i4N8uUR0WAcNwR8cnBRG9KOjIkoM= Received: from DFLE101.ent.ti.com (dfle101.ent.ti.com [10.64.6.22]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 4219tPHt027170 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 1 Mar 2024 03:55:25 -0600 Received: from DFLE112.ent.ti.com (10.64.6.33) by DFLE101.ent.ti.com (10.64.6.22) 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 03:55:25 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DFLE112.ent.ti.com (10.64.6.33) 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 03:55:25 -0600 Received: from localhost (uda0492258.dhcp.ti.com [172.24.227.9]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 4219tOE6119278; Fri, 1 Mar 2024 03:55:25 -0600 Date: Fri, 1 Mar 2024 15:25:24 +0530 From: Siddharth Vadapalli To: AngeloGioacchino Del Regno CC: Siddharth Vadapalli , , , , , , , , , , , , , , , Subject: Re: [PATCH v2] PCI: mediatek-gen3: Assert MAC reset only if PHY reset also present Message-ID: <9920b298-4627-4323-b367-13ee94a83869@ti.com> References: <20240229092449.580971-1-angelogioacchino.delregno@collabora.com> <2b2effdd-0b9d-40fd-a88d-ab364f2b0668@collabora.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2b2effdd-0b9d-40fd-a88d-ab364f2b0668@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-20240301_015549_278708_72FF75BD X-CRM114-Status: GOOD ( 30.74 ) 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 Fri, Mar 01, 2024 at 10:06:33AM +0100, AngeloGioacchino Del Regno wrote: > Il 01/03/24 07:42, Siddharth Vadapalli ha scritto: > > 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. > > > > No, that'd be fine: > > static int mtk_phy_power_off(struct phy *phy) > { > struct mtk_phy_instance *instance = phy_get_drvdata(phy); > struct mtk_tphy *tphy = dev_get_drvdata(phy->dev.parent); > > if (instance->type == PHY_TYPE_USB2) > u2_phy_instance_power_off(tphy, instance); > else if (instance->type == PHY_TYPE_PCIE) > pcie_phy_instance_power_off(tphy, instance); > > return 0; > } > > ...it's two different PHY instances that we're dealing with, here :-) I didn't realize that it is handled separately. Thank you for clarifying! Regards, Siddharth. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel