All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] PCI: dwc: Adjust Kconfig to allow IMX6 PCIe host on IMX7
@ 2017-10-17  0:11 ` Trent Piepho
  0 siblings, 0 replies; 10+ messages in thread
From: Trent Piepho @ 2017-10-17  0:11 UTC (permalink / raw)
  To: linux-arm-kernel, linux-pci
  Cc: Andrey Smirnov, Lucas Stach, Richard Zhu, Trent Piepho

The IMX6 PCI-e host driver also supports the IMX7d.  However, the
Kconfig dependencies of the driver prevented it from being enabled
unless the kernel was built with both IMX6 and IMX7 support.  It works
fine to build with only IMX7 support enabled.

Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Richard Zhu <hongxing.zhu@nxp.com>
CC: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Trent Piepho <tpiepho@impinj.com>
---
 drivers/pci/dwc/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/dwc/Kconfig b/drivers/pci/dwc/Kconfig
index 22ec82fcdea2..85cf392921a9 100644
--- a/drivers/pci/dwc/Kconfig
+++ b/drivers/pci/dwc/Kconfig
@@ -71,9 +71,9 @@ config PCI_EXYNOS
 	select PCIE_DW_HOST
 
 config PCI_IMX6
-	bool "Freescale i.MX6 PCIe controller"
+	bool "Freescale i.MX6/7 PCIe controller"
 	depends on PCI
-	depends on SOC_IMX6Q
+	depends on SOC_IMX6Q || SOC_IMX7D
 	depends on PCI_MSI_IRQ_DOMAIN
 	select PCIEPORTBUS
 	select PCIE_DW_HOST
-- 
2.13.6


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 1/2] PCI: dwc: Adjust Kconfig to allow IMX6 PCIe host on IMX7
@ 2017-10-17  0:11 ` Trent Piepho
  0 siblings, 0 replies; 10+ messages in thread
From: Trent Piepho @ 2017-10-17  0:11 UTC (permalink / raw)
  To: linux-arm-kernel

The IMX6 PCI-e host driver also supports the IMX7d.  However, the
Kconfig dependencies of the driver prevented it from being enabled
unless the kernel was built with both IMX6 and IMX7 support.  It works
fine to build with only IMX7 support enabled.

Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Richard Zhu <hongxing.zhu@nxp.com>
CC: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Trent Piepho <tpiepho@impinj.com>
---
 drivers/pci/dwc/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/dwc/Kconfig b/drivers/pci/dwc/Kconfig
index 22ec82fcdea2..85cf392921a9 100644
--- a/drivers/pci/dwc/Kconfig
+++ b/drivers/pci/dwc/Kconfig
@@ -71,9 +71,9 @@ config PCI_EXYNOS
 	select PCIE_DW_HOST
 
 config PCI_IMX6
-	bool "Freescale i.MX6 PCIe controller"
+	bool "Freescale i.MX6/7 PCIe controller"
 	depends on PCI
-	depends on SOC_IMX6Q
+	depends on SOC_IMX6Q || SOC_IMX7D
 	depends on PCI_MSI_IRQ_DOMAIN
 	select PCIEPORTBUS
 	select PCIE_DW_HOST
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] PCI: imx6: Check for link training status in link up check
  2017-10-17  0:11 ` Trent Piepho
@ 2017-10-17  0:11   ` Trent Piepho
  -1 siblings, 0 replies; 10+ messages in thread
From: Trent Piepho @ 2017-10-17  0:11 UTC (permalink / raw)
  To: linux-arm-kernel, linux-pci
  Cc: Bjorn Helgaas, Joao Pinto, Lucas Stach, Trent Piepho

This fixes a regression introduced in merge 562df5c8521e.

Prior to this the link up check done by imx6_pcie_wait_for_link()
consisted of a polling loop on imx6_pcie_link_up() (via the former
calling dw_pcie_link_up() which called the latter as callback), and
imx6_pcie_link_up() polled the link status register checking for link
up *and link not still training*.

