Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1600588 > unrolled thread

[PATCH v6 0/4] i.MX7 PCI support

Started byAndrey Smirnov <andrew.smirnov@gmail.com>
First post2017-03-14 16:20 +0100
Last post2017-03-20 18:30 +0100
Articles 5 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v6 0/4] i.MX7 PCI support Andrey Smirnov <andrew.smirnov@gmail.com> - 2017-03-14 16:20 +0100
    [PATCH v6 3/4] PCI: imx6: Do not switch speed if Gen2 is disabled Andrey Smirnov <andrew.smirnov@gmail.com> - 2017-03-14 16:20 +0100
    [PATCH v6 2/4] PCI: imx6: Do not wait for speed change on i.MX7 Andrey Smirnov <andrew.smirnov@gmail.com> - 2017-03-14 16:20 +0100
    Re: [PATCH v6 0/4] i.MX7 PCI support Dong Aisheng <dongas86@gmail.com> - 2017-03-19 16:20 +0100
      Re: [PATCH v6 0/4] i.MX7 PCI support Andrey Smirnov <andrew.smirnov@gmail.com> - 2017-03-20 18:30 +0100

#1600588 — [PATCH v6 0/4] i.MX7 PCI support

FromAndrey Smirnov <andrew.smirnov@gmail.com>
Date2017-03-14 16:20 +0100
Subject[PATCH v6 0/4] i.MX7 PCI support
Message-ID<tkWoW-1WG-31@gated-at.bofh.it>
Hello, everyone:

This is a sixth iteration of the code that adds PCI-subsystem bits
necessary for enabling PCI support on i.MX7.

Chagnes since v5:

	- Collected ACKs from Lee and Rob

Changes since v4 (can be found at [version4]):

	- Dropped typo-fix patch (originally patch #1 of the
          series). Bjorn, I am assuming that patch from v4 survived
          and stayed in your tree, let me know if that is not true.

	- Added patch with workaround to address speed change false
          failures (I kept it as a separate patch to better document
          exchange with NXP/Freescale that lead to that patch)

	- Added patch to avoid speed change on links configured Gen1
          only (Let me know if that is a terrible idea)

	- Addressed section mismatch problem by moving call to
          hook_fault_code to happend before driver registration.

Changes since v3 (can be found at [version3]):
	- Move all of the reset_control_assert's into imx6_pcie_assert_core_reset
	- Documented required reset and power domain DT bindings

Changes since v2 (can be found at [version2]):

	- Collected Reviewed-by for patch #2 from Lucas
	- Reset logic implementation moved out into a reset controller
          driver (see [reset1])
	- Removed unused leftover code

