Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp967068rdb; Fri, 19 Jan 2024 04:32:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IFgQ1b5TWSbHHcHm8oo1xGLVNqDYelwAuMa95eflS8SWoVxJQoBYLWQnJRgrJAoZ67BSlJl X-Received: by 2002:a17:903:1252:b0:1d5:4c4c:823a with SMTP id u18-20020a170903125200b001d54c4c823amr2969275plh.92.1705667542671; Fri, 19 Jan 2024 04:32:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705667542; cv=pass; d=google.com; s=arc-20160816; b=J9rJajd0dwCWaaoYFQpKBWnoApuPqVI1qe729TePCq8cgDLqwINjrmNqu33Lmt/rDi TY64OdEnGgse5Rogyf+SwxnbuFc/zM+15vCqMzMq2A7hOwVrUAfMk1JYaRC/pkMqX5m5 9UjEvW8W5wUB/3jhrJyWawci/6aFcxdUTbJDMYGnnP+98SrlPLOXoG3PwfxQgC6Qu0pW wrObgyItTLM9DyCp+9dxmAzcE8qC9Qztz56nDJAlwh1C1oQn+yhXLynTozGmyewUGBKA WErqSsn4wrj/1bbccIl0+wtEN/1Z6a/jwJzjMxoa+9jR38o3xFojJfMAWp2FNWLHDZHR rToQ== 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=Ffjuk5UUhf2ajhXazA1TZbNijQJTawfOkhzxR9sRdg0=; fh=2XV5seJ8vI6MtpHUJqeFR2Q3coj4oTFr4/SFEaeZI1o=; b=Cw95cal+jeZyH4NWl+8JGC7LhnQItCkGDT6yOwYjFeylWoe0rPCFhNv7C7cwwp2kww wHGOUPgKcv1jVZ8alJKoU04fhvXsIVtSUAs+eVbhG7ZNmWe2FO9JvQ4llbPrthjd94Be DB/SHovzUROogRo8dzE/kn2plJe5kNdT3bHl0WYjTmWQmvN/sYof+W0mBJbPb0GmOtcn tWY8fCAo6k5Dof1XDfAIWgxilLlmdwi++zlGa+Jbd0gCNWO43c1+kMGn7jPs5fAnc0PN lJL46I7EioexwnHuubvZj1koCYczkkM/NXUdAnCFoCR/TbfehMk+vtfavPAWRGZ1S6ru h8Ag== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="V1/LYnTw"; 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-2249-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2249-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id o13-20020a170902d4cd00b001d5ba357b9esi3403924plg.296.2024.01.19.04.32.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 04:32:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-2249-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=@linaro.org header.s=google header.b="V1/LYnTw"; 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-2249-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2249-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id B9BB32836AC for ; Fri, 19 Jan 2024 12:32:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C9D7B36AE1; Fri, 19 Jan 2024 12:32:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="V1/LYnTw" 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 2E7924D58F for ; Fri, 19 Jan 2024 12:32:06 +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=1705667527; cv=none; b=CyJKIK6AoaQoRAGisq9t5ozNht86Rix7HpNKf8SssrC42S5Uo6QGzd4qNMgp7m93Qs0inlhqsMHlZHUi2qHRaEZeRPiXOqx+XKWfEYf83Ymcsl4tyoFITagWso06rWvqstX9h7JQIauYuLIp92VSe29YCWsE53ONYVnz/6Guu7g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705667527; c=relaxed/simple; bh=I0UZfjlfi2E6U7pmjX/HhVBMtbSsDUbWol5BCeCBZhs=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=V2fFBzwHpEIri1joP76j2yCzMgm1h3MBXzrh5XjElHpwQwAEJm0fmEINLBM0jQ55xWeF6wsKuQ6co7g7y5KGAbZcOl0d5VRgIM7nwLybEdYapWPclu9OQ6DMlm/f7l2tjhEYf/SXMvth1BVjhvVFORir5k5Tj8aS89Fnu3/M0jc= 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=V1/LYnTw; 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-5f254d1a6daso7748117b3.2 for ; Fri, 19 Jan 2024 04:32:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1705667525; x=1706272325; 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=Ffjuk5UUhf2ajhXazA1TZbNijQJTawfOkhzxR9sRdg0=; b=V1/LYnTw529sx6xKDy+lxEaAzYcL+//TVJyrgv7aPGLAWtHTUx6SJzRmdjZJtH9DMG K3tvZ7h5ggUhiWgn+V9ZsPkSmkAr1letpe0WpJbQM0fCeQ8Prs4Pn1KW2qLaipIIofLo HZhpP5olkRUApDUpCQhig6SKYI45CLJJrR9lwbcRcV8Us7sisZBM+bTRomNJeL/fSSqK 3ATJtzS/wVsj32xzxEjaWEDn37cIUSKLUorLEX8vl2GjB1gd/wKVwrt0ns5tsWYQfi2a NuQXgw+unAPNG7UrUS8MnL7Jtnmmzn/+EVBaJX/mtI9hhXSzhLHpwNKkAfXLE9ASjYVM rzKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705667525; x=1706272325; 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=Ffjuk5UUhf2ajhXazA1TZbNijQJTawfOkhzxR9sRdg0=; b=VafoST8VUj9OEdmnfY8CBE96EKnwskLw1R4JlscEIqa3z2tYuFtL6FxNpPSW4IPAFx bo0kcHN8WUNsGuwBBnKAwQQp6Ea8eAC+8eZrN9Qaxk1XL9cAZ2iL8D3SPcp9g3xOq/PG eplvMykCt6i/dkVHYvUrA3UD1Zr/x9e/PCIVa+56WK6DUYmOeG+zbMlcRh3Svf3P4cWE D/pys2SAAAF8aUaeka1hT6ALb6ICsm7uE4C5KhYVoCwm+X8DsLs+yGwBBIB4tMW+2//k 7sgV9ElpsrqPMFcwCi5cIi2Av4zut0jHPJIonA/qHCe+mCussfV4RT7DsJ35uokkjCGv 2fJQ== X-Gm-Message-State: AOJu0YzbMpe9H2P+voZjA29wHi/42Ihe6Z3rjsiOSdhiL3jLlpJCWE3+ FjN92MicxTRljTt5vZh/zzGzMUFSzjpHWP7jAMfp4s6RRPb5LNEJinVj/GixZLXodAPJF/qU4mI sGD4XTuW3BiemjoUpU5K05At9tOS7zxEp1Vq0lw== X-Received: by 2002:a81:4a83:0:b0:5fc:b5d4:f1cf with SMTP id x125-20020a814a83000000b005fcb5d4f1cfmr2465344ywa.35.1705667525159; Fri, 19 Jan 2024 04:32:05 -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 14:31:53 +0200 Message-ID: Subject: Re: [PATCH 0/9] PCI: introduce the concept of power sequencing of PCIe devices To: Bartosz Golaszewski 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 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 PMU, > > > 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 sta= tus > > * @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_priv) > > =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. > > 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. > > 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. > 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. --=20 With best wishes Dmitry