* [PATCH] power: sequencing: pwrseq-pcie-m2: Support PCIe switch topologies
@ 2026-09-07 12:21 Wei Deng
2026-09-07 12:29 ` sashiko-bot
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Wei Deng @ 2026-09-07 12:21 UTC (permalink / raw)
To: Manivannan Sadhasivam, Bartosz Golaszewski
Cc: linux-pci, linux-pm, linux-kernel, quic_chezhou, cheng.jiang,
shuai.zhang, jinwang.li, xiuzhuo.shang, mengshi.wu
The PCI parent OF node check in pwrseq_pcie_m2_notify() and
pwrseq_pcie_m2_create_serdev() only looks at the immediate parent of the
PCI endpoint device. This fails when a PCIe switch inserts one or more
intermediate bridges between the root port and the endpoint.
For example, on lemans-evk with IFP Mezzanine board, the Toshiba TC9562
PCIe switch creates two bridge devices (upstream and downstream ports)
without OF nodes, so the WCN6855 BT device appears at depth 3 and its
immediate parent has of_node=NULL.
Add a helper pwrseq_pcie_m2_pci_parent_matches() that walks the PCI
parent chain upward until it finds a device whose OF node matches the
expected connector port node, or reaches a non-PCI device. Replace both
single-level checks with this helper to handle arbitrary PCIe switch
depths.
Signed-off-by: Wei Deng <wei.deng@oss.qualcomm.com>
---
drivers/power/sequencing/pwrseq-pcie-m2.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/drivers/power/sequencing/pwrseq-pcie-m2.c b/drivers/power/sequencing/pwrseq-pcie-m2.c
index de9848a9a9f1..82ba309ba5f3 100644
--- a/drivers/power/sequencing/pwrseq-pcie-m2.c
+++ b/drivers/power/sequencing/pwrseq-pcie-m2.c
@@ -376,6 +376,21 @@ static void pwrseq_pcie_m2_remove_serdev(struct pwrseq_pcie_m2_ctx *ctx,
mutex_unlock(&ctx->list_lock);
}
+static bool pwrseq_pcie_m2_pci_parent_matches(struct pci_dev *pdev,
+ struct device_node *pci_parent)
+{
+ struct device *dev = pdev->dev.parent;
+
+ while (dev) {
+ if (dev->of_node == pci_parent)
+ return true;
+ if (!dev_is_pci(dev))
+ break;
+ dev = dev->parent;
+ }
+ return false;
+}
+
static int pwrseq_pcie_m2_notify(struct notifier_block *nb, unsigned long action,
void *data)
{
@@ -390,7 +405,7 @@ static int pwrseq_pcie_m2_notify(struct notifier_block *nb, unsigned long action
*/
struct device_node *pci_parent __free(device_node) =
of_graph_get_remote_node(dev_of_node(ctx->dev), 0, 0);
- if (!pci_parent || (pci_parent != pdev->dev.parent->of_node))
+ if (!pci_parent || !pwrseq_pcie_m2_pci_parent_matches(pdev, pci_parent))
return NOTIFY_DONE;
switch (action) {
@@ -464,7 +479,7 @@ static int pwrseq_pcie_m2_create_serdev(struct pwrseq_pcie_m2_ctx *ctx)
/* Create serdev for existing PCI devices if required */
for_each_pci_dev(pdev) {
- if (!pdev->dev.parent || pci_parent != pdev->dev.parent->of_node)
+ if (!pwrseq_pcie_m2_pci_parent_matches(pdev, pci_parent))
continue;
if (!pci_match_id(pwrseq_m2_pci_ids, pdev))
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] power: sequencing: pwrseq-pcie-m2: Support PCIe switch topologies
2026-09-07 12:21 [PATCH] power: sequencing: pwrseq-pcie-m2: Support PCIe switch topologies Wei Deng
@ 2026-09-07 12:29 ` sashiko-bot
2026-09-09 10:56 ` Manivannan Sadhasivam
2026-09-09 12:55 ` Bartosz Golaszewski
2 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-09-07 12:29 UTC (permalink / raw)
To: Wei Deng; +Cc: linux-pci
> The PCI parent OF node check in pwrseq_pcie_m2_notify() and
> pwrseq_pcie_m2_create_serdev() only looks at the immediate parent of the
> PCI endpoint device. This fails when a PCIe switch inserts one or more
> intermediate bridges between the root port and the endpoint.
>
> For example, on lemans-evk with IFP Mezzanine board, the Toshiba TC9562
> PCIe switch creates two bridge devices (upstream and downstream ports)
> without OF nodes, so the WCN6855 BT device appears at depth 3 and its
> immediate parent has of_node=NULL.
>
> Add a helper pwrseq_pcie_m2_pci_parent_matches() that walks the PCI
> parent chain upward until it finds a device whose OF node matches the
> expected connector port node, or reaches a non-PCI device. Replace both
> single-level checks with this helper to handle arbitrary PCIe switch
> depths.
>
> Signed-off-by: Wei Deng <wei.deng@oss.qualcomm.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260907122129.1577279-1-wei.deng@oss.qualcomm.com?part=1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] power: sequencing: pwrseq-pcie-m2: Support PCIe switch topologies
2026-09-07 12:21 [PATCH] power: sequencing: pwrseq-pcie-m2: Support PCIe switch topologies Wei Deng
2026-09-07 12:29 ` sashiko-bot
@ 2026-09-09 10:56 ` Manivannan Sadhasivam
2026-09-09 12:55 ` Bartosz Golaszewski
2 siblings, 0 replies; 4+ messages in thread
From: Manivannan Sadhasivam @ 2026-09-09 10:56 UTC (permalink / raw)
To: Wei Deng
Cc: Bartosz Golaszewski, linux-pci, linux-pm, linux-kernel,
quic_chezhou, cheng.jiang, shuai.zhang, jinwang.li, xiuzhuo.shang,
mengshi.wu
On Mon, Sep 07, 2026 at 05:51:29PM +0530, Wei Deng wrote:
> The PCI parent OF node check in pwrseq_pcie_m2_notify() and
> pwrseq_pcie_m2_create_serdev() only looks at the immediate parent of the
> PCI endpoint device. This fails when a PCIe switch inserts one or more
> intermediate bridges between the root port and the endpoint.
>
> For example, on lemans-evk with IFP Mezzanine board, the Toshiba TC9562
> PCIe switch creates two bridge devices (upstream and downstream ports)
> without OF nodes, so the WCN6855 BT device appears at depth 3 and its
> immediate parent has of_node=NULL.
>
> Add a helper pwrseq_pcie_m2_pci_parent_matches() that walks the PCI
> parent chain upward until it finds a device whose OF node matches the
> expected connector port node, or reaches a non-PCI device. Replace both
> single-level checks with this helper to handle arbitrary PCIe switch
> depths.
>
> Signed-off-by: Wei Deng <wei.deng@oss.qualcomm.com>
I'd have fancied a device_for_each* helper, but that's not a big deal and
probably an overkill for just one user.
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
- Mani
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] power: sequencing: pwrseq-pcie-m2: Support PCIe switch topologies
2026-09-07 12:21 [PATCH] power: sequencing: pwrseq-pcie-m2: Support PCIe switch topologies Wei Deng
2026-09-07 12:29 ` sashiko-bot
2026-09-09 10:56 ` Manivannan Sadhasivam
@ 2026-09-09 12:55 ` Bartosz Golaszewski
2 siblings, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2026-09-09 12:55 UTC (permalink / raw)
To: Manivannan Sadhasivam, Bartosz Golaszewski, Wei Deng
Cc: Bartosz Golaszewski, linux-pci, linux-pm, linux-kernel,
quic_chezhou, cheng.jiang, shuai.zhang, jinwang.li, xiuzhuo.shang,
mengshi.wu
On Mon, 07 Sep 2026 17:51:29 +0530, Wei Deng wrote:
> The PCI parent OF node check in pwrseq_pcie_m2_notify() and
> pwrseq_pcie_m2_create_serdev() only looks at the immediate parent of the
> PCI endpoint device. This fails when a PCIe switch inserts one or more
> intermediate bridges between the root port and the endpoint.
>
> For example, on lemans-evk with IFP Mezzanine board, the Toshiba TC9562
> PCIe switch creates two bridge devices (upstream and downstream ports)
> without OF nodes, so the WCN6855 BT device appears at depth 3 and its
> immediate parent has of_node=NULL.
>
> [...]
Applied, thanks!
[1/1] power: sequencing: pwrseq-pcie-m2: Support PCIe switch topologies
https://git.kernel.org/brgl/c/935ecc5c86c5ae2693b2fbff83fc1bd086a9c915
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-09-09 12:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-07 12:21 [PATCH] power: sequencing: pwrseq-pcie-m2: Support PCIe switch topologies Wei Deng
2026-09-07 12:29 ` sashiko-bot
2026-09-09 10:56 ` Manivannan Sadhasivam
2026-09-09 12:55 ` Bartosz Golaszewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox