Skip to content

Commit 51ed2c2

Browse files
Sham MuthayyanLorenzo Pieralisi
authored andcommitted
PCI: qcom: Support pci speed set for ipq806x
Some SoC based on ipq8064/5 needs to be limited to pci GEN1 speed due to some hardware limitations. Add support for speed setting defined by the max-link-speed binding. If not defined the max speed is set to GEN2 by default. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sham Muthayyan <[email protected]> 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]>
1 parent d511580 commit 51ed2c2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <linux/slab.h>
2828
#include <linux/types.h>
2929

30+
#include "../../pci.h"
3031
#include "pcie-designware.h"
3132

3233
#define PCIE20_PARF_SYS_CTRL 0x00
@@ -99,6 +100,8 @@
99100
#define PCIE20_v3_PARF_SLV_ADDR_SPACE_SIZE 0x358
100101
#define SLV_ADDR_SPACE_SZ 0x10000000
101102

103+
#define PCIE20_LNK_CONTROL2_LINK_STATUS2 0xa0
104+
102105
#define DEVICE_TYPE_RC 0x4
103106

104107
#define QCOM_PCIE_2_1_0_MAX_SUPPLY 3
@@ -195,6 +198,7 @@ struct qcom_pcie {
195198
struct phy *phy;
196199
struct gpio_desc *reset;
197200
const struct qcom_pcie_ops *ops;
201+
int gen;
198202
};
199203

200204
#define to_qcom_pcie(x) dev_get_drvdata((x)->dev)
@@ -395,6 +399,11 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie)
395399
/* wait for clock acquisition */
396400
usleep_range(1000, 1500);
397401

402+
if (pcie->gen == 1) {
403+
val = readl(pci->dbi_base + PCIE20_LNK_CONTROL2_LINK_STATUS2);
404+
val |= PCI_EXP_LNKSTA_CLS_2_5GB;
405+
writel(val, pci->dbi_base + PCIE20_LNK_CONTROL2_LINK_STATUS2);
406+
}
398407

399408
/* Set the Max TLP size to 2K, instead of using default of 4K */
400409
writel(CFG_REMOTE_RD_REQ_BRIDGE_SIZE_2K,
@@ -1397,6 +1406,10 @@ static int qcom_pcie_probe(struct platform_device *pdev)
13971406
goto err_pm_runtime_put;
13981407
}
13991408

1409+
pcie->gen = of_pci_get_max_link_speed(pdev->dev.of_node);
1410+
if (pcie->gen < 0)
1411+
pcie->gen = 2;
1412+
14001413
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "parf");
14011414
pcie->parf = devm_ioremap_resource(dev, res);
14021415
if (IS_ERR(pcie->parf)) {

0 commit comments

Comments
 (0)