PCI: imx6: Allow to probe when dw_pcie_wait_for_link() fails
Subsystems (4)
Fabio Estevam
reviewerPATCH 1/1 PCI: imx6: Allow to probe when dw_pcie_wait_for_link() fails
The intention of commit 886a9c134755 ("PCI: dwc: Move link handling into common code") was to standardize the behavior of link down as explained in its commit log:
"The behavior for a link down was inconsistent as some drivers would fail probe in that case while others succeed. Let's standardize this to succeed as there are usecases where devices (and the link) appear later even without hotplug. For example, a reconfigured FPGA device."
The pci-imx6 still fails to probe when the link is not present, which causes the following warning:
[ 9.199175] imx6q-pcie 8ffc000.pcie: Phy link never came up [ 9.208701] imx6q-pcie: probe of 8ffc000.pcie failed with error -110 [ 9.216214] ------------[ cut here ]------------ [ 9.222057] WARNING: CPU: 0 PID: 30 at drivers/regulator/core.c:2257 _regulator_put.part.0+0x1b8/0x1dc [ 9.232411] Modules linked in: [ 9.236201] CPU: 0 PID: 30 Comm: kworker/u2:2 Not tainted 5.15.0-next-20211103 #1 [ 9.244086] Hardware name: Freescale i.MX6 SoloX (Device Tree) [ 9.250284] Workqueue: events_unbound async_run_entry_fn [ 9.256067] [<c0111730>] (unwind_backtrace) from [<c010bb74>] (show_stack+0x10/0x14) [ 9.264258] [<c010bb74>] (show_stack) from [<c0f90290>] (dump_stack_lvl+0x58/0x70) [ 9.272245] [<c0f90290>] (dump_stack_lvl) from [<c012631c>] (__warn+0xd4/0x154) [ 9.279969] [<c012631c>] (__warn) from [<c0f87b00>] (warn_slowpath_fmt+0x74/0xa8) [ 9.287882] [<c0f87b00>] (warn_slowpath_fmt) from [<c076b4bc>] (_regulator_put.part.0+0x1b8/0x1dc) [ 9.297273] [<c076b4bc>] (_regulator_put.part.0) from [<c076b574>] (regulator_put+0x2c/0x3c) [ 9.306122] [<c076b574>] (regulator_put) from [<c08c3740>] (release_nodes+0x50/0x178)
Fix this problem by ignoring the dw_pcie_wait_for_link() error like it is done on the other dwc drivers.
Tested on imx6sx-sdb and imx6q-sabresd boards.
--- drivers/pci/controller/dwc/pci-imx6.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/pci/controller/dwc/pci-imx6.c +2 -8
@@ -779,9 +779,7 @@ static int imx6_pcie_start_link(struct dw_pcie *pci)/* Start LTSSM. */ imx6_pcie_ltssm_enable (dev); - ret =dw_pcie_wait_for_link (pci); -if (ret) - goto err_reset_phy; +dw_pcie_wait_for_link (pci);if (pci->link_gen ==2 ) {/* Allow Gen2 mode after the link is up. */
@@ -817,11 +815,7 @@ static int imx6_pcie_start_link(struct dw_pcie *pci) }/* Make sure link training is finished as well! */ - ret =dw_pcie_wait_for_link (pci); -if (ret) { -dev_err (dev,"Failed to bring link up!\n" ); - goto err_reset_phy; - } +dw_pcie_wait_for_link (pci); }else {dev_info (dev,"Link: Gen2 disabled\n" ); }
Signature · 1 line
2.25.1
Hongxing Zhu
maintainerQuoted 48 lines
-----Original Message-----
From: Fabio Estevam <[email protected]>
Sent: Thursday, November 4, 2021 8:02 AM
To: Hongxing Zhu <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Fabio Estevam <[email protected]>
Subject: [PATCH] PCI: imx6: Allow to probe whendw_pcie_wait_for_link()failsThe intention of commit
886a9c134755("PCI: dwc: Move link handling into common code") was to standardize the behavior of link down as explained in its commit log:"The behavior for a link down was inconsistent as some drivers would fail probe in that case while others succeed. Let's standardize this to succeed as there are usecases where devices (and the link) appear later even without hotplug. For example, a reconfigured FPGA device."
The pci-imx6 still fails to probe when the link is not present, which causes the following warning:
[ 9.199175] imx6q-pcie 8ffc000.pcie: Phy link never came up [ 9.208701] imx6q-pcie: probe of 8ffc000.pcie failed with error -110 [ 9.216214] ------------[ cut here ]------------ [ 9.222057] WARNING: CPU: 0 PID: 30 at drivers/regulator/core.c:2257 _regulator_put.part.0+0x1b8/0x1dc [ 9.232411] Modules linked in: [ 9.236201] CPU: 0 PID: 30 Comm: kworker/u2:2 Not tainted 5.15.0-next-20211103 #1 [ 9.244086] Hardware name: Freescale i.MX6 SoloX (Device Tree) [ 9.250284] Workqueue: events_unbound async_run_entry_fn [ 9.256067] [<c0111730>] (unwind_backtrace) from [<c010bb74>] (show_stack+0x10/0x14) [ 9.264258] [<c010bb74>] (show_stack) from [<c0f90290>] (dump_stack_lvl+0x58/0x70) [ 9.272245] [<c0f90290>] (dump_stack_lvl) from [<c012631c>] (__warn+0xd4/0x154) [ 9.279969] [<c012631c>] (__warn) from [<c0f87b00>] (warn_slowpath_fmt+0x74/0xa8) [ 9.287882] [<c0f87b00>] (warn_slowpath_fmt) from [<c076b4bc>] (_regulator_put.part.0+0x1b8/0x1dc) [ 9.297273] [<c076b4bc>] (_regulator_put.part.0) from [<c076b574>] (regulator_put+0x2c/0x3c) [ 9.306122] [<c076b574>] (regulator_put) from [<c08c3740>](
release_nodes+0x50/0x178)
Quoted 7 lines
Fix this problem by ignoring the
dw_pcie_wait_for_link()error like it is done on the other dwc drivers.Tested on imx6sx-sdb and imx6q-sabresd boards.
Fixes 886a9c134755 ("PCI: dwc: Move link handling into common code")Signed-off-by Fabio Estevam <[email protected]>
[Richard Zhu] Hi Fabio:
First of all, thanks for your help to care this bug.
This dump is planned to be fixed in the #5 patch of
'[v4,0/6] PCI: imx6: refine codes and add compliance tests mode support'
"https://patchwork.kernel.org/project/linux-arm-kernel/cover/[email protected]/"
As we know that the hot-plug is not supported by i.MX PCIe. i.MX PCIe would not have any chances to be functional after one link down.
To save power consumption as much as possible, we should do the error
handling after link is down.
Ignore the the dw_pcie_wait_for_link() error, PCIe would keep consuming
the power, this is not friendly for the system power saving.
Best Regards
Richard Zhu
Quoted 36 lines
--- drivers/pci/controller/dwc/pci-imx6.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)drivers/pci/controller/dwc/pci-imx6.c +1
-3@@ -779,9 +779,7 @@ static int imx6_pcie_start_link(struct dw_pcie *pci)/* Start LTSSM. */ imx6_pcie_ltssm_enable (dev); - ret =dw_pcie_wait_for_link (pci); -if (ret) - goto err_reset_phy; +dw_pcie_wait_for_link (pci);if (pci->link_gen ==2 ) {/* Allow Gen2 mode after the link is up. */ @@ -817,11 +815,7
@@ static intimx6_pcie_start_link(struct dw_pcie *pci)drivers/pci/controller/dwc/pci-imx6.c +1
-6}/* Make sure link training is finished as well! */ - ret =dw_pcie_wait_for_link (pci); -if (ret) { -dev_err (dev,"Failed to bring link up!\n" ); - goto err_reset_phy; - } +dw_pcie_wait_for_link (pci); }else {dev_info (dev,"Link: Gen2 disabled\n" ); } --2.25.1
Fabio Estevam
reviewerHi Richard,
Quoted 5 lines · Hongxing Zhu
[Richard Zhu] Hi Fabio:
First of all, thanks for your help to care this bug.
This dump is planned to be fixed in the #5 patch of
'[v4,0/6] PCI: imx6: refine codes and add compliance tests mode support'
"https://patchwork.kernel.org/project/linux-arm-kernel/cover/[email protected]/"
Ok, great. Since this patch 5/6 is a bug fix, could you re-order this series so that the bug fix is the first one in the series?
This makes it easier for the backport to stable.
Patch 1/6 is just a cleanup and could go further.
Thanks
Hongxing Zhu
maintainerQuoted 29 lines
-----Original Message-----
From: Fabio Estevam <[email protected]>
Sent: Thursday, November 4, 2021 9:45 AM
To: Hongxing Zhu <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] PCI: imx6: Allow to probe whendw_pcie_wait_for_link()failsHi Richard,
Quoted 5 lines · Hongxing Zhu
[Richard Zhu] Hi Fabio:
First of all, thanks for your help to care this bug. This dump is planned to be fixed in the #5 patch of '[v4,0/6] PCI:
imx6: refine codes and add compliance tests mode support'"https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fp atchwork.kernel.org%2Fproject%2Flinux-arm-kernel%2Fcover%2F163574 7478-25562-1-git-send-email-hongxing.zhu%40nxp.com%2F&data= 04%7C01%7Chongxing.zhu%40nxp.com%7Ca96f456b0a004a4da69008d9 9f34bb8b%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C1%7C6377 15871101762967%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwM DAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000& sdata=bZInvFrlHI8VmWiIS2oxfraSCFAEhWmPG%2BtHLwNHD7A%3D&am p;reserved=0"
Quoted 6 lines
Ok, great. Since this patch 5/6 is a bug fix, could you re-order this series so that the bug fix is the first one in the series?
This makes it easier for the backport to stable.
Patch 1/6 is just a cleanup and could go further.
[Richard Zhu] Hi Fabio: The #5 patch relies on the changes of #2-4 patches. And the #1 patch make the changes of #2 easier.
It's better to keep the sequence of the v4 series.
BR
Richard
Quoted 2 lines
Thanks
Fabio Estevam
reviewerHi Richard,
Quoted 5 lines · Hongxing Zhu
[Richard Zhu] Hi Fabio:
First of all, thanks for your help to care this bug.
This dump is planned to be fixed in the #5 patch of
'[v4,0/6] PCI: imx6: refine codes and add compliance tests mode support'
"https://patchwork.kernel.org/project/linux-arm-kernel/cover/[email protected]/"
Any progress with this?
Since this problem affects the stable kernels, would your series be applied to the stable tree too?
Could you please resend your series so we can get this issue resolved?
Hongxing Zhu
maintainerQuoted 30 lines
-----Original Message-----
From: Fabio Estevam <[email protected]>
Sent: Saturday, December 4, 2021 11:35 PM
To: Hongxing Zhu <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] PCI: imx6: Allow to probe whendw_pcie_wait_for_link()failsHi Richard,
Quoted 5 lines · Hongxing Zhu
[Richard Zhu] Hi Fabio:
First of all, thanks for your help to care this bug. This dump is planned to be fixed in the #5 patch of '[v4,0/6] PCI:
imx6: refine codes and add compliance tests mode support'"https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fp atchwork.kernel.org%2Fproject%2Flinux-arm-kernel%2Fcover%2F163574 7478-25562-1-git-send-email-hongxing.zhu%40nxp.com%2F&data= 04%7C01%7Chongxing.zhu%40nxp.com%7C5ead6c09df204e65988908d9 b73ba44d%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637 742289061098040%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAw MDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&am p;sdata=%2FbJokqkG1jyolTO1%2FmZhxLhmzcBKUQqU4fNx%2BoKnhGg% 3D&reserved=0"
Quoted 6 lines
Any progress with this?
Since this problem affects the stable kernels, would your series be applied to the stable tree too?
Could you please resend your series so we can get this issue resolved?
[Richard Zhu] I'm glad if this series can be applied to the stable tree too. And I can re-send this patch-set again include the stable kernel tree.
Unfortunately, I can't get contact and response from Lucas for a while. Without his ack, I'm afraid that this series wouldn't be merged. Lucas might be on his vocation and limited to access the email. I will ping him from time to time.
Best Regards
Richard