Lines Matching refs:emif_data
40 static u32 sram_suspend_address(struct ti_emif_data *emif_data,
43 return (emif_data->ti_emif_sram_virt +
47 static phys_addr_t sram_resume_address(struct ti_emif_data *emif_data,
50 return ((unsigned long)emif_data->ti_emif_sram_phys +
54 static void ti_emif_free_sram(struct ti_emif_data *emif_data)
56 gen_pool_free(emif_data->sram_pool_code, emif_data->ti_emif_sram_virt,
58 gen_pool_free(emif_data->sram_pool_data,
59 emif_data->ti_emif_sram_data_virt,
64 struct ti_emif_data *emif_data)
69 emif_data->sram_pool_code = of_gen_pool_get(np, "sram", 0);
70 if (!emif_data->sram_pool_code) {
75 emif_data->ti_emif_sram_virt =
76 gen_pool_alloc(emif_data->sram_pool_code,
78 if (!emif_data->ti_emif_sram_virt) {
84 emif_data->ti_emif_sram_phys =
85 gen_pool_virt_to_phys(emif_data->sram_pool_code,
86 emif_data->ti_emif_sram_virt);
89 emif_data->sram_pool_data = of_gen_pool_get(np, "sram", 1);
90 if (!emif_data->sram_pool_data) {
96 emif_data->ti_emif_sram_data_virt =
97 gen_pool_alloc(emif_data->sram_pool_data,
99 if (!emif_data->ti_emif_sram_data_virt) {
106 emif_data->ti_emif_sram_data_phys =
107 gen_pool_virt_to_phys(emif_data->sram_pool_data,
108 emif_data->ti_emif_sram_data_virt);
113 emif_data->pm_functions.save_context =
114 sram_suspend_address(emif_data,
116 emif_data->pm_functions.enter_sr =
117 sram_suspend_address(emif_data,
119 emif_data->pm_functions.abort_sr =
120 sram_suspend_address(emif_data,
127 emif_data->pm_functions.restore_context =
128 sram_resume_address(emif_data,
130 emif_data->pm_functions.exit_sr =
131 sram_resume_address(emif_data,
133 emif_data->pm_functions.run_hw_leveling =
134 sram_resume_address(emif_data,
137 emif_data->pm_data.regs_virt =
138 (struct emif_regs_amx3 *)emif_data->ti_emif_sram_data_virt;
139 emif_data->pm_data.regs_phys = emif_data->ti_emif_sram_data_phys;
144 gen_pool_free(emif_data->sram_pool_code, emif_data->ti_emif_sram_virt,
149 static int ti_emif_push_sram(struct device *dev, struct ti_emif_data *emif_data)
154 copy_addr = sram_exec_copy(emif_data->sram_pool_code,
155 (void *)emif_data->ti_emif_sram_virt,
162 data_addr = sram_suspend_address(emif_data,
164 copy_addr = sram_exec_copy(emif_data->sram_pool_code,
166 &emif_data->pm_data,
167 sizeof(emif_data->pm_data));
183 static void ti_emif_configure_sr_delay(struct ti_emif_data *emif_data)
186 (emif_data->pm_data.ti_emif_base_addr_virt +
190 (emif_data->pm_data.ti_emif_base_addr_virt +
280 struct ti_emif_data *emif_data;
282 emif_data = devm_kzalloc(dev, sizeof(*emif_data), GFP_KERNEL);
283 if (!emif_data)
286 emif_data->pm_data.ti_emif_sram_config = (unsigned long) device_get_match_data(&pdev->dev);
288 emif_data->pm_data.ti_emif_base_addr_virt = devm_platform_get_and_ioremap_resource(pdev,
291 if (IS_ERR(emif_data->pm_data.ti_emif_base_addr_virt)) {
292 ret = PTR_ERR(emif_data->pm_data.ti_emif_base_addr_virt);
296 emif_data->pm_data.ti_emif_base_addr_phys = res->start;
298 ti_emif_configure_sr_delay(emif_data);
300 ret = ti_emif_alloc_sram(dev, emif_data);
304 ret = ti_emif_push_sram(dev, emif_data);
308 emif_instance = emif_data;
313 ti_emif_free_sram(emif_data);
320 struct ti_emif_data *emif_data = emif_instance;
324 ti_emif_free_sram(emif_data);