Skip to content

Commit 5c13b3c

Browse files
committed
Merge branch 'pci/controller/qcom'
- Disable register write access after init for IP v2.3.3, v2.9.0 (Manivannan Sadhasivam) - Use DWC helpers for enabling/disabling writes to DBI registers (Manivannan Sadhasivam) - Hide slot hotplug capability for IP v1.0.0, v1.9.0, v2.1.0, v2.3.2, v2.3.3, v2.7.0, v2.9.0 (Manivannan Sadhasivam) - Reuse v2.3.2 post-init sequence for v2.4.0 (Manivannan Sadhasivam) - * pci/controller/qcom: PCI: qcom: Do not advertise hotplug capability for IP v2.1.0 PCI: qcom: Do not advertise hotplug capability for IP v1.0.0 PCI: qcom: Use post init sequence of IP v2.3.2 for v2.4.0 PCI: qcom: Do not advertise hotplug capability for IP v2.3.2 PCI: qcom: Do not advertise hotplug capability for IPs v2.3.3 and v2.9.0 PCI: qcom: Do not advertise hotplug capability for IPs v2.7.0 and v1.9.0 PCI: qcom: Disable write access to read only registers for IP v2.9.0 PCI: qcom: Use DWC helpers for modifying the read-only DBI registers PCI: qcom: Disable write access to read only registers for IP v2.3.3
2 parents 69fa3ef + 1fdecc5 commit 5c13b3c

File tree

1 file changed

+38
-35
lines changed

1 file changed

+38
-35
lines changed

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

Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
/* DBI registers */
6262
#define AXI_MSTR_RESP_COMP_CTRL0 0x818
6363
#define AXI_MSTR_RESP_COMP_CTRL1 0x81c
64-
#define MISC_CONTROL_1_REG 0x8bc
6564

6665
/* MHI registers */
6766
#define PARF_DEBUG_CNT_PM_LINKST_IN_L2 0xc04
@@ -132,9 +131,6 @@
132131
/* AXI_MSTR_RESP_COMP_CTRL1 register fields */
133132
#define CFG_BRIDGE_SB_INIT BIT(0)
134133

135-
/* MISC_CONTROL_1_REG register fields */
136-
#define DBI_RO_WR_EN 1
137-
138134
/* PCI_EXP_SLTCAP register fields */
139135
#define PCIE_CAP_SLOT_POWER_LIMIT_VAL FIELD_PREP(PCI_EXP_SLTCAP_SPLV, 250)
140136
#define PCIE_CAP_SLOT_POWER_LIMIT_SCALE FIELD_PREP(PCI_EXP_SLTCAP_SPLS, 1)
@@ -144,7 +140,6 @@
144140
PCI_EXP_SLTCAP_AIP | \
145141
PCI_EXP_SLTCAP_PIP | \
146142
PCI_EXP_SLTCAP_HPS | \
147-
PCI_EXP_SLTCAP_HPC | \
148143
PCI_EXP_SLTCAP_EIP | \
149144
PCIE_CAP_SLOT_POWER_LIMIT_VAL | \
150145
PCIE_CAP_SLOT_POWER_LIMIT_SCALE)
@@ -274,6 +269,20 @@ static int qcom_pcie_start_link(struct dw_pcie *pci)
274269
return 0;
275270
}
276271

272+
static void qcom_pcie_clear_hpc(struct dw_pcie *pci)
273+
{
274+
u16 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP);
275+
u32 val;
276+
277+
dw_pcie_dbi_ro_wr_en(pci);
278+
279+
val = readl(pci->dbi_base + offset + PCI_EXP_SLTCAP);
280+
val &= ~PCI_EXP_SLTCAP_HPC;
281+
writel(val, pci->dbi_base + offset + PCI_EXP_SLTCAP);
282+
283+
dw_pcie_dbi_ro_wr_dis(pci);
284+
}
285+
277286
static void qcom_pcie_2_1_0_ltssm_enable(struct qcom_pcie *pcie)
278287
{
279288
u32 val;
@@ -429,6 +438,8 @@ static int qcom_pcie_post_init_2_1_0(struct qcom_pcie *pcie)
429438
writel(CFG_BRIDGE_SB_INIT,
430439
pci->dbi_base + AXI_MSTR_RESP_COMP_CTRL1);
431440

441+
qcom_pcie_clear_hpc(pcie->pci);
442+
432443
return 0;
433444
}
434445

