diff options
author | Wang Dongsheng <dongsheng.wang@freescale.com> | 2014-10-30 08:27:23 (GMT) |
---|---|---|
committer | Matthew Weigel <Matthew.Weigel@freescale.com> | 2014-12-11 18:40:01 (GMT) |
commit | 1024e36d8bbe524828407114dce2bcffede0db43 (patch) | |
tree | eb5efbd4ef8490e0d94112d1b8ca7ea84f33a059 /drivers/pci | |
parent | 2d0309396d98661a929c81145dbe00d15b54c332 (diff) | |
download | linux-fsl-qoriq-1024e36d8bbe524828407114dce2bcffede0db43.tar.xz |
ls1021a/pci: add LS1021A PCIe Power Management support
This patch only for LS1021A PCIe Power Managment, because there has
a PCIe hardware issue, we need a workaround to support it.
LS1021A Workaround for internal TKT228622 to fix the INTx hang issue.
If this hardware be fixed, we not need to do anything for PCIe PM.
Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com>
Change-Id: I7b689e4780322f77bebd8671da71d82f6fdb18a3
Reviewed-on: http://git.am.freescale.net:8181/22585
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Minghuan Lian <Minghuan.Lian@freescale.com>
Reviewed-by: Zhengxiong Jin <Jason.Jin@freescale.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/host/pci-layerscape.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/drivers/pci/host/pci-layerscape.c b/drivers/pci/host/pci-layerscape.c index c5d9ec3..e4cd563 100644 --- a/drivers/pci/host/pci-layerscape.c +++ b/drivers/pci/host/pci-layerscape.c @@ -252,17 +252,59 @@ static int __init ls_pcie_probe(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM_SLEEP +static int ls_pcie_pm_suspend(struct device *dev) +{ + return 0; +} + +static int ls_pcie_pm_resume(struct device *dev) +{ + struct ls_pcie *pcie = dev_get_drvdata(dev); + int count = 0; + u32 val; + + while (!ls_pcie_link_up(&pcie->pp)) { + usleep_range(100, 1000); + count++; + if (count >= 200) { + dev_err(dev, "phy link never came up\n"); + return -ENODEV; + } + } + + if (of_device_is_compatible(pcie->dev->of_node, "fsl,ls1021a-pcie")) { + /* + * LS1021A Workaround for internal TKT228622 + * to fix the INTx hang issue + */ + val = ioread32(pcie->dbi + PCIE_STRFMR1); + val &= 0xffff; + iowrite32(val, pcie->dbi + PCIE_STRFMR1); + + ls1021a_pcie_msi_fixup(&pcie->pp); + } + + return 0; +}; +#endif /* CONFIG_PM_SLEEP */ + static const struct of_device_id ls_pcie_of_match[] = { { .compatible = "fsl,ls1021a-pcie" }, { }, }; MODULE_DEVICE_TABLE(of, ls_pcie_of_match); +static const struct dev_pm_ops ls_pcie_pm = { + SET_SYSTEM_SLEEP_PM_OPS(ls_pcie_pm_suspend, ls_pcie_pm_resume) +}; + static struct platform_driver ls_pcie_driver = { .driver = { .name = "layerscape-pcie", .owner = THIS_MODULE, .of_match_table = ls_pcie_of_match, + .pm = &ls_pcie_pm, }, }; |