2 * This file is part of the coreboot project.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
15 #ifndef SOC_MEDIATEK_MT8173_EMI_H
16 #define SOC_MEDIATEK_MT8173_EMI_H
18 #include <soc/dramc_common.h>
33 * Vmem voltage adjustment:
35 * 2) NV: normal voltage
38 Vmem_HV_LPDDR3
= 0x50, /* 1.300V */
39 Vmem_NV_LPDDR3
= 0x44, /* 1.225V */
40 Vmem_LV_LPDDR3
= 0x36 /* 1.138V */
45 * Vcore voltage adjustment:
46 * 1) HHV: extra high voltage
48 * 3) NV: normal voltage
50 * 5) LLV: extra low voltage
52 Vcore_HHV_LPPDR3
= 0x60, /* 1.300V */
53 Vcore_HV_LPPDR3
= 0x48, /* 1.150V */
54 Vcore_NV_LPPDR3
= 0x44, /* 1.125V */
55 Vcore_LV_LPPDR3
= 0x34, /* 1.025V */
56 Vcore_LLV_LPPDR3
= 0x25 /* 0.931V */
59 struct mt8173_calib_params
{
63 s8 ca_train
[CHANNEL_NUM
][CATRAINING_NUM
];
64 s8 ca_train_center
[CHANNEL_NUM
];
65 s8 wr_level
[CHANNEL_NUM
][DQS_NUMBER
];
66 u8 gating_win
[CHANNEL_NUM
][DUAL_RANKS
][GW_PARAM_NUM
];
67 u32 rx_dqs_dly
[CHANNEL_NUM
];
68 u32 rx_dq_dly
[CHANNEL_NUM
][DQS_BIT_NUMBER
];
71 struct mt8173_timing_params
{
86 struct mt8173_emi_params
{
118 struct mt8173_mrs_params
{
129 CONA_DUAL_CH_EN
= BIT(0),
130 CONA_32BIT_EN
= BIT(1),
131 CONA_DUAL_RANK_EN
= BIT(17),
132 COL_ADDR_BITS_SHIFT
= 4,
133 COL_ADDR_BITS_MASK
= 3 << COL_ADDR_BITS_SHIFT
,
134 ROW_ADDR_BITS_SHIFT
= 12,
135 ROW_ADDR_BITS_MASK
= 3 << ROW_ADDR_BITS_SHIFT
138 struct mt8173_sdram_params
{
139 struct mt8173_calib_params calib_params
;
140 struct mt8173_timing_params ac_timing
;
141 struct mt8173_emi_params emi_set
;
142 struct mt8173_mrs_params mrs_set
;
144 unsigned int dram_freq
;
147 int complex_mem_test(u8
*start
, unsigned int len
);
148 void mt_set_emi(const struct mt8173_sdram_params
*sdram_params
);
149 void mt_mem_init(const struct mt8173_sdram_params
*sdram_params
);
150 const struct mt8173_sdram_params
*get_sdram_config(void);
151 size_t sdram_size(void);