mbox series

[v10,0/7] PCI: imx6: refine codes and add the error propagation

Message ID 1655110538-10914-1-git-send-email-hongxing.zhu@nxp.com (mailing list archive)
Headers show
Series PCI: imx6: refine codes and add the error propagation | expand

Message

Hongxing Zhu June 13, 2022, 8:55 a.m. UTC
This series patches refine pci-imx6 driver and do the following main changes.
- Encapsulate the clock enable into one standalone function
- Add the error propagation from host_init and resume
- Turn off regulator when the system is in suspend mode
- Let the probe successfully when link never comes up
- Do not hide the phy driver callbacks in core reset and clk_enable.
BTW, this series are verified on i.MX8MM EVK board when one NVME is used.

Main changes from v9 to v10:
- Add the "Reviewed-by: Lucas Stach <l.stach@pengutronix.de>" tag into #3
  and #4 patches.
Refer to Bjorn's comments:
- refine the commit of the first patch
- keep alignment of the message format in the second patch
- More specific commit and subject of the #5 and #7 patches.
Refer to Lucas' comments:
- Move the regualtor_disable into suspend, turn off the regulator when bus
  is powered off and system in suspend mode.
- Let the driver probe successfully, return zero in imx6_pcie_start_link()
  when PCIe link is down. 
  In this link down scenario, only start the PCIe link training in resume
  when the link is up before system suspend to avoid the long latency in
  the link training period.
- Don't hide phy driver callbacks in core reset and clk_enable, and refine
  the error handling accordingly.
- Drop the #8 patch of v9 series, since the clocks and powers are not gated
  off anymore when link is down.

Main changes from v8 to v9:
- Don't change pcie-designware codes, and do the error exit process only in
  pci-imx6 driver internally.
- Move the phy driver callbacks to the proper places

Main changes from v7 to v8:
Regarding Bjorn's review comments.
- Align the format of the dev_info message and refine commit log of
  #6/7/8 patches.
- Rename the err_reset_phy label, since there is no PHY reset in the out

Main changes from v6 to v7:
- Keep the regulator usage counter balance in the #5 patch of v6 series.

Main changes from v5 to v6:
- Refer to the following discussion with Fabio, fix the dump by his patch.
  https://patchwork.kernel.org/project/linux-pci/patch/1641368602-20401-6-git-send-email-hongxing.zhu@nxp.com/
  Refine and rebase this patch-set after Fabio' dump fix patch is merged.
- Add one new #4 patch to disable i.MX6QDL REF clock too when disable clocks
- Split the regulator refine codes into one standalone patch #5 in this version.

Main changes from v4 to v5:
- Since i.MX8MM PCIe support had been merged. Based on Lorenzo's git repos,
  resend the patch-set after rebase.

Main changes from v3 to v4:
- Regarding Mark's comments, delete the regulator_is_enabled() check.
- Squash #3 and #6 of v3 patch into #5 patch of v4 set.

Main changes from v2 to v3:
- Add "Reviewed-by: Lucas Stach <l.stach@pengutronix.de>" tag into
  first two patches.
- Add a Fixes tag into #3 patch.
- Split the #4 of v2 to two patches, one is clock disable codes move,
  the other one is the acutal clock unbalance fix.
- Add a new host_exit() callback into dw_pcie_host_ops, then it could be
  invoked to handle the unbalance issue in the error handling after
  host_init() function when link is down.
- Add a new host_exit() callback for i.MX PCIe driver to handle this case
  in the error handling after host_init.

Main changes from v1 to v2:
Regarding Lucas' comments.
  - Move the placement of the new imx6_pcie_clk_enable() to avoid the
    forward declarition.
  - Seperate the second patch of v1 patch-set to three patches.
  - Use the module_param to replace the kernel command line.
Regarding Bjorn's comments:
  - Use the cover-letter for a multi-patch series.
  - Correct the subject line, and refine the commit logs. For example,
    remove the timestamp of the logs.

drivers/pci/controller/dwc/pci-imx6.c | 241 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------
1 file changed, 157 insertions(+), 84 deletions(-)

[PATCH v10 1/7] PCI: imx6: Encapsulate the clock enable into one
[PATCH v10 2/7] PCI: imx6: Add the error propagation from host_init
[PATCH v10 3/7] PCI: imx6: Move imx6_pcie_clk_disable() earlier
[PATCH v10 4/7] PCI: imx6: Disable iMX6QDL PCIe REF clock when
[PATCH v10 5/7] PCI: imx6: Turn off regulator when the system is in
[PATCH v10 6/7] PCI: imx6: Mark the link down as none fatal error
[PATCH v10 7/7] PCI: imx6: Do not hide phy driver callbacks and

