|
@@ -332,6 +332,38 @@ err:
|
|
|
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", },
|
|
@@ -346,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)
|