Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp1024354rdb; Fri, 19 Jan 2024 06:07:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IHM3YOsUYVHHXojdu27Ilj0LwOwRnmvwdM25dq2OCbf1JOle/E/KCuzWmkI8WcxC85qmXel X-Received: by 2002:a05:620a:1726:b0:783:7924:296d with SMTP id az38-20020a05620a172600b007837924296dmr1397715qkb.90.1705673273949; Fri, 19 Jan 2024 06:07:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705673273; cv=pass; d=google.com; s=arc-20160816; b=Tru2Tgny0TP3PiqgI6sBcUtLVQSxkr/EHruuU5FqC+6jM3J25F0o3izNEwThgZyJg/ Q8xOIYcw2BIH1isf6uXPjCWFbC24mY8qG/FVpWuMToYd0jc8RKAhXtTebFjq6csX2hNJ FFPNwRybLhqA5XPsBTwpg9kx3mUrtBtuf7AWPA2Uf6J1rX+x1fjKp/bya5EiHYuKbycG tpO26zfS5KSJzu4HcPxDrj1Ve/GGEltt75t6o9tuvWg5FN8NnMlVUPE14s01pYDSPdHm CIm40oSu8q6PTfY6KQEMdd9+PEJYXg+UflV0dFrgv5j4iDb0/eIDRuSgVpMY7KnK0juK Grmw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=buk4fXAQxtFB8rM3poCtERMP9p3lY+Uw087Jo7Ewjck=; fh=I3IRbeo0mfhv5wASpoN19yyF273s+RKhRg3JPZ8qX3w=; b=Qv2wf8amS9xYGcW5dpbrEDbx5soblX4oAZPjK+3zpFRNwBahqfLr53wwmv+VmWvl5K jNp4MRrmAdsW9Uq2UF5SndZqgI625fLhfGsaM4bRSXc1TIm3QkN+t9s76sNr358MjWlM Qi5p6l8E45Mo48yBefdsL7Ol4MctMhzyO67/E8ATwUgP92UJeo9aHN6/6hL1JdesOt35 3K+JRNJZNXq93xLEWDEN2p3m14ILm4agcXEFRnOTteHI/nRRItpsaY+7EpSsBOw4w+fS wnfFO4orANbNk53pH8f1h+tpIcCylE5lFdaLFjzST6gy5ftfrFiOfocIUrlc1Cxqii5b /SPQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yNRXDiiY; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-wireless+bounces-2252-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2252-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 bn42-20020a05620a2aea00b007832a1c1451si16300494qkb.25.2024.01.19.06.07.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 06:07:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-2252-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=yNRXDiiY; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-wireless+bounces-2252-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2252-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 A499C1C21046 for ; Fri, 19 Jan 2024 14:07:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1B0E253E2E; Fri, 19 Jan 2024 14:07:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="yNRXDiiY" X-Original-To: linux-wireless@vger.kernel.org Received: from mail-yw1-f179.google.com (mail-yw1-f179.google.com [209.85.128.179]) (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 5018E53E27 for ; Fri, 19 Jan 2024 14:07:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705673251; cv=none; b=mDI1XNabCWQoMpZRZ2KDHFaRTPUzWwJA6d48tMhNNzT2h7PukprsP5argX2nD2qKZWK3letY4Y7Hpq+N04mqVVmRdmMe73G5O14wqI0tnJOPlTT++GvOP/0CclSWO9OrflK5UgmudJvwq7pjWVaSp6bL/n3I5+77wylhsueyakw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705673251; c=relaxed/simple; bh=W7VlGr/pUhSjMTOKO8U+EN3WTfaEJ1F6LduBG3wg8zQ=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=TApV1XwDgK0hCNNvclrRqxnBqHiL0cIekdud+ri/2Yf8cHuczUlhUk4s/FTLmyrUNlg70VKiGHTdFqNABSmAgk9AYYNGhPGoeRIOqQiKYpYkCbCM7aeyN8lDwgcFLi+pcAMeZVYbY6qj2kL4uq79nYzCKUsNzoz18MrZ0kcV5AE= 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=yNRXDiiY; arc=none smtp.client-ip=209.85.128.179 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-yw1-f179.google.com with SMTP id 00721157ae682-5f15a1052b3so8224887b3.1 for ; Fri, 19 Jan 2024 06:07:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1705673248; x=1706278048; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=buk4fXAQxtFB8rM3poCtERMP9p3lY+Uw087Jo7Ewjck=; b=yNRXDiiYmPZZ2VLPPPbO0bBQZY/xzRQHR7NCHZCUqWX2otdjzm6uum2QVgdjNHQfUX lcbaDtEnp+fJiKgaVHaErGSmAu1i4s/Dzbo/v02TsAUG10aovzcggWYpEk1GY+Iiw9Xx vAVPey4BzDww/22moIWJcz4nUyHl0ecDGfcHMCm+y8p0IT1j4JLsF8w31PmFMQv9Wd0L Dd8Thi28QUe7QRv9du4DOHgHbvcjp6tFjkZxqKbFP4YuOQoD1U5urUVAtuaGeCtHbhiG 2tSDjfwdC763CpdBz6oh+NiYPbLYiV84ukldIPDcxAn3Nz3JzhUaUhuSX9BgaETd3ITR n4JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705673248; x=1706278048; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=buk4fXAQxtFB8rM3poCtERMP9p3lY+Uw087Jo7Ewjck=; b=qbuxhmoDnV8UophlRbqQBqoUkYfM/cb1KTmeCpJ/7J7SUXEJrcMjXzLm13oRMuBcKB HSQLKACnu4N+1TMPSgtzCz11c0BawymYEDneCNUrj1VMD3wL0bcE+2u9TqAahGWvciXx lHjsF59vjBYHkz8JH18kjstO+ojNuY2tccVu4i0FPfMqo/Lm33xz6o8OiThwqt98V44+ A3wjyLFYtWQox+ahORtDCQVTgRmPe2S6y3TF4i32oV62/Dwl9faVzPBnqByI7Xm9/rxy PEjFRSvJGJkvfkfFl/Gq3rMCBhecX8pXr/LRSJLLz9TRcxzrIC/eYyCfXBbcpfey8T7+ 9vpQ== X-Gm-Message-State: AOJu0Yy1dLO+Pc24/4Y58+0yji2Ybrh0x2xAhQFnL8P5iM/d8pG7A68X pYu28ApMvPL3SB/BbbA+A/j5lEM2Kqa+zydtR6MUef4l+Y50c92mI4s/3QJfEmI58GrbqOCWCXq 7C0zHCpNS7WR/7RyzIrMc8YlJdiYXFlaaFHwMqQ== X-Received: by 2002:a0d:c201:0:b0:5ff:6173:e98e with SMTP id e1-20020a0dc201000000b005ff6173e98emr2257479ywd.63.1705673248180; Fri, 19 Jan 2024 06:07:28 -0800 (PST) Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240117160748.37682-1-brgl@bgdev.pl> In-Reply-To: From: Dmitry Baryshkov Date: Fri, 19 Jan 2024 16:07:17 +0200 Message-ID: Subject: Re: [PATCH 0/9] PCI: introduce the concept of power sequencing of PCIe devices To: brgl@bgdev.pl Cc: Kalle Valo , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio , Catalin Marinas , Will Deacon , Bjorn Helgaas , Heiko Stuebner , Jernej Skrabec , Chris Morgan , Linus Walleij , Geert Uytterhoeven , Arnd Bergmann , Neil Armstrong , =?UTF-8?B?TsOtY29sYXMgRiAuIFIgLiBBIC4gUHJhZG8=?= , Marek Szyprowski , Peng Fan , Robert Richter , Dan Williams , Jonathan Cameron , Terry Bowman , Lukas Wunner , Huacai Chen , Alex Elder , Srini Kandagatla , Greg Kroah-Hartman , Abel Vesa , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, Bartosz Golaszewski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 19 Jan 2024 at 15:35, wrote: > > On Fri, 19 Jan 2024 13:31:53 +0100, Dmitry Baryshkov > said: > > On Fri, 19 Jan 2024 at 13:52, Bartosz Golaszewski wrote= : > >> > >> On Thu, Jan 18, 2024 at 7:53=E2=80=AFPM Dmitry Baryshkov > >> wrote: > >> > > >> > >> [snip] > >> > >> > > > >> > > I'd still like to see how this can be extended to handle BT power = up, > >> > > having a single entity driving both of the BT and WiFI. > >> > > > >> > > The device tree changes behave in exactly the opposite way: they > >> > > define regulators for the WiFi device, while the WiFi is not being > >> > > powered by these regulators. Both WiFi and BT are powered by the P= MU, > >> > > which in turn consumes all specified regulators. > >> > > >> > Some additional justification, why I think that this should be > >> > modelled as a single instance instead of two different items. > >> > > >> > This is from msm-5.10 kernel: > >> > > >> > > >> > =3D=3D=3D=3D=3D CUT HERE =3D=3D=3D=3D=3D > >> > /** > >> > * cnss_select_pinctrl_enable - select WLAN_GPIO for Active pinctrl = status > >> > * @plat_priv: Platform private data structure pointer > >> > * > >> > * For QCA6490, PMU requires minimum 100ms delay between BT_EN_GPIO = off and > >> > * WLAN_EN_GPIO on. This is done to avoid power up issues. > >> > * > >> > * Return: Status of pinctrl select operation. 0 - Success. > >> > */ > >> > static int cnss_select_pinctrl_enable(struct cnss_plat_data *plat_pr= iv) > >> > =3D=3D=3D=3D=3D CUT HERE =3D=3D=3D=3D=3D > >> > > >> > > >> > Also see the bt_configure_gpios() function in the same kernel. > >> > > >> > >> You are talking about a different problem. Unfortunately we're using > >> similar naming here but I don't have a better alternative in mind. > >> > >> We have two separate issues: one is powering-up a PCI device so that > >> it can be detected and the second is dealing with a device that has > >> multiple modules in it which share a power sequence. The two are > >> independent and this series isn't trying to solve the latter. > > > > I see it from a different angle: a power up of the WiFi+BT chips. This > > includes devices like wcn3990 (which have platform + serial parts) and > > qca6390 / qca6490 / wcn6750 / etc. (which have PCI and serial parts). > > > > From my point of view, the PCIe-only part was nice for an RFC, but for > > v1 I have expected to see a final solution that we can reuse for > > wcn3990. > > > > The submodules are represented as independent devices on the DT and I don= 't > think this will change. It's not even possible as they operate on differe= nt > buses so it's not like we can MFD it with a top-level platform device and= two > sub-nodes of which one is PCI and another serdev. With that in mind, I'm > insisting that there are two separate issues and a generic power sequenci= ng > can be built on top of the PCI-specific pwrseq added here. > > >> > >> But I am aware of this and so I actually have an idea for a > >> generalized power sequencing framework. Let's call it pwrseq as > >> opposed to pci_pwrseq. > >> > >> Krzysztof is telling me that there cannot be any power sequencing > >> information contained in DT. Also: modelling the PMU in DT would just > >> over complicate stuff for now reason. We'd end up having the PMU node > >> consuming the regulators but it too would need to expose regulators > >> for WLAN and BT or be otherwise referenced by their nodes. > > > > Yes. And it is a correct representation of the device. The WiFi and BT > > parts are powered up by the outputs from PMU. We happen to have three > > different pieces (WiFi, BT and PMU) squashed on a single physical > > device. > > > > Alright, so let's imagine we do model the PMU on the device tree. It woul= d > look something like this: > > qca6390_pmu: pmic@0 { > compatible =3D "qcom,qca6390-pmu"; > > bt-gpios =3D <...>; > wlan-gpios =3D <...>; > > vdd-supply =3D <&vreg...>; > ... > > regulators-0 { > vreg_x: foo { > ... > }; > > ... > }; > }; > > Then the WLAN and BT consume the regulators from &qca6390_pmu. Obviously = we > cannot go: > > wlan { > pwrseq =3D &qca6390_pmu; > }; > > But it's enough to: > > wlan { > vdd-supply =3D <&vreg_x>; > }; I'm not sure this will fly. This means expecting that regulator framework is reentrant, which I think is not the case. > But the pwrseq driver for "qcom,qca6390-pmu" could map BT and WLAN compat= ibles > to the correct power sequence and then the relevant drivers could enable = it > using pwrseq_power_on(). > > But that comes back to what I'm doing here: the PCI part for ath11k still > needs the platform driver that will trigger the power sequence and that c= ould > be the PCI pwrseq driver for which the framework is introduced in this se= ries. > > As I said: the two are largely orthogonal. I'm fine with that as long as it stays as an RFC. We need to fix both issues before committing qca6390 power up support. > > >> > >> So I'm thinking that the DT representation should remain as it is: > >> with separate WLAN and BT nodes consuming resources relevant to their > >> functionality (BT does not need to enable PCIe regulators). > > > > Is it so? The QCA6390 docs clearly say that all regulators should be > > enabled before asserting BT_EN / WLAN_EN. See the powerup timing > > diagram and the t2 note to that diagram. > > > > Fair enough. > > >> Now how to > >> handle the QCA6490 model you brought up? How about pwrseq drivers that > >> would handle the sequence based on compatibles? > > > > The QCA6490 is also known as WCN6855. So this problem applies to > > Qualcomm sm8350 / sm8450 platforms. > > > > And strictly speaking I don't see any significant difference between > > QCA6390 and WCN6855. The regulators might be different, but the > > implementation should be the same. > > > >> > >> We'd add a new subsystem at drivers/pwrseq/. Inside there would be: > >> drivers/pwrseq/pwrseq-qca6490.c. The pwrseq framework would expose an > >> API to "sub-drivers" (in this case: BT serdev driver and the qca6490 > >> power sequencing driver). Now the latter goes: > >> > >> struct pwrseq_desc *pwrseq =3D pwrseq_get(dev); > >> > >> And the pwrseq subsystem matches the device's compatible against the > >> correct, *shared* sequence. The BT driver can do the same at any time. > >> The pwrseq driver then gets regulators, GPIOs, clocks etc. and will be > >> responsible for dealing with them. > >> > >> In sub-drivers we now do: > >> > >> ret =3D pwrseq_power_on(pwrseq); > >> > >> or > >> > >> ret =3D pwrseq_power_off(pwrseq); > >> > >> in the sub-device drivers and no longer interact with each regulator > >> on our own. The pwrseq subsystem is now in charge of adding delays > >> etc. > >> > >> That's only an idea and I haven't done any real work yet but I'm > >> throwing it out there for discussion. > > > > I've been there and I had implemented it in the same way, but rather > > having the pwrseq as a primary device in DT and parsing end-devices > > only as a fallback / compatibility case. > > > > Would you mind posting an example DT code here? I'm not sure if I underst= and > what "primary device" means in this context. qca_pwrseq: qca-pwrseq { compatible =3D "qcom,qca6390-pwrseq"; #pwrseq-cells =3D <1>; vddaon-supply =3D <&vreg_s6a_0p95>; vddpmu-supply =3D <&vreg_s2f_0p95>; vddrfa1-supply =3D <&vreg_s2f_0p95>; vddrfa2-supply =3D <&vreg_s8c_1p3>; vddrfa3-supply =3D <&vreg_s5a_1p9>; vddpcie1-supply =3D <&vreg_s8c_1p3>; vddpcie2-supply =3D <&vreg_s5a_1p9>; vddio-supply =3D <&vreg_s4a_1p8>; bt-enable-gpios =3D <&tlmm 21 GPIO_ACTIVE_HIGH>; wifi-enable-gpios =3D <&tlmm 20 GPIO_ACTIVE_HIGH>; swctrl-gpios =3D <&tlmm 124 GPIO_ACTIVE_HIGH>; }; &uart6 { status =3D "okay"; bluetooth { compatible =3D "qcom,qca6390-bt"; clocks =3D <&sleep_clk>; bt-pwrseq =3D <&qca_pwrseq 1>; }; }; See https://lore.kernel.org/linux-arm-msm/20211006035407.1147909-13-dmitry.= baryshkov@linaro.org/ --=20 With best wishes Dmitry