This was a polling loop inside another polling loop.  And the outermost
loop was duplicated with minor variations in a number of other dwc based
host drivers.

This was addressed in two commits.  Commit 4d107d3b5a68 ("PCI: imx6: Move
link up check into imx6_pcie_wait_for_link()"), changed
imx6_pcie_wait_for_link() to poll the link status register directly,
checking for link up and not training, and made imx6_pcie_link_up() only
check the link up bit (once, not a polling loop).

While commit commit 886bc5ceb5cc ("PCI: designware: Add generic
dw_pcie_wait_for_link()"), replaced the loop in imx6_pcie_wait_for_link()
with a call to a new dwc core function, which polled imx6_pcie_link_up(),
which still checked both link up and not training in a loop.

When these two commits were merged, the version of
imx6_pcie_wait_for_link() from '886 was kept, which eliminated the link
training check placed there by '4d1.  But the version of
imx6_pcie_link_up() from '4d1 was kept, which eliminated the link training
check that had been there and was moved to imx6_pcie_wait_for_link().

There result is no link training check.

Then commit dac29e6c5460 ("PCI: designware: Add default link up check if
sub-driver doesn't override") added a link training check to the default
version of dw_pcie_link_up(), but since imx6 uses imx6_pcie_link_up() it
does not use the default version with this fix.

This commit eliminates imx6_pcie_link_up() so that the default
dw_pcie_link_up() is used.  The default has the correct code and is what
the imx6 driver used to do.

Fixes: 562df5c8521e1371f3cbd0b7b868034da376d714
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Joao Pinto <Joao.Pinto@synopsys.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Trent Piepho <tpiepho@impinj.com>
---
 drivers/pci/dwc/pci-imx6.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/pci/dwc/pci-imx6.c b/drivers/pci/dwc/pci-imx6.c
index b73483534a5b..1f1069b70e45 100644
--- a/drivers/pci/dwc/pci-imx6.c
+++ b/drivers/pci/dwc/pci-imx6.c
@@ -83,8 +83,6 @@ struct imx6_pcie {
 #define PCIE_PL_PFLR_FORCE_LINK			(1 << 15)
 #define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28)
 #define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c)
-#define PCIE_PHY_DEBUG_R1_XMLH_LINK_IN_TRAINING	(1 << 29)
-#define PCIE_PHY_DEBUG_R1_XMLH_LINK_UP		(1 << 4)
 
 #define PCIE_PHY_CTRL (PL_OFFSET + 0x114)
 #define PCIE_PHY_CTRL_DATA_LOC 0
@@ -653,12 +651,6 @@ static int imx6_pcie_host_init(struct pcie_port *pp)
 	return 0;
 }
 
-static int imx6_pcie_link_up(struct dw_pcie *pci)
-{
-	return dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R1) &
-			PCIE_PHY_DEBUG_R1_XMLH_LINK_UP;
-}
-
 static const struct dw_pcie_host_ops imx6_pcie_host_ops = {
 	.host_init = imx6_pcie_host_init,
 };
@@ -701,7 +693,7 @@ static int imx6_add_pcie_port(struct imx6_pcie *imx6_pcie,
 }
 
 static const struct dw_pcie_ops dw_pcie_ops = {
-	.link_up = imx6_pcie_link_up,
+	/* No special ops needed, but pcie-designware still expects this struct */
 };
 
 static int imx6_pcie_probe(struct platform_device *pdev)
-- 
2.13.6


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] PCI: imx6: Check for link training status in link up check
@ 2017-10-17  0:11   ` Trent Piepho
  0 siblings, 0 replies; 10+ messages in thread
From: Trent Piepho @ 2017-10-17  0:11 UTC (permalink / raw)
  To: linux-arm-kernel

This fixes a regression introduced in merge 562df5c8521e.

Prior to this the link up check done by imx6_pcie_wait_for_link()
consisted of a polling loop on imx6_pcie_link_up() (via the former
calling dw_pcie_link_up() which called the latter as callback), and
imx6_pcie_link_up() polled the link status register checking for link
up *and link not still training*.

This was a polling loop inside another polling loop.  And the outermost
loop was duplicated with minor variations in a number of other dwc based
host drivers.

This was addressed in two commits.  Commit 4d107d3b5a68 ("PCI: imx6: Move
link up check into imx6_pcie_wait_for_link()"), changed
imx6_pcie_wait_for_link() to poll the link status register directly,
checking for link up and not training, and made imx6_pcie_link_up() only
check the link up bit (once, not a polling loop).

While commit commit 886bc5ceb5cc ("PCI: designware: Add generic
dw_pcie_wait_for_link()"), replaced the loop in imx6_pcie_wait_for_link()
with a call to a new dwc core function, which polled imx6_pcie_link_up(),
which still checked both link up and not training in a loop.

When these two commits were merged, the version of
imx6_pcie_wait_for_link() from '886 was kept, which eliminated the link
training check placed there by '4d1.  But the version of
imx6_pcie_link_up() from '4d1 was kept, which eliminated the link training
check that had been there and was moved to imx6_pcie_wait_for_link().

There result is no link training check.

Then commit dac29e6c5460 ("PCI: designware: Add default link up check if
sub-driver doesn't override") added a link training check to the default
version of dw_pcie_link_up(), but since imx6 uses imx6_pcie_link_up() it
does not use the default version with this fix.

This commit eliminates imx6_pcie_link_up() so that the default
dw_pcie_link_up() is used.  The default has the correct code and is what
the imx6 driver used to do.

Fixes: 562df5c8521e1371f3cbd0b7b868034da376d714
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Joao Pinto <Joao.Pinto@synopsys.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Trent Piepho <tpiepho@impinj.com>
---
 drivers/pci/dwc/pci-imx6.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/pci/dwc/pci-imx6.c b/drivers/pci/dwc/pci-imx6.c
index b73483534a5b..1f1069b70e45 100644
--- a/drivers/pci/dwc/pci-imx6.c
+++ b/drivers/pci/dwc/pci-imx6.c
@@ -83,8 +83,6 @@ struct imx6_pcie {
 #define PCIE_PL_PFLR_FORCE_LINK			(1 << 15)
 #define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28)
 #define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c)
-#define PCIE_PHY_DEBUG_R1_XMLH_LINK_IN_TRAINING	(1 << 29)
-#define PCIE_PHY_DEBUG_R1_XMLH_LINK_UP		(1 << 4)
 
 #define PCIE_PHY_CTRL (PL_OFFSET + 0x114)
 #define PCIE_PHY_CTRL_DATA_LOC 0
@@ -653,12 +651,6 @@ static int imx6_pcie_host_init(struct pcie_port *pp)
 	return 0;
 }
 
-static int imx6_pcie_link_up(struct dw_pcie *pci)
-{
-	return dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R1) &
-			PCIE_PHY_DEBUG_R1_XMLH_LINK_UP;
-}
-
 static const struct dw_pcie_host_ops imx6_pcie_host_ops = {
 	.host_init = imx6_pcie_host_init,
 };
@@ -701,7 +693,7 @@ static int imx6_add_pcie_port(struct imx6_pcie *imx6_pcie,
 }
 
 static const struct dw_pcie_ops dw_pcie_ops = {
-	.link_up = imx6_pcie_link_up,
+	/* No special ops needed, but pcie-designware still expects this struct */
 };
 
 static int imx6_pcie_probe(struct platform_device *pdev)
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] PCI: dwc: Adjust Kconfig to allow IMX6 PCIe host on IMX7
  2017-10-17  0:11 ` Trent Piepho
@ 2017-10-17  8:35   ` Lucas Stach
  -1 siblings, 0 replies; 10+ messages in thread
From: Lucas Stach @ 2017-10-17  8:35 UTC (permalink / raw)
  To: Trent Piepho, linux-arm-kernel, linux-pci; +Cc: Andrey Smirnov, Richard Zhu

QW0gTW9udGFnLCBkZW4gMTYuMTAuMjAxNywgMTc6MTEgLTA3MDAgc2NocmllYiBUcmVudCBQaWVw
aG86Cj4gVGhlIElNWDYgUENJLWUgaG9zdCBkcml2ZXIgYWxzbyBzdXBwb3J0cyB0aGUgSU1YN2Qu
wqDCoEhvd2V2ZXIsIHRoZQo+IEtjb25maWcgZGVwZW5kZW5jaWVzIG9mIHRoZSBkcml2ZXIgcHJl
dmVudGVkIGl0IGZyb20gYmVpbmcgZW5hYmxlZAo+IHVubGVzcyB0aGUga2VybmVsIHdhcyBidWls
dCB3aXRoIGJvdGggSU1YNiBhbmQgSU1YNyBzdXBwb3J0LsKgwqBJdAo+IHdvcmtzCj4gZmluZSB0
byBidWlsZCB3aXRoIG9ubHkgSU1YNyBzdXBwb3J0IGVuYWJsZWQuCj4gCj4gQ2M6IEFuZHJleS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QUlOCj4gwqAJc2VsZWN0IFBD
SUVQT1JUQlVTCj4gwqAJc2VsZWN0IFBDSUVfRFdfSE9TVAoKX19fX19fX19fX19fX19fX19fX19f
X19fX19fX19fX19fX19fX19fX19fX19fX18KbGludXgtYXJtLWtlcm5lbCBtYWlsaW5nIGxpc3QK
bGludXgtYXJtLWtlcm5lbEBsaXN0cy5pbmZyYWRlYWQub3JnCmh0dHA6Ly9saXN0cy5pbmZyYWRl
YWQub3JnL21haWxtYW4vbGlzdGluZm8vbGludXgtYXJtLWtlcm5lbAo=

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/2] PCI: dwc: Adjust Kconfig to allow IMX6 PCIe host on IMX7
@ 2017-10-17  8:35   ` Lucas Stach
  0 siblings, 0 replies; 10+ messages in thread
From: Lucas Stach @ 2017-10-17  8:35 UTC (permalink / raw)
  To: linux-arm-kernel

Am Montag, den 16.10.2017, 17:11 -0700 schrieb Trent Piepho:
> The IMX6 PCI-e host driver also supports the IMX7d.??However, the
> Kconfig dependencies of the driver prevented it from being enabled
> unless the kernel was built with both IMX6 and IMX7 support.??It
> works
> fine to build with only IMX7 support enabled.
> 
> Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
> Cc: Richard Zhu <hongxing.zhu@nxp.com>
> CC: Lucas Stach <l.stach@pengutronix.de>
> Signed-off-by: Trent Piepho <tpiepho@impinj.com>

Reviewed-by: Lucas Stach <l.stach@pengutronix.de>

> ---
> ?drivers/pci/dwc/Kconfig | 4 ++--
> ?1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/dwc/Kconfig b/drivers/pci/dwc/Kconfig
> index 22ec82fcdea2..85cf392921a9 100644
> --- a/drivers/pci/dwc/Kconfig
> +++ b/drivers/pci/dwc/Kconfig
> @@ -71,9 +71,9 @@ config PCI_EXYNOS
> ?	select PCIE_DW_HOST
> ?
> ?config PCI_IMX6
> -	bool "Freescale i.MX6 PCIe controller"
> +	bool "Freescale i.MX6/7 PCIe controller"
> ?	depends on PCI
> -	depends on SOC_IMX6Q
> +	depends on SOC_IMX6Q || SOC_IMX7D
> ?	depends on PCI_MSI_IRQ_DOMAIN
> ?	select PCIEPORTBUS
> ?	select PCIE_DW_HOST

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] PCI: imx6: Check for link training status in link up check
  2017-10-17  0:11   ` Trent Piepho
@ 2017-10-17  8:44     ` Lucas Stach
  -1 siblings, 0 replies; 10+ messages in thread
From: Lucas Stach @ 2017-10-17  8:44 UTC (permalink / raw)
  To: Trent Piepho, linux-arm-kernel, linux-pci; +Cc: Bjorn Helgaas, Joao Pinto

QW0gTW9udGFnLCBkZW4gMTYuMTAuMjAxNywgMTc6MTEgLTA3MDAgc2NocmllYiBUcmVudCBQaWVw
aG86Cj4gVGhpcyBmaXhlcyBhIHJlZ3Jlc3Npb24gaW50cm9kdWNlZCBpbiBtZXJnZSA1NjJkZjVj
ODUyMWUuCj4gCj4gUHJpb3IgdG8gdGhpcyB0aGUgbGluayB1cCBjaGVjayBkb25lIGJ5IGlteDZf
cGNpZV93YWl0X2Zvcl9saW5rKCkKPiBjb25zaXN0ZWQgb2YgYSBwb2xsaW5nIGxvb3Agb24gaW14
Nl9wY2llX2xpbmtfdXAoKSAodmlhIHRoZSBmb3JtZXIKPiBjYWxsaW5nIGR3X3BjaWVfbGlua191
cCgpIHdoaWNoIGNhbGxlZCB0aGUgbGF0dGVyIGFzIGNhbGxiYWNrKSwgYW5kCj4gaW14Nl9wY2ll
X2xpbmtfdXAoKSBwb2xsZWQgdGhlIGxpbmsgc3RhdHVzIHJlZ2lzdGVyIGNoZWNraW5nIGZvciBs
aW5rCj4gdXAgKmFuZCBsaW5rIG5vdCBzdGlsbCB0cmFpbmluZyouCj4gCj4gVGhpcyB3YXMgYSBw
b2xsaW5nIGxvb3AgaW5zaWRlIGFub3RoZXIgcG9sbGluZyBsb29wLsKgwqBBbmQgdGhlIG91dGVy
bW9zdAo+IGxvb3Agd2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BjaWUsCj4g
wqB9Cj4gwqAKPiDCoHN0YXRpYyBjb25zdCBzdHJ1Y3QgZHdfcGNpZV9vcHMgZHdfcGNpZV9vcHMg
PSB7Cj4gPiAtCS5saW5rX3VwID0gaW14Nl9wY2llX2xpbmtfdXAsCj4gPiArCS8qIE5vIHNwZWNp
YWwgb3BzIG5lZWRlZCwgYnV0IHBjaWUtZGVzaWdud2FyZSBzdGlsbCBleHBlY3RzIHRoaXMgc3Ry
dWN0ICovCj4gwqB9Owo+IMKgCj4gwqBzdGF0aWMgaW50IGlteDZfcGNpZV9wcm9iZShzdHJ1Y3Qg
cGxhdGZvcm1fZGV2aWNlICpwZGV2KQoKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f
X19fX19fX19fX19fX18KbGludXgtYXJtLWtlcm5lbCBtYWlsaW5nIGxpc3QKbGludXgtYXJtLWtl
cm5lbEBsaXN0cy5pbmZyYWRlYWQub3JnCmh0dHA6Ly9saXN0cy5pbmZyYWRlYWQub3JnL21haWxt
YW4vbGlzdGluZm8vbGludXgtYXJtLWtlcm5lbAo=

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 2/2] PCI: imx6: Check for link training status in link up check
@ 2017-10-17  8:44     ` Lucas Stach
  0 siblings, 0 replies; 10+ messages in thread
From: Lucas Stach @ 2017-10-17  8:44 UTC (permalink / raw)
  To: linux-arm-kernel

Am Montag, den 16.10.2017, 17:11 -0700 schrieb Trent Piepho:
> This fixes a regression introduced in merge 562df5c8521e.
> 
> Prior to this the link up check done by imx6_pcie_wait_for_link()
> consisted of a polling loop on imx6_pcie_link_up() (via the former
> calling dw_pcie_link_up() which called the latter as callback), and
> imx6_pcie_link_up() polled the link status register checking for link
> up *and link not still training*.
> 
> This was a polling loop inside another polling loop.??And the outermost
> loop was duplicated with minor variations in a number of other dwc based
> host drivers.
> 
> This was addressed in two commits.??Commit 4d107d3b5a68 ("PCI: imx6: Move
> link up check into imx6_pcie_wait_for_link()"), changed
> imx6_pcie_wait_for_link() to poll the link status register directly,
> checking for link up and not training, and made imx6_pcie_link_up() only
> check the link up bit (once, not a polling loop).
> 
> While commit commit 886bc5ceb5cc ("PCI: designware: Add generic
> dw_pcie_wait_for_link()"), replaced the loop in imx6_pcie_wait_for_link()
> with a call to a new dwc core function, which polled imx6_pcie_link_up(),
> which still checked both link up and not training in a loop.
> 
> When these two commits were merged, the version of
> imx6_pcie_wait_for_link() from '886 was kept, which eliminated the link
> training check placed there by '4d1.??But the version of
> imx6_pcie_link_up() from '4d1 was kept, which eliminated the link training
> check that had been there and was moved to imx6_pcie_wait_for_link().
> 
> There result is no link training check.
> 
> Then commit dac29e6c5460 ("PCI: designware: Add default link up check if
> sub-driver doesn't override")

I think you meant 01c076732e82 (PCI: designware: Check LTSSM training
bit before deciding link is up) here.

>  added a link training check to the default
> version of dw_pcie_link_up(), but since imx6 uses imx6_pcie_link_up() it
> does not use the default version with this fix.
> 
> This commit eliminates imx6_pcie_link_up() so that the default
> dw_pcie_link_up() is used.??The default has the correct code and is what
> the imx6 driver used to do.
> 
> Fixes: 562df5c8521e1371f3cbd0b7b868034da376d714
> > Cc: Bjorn Helgaas <bhelgaas@google.com>
> > Cc: Joao Pinto <Joao.Pinto@synopsys.com>
> > Cc: Lucas Stach <l.stach@pengutronix.de>
> Signed-off-by: Trent Piepho <tpiepho@impinj.com>

With the commit message fixed:

Reviewed-by: Lucas Stach <l.stach@pengutronix.de>

> ---
> ?drivers/pci/dwc/pci-imx6.c | 10 +---------
> ?1 file changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/drivers/pci/dwc/pci-imx6.c b/drivers/pci/dwc/pci-imx6.c
> index b73483534a5b..1f1069b70e45 100644
> --- a/drivers/pci/dwc/pci-imx6.c
> +++ b/drivers/pci/dwc/pci-imx6.c
> @@ -83,8 +83,6 @@ struct imx6_pcie {
> > ?#define PCIE_PL_PFLR_FORCE_LINK			(1 << 15)
> ?#define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28)
> ?#define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c)
> > -#define PCIE_PHY_DEBUG_R1_XMLH_LINK_IN_TRAINING	(1 << 29)
> > -#define PCIE_PHY_DEBUG_R1_XMLH_LINK_UP		(1 << 4)
> ?
> ?#define PCIE_PHY_CTRL (PL_OFFSET + 0x114)
> ?#define PCIE_PHY_CTRL_DATA_LOC 0
> @@ -653,12 +651,6 @@ static int imx6_pcie_host_init(struct pcie_port *pp)
> > ?	return 0;
> ?}
> ?
> -static int imx6_pcie_link_up(struct dw_pcie *pci)
> -{
> > -	return dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R1) &
> > -			PCIE_PHY_DEBUG_R1_XMLH_LINK_UP;
> -}
> -
> ?static const struct dw_pcie_host_ops imx6_pcie_host_ops = {
> > ?	.host_init = imx6_pcie_host_init,
> ?};
> @@ -701,7 +693,7 @@ static int imx6_add_pcie_port(struct imx6_pcie *imx6_pcie,
> ?}
> ?
> ?static const struct dw_pcie_ops dw_pcie_ops = {
> > -	.link_up = imx6_pcie_link_up,
> > +	/* No special ops needed, but pcie-designware still expects this struct */
> ?};
> ?
> ?static int imx6_pcie_probe(struct platform_device *pdev)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] PCI: imx6: Check for link training status in link up check
  2017-10-17  8:44     ` Lucas Stach
