Rex-BC Chen | 73e6b8e | 2021-11-02 10:31:53 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
Xi Chen | ad63eab | 2022-02-17 16:48:52 +0800 | [diff] [blame] | 3 | #include <assert.h> |
| 4 | #include <cbmem.h> |
| 5 | #include <commonlib/bsd/mem_chip_info.h> |
Rex-BC Chen | 73e6b8e | 2021-11-02 10:31:53 +0800 | [diff] [blame] | 6 | #include <soc/emi.h> |
| 7 | |
| 8 | size_t sdram_size(void) |
| 9 | { |
Xi Chen | ad63eab | 2022-02-17 16:48:52 +0800 | [diff] [blame] | 10 | const struct mem_chip_info *mc; |
| 11 | size_t size = 0; |
| 12 | |
Kyösti Mälkki | 11cac78 | 2022-04-07 07:16:48 +0300 | [diff] [blame] | 13 | if (ENV_RAMINIT) { |
Xi Chen | ad63eab | 2022-02-17 16:48:52 +0800 | [diff] [blame] | 14 | size = mtk_dram_size(); |
| 15 | printk(BIOS_INFO, "dram size (romstage): %#lx\n", size); |
| 16 | return size; |
| 17 | } |
| 18 | |
| 19 | mc = cbmem_find(CBMEM_ID_MEM_CHIP_INFO); |
| 20 | assert(mc); |
| 21 | |
| 22 | for (unsigned int i = 0; i < mc->num_channels; ++i) |
| 23 | size += mc->channel[i].density; |
| 24 | |
| 25 | printk(BIOS_INFO, "dram size: %#lx\n", size); |
| 26 | return size; |
Rex-BC Chen | 73e6b8e | 2021-11-02 10:31:53 +0800 | [diff] [blame] | 27 | } |
Ryan Chuang | 773c007 | 2021-12-27 11:38:21 +0800 | [diff] [blame] | 28 | |
| 29 | void mt_set_emi(struct dramc_param *dparam) |
| 30 | { |
| 31 | /* Do nothing */ |
| 32 | } |