Changes since v1 (can be found at [version1]):

	- All GPC related code moved into a separate driver (see [gpc1])
	- Removed GPIO probe deferral logging
	- Fixed section mismatch warning
	- Minor reformatting of fsl,imx6q-pcie.txt(as per Rob
          Herring's request)

[version5] https://lkml.org/lkml/2017/2/20/376
[version4] https://lkml.org/lkml/2017/2/7/478
[version3] https://lkml.org/lkml/2017/2/6/565
[version2] https://lkml.org/lkml/2017/2/1/510
[version1] https://lkml.org/lkml/2017/1/19/488
[gpc1] https://lkml.org/lkml/2017/2/6/551
[reset1] https://lkml.org/lkml/2017/2/6/554

Andrey Smirnov (4):
  PCI: imx6: Add code to support i.MX7D
  PCI: imx6: Do not wait for speed change on i.MX7
  PCI: imx6: Do not switch speed if Gen2 is disabled
  PCI: imx6: Allow probe deferal by reset GPIO

 .../devicetree/bindings/pci/fsl,imx6q-pcie.txt     |  13 +-
 drivers/pci/host/pci-imx6.c                        | 199 +++++++++++++++------
 include/linux/mfd/syscon/imx7-iomuxc-gpr.h         |   4 +
 3 files changed, 161 insertions(+), 55 deletions(-)

-- 
2.9.3

[toc] | [next] | [standalone]


#1600589 — [PATCH v6 3/4] PCI: imx6: Do not switch speed if Gen2 is disabled

FromAndrey Smirnov <andrew.smirnov@gmail.com>
Date2017-03-14 16:20 +0100
Subject[PATCH v6 3/4] PCI: imx6: Do not switch speed if Gen2 is disabled
Message-ID<tkWoX-1WG-45@gated-at.bofh.it>
In reply to#1600588
Save a bit of time and avoid going through link speed change procedure
in configuration where link max speed is limited to Gen1 in DT.

Cc: yurovsky@gmail.com
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/pci/host/pci-imx6.c | 52 ++++++++++++++++++++++-----------------------
 1 file changed, 26 insertions(+), 26 deletions(-)

diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c
index 473bbdc..071251f3 100644
--- a/drivers/pci/host/pci-imx6.c
+++ b/drivers/pci/host/pci-imx6.c
@@ -565,40 +565,40 @@ static int imx6_pcie_establish_link(struct imx6_pcie *imx6_pcie)
 		tmp &= ~PCIE_RC_LCR_MAX_LINK_SPEEDS_MASK;
 		tmp |= PCIE_RC_LCR_MAX_LINK_SPEEDS_GEN2;
 		dw_pcie_writel_rc(pp, PCIE_RC_LCR, tmp);
-	} else {
-		dev_info(dev, "Link: Gen2 disabled\n");
-	}
-
-	/*
-	 * Start Directed Speed Change so the best possible speed both link
-	 * partners support can be negotiated.
-	 */
-	tmp = dw_pcie_readl_rc(pp, PCIE_LINK_WIDTH_SPEED_CONTROL);
-	tmp |= PORT_LOGIC_SPEED_CHANGE;
-	dw_pcie_writel_rc(pp, PCIE_LINK_WIDTH_SPEED_CONTROL, tmp);
 
-	if (imx6_pcie->variant != IMX7D) {
 		/*
-		 * On i.MX7, DIRECT_SPEED_CHANGE behaves differently
-		 * from i.MX6 family when no link speed transition
-		 * occurs and we go Gen1 -> yep, Gen1. The difference
-		 * is that, in such case, it will not be cleared by HW
-		 * which will cause the following code to report false
-		 * failure.
+		 * Start Directed Speed Change so the best possible
+		 * speed both link partners support can be negotiated.
 		 */
+		tmp = dw_pcie_readl_rc(pp, PCIE_LINK_WIDTH_SPEED_CONTROL);
+		tmp |= PORT_LOGIC_SPEED_CHANGE;
+		dw_pcie_writel_rc(pp, PCIE_LINK_WIDTH_SPEED_CONTROL, tmp);
+
+		if (imx6_pcie->variant != IMX7D) {
+			/*
+			 * On i.MX7, DIRECT_SPEED_CHANGE behaves differently
+			 * from i.MX6 family when no link speed transition
+			 * occurs and we go Gen1 -> yep, Gen1. The difference
+			 * is that, in such case, it will not be cleared by HW
+			 * which will cause the following code to report false
+			 * failure.
+			 */
+
+			ret = imx6_pcie_wait_for_speed_change(imx6_pcie);
+			if (ret) {
+				dev_err(dev, "Failed to bring link up!\n");
+				goto err_reset_phy;
+			}
+		}
 
-		ret = imx6_pcie_wait_for_speed_change(imx6_pcie);
+		/* Make sure link training is finished as well! */
+		ret = imx6_pcie_wait_for_link(imx6_pcie);
 		if (ret) {
 			dev_err(dev, "Failed to bring link up!\n");
 			goto err_reset_phy;
 		}
-	}
-
-	/* Make sure link training is finished as well! */
-	ret = imx6_pcie_wait_for_link(imx6_pcie);
-	if (ret) {
-		dev_err(dev, "Failed to bring link up!\n");
-		goto err_reset_phy;
+	} else {
+		dev_info(dev, "Link: Gen2 disabled\n");
 	}
 
 	tmp = dw_pcie_readl_rc(pp, PCIE_RC_LCSR);
-- 
2.9.3

[toc] | [prev] | [next] | [standalone]


#1600590 — [PATCH v6 2/4] PCI: imx6: Do not wait for speed change on i.MX7

FromAndrey Smirnov <andrew.smirnov@gmail.com>
Date2017-03-14 16:20 +0100
Subject[PATCH v6 2/4] PCI: imx6: Do not wait for speed change on i.MX7
Message-ID<tkWoW-1WG-39@gated-at.bofh.it>
In reply to#1600588
As can be seen from [1]:

"...the different behavior between iMX6Q PCIe and iMX7D PCIe maybe
caused by the different controller version.

Regarding to the DOC description, the DIRECT_SPEED_CHANGE should be
cleared after the speed change from GEN1 to GEN2. Unfortunately, when
GEN1 device is used, the behavior is not documented.

So, IC design guys run the simulation and
find out the following behaviors:

     1. DIRECT_SPEED_CHANGE will be cleared in 7D after speed change
     	from GEN1 to GEN2. This matches doc’s description

     2. set MAX link speed(PCIE_CAP_TARGET_LINK_SPEED=0x01) as GEN1 and
     	re-run the simulation, DIRECT_SPEED_CHANGE will not be cleared;
     	remain as 1, this matches your result, but function test is
     	passed, so this bit should not affect the normal PCIe function.
..."

imx6_pcie_wait_for_speed_change will report false failures for Gen1 ->
Gen1 speed transition, so avoid doing that check and just rely on
imx6_pcie_wait_for_link only.

[1] https://community.nxp.com/message/867943

Cc: yurovsky@gmail.com
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/pci/host/pci-imx6.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c
index 2f3f375..473bbdc 100644
--- a/drivers/pci/host/pci-imx6.c
+++ b/drivers/pci/host/pci-imx6.c
@@ -577,10 +577,21 @@ static int imx6_pcie_establish_link(struct imx6_pcie *imx6_pcie)
 	tmp |= PORT_LOGIC_SPEED_CHANGE;
 	dw_pcie_writel_rc(pp, PCIE_LINK_WIDTH_SPEED_CONTROL, tmp);
 
