Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp185336lqg; Fri, 1 Mar 2024 01:56:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWltaVyHgeFlYG99uFxR4n2koCiW85Wtk3WGXvuwvHgrC0FpYCTLsWabX99kWYWl3Nh6LaYxe91i6TWc+GMnThS5/Hr+0Y6oF5R4rqCkg== X-Google-Smtp-Source: AGHT+IFSyxsIS6wKbqXmyd/qJxCQN1MLeGwN2B1LPePLsOhPiTkW/BzB5islVacnHnYGEfY7Iq9U X-Received: by 2002:a17:902:ec90:b0:1dc:41a1:9ece with SMTP id x16-20020a170902ec9000b001dc41a19ecemr1393881plg.19.1709286988740; Fri, 01 Mar 2024 01:56:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709286988; cv=pass; d=google.com; s=arc-20160816; b=fcj5o1tXXda2nUX77ESjenxOoIJIEN2uy3wHTwdgVWfQ7BMGWy1H2uFyn9u2TVuDeQ F17VWlFkfMq/PHFm/kGd1KxR8bpC9B4w45coNFm3D+Fs9o8FeV8cnROBn+7uuME3h/tV iABXjQ2D/fPtHqWRwomDPjLq+tqwoNTV7XJGsHpRPxzV686guxv3JyXyNGAmmj5dIjBE 6KWFsHJnV73l1DVnhG57Z6vA5B/ezxnpVX4dt0l70aSgXUHynihroBX6uBriwxglui9J LNyUeJ5sTV1ikMCUtXIrsnXkEEsJZHB/1uB4nbWC9r38/K31EVKDDHRpEwa3j5GOT/Mi Xw6w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=vDfr0yp6C7xDyyNdToZD3gwq3T9ELQ+xwGdPREZ00cI=; fh=93BDiqbKyhFxJb/B/iq9ADNz5q91ASQ0kaf35D2IFSE=; b=zRLiHzaXUrRsYJKB8hDiukmerQmD37N7+jO8BgBcnRAEU4Ime3a3Qt7uXLGolMy8ou +fJ7Wg8phz0kA5CCwj+sgJ5FxUUUMxcAax4jTnRRPLnlMBDGNYqHGTe+4luUeQVs8Iy9 AfU2DRw9a/RFF1Ezcgc3qVguPZ/rrTsm2UhtIuAOsKoP3YPDgeLjzPVruHQAJU2BYh6X gRX1lXnllZoRAd8iEPqxg4ic6FtGlnaoDO9L7pVQm2xAHwsjUqYt+WJMAeLWrnYrOL6E Ty9GGZA3XBVowsQd1j5FKXDpU1anN50/L4erM8eXGObgUpz6pCsW4KUwKLLMl+7we6Gg TljQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=xrGghXaB; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-88209-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88209-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id lq15-20020a170903144f00b001db78534cd4si3263519plb.256.2024.03.01.01.56.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 01:56:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88209-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=xrGghXaB; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-88209-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88209-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 647F8287AF1 for ; Fri, 1 Mar 2024 09:56:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D23136A8BA; Fri, 1 Mar 2024 09:56:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="xrGghXaB" Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) (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 C82346A8DC; Fri, 1 Mar 2024 09:56:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.249 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709286967; cv=none; b=SZ4DUZgQKc7ZiG8sTqQjwgjyJGKaqD3R465B1aaL73/AnxuRVAHDxau2py4UrOlnswDYOFuqZFif+Q7b/ovQ84bScKMV+O3tRRnlrElLqH6hTW27+FRDR2UGH3WqxKKQTDnFcVNVQ9rzaD9PPbuiogNpDozjqyliAxrIru3Qw2w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709286967; c=relaxed/simple; bh=68k66iiwRdL8e8XIa//t2nz73CKwh3gM563bwOXQDhE=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pml1dbCO4asvj+lCw3GTJ8DRod+RzM2KIh6r2e2bC5YTx4MRItp+tu7laRW9+FIKCFpxXK5AQFb+l2ScR/TRJvzmMazlF+OvuFD3cllgWXx7aj5sC5wg1mps1z64u8g7A6VtbjnB0j8LLdTgQJuo3JocXbJ3NgLC6lgButAyyRQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=xrGghXaB; arc=none smtp.client-ip=198.47.23.249 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <2b2effdd-0b9d-40fd-a88d-ab364f2b0668@collabora.com> X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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.