diff options
| author | Vidya Sagar <vidyas@nvidia.com> | 2017-11-28 02:08:43 -0500 |
|---|---|---|
| committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-11-29 01:50:47 -0500 |
| commit | bfce2e5d4c0ec8015eb5051a8259fb0e73a2f511 (patch) | |
| tree | 9240d2b4d3226c97eb127190d34327ae2306de10 | |
| parent | 7e28f0ae8a56f87b72b789a9638f2dcde6f7df64 (diff) | |
PCI: tegra: EP: update programming sequence change
enables core_clk as the first thing as part of controller
initialization sequence as per the change is programming
sequence
Bug 200367869
Change-Id: I2d93b2635a1a25e434abfda62cc514ede77b9bfb
Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1606081
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
| -rw-r--r-- | drivers/pci/endpoint/pcie-tegra-dw-ep.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/drivers/pci/endpoint/pcie-tegra-dw-ep.c b/drivers/pci/endpoint/pcie-tegra-dw-ep.c index 68ca06dfd..43f4b2ef5 100644 --- a/drivers/pci/endpoint/pcie-tegra-dw-ep.c +++ b/drivers/pci/endpoint/pcie-tegra-dw-ep.c | |||
| @@ -391,22 +391,36 @@ static int tegra_pcie_dw_ep_probe(struct platform_device *pdev) | |||
| 391 | 391 | ||
| 392 | pcie->dev = &pdev->dev; | 392 | pcie->dev = &pdev->dev; |
| 393 | 393 | ||
| 394 | pcie->core_clk = devm_clk_get(&pdev->dev, "core_clk"); | ||
| 395 | if (IS_ERR(pcie->core_clk)) { | ||
| 396 | dev_err(&pdev->dev, "Failed to get core clock\n"); | ||
| 397 | return PTR_ERR(pcie->core_clk); | ||
| 398 | } | ||
| 399 | ret = clk_prepare_enable(pcie->core_clk); | ||
| 400 | if (ret) { | ||
| 401 | dev_err(&pdev->dev, "Failed to enable core clock\n"); | ||
| 402 | return ret; | ||
| 403 | } | ||
| 404 | |||
| 394 | pcie->appl_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, | 405 | pcie->appl_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, |
| 395 | "appl"); | 406 | "appl"); |
| 396 | if (!pcie->appl_res) { | 407 | if (!pcie->appl_res) { |
| 397 | dev_err(&pdev->dev, "missing appl space\n"); | 408 | dev_err(&pdev->dev, "missing appl space\n"); |
| 398 | return PTR_ERR(pcie->appl_res); | 409 | ret = PTR_ERR(pcie->appl_res); |
| 410 | goto fail_appl_res; | ||
| 399 | } | 411 | } |
| 400 | pcie->appl_base = devm_ioremap_resource(&pdev->dev, pcie->appl_res); | 412 | pcie->appl_base = devm_ioremap_resource(&pdev->dev, pcie->appl_res); |
| 401 | if (IS_ERR(pcie->appl_base)) { | 413 | if (IS_ERR(pcie->appl_base)) { |
| 402 | dev_err(&pdev->dev, "mapping appl space failed\n"); | 414 | dev_err(&pdev->dev, "mapping appl space failed\n"); |
| 403 | return PTR_ERR(pcie->appl_base); | 415 | ret = PTR_ERR(pcie->appl_base); |
| 416 | goto fail_appl_res; | ||
| 404 | } | 417 | } |
| 405 | 418 | ||
| 406 | pcie->core_apb_rst = devm_reset_control_get(pcie->dev, "core_apb_rst"); | 419 | pcie->core_apb_rst = devm_reset_control_get(pcie->dev, "core_apb_rst"); |
| 407 | if (IS_ERR(pcie->core_apb_rst)) { | 420 | if (IS_ERR(pcie->core_apb_rst)) { |
| 408 | dev_err(pcie->dev, "PCIE : core_apb_rst reset is missing\n"); | 421 | dev_err(pcie->dev, "PCIE : core_apb_rst reset is missing\n"); |
| 409 | return PTR_ERR(pcie->core_apb_rst); | 422 | ret = PTR_ERR(pcie->core_apb_rst); |
| 423 | goto fail_appl_res; | ||
| 410 | } | 424 | } |
| 411 | 425 | ||
| 412 | reset_control_deassert(pcie->core_apb_rst); | 426 | reset_control_deassert(pcie->core_apb_rst); |
| @@ -539,33 +553,23 @@ static int tegra_pcie_dw_ep_probe(struct platform_device *pdev) | |||
| 539 | 553 | ||
| 540 | INIT_WORK(&pcie->pcie_ep_work, pcie_ep_work_fn); | 554 | INIT_WORK(&pcie->pcie_ep_work, pcie_ep_work_fn); |
| 541 | 555 | ||
| 542 | pcie->core_clk = devm_clk_get(&pdev->dev, "core_clk"); | ||
| 543 | if (IS_ERR(pcie->core_clk)) { | ||
| 544 | dev_err(&pdev->dev, "Failed to get core clock\n"); | ||
| 545 | ret = PTR_ERR(pcie->core_clk); | ||
| 546 | goto fail_dbi_res; | ||
| 547 | } | ||
| 548 | ret = clk_prepare_enable(pcie->core_clk); | ||
| 549 | if (ret) | ||
| 550 | goto fail_dbi_res; | ||
| 551 | |||
| 552 | pcie->core_rst = devm_reset_control_get(pcie->dev, "core_rst"); | 556 | pcie->core_rst = devm_reset_control_get(pcie->dev, "core_rst"); |
| 553 | if (IS_ERR(pcie->core_rst)) { | 557 | if (IS_ERR(pcie->core_rst)) { |
| 554 | dev_err(pcie->dev, "PCIE : core_rst reset is missing\n"); | 558 | dev_err(pcie->dev, "PCIE : core_rst reset is missing\n"); |
| 555 | ret = PTR_ERR(pcie->core_rst); | 559 | ret = PTR_ERR(pcie->core_rst); |
| 556 | goto fail_core_rst_get; | 560 | goto fail_dbi_res; |
| 557 | } | 561 | } |
| 558 | 562 | ||
| 559 | reset_control_deassert(pcie->core_rst); | 563 | reset_control_deassert(pcie->core_rst); |
| 560 | 564 | ||
| 561 | return ret; | 565 | return ret; |
| 562 | 566 | ||
| 563 | fail_core_rst_get: | ||
| 564 | clk_disable_unprepare(pcie->core_clk); | ||
| 565 | fail_dbi_res: | 567 | fail_dbi_res: |
| 566 | tegra_pcie_disable_phy(pcie); | 568 | tegra_pcie_disable_phy(pcie); |
| 567 | fail_phy: | 569 | fail_phy: |
| 568 | reset_control_assert(pcie->core_apb_rst); | 570 | reset_control_assert(pcie->core_apb_rst); |
| 571 | fail_appl_res: | ||
| 572 | clk_disable_unprepare(pcie->core_clk); | ||
| 569 | return ret; | 573 | return ret; |
| 570 | } | 574 | } |
| 571 | 575 | ||
