diff options
author | Valentine Barshak <valentine.barshak@cogentembedded.com> | 2013-12-04 11:33:35 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2013-12-09 18:24:37 -0500 |
commit | fb178d8b2fab3f2a9f203c13ffe80cfd6e01bdf1 (patch) | |
tree | 5d6c1a088da4b1ce64eaa1d26d8a0a4e53940232 | |
parent | c176d1c71bd18238e5d77d6acc6b991aa6a17f3b (diff) |
PCI: rcar: Add runtime PM support
If runtime PM is enabled in the kernel config, the PCI clocks are not
forced on at start-up, and thus, are never enabled. Use
pm_runtime_get_sync() to enable the clocks.
While at it, use dev_info() instead of pr_info() since now we have the
device pointer available in the PCI setup callback.
Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r-- | drivers/pci/host/pci-rcar-gen2.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/pci/host/pci-rcar-gen2.c b/drivers/pci/host/pci-rcar-gen2.c index 96d118242ae2..ceec147baec3 100644 --- a/drivers/pci/host/pci-rcar-gen2.c +++ b/drivers/pci/host/pci-rcar-gen2.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/pci.h> | 18 | #include <linux/pci.h> |
19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/pm_runtime.h> | ||
20 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
21 | 22 | ||
22 | /* AHB-PCI Bridge PCI communication registers */ | 23 | /* AHB-PCI Bridge PCI communication registers */ |
@@ -77,6 +78,7 @@ | |||
77 | #define RCAR_PCI_NR_CONTROLLERS 3 | 78 | #define RCAR_PCI_NR_CONTROLLERS 3 |
78 | 79 | ||
79 | struct rcar_pci_priv { | 80 | struct rcar_pci_priv { |
81 | struct device *dev; | ||
80 | void __iomem *reg; | 82 | void __iomem *reg; |
81 | struct resource io_res; | 83 | struct resource io_res; |
82 | struct resource mem_res; | 84 | struct resource mem_res; |
@@ -169,8 +171,11 @@ static int __init rcar_pci_setup(int nr, struct pci_sys_data *sys) | |||
169 | void __iomem *reg = priv->reg; | 171 | void __iomem *reg = priv->reg; |
170 | u32 val; | 172 | u32 val; |
171 | 173 | ||
174 | pm_runtime_enable(priv->dev); | ||
175 | pm_runtime_get_sync(priv->dev); | ||
176 | |||
172 | val = ioread32(reg + RCAR_PCI_UNIT_REV_REG); | 177 | val = ioread32(reg + RCAR_PCI_UNIT_REV_REG); |
173 | pr_info("PCI: bus%u revision %x\n", sys->busnr, val); | 178 | dev_info(priv->dev, "PCI: bus%u revision %x\n", sys->busnr, val); |
174 | 179 | ||
175 | /* Disable Direct Power Down State and assert reset */ | 180 | /* Disable Direct Power Down State and assert reset */ |
176 | val = ioread32(reg + RCAR_USBCTR_REG) & ~RCAR_USBCTR_DIRPD; | 181 | val = ioread32(reg + RCAR_USBCTR_REG) & ~RCAR_USBCTR_DIRPD; |
@@ -301,6 +306,7 @@ static int __init rcar_pci_probe(struct platform_device *pdev) | |||
301 | 306 | ||
302 | priv->irq = platform_get_irq(pdev, 0); | 307 | priv->irq = platform_get_irq(pdev, 0); |
303 | priv->reg = reg; | 308 | priv->reg = reg; |
309 | priv->dev = &pdev->dev; | ||
304 | 310 | ||
305 | return rcar_pci_add_controller(priv); | 311 | return rcar_pci_add_controller(priv); |
306 | } | 312 | } |