]> Pileus Git - ~andy/linux/commitdiff
PCI: rcar: Add runtime PM support
authorValentine Barshak <valentine.barshak@cogentembedded.com>
Wed, 4 Dec 2013 16:33:35 +0000 (20:33 +0400)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 9 Dec 2013 23:24:37 +0000 (16:24 -0700)
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>
drivers/pci/host/pci-rcar-gen2.c

index 96d118242ae2f04b3a87f8c7d6c9c47af6da722e..ceec147baec3560abf5cc07198ab3cc6b1d32d43 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/slab.h>
 
 /* AHB-PCI Bridge PCI communication registers */
@@ -77,6 +78,7 @@
 #define RCAR_PCI_NR_CONTROLLERS                3
 
 struct rcar_pci_priv {
+       struct device *dev;
        void __iomem *reg;
        struct resource io_res;
        struct resource mem_res;
@@ -169,8 +171,11 @@ static int __init rcar_pci_setup(int nr, struct pci_sys_data *sys)
        void __iomem *reg = priv->reg;
        u32 val;
 
+       pm_runtime_enable(priv->dev);
+       pm_runtime_get_sync(priv->dev);
+
        val = ioread32(reg + RCAR_PCI_UNIT_REV_REG);
-       pr_info("PCI: bus%u revision %x\n", sys->busnr, val);
+       dev_info(priv->dev, "PCI: bus%u revision %x\n", sys->busnr, val);
 
        /* Disable Direct Power Down State and assert reset */
        val = ioread32(reg + RCAR_USBCTR_REG) & ~RCAR_USBCTR_DIRPD;
@@ -301,6 +306,7 @@ static int __init rcar_pci_probe(struct platform_device *pdev)
 
        priv->irq = platform_get_irq(pdev, 0);
        priv->reg = reg;
+       priv->dev = &pdev->dev;
 
        return rcar_pci_add_controller(priv);
 }