Xi Chen | e8c681c | 2021-03-03 17:58:07 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
Xi Chen | e8c681c | 2021-03-03 17:58:07 +0800 | [diff] [blame] | 3 | #include <stdint.h> |
| 4 | #include <soc/dramc_common.h> |
| 5 | #include <soc/dramc_param.h> |
| 6 | #include <soc/emi.h> |
| 7 | |
| 8 | struct dramc_param *dramc_params; |
| 9 | |
| 10 | bool is_dvfs_enabled(void) |
| 11 | { |
| 12 | dramc_info("dram_init: config_dvfs: %d\n", |
| 13 | dramc_params->dramc_datas.ddr_info.config_dvfs); |
| 14 | return !!(dramc_params->dramc_datas.ddr_info.config_dvfs); |
| 15 | } |
| 16 | |
| 17 | u32 get_ddr_geometry(void) |
| 18 | { |
| 19 | dramc_info("dram_init: ddr_geometry: %d\n", |
Yu-Ping Wu | c074f61 | 2021-04-12 11:03:57 +0800 | [diff] [blame] | 20 | dramc_params->dramc_datas.ddr_info.sdram.ddr_geometry); |
| 21 | return dramc_params->dramc_datas.ddr_info.sdram.ddr_geometry; |
Xi Chen | e8c681c | 2021-03-03 17:58:07 +0800 | [diff] [blame] | 22 | } |
| 23 | |
| 24 | u32 get_ddr_type(void) |
| 25 | { |
| 26 | dramc_info("dram_init: ddr_type: %d\n", |
Yu-Ping Wu | c074f61 | 2021-04-12 11:03:57 +0800 | [diff] [blame] | 27 | dramc_params->dramc_datas.ddr_info.sdram.ddr_type); |
| 28 | return dramc_params->dramc_datas.ddr_info.sdram.ddr_type; |
Xi Chen | e8c681c | 2021-03-03 17:58:07 +0800 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | void init_dram_by_params(struct dramc_param *dparam) |
| 32 | { |
| 33 | dramc_params = dparam; |
| 34 | mt_set_emi(dramc_params); |
| 35 | } |