Skip to content

Commit 86b812d

Browse files
committed
Merge branch 'pci/controller/aspm'
- Add a dwc .host_post_init() callback for configuration after downstream devices are scanned (Manivannan Sadhasivam) - Enable ASPM for devices below qcom 1.9.0 host controllers (Manivannan Sadhasivam) * pci/controller/aspm: PCI: qcom: Enable ASPM for platforms supporting 1.9.0 ops PCI: dwc: Add host_post_init() callback
2 parents dbf9527 + 9f4f3df commit 86b812d

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

drivers/pci/controller/dwc/pcie-designware-host.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,9 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)
502502
if (ret)
503503
goto err_stop_link;
504504

505+
if (pp->ops->host_post_init)
506+
pp->ops->host_post_init(pp);
507+
505508
return 0;
506509

507510
err_stop_link:

drivers/pci/controller/dwc/pcie-designware.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ enum dw_pcie_ltssm {
301301
struct dw_pcie_host_ops {
302302
int (*host_init)(struct dw_pcie_rp *pp);
303303
void (*host_deinit)(struct dw_pcie_rp *pp);
304+
void (*host_post_init)(struct dw_pcie_rp *pp);
304305
int (*msi_host_init)(struct dw_pcie_rp *pp);
305306
void (*pme_turn_off)(struct dw_pcie_rp *pp);
306307
};

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ struct qcom_pcie_ops {
219219
int (*get_resources)(struct qcom_pcie *pcie);
220220
int (*init)(struct qcom_pcie *pcie);
221221
int (*post_init)(struct qcom_pcie *pcie);
222+
void (*host_post_init)(struct qcom_pcie *pcie);
222223
void (*deinit)(struct qcom_pcie *pcie);
223224
void (*ltssm_enable)(struct qcom_pcie *pcie);
224225
int (*config_sid)(struct qcom_pcie *pcie);
@@ -964,6 +965,22 @@ static int qcom_pcie_post_init_2_7_0(struct qcom_pcie *pcie)
964965
return 0;
965966
}
966967

968+
static int qcom_pcie_enable_aspm(struct pci_dev *pdev, void *userdata)
969+
{
970+
/* Downstream devices need to be in D0 state before enabling PCI PM substates */
971+
pci_set_power_state(pdev, PCI_D0);
972+
pci_enable_link_state(pdev, PCIE_LINK_STATE_ALL);
973+
974+
return 0;
975+
}
976+
977+
static void qcom_pcie_host_post_init_2_7_0(struct qcom_pcie *pcie)
978+
{
979+
struct dw_pcie_rp *pp = &pcie->pci->pp;
980+
981+
pci_walk_bus(pp->bridge->bus, qcom_pcie_enable_aspm, NULL);
982+
}
983+
967984
static void qcom_pcie_deinit_2_7_0(struct qcom_pcie *pcie)
968985
{
969986
struct qcom_pcie_resources_2_7_0 *res = &pcie->res.v2_7_0;
@@ -1216,9 +1233,19 @@ static void qcom_pcie_host_deinit(struct dw_pcie_rp *pp)
12161233
pcie->cfg->ops->deinit(pcie);
12171234
}
12181235

1236+
static void qcom_pcie_host_post_init(struct dw_pcie_rp *pp)
1237+
{
1238+
struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
1239+
struct qcom_pcie *pcie = to_qcom_pcie(pci);
1240+
1241+
if (pcie->cfg->ops->host_post_init)
1242+
pcie->cfg->ops->host_post_init(pcie);
1243+
}
1244+
12191245
static const struct dw_pcie_host_ops qcom_pcie_dw_ops = {
12201246
.host_init = qcom_pcie_host_init,
12211247
.host_deinit = qcom_pcie_host_deinit,
1248+
.host_post_init = qcom_pcie_host_post_init,
12221249
};
12231250

12241251
/* Qcom IP rev.: 2.1.0 Synopsys IP rev.: 4.01a */
@@ -1280,6 +1307,7 @@ static const struct qcom_pcie_ops ops_1_9_0 = {
12801307
.get_resources = qcom_pcie_get_resources_2_7_0,
12811308
.init = qcom_pcie_init_2_7_0,
12821309
.post_init = qcom_pcie_post_init_2_7_0,
1310+
.host_post_init = qcom_pcie_host_post_init_2_7_0,
12831311
.deinit = qcom_pcie_deinit_2_7_0,
12841312
.ltssm_enable = qcom_pcie_2_3_2_ltssm_enable,
12851313
.config_sid = qcom_pcie_config_sid_1_9_0,

0 commit comments

Comments
 (0)