aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Lin <shawn.lin@rock-chips.com>2017-01-11 20:53:17 -0500
committerBjorn Helgaas <bhelgaas@google.com>2017-01-12 16:31:43 -0500
commitafc9595ea4770f0157ae06fb3acedff703e169b6 (patch)
treec81cd744afb9bb2a8d5214fea2a5d802b6cd8851
parent013dd3d5e1835c2cfa9c824e61465b61509afa54 (diff)
PCI: rockchip: Disable RC's ASPM L0s based on DT "aspm-no-l0s"
Rockchip's RC produces a 100MHz reference clock but there are two methods for the PHY to generate it: (1) Use the system PLL to generate a 100MHz clock. The PHY will relock it, filter signal noise, and output the reference clock. ASPM L0s works correctly, but circuit noise issues make it difficult to pass the TX compatibility test. (2) Share the SoC's 24MHZ crystal oscillator with the PHY and force the PHY's PLL to generate 100MHz internally. In this case, exit from ASPM L0s sometimes fails due to a design error in the RC receiver circuit. Even if we use extended-synch, the PHY sometimes fails to relock the bits from FTS, which will hang the system. We want the flexibility to use both clocking methods, so add a DT property, "aspm-no-l0s". If that's present, disable L0s to avoid the issues with case (2). [bhelgaas: changelog] Reported-by: Jeffy Chen <jeffy.chen@rock-chips.com> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Brian Norris <briannorris@chromium.org> Acked-by: Rob Herring <robh@kernel.org>
-rw-r--r--Documentation/devicetree/bindings/pci/rockchip-pcie.txt2
-rw-r--r--drivers/pci/host/pcie-rockchip.c9
2 files changed, 11 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/pci/rockchip-pcie.txt b/Documentation/devicetree/bindings/pci/rockchip-pcie.txt
index 71aeda1ca055..1453a734c2f5 100644
--- a/Documentation/devicetree/bindings/pci/rockchip-pcie.txt
+++ b/Documentation/devicetree/bindings/pci/rockchip-pcie.txt
@@ -43,6 +43,8 @@ Required properties:
43- interrupt-map-mask and interrupt-map: standard PCI properties 43- interrupt-map-mask and interrupt-map: standard PCI properties
44 44
45Optional Property: 45Optional Property:
46- aspm-no-l0s: RC won't support ASPM L0s. This property is needed if
47 using 24MHz OSC for RC's PHY.
46- ep-gpios: contain the entry for pre-reset gpio 48- ep-gpios: contain the entry for pre-reset gpio
47- num-lanes: number of lanes to use 49- num-lanes: number of lanes to use
48- vpcie3v3-supply: The phandle to the 3.3v regulator to use for PCIe. 50- vpcie3v3-supply: The phandle to the 3.3v regulator to use for PCIe.
diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c
index 03923494825d..0d6e8ee5b017 100644
--- a/drivers/pci/host/pcie-rockchip.c
+++ b/drivers/pci/host/pcie-rockchip.c
@@ -145,6 +145,8 @@
145#define PCIE_RC_CONFIG_DCR_CSPL_SHIFT 18 145#define PCIE_RC_CONFIG_DCR_CSPL_SHIFT 18
146#define PCIE_RC_CONFIG_DCR_CSPL_LIMIT 0xff 146#define PCIE_RC_CONFIG_DCR_CSPL_LIMIT 0xff
147#define PCIE_RC_CONFIG_DCR_CPLS_SHIFT 26 147#define PCIE_RC_CONFIG_DCR_CPLS_SHIFT 26
148#define PCIE_RC_CONFIG_LINK_CAP (PCIE_RC_CONFIG_BASE + 0xcc)
149#define PCIE_RC_CONFIG_LINK_CAP_L0S BIT(10)
148#define PCIE_RC_CONFIG_LCS (PCIE_RC_CONFIG_BASE + 0xd0) 150#define PCIE_RC_CONFIG_LCS (PCIE_RC_CONFIG_BASE + 0xd0)
149#define PCIE_RC_CONFIG_L1_SUBSTATE_CTRL2 (PCIE_RC_CONFIG_BASE + 0x90c) 151#define PCIE_RC_CONFIG_L1_SUBSTATE_CTRL2 (PCIE_RC_CONFIG_BASE + 0x90c)
150#define PCIE_RC_CONFIG_THP_CAP (PCIE_RC_CONFIG_BASE + 0x274) 152#define PCIE_RC_CONFIG_THP_CAP (PCIE_RC_CONFIG_BASE + 0x274)
@@ -665,6 +667,13 @@ static int rockchip_pcie_init_port(struct rockchip_pcie *rockchip)
665 status &= ~PCIE_RC_CONFIG_THP_CAP_NEXT_MASK; 667 status &= ~PCIE_RC_CONFIG_THP_CAP_NEXT_MASK;
666 rockchip_pcie_write(rockchip, status, PCIE_RC_CONFIG_THP_CAP); 668 rockchip_pcie_write(rockchip, status, PCIE_RC_CONFIG_THP_CAP);
667 669
670 /* Clear L0s from RC's link cap */
671 if (of_property_read_bool(dev->of_node, "aspm-no-l0s")) {
672 status = rockchip_pcie_read(rockchip, PCIE_RC_CONFIG_LINK_CAP);
673 status &= ~PCIE_RC_CONFIG_LINK_CAP_L0S;
674 rockchip_pcie_write(rockchip, status, PCIE_RC_CONFIG_LINK_CAP);
675 }
676
668 rockchip_pcie_write(rockchip, 0x0, PCIE_RC_BAR_CONF); 677 rockchip_pcie_write(rockchip, 0x0, PCIE_RC_BAR_CONF);
669 678
670 rockchip_pcie_write(rockchip, 679 rockchip_pcie_write(rockchip,