Comments

Bjorn Helgaas June 13, 2022, 8:41 p.m. UTC | #1
On Mon, Jun 13, 2022 at 04:55:31PM +0800, Richard Zhu wrote:
> This series patches refine pci-imx6 driver and do the following main changes.
> - Encapsulate the clock enable into one standalone function
> - Add the error propagation from host_init and resume
> - Turn off regulator when the system is in suspend mode
> - Let the probe successfully when link never comes up
> - Do not hide the phy driver callbacks in core reset and clk_enable.

This doesn't apply on v5.19-rc1 for me.  Am I missing something:

  03:38:06 ~/linux (main)$ git checkout -b wip/richard-imx6-power-v10 v5.19-rc1
  Switched to a new branch 'wip/richard-imx6-power-v10'
  03:38:14 ~/linux (wip/richard-imx6-power-v10)$ b4 am -om/ https://lore.kernel.org/r/1655110538-10914-1-git-send-email-hongxing.zhu@nxp.com
  Looking up https://lore.kernel.org/r/1655110538-10914-1-git-send-email-hongxing.zhu%40nxp.com
  Analyzing 9 messages in the thread
  Checking attestation on all messages, may take a moment...
  ---
    [PATCH v10 1/7] PCI: imx6: Encapsulate the clock enable into one standalone function
    [PATCH v10 2/7] PCI: imx6: Add the error propagation from host_init
    [PATCH v10 3/7] PCI: imx6: Move imx6_pcie_clk_disable() earlier
    [PATCH v10 4/7] PCI: imx6: Disable iMX6QDL PCIe REF clock when disable PCIe clocks
    [PATCH v10 5/7] PCI: imx6: Turn off regulator when the system is in suspend mode
    [PATCH v10 6/7] PCI: imx6: Mark the link down as none fatal error
    [PATCH v10 7/7] PCI: imx6: Do not hide phy driver callbacks and refine the error handling
  ---
  Total patches: 7
  ---
  Cover: m/v10_20220613_hongxing_zhu_pci_imx6_refine_codes_and_add_the_error_propagation.cover
   Link: https://lore.kernel.org/r/1655110538-10914-1-git-send-email-hongxing.zhu@nxp.com
   Base: not specified
	 git am m/v10_20220613_hongxing_zhu_pci_imx6_refine_codes_and_add_the_error_propagation.mbx
  03:38:27 ~/linux (wip/richard-imx6-power-v10)$ git am m/v10_20220613_hongxing_zhu_pci_imx6_refine_codes_and_add_the_error_propagation.mbx
  Applying: PCI: imx6: Encapsulate the clock enable into one standalone function
  error: patch failed: drivers/pci/controller/dwc/pci-imx6.c:539
  error: drivers/pci/controller/dwc/pci-imx6.c: patch does not apply
  Patch failed at 0001 PCI: imx6: Encapsulate the clock enable into one standalone function
  hint: Use 'git am --show-current-patch' to see the failed patch
  When you have resolved this problem, run "git am --continue".
  If you prefer to skip this patch, run "git am --skip" instead.
  To restore the original branch and stop patching, run "git am --abort".
Hongxing Zhu June 14, 2022, 1 a.m. UTC | #2
> -----Original Message-----
> From: Bjorn Helgaas <helgaas@kernel.org>
> Sent: 2022年6月14日 4:41
> To: Hongxing Zhu <hongxing.zhu@nxp.com>
> Cc: l.stach@pengutronix.de; bhelgaas@google.com; robh+dt@kernel.org;
> broonie@kernel.org; lorenzo.pieralisi@arm.com; festevam@gmail.com;
> francesco.dolcini@toradex.com; linux-pci@vger.kernel.org;
> linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org;
> kernel@pengutronix.de; dl-linux-imx <linux-imx@nxp.com>
> Subject: Re: [PATCH v10 0/7] PCI: imx6: refine codes and add the error
> propagation
> 
> On Mon, Jun 13, 2022 at 04:55:31PM +0800, Richard Zhu wrote:
> > This series patches refine pci-imx6 driver and do the following main changes.
> > - Encapsulate the clock enable into one standalone function
> > - Add the error propagation from host_init and resume
> > - Turn off regulator when the system is in suspend mode
> > - Let the probe successfully when link never comes up
> > - Do not hide the phy driver callbacks in core reset and clk_enable.
> 
> This doesn't apply on v5.19-rc1 for me.  Am I missing something:
Hi Bjorn:
The V10 patch based on Shawn's for-next branch.
I would rebased them on v5.19-rc1 later.

