Message ID | 1446186299-2921-1-git-send-email-raghav@freescale.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Scott Wood |
Headers | show |
On Fri, 2015-10-30 at 11:54 +0530, Raghav Dogra wrote: > Modify platform driver suspend/resume to syscore > suspend/resume. This is because p1022ds needs to use > localbus when entering the PCIE resume. > > Signed-off-by: Raghav Dogra <raghav@freescale.com> > --- > arch/powerpc/sysdev/Makefile | 2 +- > arch/powerpc/sysdev/fsl_lbc.c | 51 +++++++++++++++++++++++++++++++++------- > --- > 2 files changed, 40 insertions(+), 13 deletions(-) > > diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile > index f7cb2a1..4c19e614 100644 > --- a/arch/powerpc/sysdev/Makefile > +++ b/arch/powerpc/sysdev/Makefile > @@ -18,9 +18,9 @@ obj-$(CONFIG_PPC_PMI) += pmi.o > obj-$(CONFIG_U3_DART) += dart_iommu.o > obj-$(CONFIG_MMIO_NVRAM) += mmio_nvram.o > obj-$(CONFIG_FSL_SOC) += fsl_soc.o fsl_mpic_err.o > +obj-$(CONFIG_FSL_LBC) += fsl_lbc.o > obj-$(CONFIG_FSL_PCI) += fsl_pci.o $(fsl-msi-obj-y) > obj-$(CONFIG_FSL_PMC) += fsl_pmc.o > -obj-$(CONFIG_FSL_LBC) += fsl_lbc.o > obj-$(CONFIG_FSL_GTM) += fsl_gtm.o > obj-$(CONFIG_FSL_85XX_CACHE_SRAM) += fsl_85xx_l2ctlr.o > fsl_85xx_cache_sram.o > obj-$(CONFIG_SIMPLE_GPIO) += simple_gpio.o > diff --git a/arch/powerpc/sysdev/fsl_lbc.c b/arch/powerpc/sysdev/fsl_lbc.c > index d631022..332d700 100644 > --- a/arch/powerpc/sysdev/fsl_lbc.c > +++ b/arch/powerpc/sysdev/fsl_lbc.c > @@ -27,6 +27,7 @@ > #include <linux/platform_device.h> > #include <linux/interrupt.h> > #include <linux/mod_devicetable.h> > +#include <linux/syscore_ops.h> > #include <asm/prom.h> > #include <asm/fsl_lbc.h> > > @@ -354,24 +355,42 @@ err: > #ifdef CONFIG_SUSPEND > > /* save lbc registers */ > -static int fsl_lbc_suspend(struct platform_device *pdev, pm_message_t > state) > +static int fsl_lbc_syscore_suspend(void) > { > - struct fsl_lbc_ctrl *ctrl = dev_get_drvdata(&pdev->dev); > - struct fsl_lbc_regs __iomem *lbc = ctrl->regs; > + struct fsl_lbc_ctrl *ctrl; > + struct fsl_lbc_regs __iomem *lbc; > + > + ctrl = fsl_lbc_ctrl_dev; > + if (!ctrl) > + goto out; > + > + lbc = ctrl->regs; > + if (!lbc) > + goto out; > > ctrl->saved_regs = kmalloc(sizeof(struct fsl_lbc_regs), > GFP_KERNEL); > if (!ctrl->saved_regs) > return -ENOMEM; > > _memcpy_fromio(ctrl->saved_regs, lbc, sizeof(struct fsl_lbc_regs)); > + > +out: > return 0; > } > > /* restore lbc registers */ > -static int fsl_lbc_resume(struct platform_device *pdev) > +static int fsl_lbc_syscore_resume(void) > { > - struct fsl_lbc_ctrl *ctrl = dev_get_drvdata(&pdev->dev); > - struct fsl_lbc_regs __iomem *lbc = ctrl->regs; > + struct fsl_lbc_ctrl *ctrl; > + struct fsl_lbc_regs __iomem *lbc; > + > + ctrl = fsl_lbc_ctrl_dev; > + if (!ctrl) > + goto out; > + > + lbc = ctrl->regs; > + if (!lbc) > + goto out; > > if (ctrl->saved_regs) { > _memcpy_toio(lbc, ctrl->saved_regs, > @@ -379,7 +398,9 @@ static int fsl_lbc_resume(struct platform_device *pdev) > kfree(ctrl->saved_regs); > ctrl->saved_regs = NULL; > } > - return 0; > + > +out: > + return; > } > #endif /* CONFIG_SUSPEND */ > > @@ -391,20 +412,26 @@ static const struct of_device_id fsl_lbc_match[] = { > {}, > }; > > +#ifdef CONFIG_SUSPEND > +static struct syscore_ops lbc_syscore_pm_ops = { > + .suspend = fsl_lbc_syscore_suspend, > + .resume = fsl_lbc_syscore_resume, > +}; > +#endif > + > static struct platform_driver fsl_lbc_ctrl_driver = { > .driver = { > .name = "fsl-lbc", > .of_match_table = fsl_lbc_match, > }, > .probe = fsl_lbc_ctrl_probe, > -#ifdef CONFIG_SUSPEND > - .suspend = fsl_lbc_suspend, > - .resume = fsl_lbc_resume, > -#endif > }; > > static int __init fsl_lbc_init(void) > { > +#ifdef CONFIG_SUSPEND > + register_syscore_ops(&lbc_syscore_pm_ops); > +#endif > return platform_driver_register(&fsl_lbc_ctrl_driver); > } > -module_init(fsl_lbc_init); > +arch_initcall(fsl_lbc_init); This was changed to subsys_initcall as of v4.2... What tree did you use to generate this patch? I'll fix the conflict this time, but please always base patches against the latest code -- and test them in that context. -Scott
On Fri, Oct 30, 2015 at 11:54:59AM +0530, Raghav Dogra wrote: > /* restore lbc registers */ > -static int fsl_lbc_resume(struct platform_device *pdev) > +static int fsl_lbc_syscore_resume(void) > { > - struct fsl_lbc_ctrl *ctrl = dev_get_drvdata(&pdev->dev); > - struct fsl_lbc_regs __iomem *lbc = ctrl->regs; > + struct fsl_lbc_ctrl *ctrl; > + struct fsl_lbc_regs __iomem *lbc; > + > + ctrl = fsl_lbc_ctrl_dev; > + if (!ctrl) > + goto out; > + > + lbc = ctrl->regs; > + if (!lbc) > + goto out; > > if (ctrl->saved_regs) { > _memcpy_toio(lbc, ctrl->saved_regs, > @@ -379,7 +398,9 @@ static int fsl_lbc_resume(struct platform_device *pdev) > kfree(ctrl->saved_regs); > ctrl->saved_regs = NULL; > } > - return 0; > + > +out: > + return; > } arch/powerpc/sysdev/fsl_lbc.c:401:2: error: 'return' with no value, in function returning non-void [-Werror=return-type] > #endif /* CONFIG_SUSPEND */ > > @@ -391,20 +412,26 @@ static const struct of_device_id fsl_lbc_match[] = { > {}, > }; > > +#ifdef CONFIG_SUSPEND > +static struct syscore_ops lbc_syscore_pm_ops = { > + .suspend = fsl_lbc_syscore_suspend, > + .resume = fsl_lbc_syscore_resume, > +}; > +#endif arch/powerpc/sysdev/fsl_lbc.c:416:2: error: initialization from incompatible pointer type [-Werror] arch/powerpc/sysdev/fsl_lbc.c:416:2: error: (near initialization for 'lbc_syscore_pm_ops.resume') [-Werror] -Scott
> -----Original Message----- > From: Wood Scott-B07421 > Sent: Thursday, December 24, 2015 9:49 AM > To: Dogra Raghav-B46184 <raghav@freescale.com> > Cc: linuxppc-dev@lists.ozlabs.org; Kushwaha Prabhakar-B32579 > <prabhakar@freescale.com> > Subject: Re: [1/2] mpc85xx/lbc: modify suspend/resume entry sequence > > On Fri, Oct 30, 2015 at 11:54:59AM +0530, Raghav Dogra wrote: > > /* restore lbc registers */ > > -static int fsl_lbc_resume(struct platform_device *pdev) > > +static int fsl_lbc_syscore_resume(void) > > { > > - struct fsl_lbc_ctrl *ctrl = dev_get_drvdata(&pdev->dev); > > - struct fsl_lbc_regs __iomem *lbc = ctrl->regs; > > + struct fsl_lbc_ctrl *ctrl; > > + struct fsl_lbc_regs __iomem *lbc; > > + > > + ctrl = fsl_lbc_ctrl_dev; > > + if (!ctrl) > > + goto out; > > + > > + lbc = ctrl->regs; > > + if (!lbc) > > + goto out; > > > > if (ctrl->saved_regs) { > > _memcpy_toio(lbc, ctrl->saved_regs, @@ -379,7 +398,9 @@ > static int > > fsl_lbc_resume(struct platform_device *pdev) > > kfree(ctrl->saved_regs); > > ctrl->saved_regs = NULL; > > } > > - return 0; > > + > > +out: > > + return; > > } > > arch/powerpc/sysdev/fsl_lbc.c:401:2: error: > 'return' with no value, in function returning non-void [-Werror=return-type] > > > > #endif /* CONFIG_SUSPEND */ > > > > @@ -391,20 +412,26 @@ static const struct of_device_id fsl_lbc_match[] = > { > > {}, > > }; > > > > +#ifdef CONFIG_SUSPEND > > +static struct syscore_ops lbc_syscore_pm_ops = { > > + .suspend = fsl_lbc_syscore_suspend, > > + .resume = fsl_lbc_syscore_resume, > > +}; > > +#endif > > arch/powerpc/sysdev/fsl_lbc.c:416:2: error: > initialization from incompatible pointer type [-Werror] > arch/powerpc/sysdev/fsl_lbc.c:416:2: error: > (near initialization for 'lbc_syscore_pm_ops.resume') [-Werror] > Can you please help us with the tool-chain used for compiling. --prabhakar
On Wed, 2015-12-23 at 22:38 -0600, Kushwaha Prabhakar-B32579 wrote: > > -----Original Message----- > > From: Wood Scott-B07421 > > Sent: Thursday, December 24, 2015 9:49 AM > > To: Dogra Raghav-B46184 <raghav@freescale.com> > > Cc: linuxppc-dev@lists.ozlabs.org; Kushwaha Prabhakar-B32579 > > <prabhakar@freescale.com> > > Subject: Re: [1/2] mpc85xx/lbc: modify suspend/resume entry sequence > > > > On Fri, Oct 30, 2015 at 11:54:59AM +0530, Raghav Dogra wrote: > > > /* restore lbc registers */ > > > -static int fsl_lbc_resume(struct platform_device *pdev) > > > +static int fsl_lbc_syscore_resume(void) > > > { > > > - struct fsl_lbc_ctrl *ctrl = dev_get_drvdata(&pdev->dev); > > > - struct fsl_lbc_regs __iomem *lbc = ctrl->regs; > > > + struct fsl_lbc_ctrl *ctrl; > > > + struct fsl_lbc_regs __iomem *lbc; > > > + > > > + ctrl = fsl_lbc_ctrl_dev; > > > + if (!ctrl) > > > + goto out; > > > + > > > + lbc = ctrl->regs; > > > + if (!lbc) > > > + goto out; > > > > > > if (ctrl->saved_regs) { > > > _memcpy_toio(lbc, ctrl->saved_regs, @@ -379,7 +398,9 @@ > > static int > > > fsl_lbc_resume(struct platform_device *pdev) > > > kfree(ctrl->saved_regs); > > > ctrl->saved_regs = NULL; > > > } > > > - return 0; > > > + > > > +out: > > > + return; > > > } > > > > arch/powerpc/sysdev/fsl_lbc.c:401:2: error: > > 'return' with no value, in function returning non-void [-Werror=return > > -type] > > > > > > > #endif /* CONFIG_SUSPEND */ > > > > > > @@ -391,20 +412,26 @@ static const struct of_device_id fsl_lbc_match[] = > > { > > > {}, > > > }; > > > > > > +#ifdef CONFIG_SUSPEND > > > +static struct syscore_ops lbc_syscore_pm_ops = { > > > + .suspend = fsl_lbc_syscore_suspend, > > > + .resume = fsl_lbc_syscore_resume, > > > +}; > > > +#endif > > > > arch/powerpc/sysdev/fsl_lbc.c:416:2: error: > > initialization from incompatible pointer type [-Werror] > > arch/powerpc/sysdev/fsl_lbc.c:416:2: error: > > (near initialization for 'lbc_syscore_pm_ops.resume') [-Werror] > > > > Can you please help us with the tool-chain used for compiling. It doesn't matter. The patch is clearly wrong based on inspection. -Scott
> -----Original Message----- > From: Wood Scott-B07421 > Sent: Thursday, December 24, 2015 10:19 AM > To: Kushwaha Prabhakar-B32579 <prabhakar@freescale.com>; Dogra > Raghav-B46184 <raghav@freescale.com> > Cc: linuxppc-dev@lists.ozlabs.org > Subject: Re: [1/2] mpc85xx/lbc: modify suspend/resume entry sequence > > On Wed, 2015-12-23 at 22:38 -0600, Kushwaha Prabhakar-B32579 wrote: > > > -----Original Message----- > > > From: Wood Scott-B07421 > > > Sent: Thursday, December 24, 2015 9:49 AM > > > To: Dogra Raghav-B46184 <raghav@freescale.com> > > > Cc: linuxppc-dev@lists.ozlabs.org; Kushwaha Prabhakar-B32579 > > > <prabhakar@freescale.com> > > > Subject: Re: [1/2] mpc85xx/lbc: modify suspend/resume entry sequence > > > > > > On Fri, Oct 30, 2015 at 11:54:59AM +0530, Raghav Dogra wrote: > > > > /* restore lbc registers */ > > > > -static int fsl_lbc_resume(struct platform_device *pdev) > > > > +static int fsl_lbc_syscore_resume(void) > > > > { > > > > - struct fsl_lbc_ctrl *ctrl = dev_get_drvdata(&pdev->dev); > > > > - struct fsl_lbc_regs __iomem *lbc = ctrl->regs; > > > > + struct fsl_lbc_ctrl *ctrl; > > > > + struct fsl_lbc_regs __iomem *lbc; > > > > + > > > > + ctrl = fsl_lbc_ctrl_dev; > > > > + if (!ctrl) > > > > + goto out; > > > > + > > > > + lbc = ctrl->regs; > > > > + if (!lbc) > > > > + goto out; > > > > > > > > if (ctrl->saved_regs) { > > > > _memcpy_toio(lbc, ctrl->saved_regs, @@ -379,7 +398,9 @@ > > > static int > > > > fsl_lbc_resume(struct platform_device *pdev) > > > > kfree(ctrl->saved_regs); > > > > ctrl->saved_regs = NULL; > > > > } > > > > - return 0; > > > > + > > > > +out: > > > > + return; > > > > } > > > > > > arch/powerpc/sysdev/fsl_lbc.c:401:2: error: > > > 'return' with no value, in function returning non-void > > > [-Werror=return -type] > > > > > > > > > > #endif /* CONFIG_SUSPEND */ > > > > > > > > @@ -391,20 +412,26 @@ static const struct of_device_id > > > > fsl_lbc_match[] = > > > { > > > > {}, > > > > }; > > > > > > > > +#ifdef CONFIG_SUSPEND > > > > +static struct syscore_ops lbc_syscore_pm_ops = { > > > > + .suspend = fsl_lbc_syscore_suspend, > > > > + .resume = fsl_lbc_syscore_resume, }; #endif > > > > > > arch/powerpc/sysdev/fsl_lbc.c:416:2: error: > > > initialization from incompatible pointer type [-Werror] > > > arch/powerpc/sysdev/fsl_lbc.c:416:2: error: > > > (near initialization for 'lbc_syscore_pm_ops.resume') [-Werror] > > > > > > > Can you please help us with the tool-chain used for compiling. > > It doesn't matter. The patch is clearly wrong based on inspection. > Can you please help me with the things which needs to be updated Or Complete patch is wrong. --prabhakar
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile index f7cb2a1..4c19e614 100644 --- a/arch/powerpc/sysdev/Makefile +++ b/arch/powerpc/sysdev/Makefile @@ -18,9 +18,9 @@ obj-$(CONFIG_PPC_PMI) += pmi.o obj-$(CONFIG_U3_DART) += dart_iommu.o obj-$(CONFIG_MMIO_NVRAM) += mmio_nvram.o obj-$(CONFIG_FSL_SOC) += fsl_soc.o fsl_mpic_err.o +obj-$(CONFIG_FSL_LBC) += fsl_lbc.o obj-$(CONFIG_FSL_PCI) += fsl_pci.o $(fsl-msi-obj-y) obj-$(CONFIG_FSL_PMC) += fsl_pmc.o -obj-$(CONFIG_FSL_LBC) += fsl_lbc.o obj-$(CONFIG_FSL_GTM) += fsl_gtm.o obj-$(CONFIG_FSL_85XX_CACHE_SRAM) += fsl_85xx_l2ctlr.o fsl_85xx_cache_sram.o obj-$(CONFIG_SIMPLE_GPIO) += simple_gpio.o diff --git a/arch/powerpc/sysdev/fsl_lbc.c b/arch/powerpc/sysdev/fsl_lbc.c index d631022..332d700 100644 --- a/arch/powerpc/sysdev/fsl_lbc.c +++ b/arch/powerpc/sysdev/fsl_lbc.c @@ -27,6 +27,7 @@ #include <linux/platform_device.h> #include <linux/interrupt.h> #include <linux/mod_devicetable.h> +#include <linux/syscore_ops.h> #include <asm/prom.h> #include <asm/fsl_lbc.h> @@ -354,24 +355,42 @@ err: #ifdef CONFIG_SUSPEND /* save lbc registers */ -static int fsl_lbc_suspend(struct platform_device *pdev, pm_message_t state) +static int fsl_lbc_syscore_suspend(void) { - struct fsl_lbc_ctrl *ctrl = dev_get_drvdata(&pdev->dev); - struct fsl_lbc_regs __iomem *lbc = ctrl->regs; + struct fsl_lbc_ctrl *ctrl; + struct fsl_lbc_regs __iomem *lbc; + + ctrl = fsl_lbc_ctrl_dev; + if (!ctrl) + goto out; + + lbc = ctrl->regs; + if (!lbc) + goto out; ctrl->saved_regs = kmalloc(sizeof(struct fsl_lbc_regs), GFP_KERNEL); if (!ctrl->saved_regs) return -ENOMEM; _memcpy_fromio(ctrl->saved_regs, lbc, sizeof(struct fsl_lbc_regs)); + +out: return 0; } /* restore lbc registers */ -static int fsl_lbc_resume(struct platform_device *pdev) +static int fsl_lbc_syscore_resume(void) { - struct fsl_lbc_ctrl *ctrl = dev_get_drvdata(&pdev->dev); - struct fsl_lbc_regs __iomem *lbc = ctrl->regs; + struct fsl_lbc_ctrl *ctrl; + struct fsl_lbc_regs __iomem *lbc; + + ctrl = fsl_lbc_ctrl_dev; + if (!ctrl) + goto out; + + lbc = ctrl->regs; + if (!lbc) + goto out; if (ctrl->saved_regs) { _memcpy_toio(lbc, ctrl->saved_regs, @@ -379,7 +398,9 @@ static int fsl_lbc_resume(struct platform_device *pdev) kfree(ctrl->saved_regs); ctrl->saved_regs = NULL; } - return 0; + +out: + return; } #endif /* CONFIG_SUSPEND */ @@ -391,20 +412,26 @@ static const struct of_device_id fsl_lbc_match[] = { {}, }; +#ifdef CONFIG_SUSPEND +static struct syscore_ops lbc_syscore_pm_ops = { + .suspend = fsl_lbc_syscore_suspend, + .resume = fsl_lbc_syscore_resume, +}; +#endif + static struct platform_driver fsl_lbc_ctrl_driver = { .driver = { .name = "fsl-lbc", .of_match_table = fsl_lbc_match, }, .probe = fsl_lbc_ctrl_probe, -#ifdef CONFIG_SUSPEND - .suspend = fsl_lbc_suspend, - .resume = fsl_lbc_resume, -#endif }; static int __init fsl_lbc_init(void) { +#ifdef CONFIG_SUSPEND + register_syscore_ops(&lbc_syscore_pm_ops); +#endif return platform_driver_register(&fsl_lbc_ctrl_driver); } -module_init(fsl_lbc_init); +arch_initcall(fsl_lbc_init);
Modify platform driver suspend/resume to syscore suspend/resume. This is because p1022ds needs to use localbus when entering the PCIE resume. Signed-off-by: Raghav Dogra <raghav@freescale.com> --- arch/powerpc/sysdev/Makefile | 2 +- arch/powerpc/sysdev/fsl_lbc.c | 51 +++++++++++++++++++++++++++++++++---------- 2 files changed, 40 insertions(+), 13 deletions(-)