diff options
author | Jia Hongtao <B38951@freescale.com> | 2011-11-21 01:29:11 -0500 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2011-11-24 03:01:40 -0500 |
commit | 09cef8bd07fe473f1ba5fb5e34a1e3db3650b9a9 (patch) | |
tree | 07ed485fc4ce9d5b48db873c5d9591fcf6958ca4 /arch/powerpc/sysdev | |
parent | 05737c7c5bca9a4f3e0f8bb9476445971b64fafd (diff) |
powerpc/85xx: Add lbc suspend support for PM
Power supply for LBC registers is off when system go to deep-sleep state.
We save the values of registers before suspend and restore to registers
after resume.
We removed the last two reservation arrays from struct fsl_lbc_regs for
allocating less memory and minimizing the memcpy size.
Signed-off-by: Jiang Yutang <b14898@freescale.com>
Signed-off-by: Jia Hongtao <B38951@freescale.com>
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/sysdev')
-rw-r--r-- | arch/powerpc/sysdev/fsl_lbc.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/arch/powerpc/sysdev/fsl_lbc.c b/arch/powerpc/sysdev/fsl_lbc.c index d5c3c90ee69..483126d7b3c 100644 --- a/arch/powerpc/sysdev/fsl_lbc.c +++ b/arch/powerpc/sysdev/fsl_lbc.c | |||
@@ -332,6 +332,38 @@ err: | |||
332 | return ret; | 332 | return ret; |
333 | } | 333 | } |
334 | 334 | ||
335 | #ifdef CONFIG_SUSPEND | ||
336 | |||
337 | /* save lbc registers */ | ||
338 | static int fsl_lbc_suspend(struct platform_device *pdev, pm_message_t state) | ||
339 | { | ||
340 | struct fsl_lbc_ctrl *ctrl = dev_get_drvdata(&pdev->dev); | ||
341 | struct fsl_lbc_regs __iomem *lbc = ctrl->regs; | ||
342 | |||
343 | ctrl->saved_regs = kmalloc(sizeof(struct fsl_lbc_regs), GFP_KERNEL); | ||
344 | if (!ctrl->saved_regs) | ||
345 | return -ENOMEM; | ||
346 | |||
347 | _memcpy_fromio(ctrl->saved_regs, lbc, sizeof(struct fsl_lbc_regs)); | ||
348 | return 0; | ||
349 | } | ||
350 | |||
351 | /* restore lbc registers */ | ||
352 | static int fsl_lbc_resume(struct platform_device *pdev) | ||
353 | { | ||
354 | struct fsl_lbc_ctrl *ctrl = dev_get_drvdata(&pdev->dev); | ||
355 | struct fsl_lbc_regs __iomem *lbc = ctrl->regs; | ||
356 | |||
357 | if (ctrl->saved_regs) { | ||
358 | _memcpy_toio(lbc, ctrl->saved_regs, | ||
359 | sizeof(struct fsl_lbc_regs)); | ||
360 | kfree(ctrl->saved_regs); | ||
361 | ctrl->saved_regs = NULL; | ||
362 | } | ||
363 | return 0; | ||
364 | } | ||
365 | #endif /* CONFIG_SUSPEND */ | ||
366 | |||
335 | static const struct of_device_id fsl_lbc_match[] = { | 367 | static const struct of_device_id fsl_lbc_match[] = { |
336 | { .compatible = "fsl,elbc", }, | 368 | { .compatible = "fsl,elbc", }, |
337 | { .compatible = "fsl,pq3-localbus", }, | 369 | { .compatible = "fsl,pq3-localbus", }, |
@@ -346,6 +378,10 @@ static struct platform_driver fsl_lbc_ctrl_driver = { | |||
346 | .of_match_table = fsl_lbc_match, | 378 | .of_match_table = fsl_lbc_match, |
347 | }, | 379 | }, |
348 | .probe = fsl_lbc_ctrl_probe, | 380 | .probe = fsl_lbc_ctrl_probe, |
381 | #ifdef CONFIG_SUSPEND | ||
382 | .suspend = fsl_lbc_suspend, | ||
383 | .resume = fsl_lbc_resume, | ||
384 | #endif | ||
349 | }; | 385 | }; |
350 | 386 | ||
351 | static int __init fsl_lbc_init(void) | 387 | static int __init fsl_lbc_init(void) |