Skip to content

Commit 95e9303

Browse files
committed
Merge branch 'pci/pm'
- Enable starfive controller runtime PM before probing host bridge (Mayank Rana) - Enable runtime power management for host bridges (Krishna chaitanya chundru) * pci/pm: PCI: Enable runtime PM of the host bridge PCI: starfive: Enable controller runtime PM before probing host bridge
2 parents 2438a74 + dc421bb commit 95e9303

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

drivers/pci/controller/plda/pcie-starfive.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,9 @@ static int starfive_pcie_probe(struct platform_device *pdev)
404404
if (ret)
405405
return ret;
406406

407+
pm_runtime_enable(&pdev->dev);
408+
pm_runtime_get_sync(&pdev->dev);
409+
407410
plda->host_ops = &sf_host_ops;
408411
plda->num_events = PLDA_MAX_EVENT_NUM;
409412
/* mask doorbell event */
@@ -413,11 +416,12 @@ static int starfive_pcie_probe(struct platform_device *pdev)
413416
plda->events_bitmap <<= PLDA_NUM_DMA_EVENTS;
414417
ret = plda_pcie_host_init(&pcie->plda, &starfive_pcie_ops,
415418
&stf_pcie_event);
416-
if (ret)
419+
if (ret) {
420+
pm_runtime_put_sync(&pdev->dev);
421+
pm_runtime_disable(&pdev->dev);
417422
return ret;
423+
}
418424

419-
pm_runtime_enable(&pdev->dev);
420-
pm_runtime_get_sync(&pdev->dev);
421425
platform_set_drvdata(pdev, pcie);
422426

423427
return 0;

drivers/pci/probe.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3111,6 +3111,17 @@ int pci_host_probe(struct pci_host_bridge *bridge)
31113111
pcie_bus_configure_settings(child);
31123112

31133113
pci_bus_add_devices(bus);
3114+
3115+
/*
3116+
* Ensure pm_runtime_enable() is called for the controller drivers
3117+
* before calling pci_host_probe(). The PM framework expects that
3118+
* if the parent device supports runtime PM, it will be enabled
3119+
* before child runtime PM is enabled.
3120+
*/
3121+
pm_runtime_set_active(&bridge->dev);
3122+
pm_runtime_no_callbacks(&bridge->dev);
3123+
devm_pm_runtime_enable(&bridge->dev);
3124+
31143125
return 0;
31153126
}
31163127
EXPORT_SYMBOL_GPL(pci_host_probe);

0 commit comments

Comments
 (0)