2022-07-20 03:53:56

by Richard Zhu

[permalink] [raw]
Subject: [PATCH v2] PCI: imx6: Support more than Gen2 speed link mode

Support more than Gen2 speed link mode, since i.MX8MP PCIe supports up to
Gen3 link speed.

Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Richard Zhu <[email protected]>
Signed-off-by: Bjorn Helgaas <[email protected]>
---
Changes from v1:
- The Supported Link Speeds of the PCI_EXP_LNKCAP should be re-configured too.
- When only Gen1 is enabled, refine the dev_info accordingly.

---
drivers/pci/controller/dwc/pci-imx6.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index e1ba11dabaa8..b66876f7efe0 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -844,12 +844,12 @@ static int imx6_pcie_start_link(struct dw_pcie *pci)
if (ret)
goto err_reset_phy;

- if (pci->link_gen == 2) {
- /* Allow Gen2 mode after the link is up. */
+ if (pci->link_gen > 1) {
+ /* Allow faster modes after the link is up */
dw_pcie_dbi_ro_wr_en(pci);
tmp = dw_pcie_readl_dbi(pci, offset + PCI_EXP_LNKCAP);
tmp &= ~PCI_EXP_LNKCAP_SLS;
- tmp |= PCI_EXP_LNKCAP_SLS_5_0GB;
+ tmp |= pci->link_gen;
dw_pcie_writel_dbi(pci, offset + PCI_EXP_LNKCAP, tmp);

/*
@@ -884,7 +884,7 @@ static int imx6_pcie_start_link(struct dw_pcie *pci)
if (ret)
goto err_reset_phy;
} else {
- dev_info(dev, "Link: Gen2 disabled\n");
+ dev_info(dev, "Link: Only Gen1 is enabled\n");
}

imx6_pcie->link_is_up = true;
--
2.25.1


2022-07-20 22:09:26

by Bjorn Helgaas

[permalink] [raw]
Subject: Re: [PATCH v2] PCI: imx6: Support more than Gen2 speed link mode

On Wed, Jul 20, 2022 at 11:26:16AM +0800, Richard Zhu wrote:
> Support more than Gen2 speed link mode, since i.MX8MP PCIe supports up to
> Gen3 link speed.
>
> Link: https://lore.kernel.org/r/[email protected]
> Signed-off-by: Richard Zhu <[email protected]>
> Signed-off-by: Bjorn Helgaas <[email protected]>

You should not post patches with my signed-off-by.

I add my signed-off-by to patches when I merge them.

I applied this to pci/ctrl/imx6, replacing the v1 patch, thanks!

> ---
> Changes from v1:
> - The Supported Link Speeds of the PCI_EXP_LNKCAP should be re-configured too.
> - When only Gen1 is enabled, refine the dev_info accordingly.
>
> ---
> drivers/pci/controller/dwc/pci-imx6.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
> index e1ba11dabaa8..b66876f7efe0 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
> @@ -844,12 +844,12 @@ static int imx6_pcie_start_link(struct dw_pcie *pci)
> if (ret)
> goto err_reset_phy;
>
> - if (pci->link_gen == 2) {
> - /* Allow Gen2 mode after the link is up. */
> + if (pci->link_gen > 1) {
> + /* Allow faster modes after the link is up */
> dw_pcie_dbi_ro_wr_en(pci);
> tmp = dw_pcie_readl_dbi(pci, offset + PCI_EXP_LNKCAP);
> tmp &= ~PCI_EXP_LNKCAP_SLS;
> - tmp |= PCI_EXP_LNKCAP_SLS_5_0GB;
> + tmp |= pci->link_gen;
> dw_pcie_writel_dbi(pci, offset + PCI_EXP_LNKCAP, tmp);
>
> /*
> @@ -884,7 +884,7 @@ static int imx6_pcie_start_link(struct dw_pcie *pci)
> if (ret)
> goto err_reset_phy;
> } else {
> - dev_info(dev, "Link: Gen2 disabled\n");
> + dev_info(dev, "Link: Only Gen1 is enabled\n");
> }
>
> imx6_pcie->link_is_up = true;
> --
> 2.25.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> [email protected]
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

2022-07-21 06:31:50

by Richard Zhu

[permalink] [raw]
Subject: RE: [PATCH v2] PCI: imx6: Support more than Gen2 speed link mode

> -----Original Message-----
> From: Bjorn Helgaas <[email protected]>
> Sent: 2022??7??21?? 5:16
> To: Hongxing Zhu <[email protected]>
> Cc: [email protected]; [email protected];
> [email protected]; [email protected];
> [email protected]; [email protected];
> [email protected]; [email protected]; dl-linux-imx
> <[email protected]>
> Subject: Re: [PATCH v2] PCI: imx6: Support more than Gen2 speed link mode
>
> On Wed, Jul 20, 2022 at 11:26:16AM +0800, Richard Zhu wrote:
> > Support more than Gen2 speed link mode, since i.MX8MP PCIe supports up
> to
> > Gen3 link speed.
> >
> > Link:
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.ker
> nel.org%2Fr%2F1652866528-13220-2-git-send-email-hongxing.zhu%40nxp.co
> m&amp;data=05%7C01%7Chongxing.zhu%40nxp.com%7Ceb7d668e5b7d469
> 8e62c08da6a9502a8%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%
> 7C637939485477367788%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjA
> wMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C
> %7C&amp;sdata=ruq7cOi7uAOq6qOFtj1OXpi6EVgeNTDFozOHJnZpga8%3D&a
> mp;reserved=0
> > Signed-off-by: Richard Zhu <[email protected]>
> > Signed-off-by: Bjorn Helgaas <[email protected]>
>
> You should not post patches with my signed-off-by.
>
Okay, got that.

> I add my signed-off-by to patches when I merge them.
>
> I applied this to pci/ctrl/imx6, replacing the v1 patch, thanks!
>
Thanks a lot for your kindly help.

Best Regards
Richard Zhu

> > ---
> > Changes from v1:
> > - The Supported Link Speeds of the PCI_EXP_LNKCAP should be re-configured
> too.
> > - When only Gen1 is enabled, refine the dev_info accordingly.
> >
> > ---
> > drivers/pci/controller/dwc/pci-imx6.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/pci/controller/dwc/pci-imx6.c
> b/drivers/pci/controller/dwc/pci-imx6.c
> > index e1ba11dabaa8..b66876f7efe0 100644
> > --- a/drivers/pci/controller/dwc/pci-imx6.c
> > +++ b/drivers/pci/controller/dwc/pci-imx6.c
> > @@ -844,12 +844,12 @@ static int imx6_pcie_start_link(struct dw_pcie
> *pci)
> > if (ret)
> > goto err_reset_phy;
> >
> > - if (pci->link_gen == 2) {
> > - /* Allow Gen2 mode after the link is up. */
> > + if (pci->link_gen > 1) {
> > + /* Allow faster modes after the link is up */
> > dw_pcie_dbi_ro_wr_en(pci);
> > tmp = dw_pcie_readl_dbi(pci, offset + PCI_EXP_LNKCAP);
> > tmp &= ~PCI_EXP_LNKCAP_SLS;
> > - tmp |= PCI_EXP_LNKCAP_SLS_5_0GB;
> > + tmp |= pci->link_gen;
> > dw_pcie_writel_dbi(pci, offset + PCI_EXP_LNKCAP, tmp);
> >
> > /*
> > @@ -884,7 +884,7 @@ static int imx6_pcie_start_link(struct dw_pcie *pci)
> > if (ret)
> > goto err_reset_phy;
> > } else {
> > - dev_info(dev, "Link: Gen2 disabled\n");
> > + dev_info(dev, "Link: Only Gen1 is enabled\n");
> > }
> >
> > imx6_pcie->link_is_up = true;
> > --
> > 2.25.1
> >
> >
> > _______________________________________________
> > linux-arm-kernel mailing list
> > [email protected]
> >
> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.infr
> adead.org%2Fmailman%2Flistinfo%2Flinux-arm-kernel&amp;data=05%7C01%
> 7Chongxing.zhu%40nxp.com%7Ceb7d668e5b7d4698e62c08da6a9502a8%7C
> 686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637939485477367788
> %7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLC
> JBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=KTl6fya0
> lIU%2FtvZOB9v%2BxEgaAhhYo45JZqwp0Cfz7qs%3D&amp;reserved=0