summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/fsl_lbc.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-11-25 15:25:39 +1100
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-11-25 15:25:39 +1100
commit56368797d6c2d093bb0e7a7e5fe7b267274b6c58 (patch)
treefc74d34be3628d31e50d3987dd372b73dd50c352 /arch/powerpc/sysdev/fsl_lbc.c
parente075cd7001634c9984950488d9201fcf896dca27 (diff)
parent8e18862d52b8ecd62354dad117aff22391b2c4e5 (diff)
downloadblackbird-obmc-linux-56368797d6c2d093bb0e7a7e5fe7b267274b6c58.tar.gz
blackbird-obmc-linux-56368797d6c2d093bb0e7a7e5fe7b267274b6c58.zip
Merge remote-tracking branch 'kumar/next' into next
Diffstat (limited to 'arch/powerpc/sysdev/fsl_lbc.c')
-rw-r--r--arch/powerpc/sysdev/fsl_lbc.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/arch/powerpc/sysdev/fsl_lbc.c b/arch/powerpc/sysdev/fsl_lbc.c
index c4d96fa32ba5..483126d7b3c0 100644
--- a/arch/powerpc/sysdev/fsl_lbc.c
+++ b/arch/powerpc/sysdev/fsl_lbc.c
@@ -328,9 +328,42 @@ static int __devinit fsl_lbc_ctrl_probe(struct platform_device *dev)
err:
iounmap(fsl_lbc_ctrl_dev->regs);
kfree(fsl_lbc_ctrl_dev);
+ fsl_lbc_ctrl_dev = NULL;
return ret;
}
+#ifdef CONFIG_SUSPEND
+
+/* save lbc registers */
+static int fsl_lbc_suspend(struct platform_device *pdev, pm_message_t state)
+{
+ struct fsl_lbc_ctrl *ctrl = dev_get_drvdata(&pdev->dev);
+ struct fsl_lbc_regs __iomem *lbc = ctrl->regs;
+
+ 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));
+ return 0;
+}
+
+/* restore lbc registers */
+static int fsl_lbc_resume(struct platform_device *pdev)
+{
+ struct fsl_lbc_ctrl *ctrl = dev_get_drvdata(&pdev->dev);
+ struct fsl_lbc_regs __iomem *lbc = ctrl->regs;
+
+ if (ctrl->saved_regs) {
+ _memcpy_toio(lbc, ctrl->saved_regs,
+ sizeof(struct fsl_lbc_regs));
+ kfree(ctrl->saved_regs);
+ ctrl->saved_regs = NULL;
+ }
+ return 0;
+}
+#endif /* CONFIG_SUSPEND */
+
static const struct of_device_id fsl_lbc_match[] = {
{ .compatible = "fsl,elbc", },
{ .compatible = "fsl,pq3-localbus", },
@@ -345,6 +378,10 @@ static struct platform_driver fsl_lbc_ctrl_driver = {
.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)
OpenPOWER on IntegriCloud