@@ -1308,13 +1308,17 @@ static int qcom_pcie_host_init(struct dw_pcie_rp *pp)
13081308 if (ret )
13091309 goto err_deinit ;
13101310
1311- ret = pci_pwrctrl_create_devices (pci -> dev );
1312- if (ret )
1313- goto err_disable_phy ;
1311+ if (!pci -> suspended ) {
1312+ ret = pci_pwrctrl_create_devices (pci -> dev );
1313+ if (ret )
1314+ goto err_disable_phy ;
1315+ }
13141316
1315- ret = pci_pwrctrl_power_on_devices (pci -> dev );
1316- if (ret )
1317- goto err_pwrctrl_destroy ;
1317+ if (!pp -> skip_pwrctrl_off ) {
1318+ ret = pci_pwrctrl_power_on_devices (pci -> dev );
1319+ if (ret )
1320+ goto err_pwrctrl_destroy ;
1321+ }
13181322
13191323 if (pcie -> cfg -> ops -> post_init ) {
13201324 ret = pcie -> cfg -> ops -> post_init (pcie );
@@ -1356,11 +1360,14 @@ static void qcom_pcie_host_deinit(struct dw_pcie_rp *pp)
13561360
13571361 qcom_pcie_perst_assert (pcie );
13581362
1359- /*
1360- * No need to destroy pwrctrl devices as this function only gets called
1361- * during system suspend as of now.
1362- */
1363- pci_pwrctrl_power_off_devices (pci -> dev );
1363+ if (!pci -> pp .skip_pwrctrl_off ) {
1364+ /*
1365+ * No need to destroy pwrctrl devices as this function only gets called
1366+ * during system suspend as of now.
1367+ */
1368+ pci_pwrctrl_power_off_devices (pci -> dev );
1369+ }
1370+
13641371 qcom_pcie_phy_power_off (pcie );
13651372 pcie -> cfg -> ops -> deinit (pcie );
13661373}
@@ -2051,11 +2058,16 @@ static int qcom_pcie_resume_noirq(struct device *dev)
20512058 ret = icc_enable (pcie -> icc_mem );
20522059 if (ret ) {
20532060 dev_err (dev , "Failed to enable PCIe-MEM interconnect path: %d\n" , ret );
2054- return ret ;
2061+ goto disable_icc_cpu ;
20552062 }
2063+
2064+ /*
2065+ * Ignore -ENODEV & -EIO here since it is expected when no endpoint is
2066+ * connected to the PCIe link.
2067+ */
20562068 ret = dw_pcie_resume_noirq (pcie -> pci );
2057- if (ret && ( ret != - ETIMEDOUT ) )
2058- return ret ;
2069+ if (ret && ret != - ENODEV && ret != - EIO )
2070+ goto disable_icc_mem ;
20592071 } else {
20602072 if (pm_suspend_target_state != PM_SUSPEND_MEM ) {
20612073 ret = icc_enable (pcie -> icc_cpu );
@@ -2070,6 +2082,12 @@ static int qcom_pcie_resume_noirq(struct device *dev)
20702082 qcom_pcie_icc_opp_update (pcie );
20712083
20722084 return 0 ;
2085+ disable_icc_mem :
2086+ icc_disable (pcie -> icc_mem );
2087+ disable_icc_cpu :
2088+ icc_disable (pcie -> icc_cpu );
2089+
2090+ return ret ;
20732091}
20742092
20752093static const struct of_device_id qcom_pcie_match [] = {
0 commit comments