|
27 | 27 | #include <linux/slab.h>
|
28 | 28 | #include <linux/types.h>
|
29 | 29 |
|
| 30 | +#include "../../pci.h" |
30 | 31 | #include "pcie-designware.h"
|
31 | 32 |
|
32 | 33 | #define PCIE20_PARF_SYS_CTRL 0x00
|
|
99 | 100 | #define PCIE20_v3_PARF_SLV_ADDR_SPACE_SIZE 0x358
|
100 | 101 | #define SLV_ADDR_SPACE_SZ 0x10000000
|
101 | 102 |
|
| 103 | +#define PCIE20_LNK_CONTROL2_LINK_STATUS2 0xa0 |
| 104 | + |
102 | 105 | #define DEVICE_TYPE_RC 0x4
|
103 | 106 |
|
104 | 107 | #define QCOM_PCIE_2_1_0_MAX_SUPPLY 3
|
@@ -195,6 +198,7 @@ struct qcom_pcie {
|
195 | 198 | struct phy *phy;
|
196 | 199 | struct gpio_desc *reset;
|
197 | 200 | const struct qcom_pcie_ops *ops;
|
| 201 | + int gen; |
198 | 202 | };
|
199 | 203 |
|
200 | 204 | #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)
|
395 | 399 | /* wait for clock acquisition */
|
396 | 400 | usleep_range(1000, 1500);
|
397 | 401 |
|
| 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 | + } |
398 | 407 |
|
399 | 408 | /* Set the Max TLP size to 2K, instead of using default of 4K */
|
400 | 409 | writel(CFG_REMOTE_RD_REQ_BRIDGE_SIZE_2K,
|
@@ -1397,6 +1406,10 @@ static int qcom_pcie_probe(struct platform_device *pdev)
|
1397 | 1406 | goto err_pm_runtime_put;
|
1398 | 1407 | }
|
1399 | 1408 |
|
| 1409 | + pcie->gen = of_pci_get_max_link_speed(pdev->dev.of_node); |
| 1410 | + if (pcie->gen < 0) |
| 1411 | + pcie->gen = 2; |
| 1412 | + |
1400 | 1413 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "parf");
|
1401 | 1414 | pcie->parf = devm_ioremap_resource(dev, res);
|
1402 | 1415 | if (IS_ERR(pcie->parf)) {
|
|
0 commit comments