summaryrefslogtreecommitdiff
path: root/drivers/mtd
diff options
context:
space:
mode:
authorBhavesh Parekh <bparekh@nvidia.com>2012-10-04 15:32:36 +0530
committerDan Willemsen <dwillemsen@nvidia.com>2013-09-14 01:32:12 -0700
commit12985576688758d593bf1ced74b32ee31f803d55 (patch)
tree42d6e13e873876e66304518e9d93621240abf7af /drivers/mtd
parent23c7e8a85d66ba28fc195eef21dcffb162a662b1 (diff)
driver: nor: tegra: Adding suspend and resume routine
Adding suspend and resume function for TegraNOR to restore the config registers and timing register bug 1010500 bug 1053727 Change-Id: I2531c0deaf17c02437b8fab9e15f9a90a9584110 Signed-off-by: Bhavesh Parekh <bparekh@nvidia.com> Reviewed-on: http://git-master/r/141525 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com> (cherry picked from commit 4c6b09264410173c66314d42d3379d53012a1882) Reviewed-on: http://git-master/r/161870 Tested-by: Nitin Agrawal <nitina@nvidia.com> Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/maps/tegra_nor.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/mtd/maps/tegra_nor.c b/drivers/mtd/maps/tegra_nor.c
index 989fb2b334b8..d275b3c48070 100644
--- a/drivers/mtd/maps/tegra_nor.c
+++ b/drivers/mtd/maps/tegra_nor.c
@@ -124,6 +124,7 @@ struct tegra_nor_info {
u32 init_config;
u32 timing0_default, timing1_default;
u32 timing0_read, timing1_read;
+ u32 suspend_config;
};
static inline unsigned long snor_tegra_readl(struct tegra_nor_info *tnor,
@@ -514,9 +515,32 @@ static int tegra_nor_remove(struct platform_device *pdev)
return 0;
}
+#ifdef CONFIG_PM
+static int tegra_nor_suspend(struct platform_device *pdev, pm_message_t state)
+{
+ struct tegra_nor_info *info = platform_get_drvdata(pdev);
+ info->suspend_config = snor_tegra_readl(info, TEGRA_SNOR_CONFIG_REG);
+ return 0;
+}
+
+static int tegra_nor_resume(struct platform_device *pdev)
+{
+ struct tegra_nor_info *info = platform_get_drvdata(pdev);
+
+ snor_tegra_writel(info, info->suspend_config, TEGRA_SNOR_CONFIG_REG);
+ snor_tegra_writel(info, info->timing1_default, TEGRA_SNOR_TIMING1_REG);
+ snor_tegra_writel(info, info->timing0_default, TEGRA_SNOR_TIMING0_REG);
+ return 0;
+}
+#endif
+
static struct platform_driver __refdata tegra_nor_driver = {
.probe = tegra_nor_probe,
.remove = tegra_nor_remove,
+#ifdef CONFIG_PM
+ .suspend = tegra_nor_suspend,
+ .resume = tegra_nor_resume,
+#endif
.driver = {
.name = DRV_NAME,
.owner = THIS_MODULE,