@ 2017-10-17 17:37       ` Trent Piepho
  -1 siblings, 0 replies; 10+ messages in thread
From: Trent Piepho @ 2017-10-17 17:37 UTC (permalink / raw)
  To: l.stach, linux-arm-kernel, linux-pci; +Cc: bhelgaas, Joao.Pinto

On Tue, 2017-10-17 at 10:44 +0200, Lucas Stach wrote:
> Am Montag, den 16.10.2017, 17:11 -0700 schrieb Trent Piepho:
> > 
> > 
> > There result is no link training check.
> > 
> > Then commit dac29e6c5460 ("PCI: designware: Add default link up check if
> > sub-driver doesn't override")
> 
> I think you meant 01c076732e82 (PCI: designware: Check LTSSM training
> bit before deciding link is up) here.
> 
> >  added a link training check to the default
> > version of dw_pcie_link_up(), but since imx6 uses imx6_pcie_link_up() it
> > does not use the default version with this fix.

It was really the combination of both commits.  'dac added the common
link up check, which imx6 didn't use, and then '01c added the training
check to it.  It appears I've attributed both changes to 'dac in my
message and forgot '01c.  I'll fix.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 2/2] PCI: imx6: Check for link training status in link up check
@ 2017-10-17 17:37       ` Trent Piepho
  0 siblings, 0 replies; 10+ messages in thread
