aboutsummaryrefslogtreecommitdiff
path: root/src/soc/mediatek/mt8183/dramc_pi_basic_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/mediatek/mt8183/dramc_pi_basic_api.c')
-rw-r--r--src/soc/mediatek/mt8183/dramc_pi_basic_api.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/soc/mediatek/mt8183/dramc_pi_basic_api.c b/src/soc/mediatek/mt8183/dramc_pi_basic_api.c
index aa156f74f6..4a884b1976 100644
--- a/src/soc/mediatek/mt8183/dramc_pi_basic_api.c
+++ b/src/soc/mediatek/mt8183/dramc_pi_basic_api.c
@@ -47,10 +47,12 @@ void dramc_sw_impedance_cal(const struct sdram_params *params, u8 term,
broadcast_bak = dramc_get_broadcast();
dramc_set_broadcast(DRAMC_BROADCAST_OFF);
- clrbits32(&ch[0].phy.misc_spm_ctrl1, 0xf << 0);
- write32(&ch[0].phy.misc_spm_ctrl2, 0x0);
- write32(&ch[0].phy.misc_spm_ctrl0, 0x0);
- clrbits32(&ch[0].ao.impcal, 0x1 << 31);
+ for (u8 chn = 0; chn < CHANNEL_MAX; chn++) {
+ clrbits32(&ch[chn].phy.misc_spm_ctrl1, 0xf << 0);
+ write32(&ch[chn].phy.misc_spm_ctrl2, 0x0);
+ write32(&ch[chn].phy.misc_spm_ctrl0, 0x0);
+ clrbits32(&ch[chn].ao.impcal, 0x1 << 31);
+ }
impcal_bak = read32(&ch[0].ao.impcal);
dramc_sw_imp_cal_vref_sel(term, IMPCAL_STAGE_DRVP);
@@ -91,7 +93,7 @@ void dramc_sw_impedance_cal(const struct sdram_params *params, u8 term,
if (term == ODT_ON)
setbits32(&ch[0].ao.impcal, 0x1 << 21);
clrsetbits32(&ch[0].ao.shu[0].impcal1, 0x1f << 4 | 0x1f << 11,
- DRVP_result << 4 | 0x1f << 11);
+ DRVP_result << 4);
clrsetbits32(&ch[0].phy.shu[0].ca_cmd[11], 0xff << 0, 0x3);
for (u8 impx_drv = 0; impx_drv < 32; impx_drv++) {
@@ -150,9 +152,6 @@ void dramc_sw_impedance_save_reg(u8 freq_group,
sw_impedance[ODT_OFF][2] = sw_impedance[ODT_ON][2];
sw_impedance[ODT_OFF][3] = sw_impedance[ODT_ON][3];
- clrsetbits32(&ch[0].phy.shu[0].ca_cmd[11], 0xff, 0x3);
- dramc_sw_imp_cal_vref_sel(dq_term, IMPCAL_STAGE_DRVP);
-
/* DQ */
clrsetbits32(&ch[0].ao.shu[0].drving[0], (0x1f << 5) | (0x1f << 0),
(sw_impedance[dq_term][0] << 5) |
@@ -202,7 +201,10 @@ void dramc_sw_impedance_save_reg(u8 freq_group,
SET32_BITFIELDS(&ch[0].phy.shu[0].ca_cmd[0],
SHU1_CA_CMD0_RG_TX_ARCLK_DRVN_PRE, 0);
+ dramc_set_broadcast(DRAMC_BROADCAST_OFF);
clrsetbits32(&ch[0].phy.shu[0].ca_dll[1], 0x1f << 16, 0x9 << 16);
+ clrsetbits32(&ch[1].phy.shu[0].ca_dll[1], 0x1f << 16, 0x9 << 16);
+ dramc_set_broadcast(DRAMC_BROADCAST_ON);
}
static void transfer_pll_to_spm_control(void)