Lines Matching +full:sram +full:- +full:proc
1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (C) 2012-2018 Texas Instruments Incorporated - http://www.ti.com/
17 #include <linux/nvmem-consumer.h>
24 #include <linux/rtc/rtc-omap.h>
26 #include <linux/sram.h>
28 #include <linux/ti-emif-sram.h>
31 #include <asm/proc-fns.h>
35 #define AMX3_PM_SRAM_SYMBOL_OFFSET(sym) ((unsigned long)(sym) - \
36 (unsigned long)pm_sram->do_wfi)
104 pm_sram->do_wfi, in am33xx_push_sram_idle()
105 *pm_sram->do_wfi_sz); in am33xx_push_sram_idle()
108 "PM: %s: am33xx_do_wfi copy to sram failed\n", in am33xx_push_sram_idle()
110 return -ENODEV; in am33xx_push_sram_idle()
114 sram_suspend_address((unsigned long)pm_sram->emif_sram_table); in am33xx_push_sram_idle()
119 return -EPROBE_DEFER; in am33xx_push_sram_idle()
123 sram_suspend_address((unsigned long)pm_sram->ro_sram_data); in am33xx_push_sram_idle()
129 "PM: %s: ro_sram_data copy to sram failed\n", in am33xx_push_sram_idle()
131 return -ENODEV; in am33xx_push_sram_idle()
143 m3_ipc->ops->prepare_low_power(m3_ipc, WKUP_M3_IDLE); in am33xx_do_sram_idle()
145 return pm_ops->cpu_suspend(am33xx_do_wfi_sram, wfi_flags); in am33xx_do_sram_idle()
153 return -ENOMEM; in am43xx_map_gic()
177 omap_rtc_power_off_program(&omap_rtc->dev); in am33xx_rtc_only_idle()
183 * Note that the RTC module clock must be re-enabled only for rtc+ddr suspend.
193 pm_ops->check_off_mode_enable()) { in am33xx_pm_suspend()
200 pm_ops->save_context(); in am33xx_pm_suspend()
203 ret = pm_ops->soc_suspend(suspend_state, am33xx_rtc_only_idle, in am33xx_pm_suspend()
207 dev_info(pm33xx_dev, "Entering RTC Only mode with DDR in self-refresh\n"); in am33xx_pm_suspend()
211 pm_ops->restore_context(); in am33xx_pm_suspend()
212 m3_ipc->ops->set_rtc_only(m3_ipc); in am33xx_pm_suspend()
216 ret = pm_ops->soc_suspend(suspend_state, am33xx_do_wfi_sram, in am33xx_pm_suspend()
223 i = m3_ipc->ops->request_pm_status(m3_ipc); in am33xx_pm_suspend()
233 ret = -1; in am33xx_pm_suspend()
238 ret = -1; in am33xx_pm_suspend()
247 m3_ipc->ops->request_wake_src(m3_ipc)); in am33xx_pm_suspend()
251 if (suspend_state == PM_SUSPEND_MEM && pm_ops->check_off_mode_enable()) in am33xx_pm_suspend()
267 ret = -EINVAL; in am33xx_pm_enter()
275 int ret = -EINVAL; in am33xx_pm_begin()
278 if (state == PM_SUSPEND_MEM && pm_ops->check_off_mode_enable()) { in am33xx_pm_begin()
279 nvmem = devm_nvmem_device_get(&omap_rtc->dev, in am33xx_pm_begin()
289 pm_ops->begin_suspend(); in am33xx_pm_begin()
293 ret = m3_ipc->ops->prepare_low_power(m3_ipc, WKUP_M3_DEEPSLEEP); in am33xx_pm_begin()
296 ret = m3_ipc->ops->prepare_low_power(m3_ipc, WKUP_M3_STANDBY); in am33xx_pm_begin()
308 nvmem = devm_nvmem_device_get(&omap_rtc->dev, "omap_rtc_scratch0"); in am33xx_pm_end()
312 m3_ipc->ops->finish_low_power(m3_ipc); in am33xx_pm_end()
316 * 32 bits of Interrupt Set-Pending correspond to 32 in am33xx_pm_end()
333 pm_ops->finish_suspend(); in am33xx_pm_end()
365 m3_ipc->ops->set_mem_type(m3_ipc, temp); in am33xx_pm_set_ipc_ops()
369 *pm_sram->resume_offset + 0x4; in am33xx_pm_set_ipc_ops()
371 m3_ipc->ops->set_resume_address(m3_ipc, (void *)resume_address); in am33xx_pm_set_ipc_ops()
376 gen_pool_free(sram_pool, ocmcram_location, *pm_sram->do_wfi_sz); in am33xx_pm_free_sram()
382 * Push the minimal suspend-resume code to SRAM
387 of_find_compatible_node(NULL, NULL, "ti,omap3-mpu"); in am33xx_pm_alloc_sram()
390 np = of_find_compatible_node(NULL, NULL, "ti,omap4-mpu"); in am33xx_pm_alloc_sram()
392 return dev_err_probe(pm33xx_dev, -ENODEV, in am33xx_pm_alloc_sram()
397 sram_pool = of_gen_pool_get(np, "pm-sram", 0); in am33xx_pm_alloc_sram()
399 return dev_err_probe(pm33xx_dev, -ENODEV, in am33xx_pm_alloc_sram()
400 "PM: %s: Unable to get sram pool for ocmcram\n", in am33xx_pm_alloc_sram()
403 sram_pool_data = of_gen_pool_get(np, "pm-sram", 1); in am33xx_pm_alloc_sram()
405 return dev_err_probe(pm33xx_dev, -ENODEV, in am33xx_pm_alloc_sram()
406 "PM: %s: Unable to get sram data pool for ocmcram\n", in am33xx_pm_alloc_sram()
409 ocmcram_location = gen_pool_alloc(sram_pool, *pm_sram->do_wfi_sz); in am33xx_pm_alloc_sram()
411 return dev_err_probe(pm33xx_dev, -ENOMEM, in am33xx_pm_alloc_sram()
418 gen_pool_free(sram_pool, ocmcram_location, *pm_sram->do_wfi_sz); in am33xx_pm_alloc_sram()
419 return dev_err_probe(pm33xx_dev, -ENOMEM, in am33xx_pm_alloc_sram()
437 rtc_fck = of_clk_get_by_name(np->parent, "fck"); in am33xx_pm_rtc_setup()
444 error = -ENODEV; in am33xx_pm_rtc_setup()
451 error = -EPROBE_DEFER; in am33xx_pm_rtc_setup()
455 nvmem = devm_nvmem_device_get(&omap_rtc->dev, in am33xx_pm_rtc_setup()
461 pr_warn("PM: bootloader does not support rtc-only!\n"); in am33xx_pm_rtc_setup()
465 val = pm_sram->resume_address; in am33xx_pm_rtc_setup()
470 pr_warn("PM: no-rtc available, rtc-only mode disabled.\n"); in am33xx_pm_rtc_setup()
485 struct device *dev = &pdev->dev; in am33xx_pm_probe()
490 return -ENODEV; in am33xx_pm_probe()
492 pm_ops = dev->platform_data; in am33xx_pm_probe()
495 return -ENODEV; in am33xx_pm_probe()
504 pm_sram = pm_ops->get_sram_addrs(); in am33xx_pm_probe()
507 return -ENODEV; in am33xx_pm_probe()
513 return -EPROBE_DEFER; in am33xx_pm_probe()
537 * the DDR in self-refresh, we want to save the context in am33xx_pm_probe()
538 * of the EMIF, and we want the wkup_m3 to handle low-power in am33xx_pm_probe()
552 ret = pm_ops->init(am33xx_do_sram_idle); in am33xx_pm_probe()
555 ret = -ENODEV; in am33xx_pm_probe()
578 pm_runtime_put_sync(&pdev->dev); in am33xx_pm_remove()
579 pm_runtime_disable(&pdev->dev); in am33xx_pm_remove()
580 if (pm_ops->deinit) in am33xx_pm_remove()
581 pm_ops->deinit(); in am33xx_pm_remove()