From: Trent Piepho @ 2017-10-17 17:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 2017-10-17 at 10:44 +0200, Lucas Stach wrote:
> Am Montag, den 16.10.2017, 17:11 -0700 schrieb Trent Piepho:
> > 
> > 
> > There result is no link training check.
> > 
> > Then commit dac29e6c5460 ("PCI: designware: Add default link up check if
> > sub-driver doesn't override")
> 
> I think you meant 01c076732e82 (PCI: designware: Check LTSSM training
> bit before deciding link is up) here.
> 
> >  added a link training check to the default
> > version of dw_pcie_link_up(), but since imx6 uses imx6_pcie_link_up() it
> > does not use the default version with this fix.

It was really the combination of both commits.  'dac added the common
link up check, which imx6 didn't use, and then '01c added the training
check to it.  It appears I've attributed both changes to 'dac in my
message and forgot '01c.  I'll fix.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-10-17 17:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-17  0:11 [PATCH 1/2] PCI: dwc: Adjust Kconfig to allow IMX6 PCIe host on IMX7 Trent Piepho
2017-10-17  0:11 ` Trent Piepho
2017-10-17  0:11 ` [PATCH 2/2] PCI: imx6: Check for link training status in link up check Trent Piepho
2017-10-17  0:11   ` Trent Piepho
2017-10-17  8:44   ` Lucas Stach
2017-10-17  8:44     ` Lucas Stach
2017-10-17 17:37     ` Trent Piepho
2017-10-17 17:37       ` Trent Piepho
2017-10-17  8:35 ` [PATCH 1/2] PCI: dwc: Adjust Kconfig to allow IMX6 PCIe host on IMX7 Lucas Stach
2017-10-17  8:35   ` Lucas Stach

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.