@@ -512,6 +523,8 @@ static int qcom_pcie_post_init_1_0_0(struct qcom_pcie *pcie)
512523
writel(val, pcie->parf + PARF_AXI_MSTR_WR_ADDR_HALT);
513524
}
514525

526+
qcom_pcie_clear_hpc(pcie->pci);
527+
515528
return 0;
516529
}
517530

@@ -607,6 +620,8 @@ static int qcom_pcie_post_init_2_3_2(struct qcom_pcie *pcie)
607620
val |= EN;
608621
writel(val, pcie->parf + PARF_AXI_MSTR_WR_ADDR_HALT_V2);
609622

623+
qcom_pcie_clear_hpc(pcie->pci);
624+
610625
return 0;
611626
}
612627

@@ -692,34 +707,6 @@ static int qcom_pcie_init_2_4_0(struct qcom_pcie *pcie)
692707
return 0;
693708
}
694709

695-
static int qcom_pcie_post_init_2_4_0(struct qcom_pcie *pcie)
696-
{
697-
u32 val;
698-
699-
/* enable PCIe clocks and resets */
700-
val = readl(pcie->parf + PARF_PHY_CTRL);
701-
val &= ~PHY_TEST_PWR_DOWN;
702-
writel(val, pcie->parf + PARF_PHY_CTRL);
703-
704-
/* change DBI base address */
705-
writel(0, pcie->parf + PARF_DBI_BASE_ADDR);
706-
707-
/* MAC PHY_POWERDOWN MUX DISABLE */
708-
val = readl(pcie->parf + PARF_SYS_CTRL);
709-
val &= ~MAC_PHY_POWERDOWN_IN_P2_D_MUX_EN;
710-
writel(val, pcie->parf + PARF_SYS_CTRL);
711-
712-
val = readl(pcie->parf + PARF_MHI_CLOCK_RESET_CTRL);
713-
val |= BYPASS;
714-
writel(val, pcie->parf + PARF_MHI_CLOCK_RESET_CTRL);
715-
716-
val = readl(pcie->parf + PARF_AXI_MSTR_WR_ADDR_HALT_V2);
717-
val |= EN;
718-
writel(val, pcie->parf + PARF_AXI_MSTR_WR_ADDR_HALT_V2);
719-
720-
return 0;
721-
}
722-
723710
static int qcom_pcie_get_resources_2_3_3(struct qcom_pcie *pcie)
724711
{
725712
struct qcom_pcie_resources_2_3_3 *res = &pcie->res.v2_3_3;
@@ -826,7 +813,9 @@ static int qcom_pcie_post_init_2_3_3(struct qcom_pcie *pcie)
826813
writel(0, pcie->parf + PARF_Q2A_FLUSH);
827814

828815
writel(PCI_COMMAND_MASTER, pci->dbi_base + PCI_COMMAND);
829-
writel(DBI_RO_WR_EN, pci->dbi_base + MISC_CONTROL_1_REG);
816+
817+
dw_pcie_dbi_ro_wr_en(pci);
818+
830819
writel(PCIE_CAP_SLOT_VAL, pci->dbi_base + offset + PCI_EXP_SLTCAP);
831820

832821
val = readl(pci->dbi_base + offset + PCI_EXP_LNKCAP);
@@ -836,6 +825,8 @@ static int qcom_pcie_post_init_2_3_3(struct qcom_pcie *pcie)
836825
writel(PCI_EXP_DEVCTL2_COMP_TMOUT_DIS, pci->dbi_base + offset +
837826
PCI_EXP_DEVCTL2);
838827

828+
dw_pcie_dbi_ro_wr_dis(pci);
829+
839830
return 0;
840831
}
841832