Best Regards
Richard Zhu

> 
>   03:38:06 ~/linux (main)$ git checkout -b wip/richard-imx6-power-v10
> v5.19-rc1
>   Switched to a new branch 'wip/richard-imx6-power-v10'
>   03:38:14 ~/linux (wip/richard-imx6-power-v10)$ b4 am -om/
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.ker
> nel.org%2Fr%2F1655110538-10914-1-git-send-email-hongxing.zhu%40nxp.co
> m&amp;data=05%7C01%7Chongxing.zhu%40nxp.com%7C5c2dbbe817b94f90
> 919508da4d7d16bb%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7
> C637907496897306313%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAw
> MDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%
> 7C&amp;sdata=bCMhbBxRNV8D0lnVBxURUFRbtMNADUxZJq4wZz47rKY%3D&
> amp;reserved=0
>   Looking up
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.ker
> nel.org%2Fr%2F1655110538-10914-1-git-send-email-hongxing.zhu%2540nxp.
> com&amp;data=05%7C01%7Chongxing.zhu%40nxp.com%7C5c2dbbe817b94f
> 90919508da4d7d16bb%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0
> %7C637907496897306313%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLj
> AwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7
> C%7C&amp;sdata=s3FVLiwJneQlQPV1KKj4cPJ2jD%2FtKudkqP4wd0LACgI%3D
> &amp;reserved=0
>   Analyzing 9 messages in the thread
>   Checking attestation on all messages, may take a moment...
>   ---
>     [PATCH v10 1/7] PCI: imx6: Encapsulate the clock enable into one
> standalone function
>     [PATCH v10 2/7] PCI: imx6: Add the error propagation from host_init
>     [PATCH v10 3/7] PCI: imx6: Move imx6_pcie_clk_disable() earlier
>     [PATCH v10 4/7] PCI: imx6: Disable iMX6QDL PCIe REF clock when disable
> PCIe clocks
>     [PATCH v10 5/7] PCI: imx6: Turn off regulator when the system is in
> suspend mode
>     [PATCH v10 6/7] PCI: imx6: Mark the link down as none fatal error
>     [PATCH v10 7/7] PCI: imx6: Do not hide phy driver callbacks and refine the
> error handling
>   ---
>   Total patches: 7
>   ---
>   Cover:
> m/v10_20220613_hongxing_zhu_pci_imx6_refine_codes_and_add_the_error_
> propagation.cover
>    Link:
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.ker
> nel.org%2Fr%2F1655110538-10914-1-git-send-email-hongxing.zhu%40nxp.co
> m&amp;data=05%7C01%7Chongxing.zhu%40nxp.com%7C5c2dbbe817b94f90
> 919508da4d7d16bb%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7
> C637907496897306313%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAw
> MDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%
> 7C&amp;sdata=bCMhbBxRNV8D0lnVBxURUFRbtMNADUxZJq4wZz47rKY%3D&
> amp;reserved=0
>    Base: not specified
> 	 git am
> m/v10_20220613_hongxing_zhu_pci_imx6_refine_codes_and_add_the_error_
> propagation.mbx
>   03:38:27 ~/linux (wip/richard-imx6-power-v10)$ git am
> m/v10_20220613_hongxing_zhu_pci_imx6_refine_codes_and_add_the_error_
> propagation.mbx
>   Applying: PCI: imx6: Encapsulate the clock enable into one standalone
> function
>   error: patch failed: drivers/pci/controller/dwc/pci-imx6.c:539
>   error: drivers/pci/controller/dwc/pci-imx6.c: patch does not apply
>   Patch failed at 0001 PCI: imx6: Encapsulate the clock enable into one
> standalone function
>   hint: Use 'git am --show-current-patch' to see the failed patch
>   When you have resolved this problem, run "git am --continue".
>   If you prefer to skip this patch, run "git am --skip" instead.
>   To restore the original branch and stop patching, run "git am --abort".