diff options
Diffstat (limited to 'drivers/memory')
-rw-r--r-- | drivers/memory/ti-emif-pm.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/memory/ti-emif-pm.c b/drivers/memory/ti-emif-pm.c index 632651f4b6e8..2250d03ea17f 100644 --- a/drivers/memory/ti-emif-pm.c +++ b/drivers/memory/ti-emif-pm.c | |||
@@ -249,6 +249,34 @@ static const struct of_device_id ti_emif_of_match[] = { | |||
249 | }; | 249 | }; |
250 | MODULE_DEVICE_TABLE(of, ti_emif_of_match); | 250 | MODULE_DEVICE_TABLE(of, ti_emif_of_match); |
251 | 251 | ||
252 | #ifdef CONFIG_PM_SLEEP | ||
253 | static int ti_emif_resume(struct device *dev) | ||
254 | { | ||
255 | unsigned long tmp = | ||
256 | __raw_readl((void *)emif_instance->ti_emif_sram_virt); | ||
257 | |||
258 | /* | ||
259 | * Check to see if what we are copying is already present in the | ||
260 | * first byte at the destination, only copy if it is not which | ||
261 | * indicates we have lost context and sram no longer contains | ||
262 | * the PM code | ||
263 | */ | ||
264 | if (tmp != ti_emif_sram) | ||
265 | ti_emif_push_sram(dev, emif_instance); | ||
266 | |||
267 | return 0; | ||
268 | } | ||
269 | |||
270 | static int ti_emif_suspend(struct device *dev) | ||
271 | { | ||
272 | /* | ||
273 | * The contents will be present in DDR hence no need to | ||
274 | * explicitly save | ||
275 | */ | ||
276 | return 0; | ||
277 | } | ||
278 | #endif /* CONFIG_PM_SLEEP */ | ||
279 | |||
252 | static int ti_emif_probe(struct platform_device *pdev) | 280 | static int ti_emif_probe(struct platform_device *pdev) |
253 | { | 281 | { |
254 | int ret; | 282 | int ret; |
@@ -308,12 +336,17 @@ static int ti_emif_remove(struct platform_device *pdev) | |||
308 | return 0; | 336 | return 0; |
309 | } | 337 | } |
310 | 338 | ||
339 | static const struct dev_pm_ops ti_emif_pm_ops = { | ||
340 | SET_SYSTEM_SLEEP_PM_OPS(ti_emif_suspend, ti_emif_resume) | ||
341 | }; | ||
342 | |||
311 | static struct platform_driver ti_emif_driver = { | 343 | static struct platform_driver ti_emif_driver = { |
312 | .probe = ti_emif_probe, | 344 | .probe = ti_emif_probe, |
313 | .remove = ti_emif_remove, | 345 | .remove = ti_emif_remove, |
314 | .driver = { | 346 | .driver = { |
315 | .name = KBUILD_MODNAME, | 347 | .name = KBUILD_MODNAME, |
316 | .of_match_table = of_match_ptr(ti_emif_of_match), | 348 | .of_match_table = of_match_ptr(ti_emif_of_match), |
349 | .pm = &ti_emif_pm_ops, | ||
317 | }, | 350 | }, |
318 | }; | 351 | }; |
319 | module_platform_driver(ti_emif_driver); | 352 | module_platform_driver(ti_emif_driver); |