-	ret = imx6_pcie_wait_for_speed_change(imx6_pcie);
-	if (ret) {
-		dev_err(dev, "Failed to bring link up!\n");
-		goto err_reset_phy;
+	if (imx6_pcie->variant != IMX7D) {
+		/*
+		 * On i.MX7, DIRECT_SPEED_CHANGE behaves differently
+		 * from i.MX6 family when no link speed transition
+		 * occurs and we go Gen1 -> yep, Gen1. The difference
+		 * is that, in such case, it will not be cleared by HW
+		 * which will cause the following code to report false
+		 * failure.
+		 */
+
+		ret = imx6_pcie_wait_for_speed_change(imx6_pcie);
+		if (ret) {
+			dev_err(dev, "Failed to bring link up!\n");
+			goto err_reset_phy;
+		}
 	}
 
 	/* Make sure link training is finished as well! */
-- 
2.9.3

[toc] | [prev] | [next] | [standalone]


#1604002

FromDong Aisheng <dongas86@gmail.com>
Date2017-03-19 16:20 +0100
Message-ID<tmKMF-7B1-19@gated-at.bofh.it>
In reply to#1600588
On Tue, Mar 14, 2017 at 08:18:23AM -0700, Andrey Smirnov wrote:
> Hello, everyone:
> 
> This is a sixth iteration of the code that adds PCI-subsystem bits
> necessary for enabling PCI support on i.MX7.
> 

....

> Andrey Smirnov (4):
>   PCI: imx6: Add code to support i.MX7D
>   PCI: imx6: Do not wait for speed change on i.MX7
>   PCI: imx6: Do not switch speed if Gen2 is disabled
>   PCI: imx6: Allow probe deferal by reset GPIO
> 
>  .../devicetree/bindings/pci/fsl,imx6q-pcie.txt     |  13 +-
>  drivers/pci/host/pci-imx6.c                        | 199 +++++++++++++++------

Can't apply and test it.

The directory has been changed to drivers/pci/host/dwc/pci-imx6.c
since the commit below:
commit 950bf6388bc22c2749b8b66c501df1462639d6bd
Author: Kishon Vijay Abraham I <kishon@ti.com>
Date:   Fri Jan 6 18:22:48 2017 +0530

    PCI: Move DesignWare IP support to new drivers/pci/dwc/ directory
    
    Group all the PCI drivers that use DesignWare core in dwc directory.
    dwc IP is capable of operating in both host mode and device mode and
    keeping it inside the *host* directory is misleading.
    
    Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Acked-by: Jingoo Han <jingoohan1@gmail.com>
    Acked-By: Joao Pinto <jpinto@synopsys.com>

Regards
Dong Aisheng

>  include/linux/mfd/syscon/imx7-iomuxc-gpr.h         |   4 +
>  3 files changed, 161 insertions(+), 55 deletions(-)
> 


> -- 
> 2.9.3
> 

[toc] | [prev] | [next] | [standalone]


#1604830

FromAndrey Smirnov <andrew.smirnov@gmail.com>
Date2017-03-20 18:30 +0100
Message-ID<tn9i2-7Yx-23@gated-at.bofh.it>
In reply to#1604002
On Mon, Mar 20, 2017 at 12:09 AM, Dong Aisheng <dongas86@gmail.com> wrote:
> On Tue, Mar 14, 2017 at 08:18:23AM -0700, Andrey Smirnov wrote:
>> Hello, everyone:
>>
>> This is a sixth iteration of the code that adds PCI-subsystem bits
>> necessary for enabling PCI support on i.MX7.
>>
>
> ....
>
>> Andrey Smirnov (4):
>>   PCI: imx6: Add code to support i.MX7D
>>   PCI: imx6: Do not wait for speed change on i.MX7
>>   PCI: imx6: Do not switch speed if Gen2 is disabled
>>   PCI: imx6: Allow probe deferal by reset GPIO
>>
>>  .../devicetree/bindings/pci/fsl,imx6q-pcie.txt     |  13 +-
>>  drivers/pci/host/pci-imx6.c                        | 199 +++++++++++++++------
>
> Can't apply and test it.

Sorry about that. I'll rebase the set and submit it as v7.

>
> The directory has been changed to drivers/pci/host/dwc/pci-imx6.c
> since the commit below:
> commit 950bf6388bc22c2749b8b66c501df1462639d6bd
> Author: Kishon Vijay Abraham I <kishon@ti.com>
> Date:   Fri Jan 6 18:22:48 2017 +0530
>
>     PCI: Move DesignWare IP support to new drivers/pci/dwc/ directory
>
>     Group all the PCI drivers that use DesignWare core in dwc directory.
>     dwc IP is capable of operating in both host mode and device mode and
>     keeping it inside the *host* directory is misleading.
>
>     Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>     Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
>     Acked-by: Jingoo Han <jingoohan1@gmail.com>
>     Acked-By: Joao Pinto <jpinto@synopsys.com>
>
> Regards
> Dong Aisheng
>
>>  include/linux/mfd/syscon/imx7-iomuxc-gpr.h         |   4 +
>>  3 files changed, 161 insertions(+), 55 deletions(-)
>>
>
>
>> --
>> 2.9.3
>>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web