diff options
author | Andrey Smirnov <andrew.smirnov@gmail.com> | 2017-03-28 11:42:52 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2017-04-04 18:58:33 -0400 |
commit | 93b226f9c65a951a91617f87ba1f05f14e59f26f (patch) | |
tree | 6a0a321462cbc3c7fd0a48f8cf921c59042fb812 /drivers/pci/dwc | |
parent | e6dcd87fff69a9d454104b65569074855cf95b1e (diff) |
PCI: imx6: Do not switch speed if Gen2 is disabled
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.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Cc: yurovsky@gmail.com
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Dong Aisheng <dongas86@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org
Diffstat (limited to 'drivers/pci/dwc')
-rw-r--r-- | drivers/pci/dwc/pci-imx6.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/drivers/pci/dwc/pci-imx6.c b/drivers/pci/dwc/pci-imx6.c index 793b008553a0..102edcf1e261 100644 --- a/drivers/pci/dwc/pci-imx6.c +++ b/drivers/pci/dwc/pci-imx6.c | |||
@@ -533,40 +533,40 @@ static int imx6_pcie_establish_link(struct imx6_pcie *imx6_pcie) | |||
533 | tmp &= ~PCIE_RC_LCR_MAX_LINK_SPEEDS_MASK; | 533 | tmp &= ~PCIE_RC_LCR_MAX_LINK_SPEEDS_MASK; |
534 | tmp |= PCIE_RC_LCR_MAX_LINK_SPEEDS_GEN2; | 534 | tmp |= PCIE_RC_LCR_MAX_LINK_SPEEDS_GEN2; |
535 | dw_pcie_writel_dbi(pci, PCIE_RC_LCR, tmp); | 535 | dw_pcie_writel_dbi(pci, PCIE_RC_LCR, tmp); |
536 | } else { | ||
537 | dev_info(dev, "Link: Gen2 disabled\n"); | ||
538 | } | ||
539 | |||
540 | /* | ||
541 | * Start Directed Speed Change so the best possible speed both link | ||
542 | * partners support can be negotiated. | ||
543 | */ | ||
544 | tmp = dw_pcie_readl_dbi(pci, PCIE_LINK_WIDTH_SPEED_CONTROL); | ||
545 | tmp |= PORT_LOGIC_SPEED_CHANGE; | ||
546 | dw_pcie_writel_dbi(pci, PCIE_LINK_WIDTH_SPEED_CONTROL, tmp); | ||
547 | 536 | ||
548 | if (imx6_pcie->variant != IMX7D) { | ||
549 | /* | 537 | /* |
550 | * On i.MX7, DIRECT_SPEED_CHANGE behaves differently | 538 | * Start Directed Speed Change so the best possible |
551 | * from i.MX6 family when no link speed transition | 539 | * speed both link partners support can be negotiated. |
552 | * occurs and we go Gen1 -> yep, Gen1. The difference | ||
553 | * is that, in such case, it will not be cleared by HW | ||
554 | * which will cause the following code to report false | ||
555 | * failure. | ||
556 | */ | 540 | */ |
541 | tmp = dw_pcie_readl_dbi(pci, PCIE_LINK_WIDTH_SPEED_CONTROL); | ||
542 | tmp |= PORT_LOGIC_SPEED_CHANGE; | ||
543 | dw_pcie_writel_dbi(pci, PCIE_LINK_WIDTH_SPEED_CONTROL, tmp); | ||
544 | |||
545 | if (imx6_pcie->variant != IMX7D) { | ||
546 | /* | ||
547 | * On i.MX7, DIRECT_SPEED_CHANGE behaves differently | ||
548 | * from i.MX6 family when no link speed transition | ||
549 | * occurs and we go Gen1 -> yep, Gen1. The difference | ||
550 | * is that, in such case, it will not be cleared by HW | ||
551 | * which will cause the following code to report false | ||
552 | * failure. | ||
553 | */ | ||
554 | |||
555 | ret = imx6_pcie_wait_for_speed_change(imx6_pcie); | ||
556 | if (ret) { | ||
557 | dev_err(dev, "Failed to bring link up!\n"); | ||
558 | goto err_reset_phy; | ||
559 | } | ||
560 | } | ||
557 | 561 | ||
558 | ret = imx6_pcie_wait_for_speed_change(imx6_pcie); | 562 | /* Make sure link training is finished as well! */ |
563 | ret = imx6_pcie_wait_for_link(imx6_pcie); | ||
559 | if (ret) { | 564 | if (ret) { |
560 | dev_err(dev, "Failed to bring link up!\n"); | 565 | dev_err(dev, "Failed to bring link up!\n"); |
561 | goto err_reset_phy; | 566 | goto err_reset_phy; |
562 | } | 567 | } |
563 | } | 568 | } else { |
564 | 569 | dev_info(dev, "Link: Gen2 disabled\n"); | |
565 | /* Make sure link training is finished as well! */ | ||
566 | ret = imx6_pcie_wait_for_link(imx6_pcie); | ||
567 | if (ret) { | ||
568 | dev_err(dev, "Failed to bring link up!\n"); | ||
569 | goto err_reset_phy; | ||
570 | } | 570 | } |
571 | 571 | ||
572 | tmp = dw_pcie_readl_dbi(pci, PCIE_RC_LCSR); | 572 | tmp = dw_pcie_readl_dbi(pci, PCIE_RC_LCSR); |