FAILED: patch "[PATCH] PCI: j721e: Fix programming sequence of "strap" settings" failed to apply to 5.10-stable tree
Subsystems (5)
[email protected]
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x f842d3313ba179d4005096357289c7ad09cec575
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2025101617-matching-native-d141@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From f842d3313ba179d4005096357289c7ad09cec575 Mon Sep 17 00:00:00 2001
From: Siddharth Vadapalli <[email protected]>
Date: Mon, 8 Sep 2025 17:38:27 +0530
Subject: [PATCH] PCI: j721e: Fix programming sequence of "strap" settings
The Cadence PCIe Controller integrated in the TI K3 SoCs supports both Root-Complex and Endpoint modes of operation. The Glue Layer allows "strapping" the Mode of operation of the Controller, the Link Speed and the Link Width. This is enabled by programming the "PCIEn_CTRL" register (n corresponds to the PCIe instance) within the CTRL_MMR memory-mapped register space. The "reset-values" of the registers are also different depending on the mode of operation.
Since the PCIe Controller latches onto the "reset-values" immediately after being powered on, if the Glue Layer configuration is not done while the PCIe Controller is off, it will result in the PCIe Controller latching onto the wrong "reset-values". In practice, this will show up as a wrong representation of the PCIe Controller's capability structures in the PCIe Configuration Space. Some such capabilities which are supported by the PCIe Controller in the Root-Complex mode but are incorrectly latched onto as being unsupported are:
- Link Bandwidth Notification
- Alternate Routing ID (ARI) Forwarding Support
- Next capability offset within Advanced Error Reporting (AER) capability
Fix this by powering off the PCIe Controller before programming the "strap" settings and powering it on after that. The runtime PM APIs namely pm_runtime_put_sync() and pm_runtime_get_sync() will decrement and increment the usage counter respectively, causing GENPD to power off and power on the PCIe Controller.
drivers/pci/controller/cadence/pci-j721e.c +25 -0
@@ -284,6 +284,25 @@ static int j721e_pcie_ctrl_init(struct j721e_pcie *pcie)if (!ret) offset = args.args[0 ]; +/* +* The PCIe Controller's registers have different "reset-values" +* depending on the "strap" settings programmed into the PCIEn_CTRL +* register within the CTRL_MMR memory-mapped register space. +* The registers latch onto a "reset-value" based on the "strap" +* settings sampled after the PCIe Controller is powered on. +* To ensure that the "reset-values" are sampled accurately, power +* off the PCIe Controller before programming the "strap" settings +* and power it on after that. The runtime PM APIs namely +* pm_runtime_put_sync() and pm_runtime_get_sync() will decrement and +* increment the usage counter respectively, causing GENPD to power off +* and power on the PCIe Controller. +*/ + ret =pm_runtime_put_sync (dev); +if (ret <0 ) { +dev_err (dev,"Failed to power off PCIe Controller\n" ); +return ret; + } + ret =j721e_pcie_set_mode (pcie, syscon, offset);if (ret <0 ) {dev_err (dev,"Failed to set pci mode\n" );
@@ -302,6 +321,12 @@ static int j721e_pcie_ctrl_init(struct j721e_pcie *pcie)return ret; } + ret =pm_runtime_get_sync (dev); +if (ret <0 ) { +dev_err (dev,"Failed to power on PCIe Controller\n" ); +return ret; + } +/* Enable ACSPCIE refclk output if the optional property exists */ syscon =syscon_regmap_lookup_by_phandle_optional (node,"ti,syscon-acspcie-proxy-ctrl" );
Sasha Levin
maintainerPATCH 1/1 PCI: j721e: Fix programming sequence of "strap" settings
From: Siddharth Vadapalli <[email protected]>
[ Upstream commit f842d3313ba179d4005096357289c7ad09cec575 ]
The Cadence PCIe Controller integrated in the TI K3 SoCs supports both Root-Complex and Endpoint modes of operation. The Glue Layer allows "strapping" the Mode of operation of the Controller, the Link Speed and the Link Width. This is enabled by programming the "PCIEn_CTRL" register (n corresponds to the PCIe instance) within the CTRL_MMR memory-mapped register space. The "reset-values" of the registers are also different depending on the mode of operation.
Since the PCIe Controller latches onto the "reset-values" immediately after being powered on, if the Glue Layer configuration is not done while the PCIe Controller is off, it will result in the PCIe Controller latching onto the wrong "reset-values". In practice, this will show up as a wrong representation of the PCIe Controller's capability structures in the PCIe Configuration Space. Some such capabilities which are supported by the PCIe Controller in the Root-Complex mode but are incorrectly latched onto as being unsupported are:
- Link Bandwidth Notification
- Alternate Routing ID (ARI) Forwarding Support
- Next capability offset within Advanced Error Reporting (AER) capability
Fix this by powering off the PCIe Controller before programming the "strap" settings and powering it on after that. The runtime PM APIs namely pm_runtime_put_sync() and pm_runtime_get_sync() will decrement and increment the usage counter respectively, causing GENPD to power off and power on the PCIe Controller.
--- drivers/pci/controller/cadence/pci-j721e.c | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+)
drivers/pci/controller/cadence/pci-j721e.c +25 -0
@@ -227,6 +227,25 @@ static int j721e_pcie_ctrl_init(struct j721e_pcie *pcie)return PTR_ERR (syscon); } +/* +* The PCIe Controller's registers have different "reset-values" +* depending on the "strap" settings programmed into the PCIEn_CTRL +* register within the CTRL_MMR memory-mapped register space. +* The registers latch onto a "reset-value" based on the "strap" +* settings sampled after the PCIe Controller is powered on. +* To ensure that the "reset-values" are sampled accurately, power +* off the PCIe Controller before programming the "strap" settings +* and power it on after that. The runtime PM APIs namely +* pm_runtime_put_sync() and pm_runtime_get_sync() will decrement and +* increment the usage counter respectively, causing GENPD to power off +* and power on the PCIe Controller. +*/ + ret =pm_runtime_put_sync (dev); +if (ret <0 ) { +dev_err (dev,"Failed to power off PCIe Controller\n" ); +return ret; + } + ret =j721e_pcie_set_mode (pcie, syscon);if (ret <0 ) {dev_err (dev,"Failed to set pci mode\n" );
@@ -245,6 +264,12 @@ static int j721e_pcie_ctrl_init(struct j721e_pcie *pcie)return ret; } + ret =pm_runtime_get_sync (dev); +if (ret <0 ) { +dev_err (dev,"Failed to power on PCIe Controller\n" ); +return ret; + } +return 0 ; }
Signature · 1 line
2.51.0