From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (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 D07581FF7CA for ; Mon, 16 Dec 2024 10:50:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734346230; cv=none; b=os1YduJB8BwVjIhsLrrAxcHHvla4gn6r2JIqRkZvtqKFlNObJYkEf5r/f6OwFVjTdWxeAwTT6WuIq5nGIdJtbmYjxxKun/kDTa5oONCf+RY7qVj+STflhkzU3+bp1/w/9GMssqTDc94WCgbqFh8EWl9HJIcx7Jq/b4gVoqsZOgY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734346230; c=relaxed/simple; bh=pU9+RFIvvPtP4mmdfCgIU3Gp7wNrqZG+8HkcraOhF8c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ByQcofatLo9tZP3etO2moCNkxqai9yQUyGdlJChEKduZpByH58JcPtH+PLEPYzOlWgFd1O3yEpKj2kiP/8V7YKoIJrvvQ8o4dZNYoZFQLgv9q1Tqnnf+Nv1yiY2pczUo0Z/H4avGO472oKAwLaHAzDxHDc8yqfN3YtwOwQEpB4M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=lIbDmuA6; arc=none smtp.client-ip=209.85.208.43 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="lIbDmuA6" Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-5d3f249f3b2so5599668a12.3 for ; Mon, 16 Dec 2024 02:50:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734346225; x=1734951025; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=MqGC67fLkQNsDpcKJfvwCJwfrp98opCS1CMiZnUF5wI=; b=lIbDmuA6ZFZEwwD1s6FJ/oV+KSnfIfKIbzj3/wj4Qb2G9Yc78zClhfBbA1EWddxGVn mFBk+6EHooV00HA7hO8ma2tJDB1aZmi5hXgkWRY2T/8DMOXrIIZzxdMOnSoqU2GykRvu /gENWNJ1RbcF4Lr5F/am+augwCWoDfQYc7sdXI251hsAmcHiyX0IM9cK883+3ugY6xHa w19g35Jno4yQuTxwaOCerXMX5HgUL8I2414fH92a7KKj/bzz0nahlGN46XPNo7QEtjhw Y6Q932s9BR4URhnzZfZ/4G9ZXV6QI44WhPEElVmsZQFLNXVH5iWYswxYWGc8KYANtQ7h FNsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734346225; x=1734951025; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=MqGC67fLkQNsDpcKJfvwCJwfrp98opCS1CMiZnUF5wI=; b=wYq++rn1Ms8lHh8MbWN6zMH7K2o4QcHYdqGfAcrH6226hnxVZVMxU67Rf/d7c/Ii1R uIS5cS+YWApkDrEUDKXLc0Kvonz5ceDYQmePVm/9MyHf2sUh/yD1ozMNiL2CygGMhcS8 CiWkgXKtqtJw4MsbFvpb0WbT2sfH7wBFErXEZJlsvFgZGbxlq4tF9XcDzK+NsWu86ouc O9ab2+RyvRK5yFVOVKp34L7Bbjnp6Nqi2f8p6eAKE7XrKEFftejdFuFUBEZGjDer/twY Qa99PTtgFI8ZPDBaYuaWcQOCiYQZSMrtiMokQiJtNxdBlO3w88gYOkTu3Jj/AjUdFnI1 ulDw== X-Forwarded-Encrypted: i=1; AJvYcCUJmlTdid0ApwBwtQwd+39kaOIMRQB5rTCCNdEhln2ptWHBtRpiScilURWmqaRs6orsYjp29fldGT/Shic=@vger.kernel.org X-Gm-Message-State: AOJu0Ywg9JOBGjnrMFG+lB1U8s0Jd8F+8DK3qE6XazdKVTCkGS80+eug Z4t2n4NgCam0cN0dsIPW3Imm5W6g1LrObUvQfhSrtuqbLV4uLKzj1HnVfq+AWBg= X-Gm-Gg: ASbGncvtFtc8on4PYi3gDDZmOKCd7VQppBmhphJ7q3S/nfNkH13l4e+dwKhJAEeDIHD yDH8x53F5GvgTWgKitsShWZePzygwOWY5lzwzC2N6xWjkEN+pe+oXLNJgeojqj7B3Iij4VNKmK/ 9RAYxL64Sg20T5FsCeHitQg4p+CUXxEXML8a+XokWXFKO8DBI8TJuwM7JurtYOnpEI6D1fsL3/C iu/ChnVegrHcJDUZaiooqrrSE+cNAvIhtqsIl0FiEHPVWom2Za12WFAwBgFjInCa3xy X-Google-Smtp-Source: AGHT+IFWsdeBbOo/gehwDdAxH4dsAhxbK3jXs+6BV6q3JsoZI77/m4XtW3wgpgeXPo6fqHHqV7VINA== X-Received: by 2002:a05:6402:34c7:b0:5d0:cfad:f71 with SMTP id 4fb4d7f45d1cf-5d63c407452mr27602457a12.32.1734346224811; Mon, 16 Dec 2024 02:50:24 -0800 (PST) Received: from linaro.org ([2a02:2454:ff21:ef80:45ce:f141:322e:8943]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aab963c54d2sm312557966b.190.2024.12.16.02.50.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Dec 2024 02:50:24 -0800 (PST) Date: Mon, 16 Dec 2024 11:50:20 +0100 From: Stephan Gerhold To: Manivannan Sadhasivam Cc: Bartosz Golaszewski , Bjorn Helgaas , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: Re: [RFT PATCH] Revert "power: sequencing: request the WLAN enable GPIO as-is" Message-ID: References: <20241203141251.11735-1-brgl@bgdev.pl> <20241216070554.ym54ozdw45zhveo7@thinkpad> 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: <20241216070554.ym54ozdw45zhveo7@thinkpad> On Mon, Dec 16, 2024 at 12:35:54PM +0530, Manivannan Sadhasivam wrote: > On Fri, Dec 13, 2024 at 07:19:34PM +0100, Stephan Gerhold wrote: > > On Tue, Dec 03, 2024 at 03:12:51PM +0100, Bartosz Golaszewski wrote: > > > From: Bartosz Golaszewski > > > > > > This reverts commit a9aaf1ff88a8cb99a1335c9eb76de637f0cf8c10. > > > > > > With the changes recently merged into the PCI/pwrctrl/ we now have > > > correct ordering between the pwrseq provider and the PCI-pwrctrl > > > consumers. With that, the pwrseq WCN driver no longer needs to leave the > > > GPIO state as-is and we can remove the workaround. > > > > > > > Should probably revert commit d8b762070c3f ("power: sequencing: > > qcom-wcn: set the wlan-enable GPIO to output") as well? > > > > > Signed-off-by: Bartosz Golaszewski > > > --- > > > drivers/power/sequencing/pwrseq-qcom-wcn.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/power/sequencing/pwrseq-qcom-wcn.c b/drivers/power/sequencing/pwrseq-qcom-wcn.c > > > index 682a9beac69eb..bb8c47280b7bc 100644 > > > --- a/drivers/power/sequencing/pwrseq-qcom-wcn.c > > > +++ b/drivers/power/sequencing/pwrseq-qcom-wcn.c > > > @@ -379,7 +379,7 @@ static int pwrseq_qcom_wcn_probe(struct platform_device *pdev) > > > "Failed to get the Bluetooth enable GPIO\n"); > > > > > > ctx->wlan_gpio = devm_gpiod_get_optional(dev, "wlan-enable", > > > - GPIOD_ASIS); > > > + GPIOD_OUT_LOW); > > > if (IS_ERR(ctx->wlan_gpio)) > > > return dev_err_probe(dev, PTR_ERR(ctx->wlan_gpio), > > > "Failed to get the WLAN enable GPIO\n"); > > > -- > > > 2.30.2 > > > > > > > I'm not sure why but applying this patch brings back the error I had > > before. It does seem like setting wlan-enable GPIO happens early enough, > > but maybe some timing is still wrong. > > > > There should be no room for timing issue now :/ > > > [ 17.132161] wlan_gpio, 1);> > > [ 17.480619] ath12k_pci 0004:01:00.0: of_irq_parse_pci: failed with rc=134 > > [ 17.491997] ath12k_pci 0004:01:00.0: pci device id mismatch: 0xffff 0x1107 > > [ 17.492000] ath12k_pci 0004:01:00.0: failed to claim device: -5 > > [ 17.492075] ath12k_pci 0004:01:00.0: probe with driver ath12k_pci failed with error -5 > > > > Are you sure that this is the same error that you noticed before? > Yes, "pci device id mismatch: 0xffff 0x1107" is definitely the same error I saw before. > > Any ideas/suggestions? > > > > Can you verify that the pwrctrl driver's probe is completed *before* ath12k > driver starting to probe by adding the debug prints in both drivers? > I tried booting with "modprobe.blacklist=ath12k" and manually loaded the module several seconds after the boot completed. Error is unchanged: [ 16.628165] wlan_gpio, 1);> [ 55.065794] ath12k_pci 0004:01:00.0: of_irq_parse_pci: failed with rc=134 [ 55.073354] ath12k_pci 0004:01:00.0: pci device id mismatch: 0xffff 0x1107 [ 55.080457] ath12k_pci 0004:01:00.0: failed to claim device: -5 [ 55.088977] ath12k_pci 0004:01:00.0: probe with driver ath12k_pci failed with error -5 I played around a bit more and it looks like the problem is that the PCI device is still being enumerated during startup, before the pwrseq driver is loaded. Not with the ath12k driver, but the internal PCI subsystem state. And then the PCI link dies briefly when the pwrseq driver loads. If I add some hacks to the DT to force the wlan-enable GPIO low before the entire PCI _controller_ is probed, then it works correctly: [ 16.607359] wlan_gpio, 1);> [ 16.668533] pci 0004:01:00.0: [17cb:1107] type 00 class 0x028000 PCIe Endpoint [ 16.668606] pci 0004:01:00.0: BAR 0 [mem 0x00000000-0x001fffff 64bit] [ 16.669055] pci 0004:01:00.0: PME# supported from D0 D3hot D3cold [ 16.675546] pcieport 0004:00:00.0: bridge window [mem 0x7c400000-0x7c5fffff]: assigned [ 16.675555] pci 0004:01:00.0: BAR 0 [mem 0x7c400000-0x7c5fffff 64bit]: assigned [ 16.862083] ath12k_pci 0004:01:00.0: BAR 0 [mem 0x7c400000-0x7c5fffff 64bit]: assigned [ 16.870358] ath12k_pci 0004:01:00.0: enabling device (0000 -> 0002) [ 16.888792] ath12k_pci 0004:01:00.0: MSI vectors: 16 [ 16.893954] ath12k_pci 0004:01:00.0: Hardware name: wcn7850 hw2.0 Note the pci messages after enabling the GPIO, before the first ath12k_pci messages. Without the hack, those appear already before the pwrseq driver is being loaded (during initramfs). [ 5.888688] pci 0004:01:00.0: [17cb:1107] type 00 class 0x028000 PCIe Endpoint [ 5.888758] pci 0004:01:00.0: BAR 0 [mem 0x00000000-0x001fffff 64bit] [ 5.889207] pci 0004:01:00.0: PME# supported from D0 D3hot D3cold [ 5.902692] pci 0004:00:00.0: bridge window [mem 0x7c400000-0x7c5fffff]: assigned [ 5.910311] pci 0004:01:00.0: BAR 0 [mem 0x7c400000-0x7c5fffff 64bit]: assigned ... [ 21.227565] wlan_gpio, 1);> [ 21.305496] ath12k_pci 0004:01:00.0: of_irq_parse_pci: failed with rc=134 [ 21.318382] ath12k_pci 0004:01:00.0: pci device id mismatch: 0xffff 0x1107 [ 21.338489] ath12k_pci 0004:01:00.0: failed to claim device: -5 [ 21.338555] ath12k_pci 0004:01:00.0: probe with driver ath12k_pci failed with error -5 Can we skip scanning the PCI bus until the power sequencing is done? The hack I used (see below) works, but is a bit odd since it requires assigning the wcn7850-pmu pinctrl to the PCI bus in the DT. Otherwise the GPIO is not forced low early enough. Thanks, Stephan diff --git a/arch/arm64/boot/dts/qcom/x1e80100-crd.dts b/arch/arm64/boot/dts/qcom/x1e80100-crd.dts index 054ae260218e..8b658d15f185 100644 --- a/arch/arm64/boot/dts/qcom/x1e80100-crd.dts +++ b/arch/arm64/boot/dts/qcom/x1e80100-crd.dts @@ -562,8 +562,8 @@ wcn7850-pmu { wlan-enable-gpios = <&tlmm 117 GPIO_ACTIVE_HIGH>; bt-enable-gpios = <&tlmm 116 GPIO_ACTIVE_HIGH>; - pinctrl-0 = <&wcn_wlan_bt_en>; - pinctrl-names = "default"; + //pinctrl-0 = <&wcn_wlan_bt_en>; + //pinctrl-names = "default"; regulators { vreg_pmu_rfa_cmn: ldo0 { @@ -1298,7 +1298,7 @@ &pcie4 { perst-gpios = <&tlmm 146 GPIO_ACTIVE_LOW>; wake-gpios = <&tlmm 148 GPIO_ACTIVE_LOW>; - pinctrl-0 = <&pcie4_default>; + pinctrl-0 = <&pcie4_default>, <&wcn_wlan_bt_en>; pinctrl-names = "default"; status = "okay"; @@ -1757,6 +1757,7 @@ wcn_wlan_bt_en: wcn-wlan-bt-en-state { function = "gpio"; drive-strength = <2>; bias-disable; + output-low; }; wwan_sw_en: wwan-sw-en-state {