|
45 | 45 | #define PARF_PHY_REFCLK 0x4c
|
46 | 46 | #define PARF_CONFIG_BITS 0x50
|
47 | 47 | #define PARF_DBI_BASE_ADDR 0x168
|
| 48 | +#define PARF_SLV_ADDR_SPACE_SIZE 0x16c |
48 | 49 | #define PARF_MHI_CLOCK_RESET_CTRL 0x174
|
49 | 50 | #define PARF_AXI_MSTR_WR_ADDR_HALT 0x178
|
50 | 51 | #define PARF_AXI_MSTR_WR_ADDR_HALT_V2 0x1a8
|
|
55 | 56 | #define PARF_INT_ALL_MASK 0x22c
|
56 | 57 | #define PARF_SID_OFFSET 0x234
|
57 | 58 | #define PARF_BDF_TRANSLATE_CFG 0x24c
|
58 |
| -#define PARF_SLV_ADDR_SPACE_SIZE 0x358 |
| 59 | +#define PARF_DBI_BASE_ADDR_V2 0x350 |
| 60 | +#define PARF_DBI_BASE_ADDR_V2_HI 0x354 |
| 61 | +#define PARF_SLV_ADDR_SPACE_SIZE_V2 0x358 |
| 62 | +#define PARF_SLV_ADDR_SPACE_SIZE_V2_HI 0x35c |
59 | 63 | #define PARF_NO_SNOOP_OVERIDE 0x3d4
|
| 64 | +#define PARF_ATU_BASE_ADDR 0x634 |
| 65 | +#define PARF_ATU_BASE_ADDR_HI 0x638 |
60 | 66 | #define PARF_DEVICE_TYPE 0x1000
|
61 | 67 | #define PARF_BDF_TO_SID_TABLE_N 0x2000
|
62 | 68 | #define PARF_BDF_TO_SID_CFG 0x2c00
|
|
111 | 117 | #define PHY_RX0_EQ(x) FIELD_PREP(GENMASK(26, 24), x)
|
112 | 118 |
|
113 | 119 | /* PARF_SLV_ADDR_SPACE_SIZE register value */
|
114 |
| -#define SLV_ADDR_SPACE_SZ 0x10000000 |
| 120 | +#define SLV_ADDR_SPACE_SZ 0x80000000 |
115 | 121 |
|
116 | 122 | /* PARF_MHI_CLOCK_RESET_CTRL register fields */
|
117 | 123 | #define AHB_CLK_EN BIT(0)
|
@@ -330,6 +336,50 @@ static void qcom_pcie_clear_hpc(struct dw_pcie *pci)
|
330 | 336 | dw_pcie_dbi_ro_wr_dis(pci);
|
331 | 337 | }
|
332 | 338 |
|
| 339 | +static void qcom_pcie_configure_dbi_base(struct qcom_pcie *pcie) |
| 340 | +{ |
| 341 | + struct dw_pcie *pci = pcie->pci; |
| 342 | + |
| 343 | + if (pci->dbi_phys_addr) { |
| 344 | + /* |
| 345 | + * PARF_DBI_BASE_ADDR register is in CPU domain and require to |
| 346 | + * be programmed with CPU physical address. |
| 347 | + */ |
| 348 | + writel(lower_32_bits(pci->dbi_phys_addr), pcie->parf + |
| 349 | + PARF_DBI_BASE_ADDR); |
| 350 | + writel(SLV_ADDR_SPACE_SZ, pcie->parf + |
| 351 | + PARF_SLV_ADDR_SPACE_SIZE); |
| 352 | + } |
| 353 | +} |
| 354 | + |
| 355 | +static void qcom_pcie_configure_dbi_atu_base(struct qcom_pcie *pcie) |
| 356 | +{ |
| 357 | + struct dw_pcie *pci = pcie->pci; |
| 358 | + |
| 359 | + if (pci->dbi_phys_addr) { |
| 360 | + /* |
| 361 | + * PARF_DBI_BASE_ADDR_V2 and PARF_ATU_BASE_ADDR registers are |
| 362 | + * in CPU domain and require to be programmed with CPU |
| 363 | + * physical addresses. |
| 364 | + */ |
| 365 | + writel(lower_32_bits(pci->dbi_phys_addr), pcie->parf + |
| 366 | + PARF_DBI_BASE_ADDR_V2); |
| 367 | + writel(upper_32_bits(pci->dbi_phys_addr), pcie->parf + |
| 368 | + PARF_DBI_BASE_ADDR_V2_HI); |
| 369 | + |
| 370 | + if (pci->atu_phys_addr) { |
| 371 | + writel(lower_32_bits(pci->atu_phys_addr), pcie->parf + |
| 372 | + PARF_ATU_BASE_ADDR); |
| 373 | + writel(upper_32_bits(pci->atu_phys_addr), pcie->parf + |
| 374 | + PARF_ATU_BASE_ADDR_HI); |
| 375 | + } |
| 376 | + |
| 377 | + writel(0x0, pcie->parf + PARF_SLV_ADDR_SPACE_SIZE_V2); |
| 378 | + writel(SLV_ADDR_SPACE_SZ, pcie->parf + |
| 379 | + PARF_SLV_ADDR_SPACE_SIZE_V2_HI); |
| 380 | + } |
| 381 | +} |
| 382 | + |
333 | 383 | static void qcom_pcie_2_1_0_ltssm_enable(struct qcom_pcie *pcie)
|
334 | 384 | {
|
335 | 385 | u32 val;
|
@@ -546,8 +596,7 @@ static int qcom_pcie_init_1_0_0(struct qcom_pcie *pcie)
|
546 | 596 |
|
547 | 597 | static int qcom_pcie_post_init_1_0_0(struct qcom_pcie *pcie)
|
548 | 598 | {
|
549 |
| - /* change DBI base address */ |
550 |
| - writel(0, pcie->parf + PARF_DBI_BASE_ADDR); |
| 599 | + qcom_pcie_configure_dbi_base(pcie); |
551 | 600 |
|
552 | 601 | if (IS_ENABLED(CONFIG_PCI_MSI)) {
|
553 | 602 | u32 val = readl(pcie->parf + PARF_AXI_MSTR_WR_ADDR_HALT);
|
@@ -634,8 +683,7 @@ static int qcom_pcie_post_init_2_3_2(struct qcom_pcie *pcie)
|
634 | 683 | val &= ~PHY_TEST_PWR_DOWN;
|
635 | 684 | writel(val, pcie->parf + PARF_PHY_CTRL);
|
636 | 685 |
|
637 |
| - /* change DBI base address */ |
638 |
| - writel(0, pcie->parf + PARF_DBI_BASE_ADDR); |
| 686 | + qcom_pcie_configure_dbi_base(pcie); |
639 | 687 |
|
640 | 688 | /* MAC PHY_POWERDOWN MUX DISABLE */
|
641 | 689 | val = readl(pcie->parf + PARF_SYS_CTRL);
|
@@ -817,13 +865,11 @@ static int qcom_pcie_post_init_2_3_3(struct qcom_pcie *pcie)
|
817 | 865 | u16 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP);
|
818 | 866 | u32 val;
|
819 | 867 |
|
820 |
| - writel(SLV_ADDR_SPACE_SZ, pcie->parf + PARF_SLV_ADDR_SPACE_SIZE); |
821 |
| - |
822 | 868 | val = readl(pcie->parf + PARF_PHY_CTRL);
|
823 | 869 | val &= ~PHY_TEST_PWR_DOWN;
|
824 | 870 | writel(val, pcie->parf + PARF_PHY_CTRL);
|
825 | 871 |
|
826 |
| - writel(0, pcie->parf + PARF_DBI_BASE_ADDR); |
| 872 | + qcom_pcie_configure_dbi_atu_base(pcie); |
827 | 873 |
|
828 | 874 | writel(MST_WAKEUP_EN | SLV_WAKEUP_EN | MSTR_ACLK_CGC_DIS
|
829 | 875 | | SLV_ACLK_CGC_DIS | CORE_CLK_CGC_DIS |
|
@@ -919,8 +965,7 @@ static int qcom_pcie_init_2_7_0(struct qcom_pcie *pcie)
|
919 | 965 | val &= ~PHY_TEST_PWR_DOWN;
|
920 | 966 | writel(val, pcie->parf + PARF_PHY_CTRL);
|
921 | 967 |
|
922 |
| - /* change DBI base address */ |
923 |
| - writel(0, pcie->parf + PARF_DBI_BASE_ADDR); |
| 968 | + qcom_pcie_configure_dbi_atu_base(pcie); |
924 | 969 |
|
925 | 970 | /* MAC PHY_POWERDOWN MUX DISABLE */
|
926 | 971 | val = readl(pcie->parf + PARF_SYS_CTRL);
|
@@ -1129,14 +1174,11 @@ static int qcom_pcie_post_init_2_9_0(struct qcom_pcie *pcie)
|
1129 | 1174 | u32 val;
|
1130 | 1175 | int i;
|
1131 | 1176 |
|
1132 |
| - writel(SLV_ADDR_SPACE_SZ, |
1133 |
| - pcie->parf + PARF_SLV_ADDR_SPACE_SIZE); |
1134 |
| - |
1135 | 1177 | val = readl(pcie->parf + PARF_PHY_CTRL);
|
1136 | 1178 | val &= ~PHY_TEST_PWR_DOWN;
|
1137 | 1179 | writel(val, pcie->parf + PARF_PHY_CTRL);
|
1138 | 1180 |
|
1139 |
| - writel(0, pcie->parf + PARF_DBI_BASE_ADDR); |
| 1181 | + qcom_pcie_configure_dbi_atu_base(pcie); |
1140 | 1182 |
|
1141 | 1183 | writel(DEVICE_TYPE_RC, pcie->parf + PARF_DEVICE_TYPE);
|
1142 | 1184 | writel(BYPASS | MSTR_AXI_CLK_EN | AHB_CLK_EN,
|
|
0 commit comments