Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6452192rdb; Tue, 2 Jan 2024 02:18:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IEVCKwHG/X/CV/oQHiiYBoJSS2ymvDA10sFOy5cm11x6hRbE0rTGc0Je4IT36Fx9h4apI9z X-Received: by 2002:a05:6a00:4b48:b0:6da:2f8e:bdf4 with SMTP id kr8-20020a056a004b4800b006da2f8ebdf4mr3007043pfb.60.1704190698546; Tue, 02 Jan 2024 02:18:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704190698; cv=none; d=google.com; s=arc-20160816; b=QkV2o1msiaHRX25IEgjoLkmDmqa7NNPEgON7Wq7VvQ3lMCzwihHw0NvL2MdPIzUMAO rKvZWcuLV3VgEyen/nYDWGmSrHhnj/9jlYNJiEpiPnRJIbfNGTZEw/EjTTD6pvenNlGy vsyzaAX/6TzKxRSttHGt2CTskwVAXYVHT+ebLAE4eH5/YL45taDTWs059RB57M28fZv6 euKsL+zqG0Hc4Mr0ViSVdAqE/JEq+wBnbYfo191FrEi90CfShiJbHJUTbVFdJZ3Ikq7/ gK3tV62pG9aC0aiyoH7OLHiC/09KfDR060Osc8IQJAFfp9ELQsZbL9NrHIKVwirNRH7h gnkw== ARC-Message-Signature: i=1; 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=K9nw9QrThOAnXqNRk0ANEA1snUEZSvQljwTSOc/tg4Y=; fh=gfNDmRo213gmI1aWLdkWnH5sGjyqSXIbPYey6Bc00z0=; b=vVnpb81z3RsWUmNb4g0auoQYVmH8UBUw+BTY2eKCAR0OAwzdTUlRYjYYLAY1J74qCG hzKo6QST7tZHUqRKqLgPK8TPuWDSWCFlT4d8UMKKVfeZ7WrvYo4dtTte3EjS+2n84zYE KESHgp6mmTq2lV4sMUaMcDfzD6gdCKqqNx8r7XOZbaaADx/zWkcbhb70PhvNDbH2PWXb SVEnM/fsBX9SrBdOhHwhA0E+WOT+TcCEnKREz4r8CYVgh0wnVfvYm/V/VRkjg4q49Fwq /1OWNjORzIZDIzlbzHb0JS83MwL3QTsW++OBVziArRkN0avgcpCV/hg8nv5Z4KHDCWKv 5HUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RA0Nu7tG; spf=pass (google.com: domain of linux-kernel+bounces-14231-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14231-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id h2-20020a63f902000000b005c5e2488c32si16990594pgi.405.2024.01.02.02.18.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 02:18:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14231-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RA0Nu7tG; spf=pass (google.com: domain of linux-kernel+bounces-14231-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14231-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 33D95282E4A for ; Tue, 2 Jan 2024 10:18:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 823EFD534; Tue, 2 Jan 2024 10:17:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RA0Nu7tG" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 ABE5DD292; Tue, 2 Jan 2024 10:17:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C492C433C7; Tue, 2 Jan 2024 10:17:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704190668; bh=jiBwZ5dchDkw03vTAO8SBjv+oWAMHIaTv6i021/t1ss=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=RA0Nu7tG1q3bcqfkaWEFMLFy0OwAWJShaIzJvdv8XEOhMyu+4MNeacs8eo9viwHAI 0FVF+6zGz+OYENdWGLEni2qL58xswCohz99Vu/upJMvGAFX4Cxqdji9umsYGPEuly2 5a9vugHP/4mwqk63JR3RUHdvaUD7Id1/EN+aHnctubIc5P+zy2y2VaSpMgJo2hbbtr hgO2OmpJcN6CmnH6imffiLHuzUU2C2NBuy60d74wUvlOEXVcbtz/TFm+bxJd7yog5D g2//k+xlO2FB8wqIGznKFEdL3878A5onz/K0eG1o/vemN0m0xBcVoCGnP+7BZ1sdUH DUVHDY1XhaYAQ== Received: from johan by xi.lan with local (Exim 4.96.2) (envelope-from ) id 1rKbq6-0002Ef-1M; Tue, 02 Jan 2024 11:17:39 +0100 Date: Tue, 2 Jan 2024 11:17:38 +0100 From: Johan Hovold To: Konrad Dybcio Cc: Manivannan Sadhasivam , Bjorn Andersson , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Philipp Zabel , Stanimir Varbanov , Andrew Murray , Vinod Koul , Marijn Suijten , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/4] PCI: qcom: Reshuffle reset logic in 2_7_0 .init Message-ID: References: <20231227-topic-8280_pcie-v1-0-095491baf9e4@linaro.org> <20231227-topic-8280_pcie-v1-1-095491baf9e4@linaro.org> <598ede70-bc01-4137-b68b-981c3d420735@linaro.org> 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: <598ede70-bc01-4137-b68b-981c3d420735@linaro.org> On Sat, Dec 30, 2023 at 02:16:18AM +0100, Konrad Dybcio wrote: > On 29.12.2023 16:29, Johan Hovold wrote: > > [ Again, please remember to add a newline before you inline comments to > > make you replies readable. ] > > > > On Fri, Dec 29, 2023 at 04:01:27PM +0100, Konrad Dybcio wrote: > >> On 29.12.2023 15:04, Johan Hovold wrote: > >>> On Wed, Dec 27, 2023 at 11:17:19PM +0100, Konrad Dybcio wrote: > >>>> At least on SC8280XP, if the PCIe reset is asserted, the corresponding > >>>> AUX_CLK will be stuck at 'off'. > >>> > >>> No, this path is exercised on every boot without the aux clock ever > >>> being stuck at off. So something is clearly missing in this description. > > > >> That's likely because the hardware has been initialized and not cleanly > >> shut down by your bootloader. When you reset it, or your bootloader > >> wasn't so kind, you need to start initialization from scratch. > > > > What does that even mean? I'm telling you that this reset is asserted on > > each boot, on all sc8280xp platforms I have access to, and never have I > > seen the aux clk stuck at off. > > > > So clearly your claim above is too broad and the commit message is > > incorrect or incomplete. > > diff --git a/drivers/clk/qcom/gcc-sc8280xp.c b/drivers/clk/qcom/gcc-sc8280xp.c > index 0b7801971dc1..6650bd6af5e3 100644 > --- a/drivers/clk/qcom/gcc-sc8280xp.c > +++ b/drivers/clk/qcom/gcc-sc8280xp.c > @@ -7566,6 +7566,18 @@ static int gcc_sc8280xp_probe(struct platform_device *pdev) > if (ret) > goto err_put_rpm; > > + int val; > + regmap_read(regmap, 0xa0000, &val); > + pr_err("GCC_PCIE_3A_BCR = 0x%x\n", val); > + regmap_read(regmap, 0xa00f0, &val); > + pr_err("GCC_PCIE_3A_LINK_DOWN_BCR = 0x%x\n", val); > + regmap_read(regmap, 0xa00fc, &val); > + pr_err("GCC_PCIE_3A_NOCSR_COM_PHY_BCR = 0x%x\n", val); > + regmap_read(regmap, 0xa00e0, &val); > + pr_err("GCC_PCIE_3A_PHY_BCR = 0x%x\n", val); > + regmap_read(regmap, 0xa00e4, &val); > + pr_err("GCC_PCIE_3A_PHY_NOCSR_COM_PHY_BCR = 0x%x\n", val); > + > pm_runtime_put(&pdev->dev); > > return 0; > > > [root@sc8280xp-crd ~]# dmesg | grep BCR > [ 2.500245] GCC_PCIE_3A_BCR = 0x0 > [ 2.500250] GCC_PCIE_3A_LINK_DOWN_BCR = 0x0 > [ 2.500253] GCC_PCIE_3A_NOCSR_COM_PHY_BCR = 0x0 > [ 2.500255] GCC_PCIE_3A_PHY_BCR = 0x0 > [ 2.500257] GCC_PCIE_3A_PHY_NOCSR_COM_PHY_BCR = 0x0 > > > 0 meaning "not asserted". We're clearly talking past each other. When I'm saying reset is asserted on each boot, I'm referring to reset being asserted in qcom_pcie_init_2_7_0(), whereas you appear to be referring to whether the reset has been left asserted by the bootloader when the driver probes. I understand what you meant to say now, but I think you should rephrase: At least on SC8280XP, if the PCIe reset is asserted, the corresponding AUX_CLK will be stuck at 'off'. because as it stands, it sounds like the problem happens when the driver asserts reset. > PCIE3A is used for WLAN on the CRD, btw. You meant to say WWAN (modem). > >>>> Assert the reset (which may end up being a NOP if it was previously > >>>> asserted) and de-assert it back *before* turning on the clocks to avoid > >>>> such cases. > >>>> > >>>> In addition to that, in case the clock bulk enable fails, assert the > >>>> RC reset back, as the hardware is in an unknown state at best. > >>> > >>> This is arguably a separate change, and not necessarily one that is > >>> correct either > > > >> If the clock enable fails, the PCIe hw is not in reset state, ergo it > >> may be doing "something", and that "something" would eat non-zero power. > >> It's just cleaning up after yourself. > > > > How can it do something without power and clocks? > > Fair point. > > As far as power goes, the RC hangs off CX, which is on whenever the > system is not in power collapse. As for clocks, at least parts of it > use the crystal oscillator, not sure if directly. > > > And leaving reset > > asserted for non-powered devices is generally not a good idea. > > Depends on the hw. That's why I said "generally". > > The commit message does not even mention suspend, it just makes a > > clearly false general claim about a clock being stuck unless you reorder > > things. > > No, I insist that this general statement, while indeed lacking a full > description of the problem, is provably true. The AUX clock will not > turn on if the PCIe reset is asserted, at least on SC8280XP. I agree, I was misinterpreting the commit message. Johan