@@ -219,6 +219,7 @@ struct qcom_pcie_ops {
219
219
int (* get_resources )(struct qcom_pcie * pcie );
220
220
int (* init )(struct qcom_pcie * pcie );
221
221
int (* post_init )(struct qcom_pcie * pcie );
222
+ void (* host_post_init )(struct qcom_pcie * pcie );
222
223
void (* deinit )(struct qcom_pcie * pcie );
223
224
void (* ltssm_enable )(struct qcom_pcie * pcie );
224
225
int (* config_sid )(struct qcom_pcie * pcie );
@@ -964,6 +965,22 @@ static int qcom_pcie_post_init_2_7_0(struct qcom_pcie *pcie)
964
965
return 0 ;
965
966
}
966
967
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
+
967
984
static void qcom_pcie_deinit_2_7_0 (struct qcom_pcie * pcie )
968
985
{
969
986
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)
1216
1233
pcie -> cfg -> ops -> deinit (pcie );
1217
1234
}
1218
1235
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
+
1219
1245
static const struct dw_pcie_host_ops qcom_pcie_dw_ops = {
1220
1246
.host_init = qcom_pcie_host_init ,
1221
1247
.host_deinit = qcom_pcie_host_deinit ,
1248
+ .host_post_init = qcom_pcie_host_post_init ,
1222
1249
};
1223
1250
1224
1251
/* 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 = {
1280
1307
.get_resources = qcom_pcie_get_resources_2_7_0 ,
1281
1308
.init = qcom_pcie_init_2_7_0 ,
1282
1309
.post_init = qcom_pcie_post_init_2_7_0 ,
1310
+ .host_post_init = qcom_pcie_host_post_init_2_7_0 ,
1283
1311
.deinit = qcom_pcie_deinit_2_7_0 ,
1284
1312
.ltssm_enable = qcom_pcie_2_3_2_ltssm_enable ,
1285
1313
.config_sid = qcom_pcie_config_sid_1_9_0 ,
0 commit comments