• Home
  • Raw
  • Download

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()
145 ret = m3_ipc->ops->prepare_low_power(m3_ipc, WKUP_M3_IDLE); in am33xx_do_sram_idle()
147 return pm_ops->cpu_suspend(am33xx_do_wfi_sram, wfi_flags); in am33xx_do_sram_idle()
155 return -ENOMEM; in am43xx_map_gic()
179 omap_rtc_power_off_program(&omap_rtc->dev); in am33xx_rtc_only_idle()
185 * Note that the RTC module clock must be re-enabled only for rtc+ddr suspend.
195 pm_ops->check_off_mode_enable()) { in am33xx_pm_suspend()
202 pm_ops->save_context(); in am33xx_pm_suspend()
205 ret = pm_ops->soc_suspend(suspend_state, am33xx_rtc_only_idle, in am33xx_pm_suspend()
209 dev_info(pm33xx_dev, "Entering RTC Only mode with DDR in self-refresh\n"); in am33xx_pm_suspend()
213 pm_ops->restore_context(); in am33xx_pm_suspend()
214 m3_ipc->ops->set_rtc_only(m3_ipc); in am33xx_pm_suspend()
218 ret = pm_ops->soc_suspend(suspend_state, am33xx_do_wfi_sram, in am33xx_pm_suspend()
225 i = m3_ipc->ops->request_pm_status(m3_ipc); in am33xx_pm_suspend()
235 ret = -1; in am33xx_pm_suspend()
240 ret = -1; in am33xx_pm_suspend()
249 m3_ipc->ops->request_wake_src(m3_ipc)); in am33xx_pm_suspend()
253 if (suspend_state == PM_SUSPEND_MEM && pm_ops->check_off_mode_enable()) in am33xx_pm_suspend()
269 ret = -EINVAL; in am33xx_pm_enter()
277 int ret = -EINVAL; in am33xx_pm_begin()
280 if (state == PM_SUSPEND_MEM && pm_ops->check_off_mode_enable()) { in am33xx_pm_begin()
281 nvmem = devm_nvmem_device_get(&omap_rtc->dev, in am33xx_pm_begin()
291 pm_ops->begin_suspend(); in am33xx_pm_begin()
295 ret = m3_ipc->ops->prepare_low_power(m3_ipc, WKUP_M3_DEEPSLEEP); in am33xx_pm_begin()
298 ret = m3_ipc->ops->prepare_low_power(m3_ipc, WKUP_M3_STANDBY); in am33xx_pm_begin()
310 nvmem = devm_nvmem_device_get(&omap_rtc->dev, "omap_rtc_scratch0"); in am33xx_pm_end()
314 m3_ipc->ops->finish_low_power(m3_ipc); in am33xx_pm_end()
318 * 32 bits of Interrupt Set-Pending correspond to 32 in am33xx_pm_end()
335 pm_ops->finish_suspend(); in am33xx_pm_end()
367 m3_ipc->ops->set_mem_type(m3_ipc, temp); in am33xx_pm_set_ipc_ops()
371 *pm_sram->resume_offset + 0x4; in am33xx_pm_set_ipc_ops()
373 m3_ipc->ops->set_resume_address(m3_ipc, (void *)resume_address); in am33xx_pm_set_ipc_ops()
378 gen_pool_free(sram_pool, ocmcram_location, *pm_sram->do_wfi_sz); in am33xx_pm_free_sram()
384 * Push the minimal suspend-resume code to SRAM
391 np = of_find_compatible_node(NULL, NULL, "ti,omap3-mpu"); in am33xx_pm_alloc_sram()
393 np = of_find_compatible_node(NULL, NULL, "ti,omap4-mpu"); in am33xx_pm_alloc_sram()
397 return -ENODEV; in am33xx_pm_alloc_sram()
401 sram_pool = of_gen_pool_get(np, "pm-sram", 0); in am33xx_pm_alloc_sram()
403 dev_err(pm33xx_dev, "PM: %s: Unable to get sram pool for ocmcram\n", in am33xx_pm_alloc_sram()
405 ret = -ENODEV; in am33xx_pm_alloc_sram()
409 sram_pool_data = of_gen_pool_get(np, "pm-sram", 1); in am33xx_pm_alloc_sram()
411 dev_err(pm33xx_dev, "PM: %s: Unable to get sram data pool for ocmcram\n", in am33xx_pm_alloc_sram()
413 ret = -ENODEV; in am33xx_pm_alloc_sram()
417 ocmcram_location = gen_pool_alloc(sram_pool, *pm_sram->do_wfi_sz); in am33xx_pm_alloc_sram()
421 ret = -ENOMEM; in am33xx_pm_alloc_sram()
429 gen_pool_free(sram_pool, ocmcram_location, *pm_sram->do_wfi_sz); in am33xx_pm_alloc_sram()
430 ret = -ENOMEM; in am33xx_pm_alloc_sram()
449 rtc_fck = of_clk_get_by_name(np->parent, "fck"); in am33xx_pm_rtc_setup()
456 error = -ENODEV; in am33xx_pm_rtc_setup()
463 error = -EPROBE_DEFER; in am33xx_pm_rtc_setup()
467 nvmem = devm_nvmem_device_get(&omap_rtc->dev, in am33xx_pm_rtc_setup()
473 pr_warn("PM: bootloader does not support rtc-only!\n"); in am33xx_pm_rtc_setup()
477 val = pm_sram->resume_address; in am33xx_pm_rtc_setup()
482 pr_warn("PM: no-rtc available, rtc-only mode disabled.\n"); in am33xx_pm_rtc_setup()
497 struct device *dev = &pdev->dev; in am33xx_pm_probe()
502 return -ENODEV; in am33xx_pm_probe()
504 pm_ops = dev->platform_data; in am33xx_pm_probe()
507 return -ENODEV; in am33xx_pm_probe()
516 pm_sram = pm_ops->get_sram_addrs(); in am33xx_pm_probe()
519 return -ENODEV; in am33xx_pm_probe()
525 return -EPROBE_DEFER; in am33xx_pm_probe()
549 * the DDR in self-refresh, we want to save the context in am33xx_pm_probe()
550 * of the EMIF, and we want the wkup_m3 to handle low-power in am33xx_pm_probe()
566 ret = pm_ops->init(am33xx_do_sram_idle); in am33xx_pm_probe()
569 ret = -ENODEV; in am33xx_pm_probe()
592 pm_runtime_put_sync(&pdev->dev); in am33xx_pm_remove()
593 pm_runtime_disable(&pdev->dev); in am33xx_pm_remove()
594 if (pm_ops->deinit) in am33xx_pm_remove()
595 pm_ops->deinit(); in am33xx_pm_remove()