Skip to content

Commit 5149901

Browse files
AnsuelLorenzo Pieralisi
authored andcommitted
PCI: qcom: Define some PARF params needed for ipq8064 SoC
Set some specific value for Tx De-Emphasis, Tx Swing and Rx equalization needed on some ipq8064 based device (Netgear R7800 for example). Without this the system locks on kernel load. Link: https://lore.kernel.org/r/[email protected] Fixes: 82a8238 ("PCI: qcom: Add Qualcomm PCIe controller driver") Signed-off-by: Ansuel Smith <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Reviewed-by: Rob Herring <[email protected]> Acked-by: Stanimir Varbanov <[email protected]> Cc: [email protected] # v4.5+
1 parent 6a11452 commit 5149901

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

drivers/pci/controller/dwc/pcie-qcom.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,18 @@
7777
#define DBI_RO_WR_EN 1
7878

7979
#define PERST_DELAY_US 1000
80+
/* PARF registers */
81+
#define PCIE20_PARF_PCS_DEEMPH 0x34
82+
#define PCS_DEEMPH_TX_DEEMPH_GEN1(x) ((x) << 16)
83+
#define PCS_DEEMPH_TX_DEEMPH_GEN2_3_5DB(x) ((x) << 8)
84+
#define PCS_DEEMPH_TX_DEEMPH_GEN2_6DB(x) ((x) << 0)
85+
86+
#define PCIE20_PARF_PCS_SWING 0x38
87+
#define PCS_SWING_TX_SWING_FULL(x) ((x) << 8)
88+
#define PCS_SWING_TX_SWING_LOW(x) ((x) << 0)
89+
90+
#define PCIE20_PARF_CONFIG_BITS 0x50
91+
#define PHY_RX0_EQ(x) ((x) << 24)
8092

8193
#define PCIE20_v3_PARF_SLV_ADDR_SPACE_SIZE 0x358
8294
#define SLV_ADDR_SPACE_SZ 0x10000000
@@ -293,6 +305,7 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie)
293305
struct qcom_pcie_resources_2_1_0 *res = &pcie->res.v2_1_0;
294306
struct dw_pcie *pci = pcie->pci;
295307
struct device *dev = pci->dev;
308+
struct device_node *node = dev->of_node;
296309
u32 val;
297310
int ret;
298311

@@ -347,6 +360,17 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie)
347360
val &= ~BIT(0);
348361
writel(val, pcie->parf + PCIE20_PARF_PHY_CTRL);
349362

363+
if (of_device_is_compatible(node, "qcom,pcie-ipq8064")) {
364+
writel(PCS_DEEMPH_TX_DEEMPH_GEN1(24) |
365+
PCS_DEEMPH_TX_DEEMPH_GEN2_3_5DB(24) |
366+
PCS_DEEMPH_TX_DEEMPH_GEN2_6DB(34),
367+
pcie->parf + PCIE20_PARF_PCS_DEEMPH);
368+
writel(PCS_SWING_TX_SWING_FULL(120) |
369+
PCS_SWING_TX_SWING_LOW(120),
370+
pcie->parf + PCIE20_PARF_PCS_SWING);
371+
writel(PHY_RX0_EQ(4), pcie->parf + PCIE20_PARF_CONFIG_BITS);
372+
}
373+
350374
/* enable external reference clock */
351375
val = readl(pcie->parf + PCIE20_PARF_PHY_REFCLK);
352376
val |= BIT(16);

0 commit comments

Comments
 (0)