Commit ac6082dd authored by Raghav Dogra's avatar Raghav Dogra Committed by Scott Wood

powerpc/fsl-lbc: Modify suspend/resume entry sequence

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: default avatarRaghav Dogra <raghav.dogra@nxp.com>
[scottwood: dropped makefile churn]
Signed-off-by: default avatarScott Wood <oss@buserror.net>
parent 921fff35
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/mod_devicetable.h> #include <linux/mod_devicetable.h>
#include <linux/syscore_ops.h>
#include <asm/prom.h> #include <asm/prom.h>
#include <asm/fsl_lbc.h> #include <asm/fsl_lbc.h>
...@@ -352,24 +353,42 @@ static int fsl_lbc_ctrl_probe(struct platform_device *dev) ...@@ -352,24 +353,42 @@ static int fsl_lbc_ctrl_probe(struct platform_device *dev)
#ifdef CONFIG_SUSPEND #ifdef CONFIG_SUSPEND
/* save lbc registers */ /* 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_ctrl *ctrl;
struct fsl_lbc_regs __iomem *lbc = ctrl->regs; 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); ctrl->saved_regs = kmalloc(sizeof(struct fsl_lbc_regs), GFP_KERNEL);
if (!ctrl->saved_regs) if (!ctrl->saved_regs)
return -ENOMEM; return -ENOMEM;
_memcpy_fromio(ctrl->saved_regs, lbc, sizeof(struct fsl_lbc_regs)); _memcpy_fromio(ctrl->saved_regs, lbc, sizeof(struct fsl_lbc_regs));
out:
return 0; return 0;
} }
/* restore lbc registers */ /* restore lbc registers */
static int fsl_lbc_resume(struct platform_device *pdev) static void fsl_lbc_syscore_resume(void)
{ {
struct fsl_lbc_ctrl *ctrl = dev_get_drvdata(&pdev->dev); struct fsl_lbc_ctrl *ctrl;
struct fsl_lbc_regs __iomem *lbc = ctrl->regs; 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) { if (ctrl->saved_regs) {
_memcpy_toio(lbc, ctrl->saved_regs, _memcpy_toio(lbc, ctrl->saved_regs,
...@@ -377,7 +396,9 @@ static int fsl_lbc_resume(struct platform_device *pdev) ...@@ -377,7 +396,9 @@ static int fsl_lbc_resume(struct platform_device *pdev)
kfree(ctrl->saved_regs); kfree(ctrl->saved_regs);
ctrl->saved_regs = NULL; ctrl->saved_regs = NULL;
} }
return 0;
out:
return;
} }
#endif /* CONFIG_SUSPEND */ #endif /* CONFIG_SUSPEND */
...@@ -389,20 +410,26 @@ static const struct of_device_id fsl_lbc_match[] = { ...@@ -389,20 +410,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 = { static struct platform_driver fsl_lbc_ctrl_driver = {
.driver = { .driver = {
.name = "fsl-lbc", .name = "fsl-lbc",
.of_match_table = fsl_lbc_match, .of_match_table = fsl_lbc_match,
}, },
.probe = fsl_lbc_ctrl_probe, .probe = fsl_lbc_ctrl_probe,
#ifdef CONFIG_SUSPEND
.suspend = fsl_lbc_suspend,
.resume = fsl_lbc_resume,
#endif
}; };
static int __init fsl_lbc_init(void) 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); return platform_driver_register(&fsl_lbc_ctrl_driver);
} }
subsys_initcall(fsl_lbc_init); subsys_initcall(fsl_lbc_init);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment