Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp4868671rdb; Fri, 29 Dec 2023 17:16:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IGeVqUBYBW2KHqx9Xx1xXgL5oquFFHyEvmeJffQ/W9wnQLgssbdzz4RP6m8aC30i4h17wRo X-Received: by 2002:a05:6214:dcf:b0:67a:a24d:e58a with SMTP id 15-20020a0562140dcf00b0067aa24de58amr20568483qvt.7.1703899001432; Fri, 29 Dec 2023 17:16:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703899001; cv=none; d=google.com; s=arc-20160816; b=ArBn8C7bc/qkqwl9Zz0+VOZ9qASNlLcGVdoHHxBgT/ob9y/VBgnsqbyHZ0vl7GXtXn SPiymJf2XSeeDLMRKyHONO7g7CYI9W45MbKMBiLODYDP4znQYajwMHL5G44nBHMRnM6y Zwfm7iQjSwQ+fARyg2MT0cMOlpjaleTtbh07WZwPT7VhuaM2LZjhCCrHvhDRFzkagCoc LT51spAWwGcNkH1yvbCBZcSs6Z1Qf7eD/ojLLK88Rdb30z74KjXOEYL3KvZm305CC7ja OC5W/znQFl1oDwLEtKFM8LVrkpqJ51Z8bt6OIndUJ5NVWv5AqftMA7KnqjS1O5xOJjls MxEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=EcIe4YJ5YCTQdS+tf3+D0wVuBPwXDmW3xk764/9wSSI=; fh=j+hk/3OfcCktVjNP31WnQB3oXNShaPLiiRzszZelSYw=; b=DEYUTLTgGGKiwvJqUujo/sHcAyxdhnQMmlxFu218TelcZmT+hU/I9xmQqjYvyxIr3K w/f3H4/BTNUhDRNepR4k/K0g7ftTUMj4xk2QV/HTm1Eyk8kDQZOKs9ZHXlKNBJYY92I7 S6kQ59XMHwiSbXbs064c5UOIpSFRIwVq2uPJ0MbXp5uXFX5sv122vyHT4YchzHQRDaEF J3owMqvl+uDhiBYAsQLZNWvYGnVHP2w37VReBZC7YVqRGfnk6fxBTvQeO0xbfMu5v3Dj vEg2J29XzBnJxUIGGPtW4R+b0HK8ln9eptOAR4IbkizKlpuGjWGttq/4HRPB6HMhr+6t 57Mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rPPnWcyQ; spf=pass (google.com: domain of linux-kernel+bounces-13301-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13301-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id q7-20020a0ce207000000b0067f8e28347asi18128647qvl.492.2023.12.29.17.16.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Dec 2023 17:16:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-13301-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rPPnWcyQ; spf=pass (google.com: domain of linux-kernel+bounces-13301-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13301-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 1F9E01C20E9A for ; Sat, 30 Dec 2023 01:16:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6B7DB10FF; Sat, 30 Dec 2023 01:16:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="rPPnWcyQ" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77601801 for ; Sat, 30 Dec 2023 01:16:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-9fa45e75ed9so756872566b.1 for ; Fri, 29 Dec 2023 17:16:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703898987; x=1704503787; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=EcIe4YJ5YCTQdS+tf3+D0wVuBPwXDmW3xk764/9wSSI=; b=rPPnWcyQNJb6GYO6NY79RTsOAvALwsO8VbpAjyRia2vurXSev+fSLfYLSEjfpcV+F1 mzYzYyKjyWlhdMqwXSzx1TGwOKlUAr74Hs36YH2iR4QfEyYMd//gntOcJrCKIa7sq5ri Xqc8iiKMkkq8SCrY4xkrButWEPusB0DLEYoDeNjeeKJOA9WmtUO8T+oUagrSlGapJLrQ D25sNMJH2+89IdR8H6oxuufHEz2Gbcm2wIbOGoK5wT2qKgMlK0EMTtL24CzEwLvFvUJL YSuAoeg50cZKpzhCoyVxLW8nwjIbnXtgtb0JXmjDLDMy62NgVKbwXOACSqA1JyPeh39b eMDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703898987; x=1704503787; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=EcIe4YJ5YCTQdS+tf3+D0wVuBPwXDmW3xk764/9wSSI=; b=JF5/n5hs72fYoNkMoPBQkBvB7t7A3bCmaZzQbPG3xSQZ+RcMhvKxMl9pQs5d1CKzUq qUaWityVYDh31Zqn+CU+Bzw4kbZmMmr3VOt/bnkrgpWhqPmwaPnePtrYxfCJv9Kc9Gkk JTd67u3/q3073ld+J0rUNY4DCM4x9Fws/Y+ywbqMf14iFlXpF5zILvRQ0p/U0ECWnhQX wh32eTwoF93ge9gVzm8VQKRQ92w8o3/WQ08SVNnMMMhrbluhlcsXdyNjoR5it2WbSreq iCZwiKclE95sgd4CGijTyWyjIexr7j2jO+1naWoPv842MkFnUakd1by/SR+lbUM41wxJ YMCg== X-Gm-Message-State: AOJu0YzzBAIk80U5RUQDoxDQSA7H7QC9YtyJc7c5d553cvs1YnOSRAOj o+mVnmnUWDD4B7L5/katrdOySpBLkXH10w== X-Received: by 2002:a17:906:cc12:b0:a17:d7ea:f59e with SMTP id ml18-20020a170906cc1200b00a17d7eaf59emr5811394ejb.48.1703898986762; Fri, 29 Dec 2023 17:16:26 -0800 (PST) Received: from [192.168.199.125] ([178.235.179.36]) by smtp.gmail.com with ESMTPSA id fp21-20020a1709069e1500b00a26ade46619sm8019163ejc.121.2023.12.29.17.16.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 29 Dec 2023 17:16:26 -0800 (PST) Message-ID: <598ede70-bc01-4137-b68b-981c3d420735@linaro.org> Date: Sat, 30 Dec 2023 02:16:18 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/4] PCI: qcom: Reshuffle reset logic in 2_7_0 .init Content-Language: en-US To: Johan Hovold Cc: Manivannan Sadhasivam , Bjorn Andersson , Lorenzo Pieralisi , =?UTF-8?Q?Krzysztof_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 References: <20231227-topic-8280_pcie-v1-0-095491baf9e4@linaro.org> <20231227-topic-8280_pcie-v1-1-095491baf9e4@linaro.org> From: Konrad Dybcio Autocrypt: addr=konrad.dybcio@linaro.org; keydata= xsFNBF9ALYUBEADWAhxdTBWrwAgDQQzc1O/bJ5O7b6cXYxwbBd9xKP7MICh5YA0DcCjJSOum BB/OmIWU6X+LZW6P88ZmHe+KeyABLMP5s1tJNK1j4ntT7mECcWZDzafPWF4F6m4WJOG27kTJ HGWdmtO+RvadOVi6CoUDqALsmfS3MUG5Pj2Ne9+0jRg4hEnB92AyF9rW2G3qisFcwPgvatt7 TXD5E38mLyOPOUyXNj9XpDbt1hNwKQfiidmPh5e7VNAWRnW1iCMMoKqzM1Anzq7e5Afyeifz zRcQPLaqrPjnKqZGL2BKQSZDh6NkI5ZLRhhHQf61fkWcUpTp1oDC6jWVfT7hwRVIQLrrNj9G MpPzrlN4YuAqKeIer1FMt8cq64ifgTzxHzXsMcUdclzq2LTk2RXaPl6Jg/IXWqUClJHbamSk t1bfif3SnmhA6TiNvEpDKPiT3IDs42THU6ygslrBxyROQPWLI9IL1y8S6RtEh8H+NZQWZNzm UQ3imZirlPjxZtvz1BtnnBWS06e7x/UEAguj7VHCuymVgpl2Za17d1jj81YN5Rp5L9GXxkV1 aUEwONM3eCI3qcYm5JNc5X+JthZOWsbIPSC1Rhxz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1Q//Xta1ShwL0MLSC1KL1lXGXeRM 8arzfyiB5wJ9tb9U/nZvhhdfilEDLe0jKJY0RJErbdRHsalwQCrtq/1ewQpMpsRxXzAjgfRN jc4tgxRWmI+aVTzSRpywNahzZBT695hMz81cVZJoZzaV0KaMTlSnBkrviPz1nIGHYCHJxF9r cIu0GSIyUjZ/7xslxdvjpLth16H27JCWDzDqIQMtg61063gNyEyWgt1qRSaK14JIH/DoYRfn jfFQSC8bffFjat7BQGFz4ZpRavkMUFuDirn5Tf28oc5ebe2cIHp4/kajTx/7JOxWZ80U70mA cBgEeYSrYYnX+UJsSxpzLc/0sT1eRJDEhI4XIQM4ClIzpsCIN5HnVF76UQXh3a9zpwh3dk8i bhN/URmCOTH+LHNJYN/MxY8wuukq877DWB7k86pBs5IDLAXmW8v3gIDWyIcgYqb2v8QO2Mqx YMqL7UZxVLul4/JbllsQB8F/fNI8AfttmAQL9cwo6C8yDTXKdho920W4WUR9k8NT/OBqWSyk bGqMHex48FVZhexNPYOd58EY9/7mL5u0sJmo+jTeb4JBgIbFPJCFyng4HwbniWgQJZ1WqaUC nas9J77uICis2WH7N8Bs9jy0wQYezNzqS+FxoNXmDQg2jetX8en4bO2Di7Pmx0jXA4TOb9TM izWDgYvmBE8= In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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". Adding the read in the GCC driver .probe ensures we get the unmodified data, as all GCC consumers must wait for it to probe. PCIE3A is used for WLAN on the CRD, btw. > >>>> 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. > >>> so should at least go in a separate patch if it should >>> be done at all. > >> I'll grumpily comply.. > > I suggest you leave it deasserted unless you have documentation > suggesting that the opposite is safe and recommended for this piece of > hardware. > >>>> Fixes: ed8cc3b1fc84 ("PCI: qcom: Add support for SDM845 PCIe controller") >>> >>> I think you're being way to liberal with your use of Fixes tags. To >>> claim that this is a bug, you need to make a more convincing case for >>> why you think so. > >> The first paragraph describes the issue that this patch fixes. > > Yes, but this is all very hand-wavy so far. With a complete commit > message I may agree, but you still haven't convinced me that this is a > bug and not just a workaround from some not fully-understood issue on > one particular platform. Right, reading it again, it doesn't really tell the whole story. > >>> Also note Qualcomm's vendor driver is similarly asserting reset after >>> enabling the clocks. > >> It's also not asserting the reset on suspend, see below. > > Right, as I mentioned. > >>> That driver does not seem to reset the controller on resume, though, in >>> case that is relevant for your current experiments. > >> I know, the vendor driver doesn't fully shut down the controller. This >> is however the only sequence that we (partially) have upstream, and the >> only one that is going to work on SC8280XP (due to hw design). >> >> On other platforms, a "soft shutdown" (i.e. dropping the link, cutting >> clocks but not fully resetting the RC state) should be possible, but >> that's not what this patchset concerns. > > 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. Konrad