Skip to content

Commit d1997c9

Browse files
jhovoldLorenzo Pieralisi
authored andcommitted
PCI: qcom: Disable ASPM L0s for sc8280xp, sa8540p and sa8295p
Commit 9f4f3df ("PCI: qcom: Enable ASPM for platforms supporting 1.9.0 ops") started enabling ASPM unconditionally when the hardware claims to support it. This triggers Correctable Errors for some PCIe devices on machines like the Lenovo ThinkPad X13s when L0s is enabled, which could indicate an incomplete driver ASPM implementation or that the hardware does in fact not support L0s. This has now been confirmed by Qualcomm to be the case for sc8280xp and its derivate platforms (e.g. sa8540p and sa8295p). Specifically, the PHY configuration used on these platforms is not correctly tuned for L0s and there is currently no updated configuration available. Add a new flag to the driver configuration data and use it to disable ASPM L0s on sc8280xp, sa8540p and sa8295p for now. Note that only the 1.9.0 ops enable ASPM currently. Link: https://lore.kernel.org/r/[email protected] Fixes: 9f4f3df ("PCI: qcom: Enable ASPM for platforms supporting 1.9.0 ops") Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Cc: [email protected] # 6.7
1 parent 545e88c commit d1997c9

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

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

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ struct qcom_pcie_ops {
229229

230230
struct qcom_pcie_cfg {
231231
const struct qcom_pcie_ops *ops;
232+
bool no_l0s;
232233
};
233234

234235
struct qcom_pcie {
@@ -272,6 +273,26 @@ static int qcom_pcie_start_link(struct dw_pcie *pci)
272273
return 0;
273274
}
274275

276+
static void qcom_pcie_clear_aspm_l0s(struct dw_pcie *pci)
277+
{
278+
struct qcom_pcie *pcie = to_qcom_pcie(pci);
279+
u16 offset;
280+
u32 val;
281+
282+
if (!pcie->cfg->no_l0s)
283+
return;
284+
285+
offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP);
286+
287+
dw_pcie_dbi_ro_wr_en(pci);
288+
289+
val = readl(pci->dbi_base + offset + PCI_EXP_LNKCAP);
290+
val &= ~PCI_EXP_LNKCAP_ASPM_L0S;
291+
writel(val, pci->dbi_base + offset + PCI_EXP_LNKCAP);
292+
293+
dw_pcie_dbi_ro_wr_dis(pci);
294+
}
295+
275296
static void qcom_pcie_clear_hpc(struct dw_pcie *pci)
276297
{
277298
u16 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP);
@@ -961,6 +982,7 @@ static int qcom_pcie_init_2_7_0(struct qcom_pcie *pcie)
961982

962983
static int qcom_pcie_post_init_2_7_0(struct qcom_pcie *pcie)
963984
{
985+
qcom_pcie_clear_aspm_l0s(pcie->pci);
964986
qcom_pcie_clear_hpc(pcie->pci);
965987

966988
return 0;
@@ -1358,6 +1380,11 @@ static const struct qcom_pcie_cfg cfg_2_9_0 = {
13581380
.ops = &ops_2_9_0,
13591381
};
13601382

1383+
static const struct qcom_pcie_cfg cfg_sc8280xp = {
1384+
.ops = &ops_1_9_0,
1385+
.no_l0s = true,
1386+
};
1387+
13611388
static const struct dw_pcie_ops dw_pcie_ops = {
13621389
.link_up = qcom_pcie_link_up,
13631390
.start_link = qcom_pcie_start_link,
@@ -1629,11 +1656,11 @@ static const struct of_device_id qcom_pcie_match[] = {
16291656
{ .compatible = "qcom,pcie-ipq8074-gen3", .data = &cfg_2_9_0 },
16301657
{ .compatible = "qcom,pcie-msm8996", .data = &cfg_2_3_2 },
16311658
{ .compatible = "qcom,pcie-qcs404", .data = &cfg_2_4_0 },
1632-
{ .compatible = "qcom,pcie-sa8540p", .data = &cfg_1_9_0 },
1659+
{ .compatible = "qcom,pcie-sa8540p", .data = &cfg_sc8280xp },
16331660
{ .compatible = "qcom,pcie-sa8775p", .data = &cfg_1_9_0},
16341661
{ .compatible = "qcom,pcie-sc7280", .data = &cfg_1_9_0 },
16351662
{ .compatible = "qcom,pcie-sc8180x", .data = &cfg_1_9_0 },
1636-
{ .compatible = "qcom,pcie-sc8280xp", .data = &cfg_1_9_0 },
1663+
{ .compatible = "qcom,pcie-sc8280xp", .data = &cfg_sc8280xp },
16371664
{ .compatible = "qcom,pcie-sdm845", .data = &cfg_2_7_0 },
16381665
{ .compatible = "qcom,pcie-sdx55", .data = &cfg_1_9_0 },
16391666
{ .compatible = "qcom,pcie-sm8150", .data = &cfg_1_9_0 },

0 commit comments

Comments
 (0)