aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/host/pcie-rockchip.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/host/pcie-rockchip.c')
-rw-r--r--drivers/pci/host/pcie-rockchip.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c
index e0b22dab9b7a..e04f69beb42d 100644
--- a/drivers/pci/host/pcie-rockchip.c
+++ b/drivers/pci/host/pcie-rockchip.c
@@ -190,6 +190,9 @@ struct rockchip_pcie {
190 struct reset_control *mgmt_rst; 190 struct reset_control *mgmt_rst;
191 struct reset_control *mgmt_sticky_rst; 191 struct reset_control *mgmt_sticky_rst;
192 struct reset_control *pipe_rst; 192 struct reset_control *pipe_rst;
193 struct reset_control *pm_rst;
194 struct reset_control *aclk_rst;
195 struct reset_control *pclk_rst;
193 struct clk *aclk_pcie; 196 struct clk *aclk_pcie;
194 struct clk *aclk_perf_pcie; 197 struct clk *aclk_perf_pcie;
195 struct clk *hclk_pcie; 198 struct clk *hclk_pcie;
@@ -408,6 +411,44 @@ static int rockchip_pcie_init_port(struct rockchip_pcie *rockchip)
408 411
409 gpiod_set_value(rockchip->ep_gpio, 0); 412 gpiod_set_value(rockchip->ep_gpio, 0);
410 413
414 err = reset_control_assert(rockchip->aclk_rst);
415 if (err) {
416 dev_err(dev, "assert aclk_rst err %d\n", err);
417 return err;
418 }
419
420 err = reset_control_assert(rockchip->pclk_rst);
421 if (err) {
422 dev_err(dev, "assert pclk_rst err %d\n", err);
423 return err;
424 }
425
426 err = reset_control_assert(rockchip->pm_rst);
427 if (err) {
428 dev_err(dev, "assert pm_rst err %d\n", err);
429 return err;
430 }
431
432 udelay(10);
433
434 err = reset_control_deassert(rockchip->pm_rst);
435 if (err) {
436 dev_err(dev, "deassert pm_rst err %d\n", err);
437 return err;
438 }
439
440 err = reset_control_deassert(rockchip->aclk_rst);
441 if (err) {
442 dev_err(dev, "deassert mgmt_sticky_rst err %d\n", err);
443 return err;
444 }
445
446 err = reset_control_deassert(rockchip->pclk_rst);
447 if (err) {
448 dev_err(dev, "deassert mgmt_sticky_rst err %d\n", err);
449 return err;
450 }
451
411 err = phy_init(rockchip->phy); 452 err = phy_init(rockchip->phy);
412 if (err < 0) { 453 if (err < 0) {
413 dev_err(dev, "fail to init phy, err %d\n", err); 454 dev_err(dev, "fail to init phy, err %d\n", err);
@@ -781,6 +822,27 @@ static int rockchip_pcie_parse_dt(struct rockchip_pcie *rockchip)
781 return PTR_ERR(rockchip->pipe_rst); 822 return PTR_ERR(rockchip->pipe_rst);
782 } 823 }
783 824
825 rockchip->pm_rst = devm_reset_control_get(dev, "pm");
826 if (IS_ERR(rockchip->pm_rst)) {
827 if (PTR_ERR(rockchip->pm_rst) != -EPROBE_DEFER)
828 dev_err(dev, "missing pm reset property in node\n");
829 return PTR_ERR(rockchip->pm_rst);
830 }
831
832 rockchip->pclk_rst = devm_reset_control_get(dev, "pclk");
833 if (IS_ERR(rockchip->pclk_rst)) {
834 if (PTR_ERR(rockchip->pclk_rst) != -EPROBE_DEFER)
835 dev_err(dev, "missing pclk reset property in node\n");
836 return PTR_ERR(rockchip->pclk_rst);
837 }
838
839 rockchip->aclk_rst = devm_reset_control_get(dev, "aclk");
840 if (IS_ERR(rockchip->aclk_rst)) {
841 if (PTR_ERR(rockchip->aclk_rst) != -EPROBE_DEFER)
842 dev_err(dev, "missing aclk reset property in node\n");
843 return PTR_ERR(rockchip->aclk_rst);
844 }
845
784 rockchip->ep_gpio = devm_gpiod_get(dev, "ep", GPIOD_OUT_HIGH); 846 rockchip->ep_gpio = devm_gpiod_get(dev, "ep", GPIOD_OUT_HIGH);
785 if (IS_ERR(rockchip->ep_gpio)) { 847 if (IS_ERR(rockchip->ep_gpio)) {
786 dev_err(dev, "missing ep-gpios property in node\n"); 848 dev_err(dev, "missing ep-gpios property in node\n");