linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/fsl-pci: Add PCI controller ATMU PM support
@ 2012-11-01  2:19 Jia Hongtao
  2012-11-01 13:25 ` [linuxppc-release] " Timur Tabi
  0 siblings, 1 reply; 4+ messages in thread
From: Jia Hongtao @ 2012-11-01  2:19 UTC (permalink / raw)
  To: linuxppc-dev, galak; +Cc: B07421, 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 |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index ffb93ae..793a017 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,12 +902,29 @@ static int __devinit fsl_pci_probe(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_SUSPEND
+static int fsl_pci_resume(struct platform_device *pdev)
+{
+	struct pci_controller *hose;
+	struct resource pci_rsrc;
+
+	hose = pci_find_hose_for_OF_device(pdev->dev.of_node);
+	of_address_to_resource(pdev->dev.of_node, 0, &pci_rsrc);
+	setup_pci_atmu(hose, &pci_rsrc);
+
+	return 0;
+}
+#endif
+
 static struct platform_driver fsl_pci_driver = {
 	.driver = {
 		.name = "fsl-pci",
 		.of_match_table = pci_ids,
 	},
 	.probe = fsl_pci_probe,
+#ifdef CONFIG_SUSPEND
+	.resume	= fsl_pci_resume,
+#endif
 };
 
 static int __init fsl_pci_init(void)
-- 
1.7.5.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [linuxppc-release] [PATCH] powerpc/fsl-pci: Add PCI controller ATMU PM support
  2012-11-01  2:19 [PATCH] powerpc/fsl-pci: Add PCI controller ATMU PM support Jia Hongtao
@ 2012-11-01 13:25 ` Timur Tabi
  2012-11-05  2:40   ` Jia Hongtao-B38951
  0 siblings, 1 reply; 4+ messages in thread
From: Timur Tabi @ 2012-11-01 13:25 UTC (permalink / raw)
  To: Jia Hongtao; +Cc: B07421, linuxppc-dev

Jia Hongtao wrote:

> +#ifdef CONFIG_SUSPEND
> +static int fsl_pci_resume(struct platform_device *pdev)
> +{
> +	struct pci_controller *hose;
> +	struct resource pci_rsrc;
> +
> +	hose = pci_find_hose_for_OF_device(pdev->dev.of_node);
> +	of_address_to_resource(pdev->dev.of_node, 0, &pci_rsrc);
> +	setup_pci_atmu(hose, &pci_rsrc);
> +
> +	return 0;
> +}

Some of these functions can fail, so they should return an error code if
they do.

> +#endif
> +
>  static struct platform_driver fsl_pci_driver = {
>  	.driver = {
>  		.name = "fsl-pci",
>  		.of_match_table = pci_ids,
>  	},
>  	.probe = fsl_pci_probe,
> +#ifdef CONFIG_SUSPEND
> +	.resume	= fsl_pci_resume,
> +#endif

Do this instead:

#ifdef CONFIG_SUSPEND
static int fsl_pci_resume(struct platform_device *pdev)
...
#else
#define fsl_pci_resume NULL
#endif

-- 
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [linuxppc-release] [PATCH] powerpc/fsl-pci: Add PCI controller ATMU PM support
  2012-11-01 13:25 ` [linuxppc-release] " Timur Tabi
@ 2012-11-05  2:40   ` Jia Hongtao-B38951
  2012-11-05 19:18     ` Timur Tabi
  0 siblings, 1 reply; 4+ messages in thread
From: Jia Hongtao-B38951 @ 2012-11-05  2:40 UTC (permalink / raw)
  To: Tabi Timur-B04825; +Cc: Wood Scott-B07421, linuxppc-dev, Li Yang-R58472



> -----Original Message-----
> From: Tabi Timur-B04825
> Sent: Thursday, November 01, 2012 9:26 PM
> To: Jia Hongtao-B38951
> Cc: linuxppc-dev@lists.ozlabs.org; galak@kernel.crashing.org; Wood Scott-
> B07421; Li Yang-R58472
> Subject: Re: [linuxppc-release] [PATCH] powerpc/fsl-pci: Add PCI
> controller ATMU PM support
>=20
> Jia Hongtao wrote:
>=20
> > +#ifdef CONFIG_SUSPEND
> > +static int fsl_pci_resume(struct platform_device *pdev)
> > +{
> > +	struct pci_controller *hose;
> > +	struct resource pci_rsrc;
> > +
> > +	hose =3D pci_find_hose_for_OF_device(pdev->dev.of_node);
> > +	of_address_to_resource(pdev->dev.of_node, 0, &pci_rsrc);
> > +	setup_pci_atmu(hose, &pci_rsrc);
> > +
> > +	return 0;
> > +}
>=20
> Some of these functions can fail, so they should return an error code if
> they do.

I checked the of_address_to_resource function now.
Is that necessary to check other two fuctions?

>=20
> > +#endif
> > +
> >  static struct platform_driver fsl_pci_driver =3D {
> >  	.driver =3D {
> >  		.name =3D "fsl-pci",
> >  		.of_match_table =3D pci_ids,
> >  	},
> >  	.probe =3D fsl_pci_probe,
> > +#ifdef CONFIG_SUSPEND
> > +	.resume	=3D fsl_pci_resume,
> > +#endif
>=20
> Do this instead:
>=20
> #ifdef CONFIG_SUSPEND
> static int fsl_pci_resume(struct platform_device *pdev)
> ...
> #else
> #define fsl_pci_resume NULL
> #endif

Ok, I will update this.

-Hongtao.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linuxppc-release] [PATCH] powerpc/fsl-pci: Add PCI controller ATMU PM support
  2012-11-05  2:40   ` Jia Hongtao-B38951
@ 2012-11-05 19:18     ` Timur Tabi
  0 siblings, 0 replies; 4+ messages in thread
From: Timur Tabi @ 2012-11-05 19:18 UTC (permalink / raw)
  To: Jia Hongtao-B38951; +Cc: Wood Scott-B07421, linuxppc-dev, Li Yang-R58472

Jia Hongtao-B38951 wrote:

>>
>>> +#ifdef CONFIG_SUSPEND
>>> +static int fsl_pci_resume(struct platform_device *pdev)
>>> +{
>>> +	struct pci_controller *hose;
>>> +	struct resource pci_rsrc;
>>> +
>>> +	hose = pci_find_hose_for_OF_device(pdev->dev.of_node);
>>> +	of_address_to_resource(pdev->dev.of_node, 0, &pci_rsrc);
>>> +	setup_pci_atmu(hose, &pci_rsrc);
>>> +
>>> +	return 0;
>>> +}
>>
>> Some of these functions can fail, so they should return an error code if
>> they do.
> 
> I checked the of_address_to_resource function now.
> Is that necessary to check other two fuctions?

Yes, check to ensure that 'hose' is not NULL.

-- 
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-11-05 19:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-01  2:19 [PATCH] powerpc/fsl-pci: Add PCI controller ATMU PM support Jia Hongtao
2012-11-01 13:25 ` [linuxppc-release] " Timur Tabi
2012-11-05  2:40   ` Jia Hongtao-B38951
2012-11-05 19:18     ` 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).