Skip to content

Commit 56e2a44

Browse files
Ansuelgregkh
authored andcommitted
PCI: qcom: Define some PARF params needed for ipq8064 SoC
commit 5149901 upstream. 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/20200615210608.21469-8-ansuelsmth@gmail.com Fixes: 82a8238 ("PCI: qcom: Add Qualcomm PCIe controller driver") Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Reviewed-by: Rob Herring <robh@kernel.org> Acked-by: Stanimir Varbanov <svarbanov@mm-sol.com> Cc: stable@vger.kernel.org # v4.5+ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ae33b1e commit 56e2a44

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

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

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

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

8092
#define PCIE20_v3_PARF_SLV_ADDR_SPACE_SIZE 0x358
8193
#define SLV_ADDR_SPACE_SZ 0x10000000
@@ -275,6 +287,7 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie)
275287
struct qcom_pcie_resources_2_1_0 *res = &pcie->res.v2_1_0;
276288
struct dw_pcie *pci = pcie->pci;
277289
struct device *dev = pci->dev;
290+
struct device_node *node = dev->of_node;
278291
u32 val;
279292
int ret;
280293

@@ -319,6 +332,17 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie)
319332
val &= ~BIT(0);
320333
writel(val, pcie->parf + PCIE20_PARF_PHY_CTRL);
321334

335+
if (of_device_is_compatible(node, "qcom,pcie-ipq8064")) {
336+
writel(PCS_DEEMPH_TX_DEEMPH_GEN1(24) |
337+
PCS_DEEMPH_TX_DEEMPH_GEN2_3_5DB(24) |
338+
PCS_DEEMPH_TX_DEEMPH_GEN2_6DB(34),
339+
pcie->parf + PCIE20_PARF_PCS_DEEMPH);
340+
writel(PCS_SWING_TX_SWING_FULL(120) |
341+
PCS_SWING_TX_SWING_LOW(120),
342+
pcie->parf + PCIE20_PARF_PCS_SWING);
343+
writel(PHY_RX0_EQ(4), pcie->parf + PCIE20_PARF_CONFIG_BITS);
344+
}
345+
322346
/* enable external reference clock */
323347
val = readl(pcie->parf + PCIE20_PARF_PHY_REFCLK);
324348
val |= BIT(16);

0 commit comments

Comments
 (0)