diff options
Diffstat (limited to 'drivers/pci/controller/pcie-cadence-ep.c')
-rw-r--r-- | drivers/pci/controller/pcie-cadence-ep.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/pci/controller/pcie-cadence-ep.c b/drivers/pci/controller/pcie-cadence-ep.c index e3fe4124e3af..c02f33d8e506 100644 --- a/drivers/pci/controller/pcie-cadence-ep.c +++ b/drivers/pci/controller/pcie-cadence-ep.c | |||
@@ -439,6 +439,7 @@ static int cdns_pcie_ep_probe(struct platform_device *pdev) | |||
439 | struct pci_epc *epc; | 439 | struct pci_epc *epc; |
440 | struct resource *res; | 440 | struct resource *res; |
441 | int ret; | 441 | int ret; |
442 | int phy_count; | ||
442 | 443 | ||
443 | ep = devm_kzalloc(dev, sizeof(*ep), GFP_KERNEL); | 444 | ep = devm_kzalloc(dev, sizeof(*ep), GFP_KERNEL); |
444 | if (!ep) | 445 | if (!ep) |
@@ -473,6 +474,12 @@ static int cdns_pcie_ep_probe(struct platform_device *pdev) | |||
473 | if (!ep->ob_addr) | 474 | if (!ep->ob_addr) |
474 | return -ENOMEM; | 475 | return -ENOMEM; |
475 | 476 | ||
477 | ret = cdns_pcie_init_phy(dev, pcie); | ||
478 | if (ret) { | ||
479 | dev_err(dev, "failed to init phy\n"); | ||
480 | return ret; | ||
481 | } | ||
482 | platform_set_drvdata(pdev, pcie); | ||
476 | pm_runtime_enable(dev); | 483 | pm_runtime_enable(dev); |
477 | ret = pm_runtime_get_sync(dev); | 484 | ret = pm_runtime_get_sync(dev); |
478 | if (ret < 0) { | 485 | if (ret < 0) { |
@@ -521,6 +528,10 @@ static int cdns_pcie_ep_probe(struct platform_device *pdev) | |||
521 | 528 | ||
522 | err_get_sync: | 529 | err_get_sync: |
523 | pm_runtime_disable(dev); | 530 | pm_runtime_disable(dev); |
531 | cdns_pcie_disable_phy(pcie); | ||
532 | phy_count = pcie->phy_count; | ||
533 | while (phy_count--) | ||
534 | device_link_del(pcie->link[phy_count]); | ||
524 | 535 | ||
525 | return ret; | 536 | return ret; |
526 | } | 537 | } |
@@ -528,6 +539,7 @@ static int cdns_pcie_ep_probe(struct platform_device *pdev) | |||
528 | static void cdns_pcie_ep_shutdown(struct platform_device *pdev) | 539 | static void cdns_pcie_ep_shutdown(struct platform_device *pdev) |
529 | { | 540 | { |
530 | struct device *dev = &pdev->dev; | 541 | struct device *dev = &pdev->dev; |
542 | struct cdns_pcie *pcie = dev_get_drvdata(dev); | ||
531 | int ret; | 543 | int ret; |
532 | 544 | ||
533 | ret = pm_runtime_put_sync(dev); | 545 | ret = pm_runtime_put_sync(dev); |
@@ -536,7 +548,7 @@ static void cdns_pcie_ep_shutdown(struct platform_device *pdev) | |||
536 | 548 | ||
537 | pm_runtime_disable(dev); | 549 | pm_runtime_disable(dev); |
538 | 550 | ||
539 | /* The PCIe controller can't be disabled. */ | 551 | cdns_pcie_disable_phy(pcie); |
540 | } | 552 | } |
541 | 553 | ||
542 | static struct platform_driver cdns_pcie_ep_driver = { | 554 | static struct platform_driver cdns_pcie_ep_driver = { |