@@ -966,6 +957,13 @@ static int qcom_pcie_init_2_7_0(struct qcom_pcie *pcie)
966957
return ret;
967958
}
968959

960+
static int qcom_pcie_post_init_2_7_0(struct qcom_pcie *pcie)
961+
{
962+
qcom_pcie_clear_hpc(pcie->pci);
963+
964+
return 0;
965+
}
966+
969967
static void qcom_pcie_deinit_2_7_0(struct qcom_pcie *pcie)
970968
{
971969
struct qcom_pcie_resources_2_7_0 *res = &pcie->res.v2_7_0;
@@ -1136,6 +1134,7 @@ static int qcom_pcie_post_init_2_9_0(struct qcom_pcie *pcie)
11361134
writel(0, pcie->parf + PARF_Q2A_FLUSH);
11371135

11381136
dw_pcie_dbi_ro_wr_en(pci);
1137+
11391138
writel(PCIE_CAP_SLOT_VAL, pci->dbi_base + offset + PCI_EXP_SLTCAP);
11401139

11411140
val = readl(pci->dbi_base + offset + PCI_EXP_LNKCAP);
@@ -1145,6 +1144,8 @@ static int qcom_pcie_post_init_2_9_0(struct qcom_pcie *pcie)
11451144
writel(PCI_EXP_DEVCTL2_COMP_TMOUT_DIS, pci->dbi_base + offset +
11461145
PCI_EXP_DEVCTL2);
11471146

1147+
dw_pcie_dbi_ro_wr_dis(pci);
1148+
11481149
for (i = 0; i < 256; i++)
11491150
writel(0, pcie->parf + PARF_BDF_TO_SID_TABLE_N + (4 * i));
11501151

@@ -1251,7 +1252,7 @@ static const struct qcom_pcie_ops ops_2_3_2 = {
12511252
static const struct qcom_pcie_ops ops_2_4_0 = {
12521253
.get_resources = qcom_pcie_get_resources_2_4_0,
12531254
.init = qcom_pcie_init_2_4_0,
1254-
.post_init = qcom_pcie_post_init_2_4_0,
1255+
.post_init = qcom_pcie_post_init_2_3_2,
12551256
.deinit = qcom_pcie_deinit_2_4_0,
12561257
.ltssm_enable = qcom_pcie_2_3_2_ltssm_enable,
12571258
};
@@ -1269,6 +1270,7 @@ static const struct qcom_pcie_ops ops_2_3_3 = {
12691270
static const struct qcom_pcie_ops ops_2_7_0 = {
12701271
.get_resources = qcom_pcie_get_resources_2_7_0,
12711272
.init = qcom_pcie_init_2_7_0,
1273+
.post_init = qcom_pcie_post_init_2_7_0,
12721274
.deinit = qcom_pcie_deinit_2_7_0,
12731275
.ltssm_enable = qcom_pcie_2_3_2_ltssm_enable,
12741276
};
@@ -1277,6 +1279,7 @@ static const struct qcom_pcie_ops ops_2_7_0 = {
12771279
static const struct qcom_pcie_ops ops_1_9_0 = {
12781280
.get_resources = qcom_pcie_get_resources_2_7_0,
12791281
.init = qcom_pcie_init_2_7_0,
1282+
.post_init = qcom_pcie_post_init_2_7_0,
12801283
.deinit = qcom_pcie_deinit_2_7_0,
12811284
.ltssm_enable = qcom_pcie_2_3_2_ltssm_enable,
12821285
.config_sid = qcom_pcie_config_sid_1_9_0,

0 commit comments

Comments
 (0)