* [PATCH][V2] powerpc/fsl-pci: Add PCI controller ATMU PM support
@ 2012-11-07 8:10 Jia Hongtao
2012-11-07 15:57 ` Timur Tabi
0 siblings, 1 reply; 2+ messages in thread
From: Jia Hongtao @ 2012-11-07 8:10 UTC (permalink / raw)
To: linuxppc-dev, galak; +Cc: B07421, B04825, b38951
Power supply for PCI controller ATMU registers is off when system go to
deep-sleep state. So ATMU registers should be re-setup during PCI
controllers resume from sleep.
Signed-off-by: Jia Hongtao <B38951@freescale.com>
Signed-off-by: Li Yang <leoli@freescale.com>
---
arch/powerpc/sysdev/fsl_pci.c | 37 +++++++++++++++++++++++++++++++++++--
1 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index ffb93ae..e6ab952 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -89,7 +89,7 @@ static int fsl_pci_dma_set_mask(struct device *dev, u64 dma_mask)
return 0;
}
-static int __init setup_one_atmu(struct ccsr_pci __iomem *pci,
+static int setup_one_atmu(struct ccsr_pci __iomem *pci,
unsigned int index, const struct resource *res,
resource_size_t offset)
{
@@ -126,7 +126,7 @@ static int __init setup_one_atmu(struct ccsr_pci __iomem *pci,
}
/* atmu setup for fsl pci/pcie controller */
-static void __init setup_pci_atmu(struct pci_controller *hose,
+static void setup_pci_atmu(struct pci_controller *hose,
struct resource *rsrc)
{
struct ccsr_pci __iomem *pci;
@@ -902,9 +902,42 @@ static int __devinit fsl_pci_probe(struct platform_device *pdev)
return 0;
}
+#ifdef CONFIG_PM
+static int fsl_pci_resume(struct device *dev)
+{
+ struct pci_controller *hose;
+ struct resource pci_rsrc;
+
+ hose = pci_find_hose_for_OF_device(dev->of_node);
+ if (!hose)
+ return -ENODEV;
+
+ if (of_address_to_resource(dev->of_node, 0, &pci_rsrc)) {
+ pr_warning("Get pci register base failed");
+ return -ENOMEM;
+ }
+
+ setup_pci_atmu(hose, &pci_rsrc);
+
+ return 0;
+}
+
+static const struct dev_pm_ops pci_pm_ops = {
+ .resume = fsl_pci_resume,
+};
+
+#define PCI_PM_OPS (&pci_pm_ops)
+
+#else
+
+#define PCI_PM_OPS NULL
+
+#endif
+
static struct platform_driver fsl_pci_driver = {
.driver = {
.name = "fsl-pci",
+ .pm = PCI_PM_OPS,
.of_match_table = pci_ids,
},
.probe = fsl_pci_probe,
--
1.7.5.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH][V2] powerpc/fsl-pci: Add PCI controller ATMU PM support
2012-11-07 8:10 [PATCH][V2] powerpc/fsl-pci: Add PCI controller ATMU PM support Jia Hongtao
@ 2012-11-07 15:57 ` Timur Tabi
0 siblings, 0 replies; 2+ messages in thread
From: Timur Tabi @ 2012-11-07 15:57 UTC (permalink / raw)
To: Jia Hongtao; +Cc: B07421, linuxppc-dev
Jia Hongtao wrote:
> Power supply for PCI controller ATMU registers is off when system go to
> deep-sleep state. So ATMU registers should be re-setup during PCI
> controllers resume from sleep.
>
> Signed-off-by: Jia Hongtao <B38951@freescale.com>
> Signed-off-by: Li Yang <leoli@freescale.com>
> ---
> arch/powerpc/sysdev/fsl_pci.c | 37 +++++++++++++++++++++++++++++++++++--
> 1 files changed, 35 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
> index ffb93ae..e6ab952 100644
> --- a/arch/powerpc/sysdev/fsl_pci.c
> +++ b/arch/powerpc/sysdev/fsl_pci.c
> @@ -89,7 +89,7 @@ static int fsl_pci_dma_set_mask(struct device *dev, u64 dma_mask)
> return 0;
> }
>
> -static int __init setup_one_atmu(struct ccsr_pci __iomem *pci,
> +static int setup_one_atmu(struct ccsr_pci __iomem *pci,
> unsigned int index, const struct resource *res,
> resource_size_t offset)
> {
> @@ -126,7 +126,7 @@ static int __init setup_one_atmu(struct ccsr_pci __iomem *pci,
> }
>
> /* atmu setup for fsl pci/pcie controller */
> -static void __init setup_pci_atmu(struct pci_controller *hose,
> +static void setup_pci_atmu(struct pci_controller *hose,
> struct resource *rsrc)
> {
> struct ccsr_pci __iomem *pci;
> @@ -902,9 +902,42 @@ static int __devinit fsl_pci_probe(struct platform_device *pdev)
> return 0;
> }
>
> +#ifdef CONFIG_PM
> +static int fsl_pci_resume(struct device *dev)
> +{
> + struct pci_controller *hose;
> + struct resource pci_rsrc;
> +
> + hose = pci_find_hose_for_OF_device(dev->of_node);
> + if (!hose)
> + return -ENODEV;
> +
> + if (of_address_to_resource(dev->of_node, 0, &pci_rsrc)) {
> + pr_warning("Get pci register base failed");
> + return -ENOMEM;
dev_err
and it's not -ENOMEM. ENOMEM means that you've run out of memory. This
should also be ENODEV.
> + }
> +
> + setup_pci_atmu(hose, &pci_rsrc);
> +
> + return 0;
> +}
> +
> +static const struct dev_pm_ops pci_pm_ops = {
> + .resume = fsl_pci_resume,
> +};
> +
> +#define PCI_PM_OPS (&pci_pm_ops)
> +
> +#else
> +
> +#define PCI_PM_OPS NULL
> +
> +#endif
> +
> static struct platform_driver fsl_pci_driver = {
> .driver = {
> .name = "fsl-pci",
> + .pm = PCI_PM_OPS,
> .of_match_table = pci_ids,
> },
> .probe = fsl_pci_probe,
>
--
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-11-07 15:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-07 8:10 [PATCH][V2] powerpc/fsl-pci: Add PCI controller ATMU PM support Jia Hongtao
2012-11-07 15:57 ` Timur Tabi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).