huayang duan has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32284
Change subject: mediatek/mt8183: fix mode register setting fail issue ......................................................................
mediatek/mt8183: fix mode register setting fail issue
the mode register setting of DRAM maybe failed without delay operate, need add delay after each MR write.
BUG=b:80501386 BRANCH=none TEST=Boots correctly and stress test pass on Kukui.
Change-Id: I51785e90b2014994be5018bfe543245d44626242 Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c 1 file changed, 128 insertions(+), 44 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/32284/1
diff --git a/src/soc/mediatek/mt8183/dramc_init_setting.c b/src/soc/mediatek/mt8183/dramc_init_setting.c old mode 100644 new mode 100755 index d275127..98108c6 --- a/src/soc/mediatek/mt8183/dramc_init_setting.c +++ b/src/soc/mediatek/mt8183/dramc_init_setting.c @@ -18,6 +18,7 @@ #include <soc/dramc_pi_api.h> #include <soc/dramc_register.h> #include <soc/infracfg.h> +#include <delay.h>
struct reg_init_value { u32 *addr; @@ -620,7 +621,52 @@ {&ch[1].phy.shu[0].rk[1].b[1].dq[1], 0x22000000}, {&ch[1].phy.shu[0].b[0].dll[1], 0x00022501},
- /* dramc mode register init */ + /* update the ac timing */ + {&ch[0].ao.shu[0].actim[0], 0x06020c07}, + {&ch[0].ao.shu[0].actim[1], 0x10080501}, + {&ch[0].ao.shu[0].actim[2], 0x07070201}, + {&ch[0].ao.shu[0].actim[3], 0x6164002c}, + {&ch[0].ao.shu[0].actim[4], 0x22650077}, + {&ch[0].ao.shu[0].actim[5], 0x0a000c0b}, + {&ch[0].ao.shu[0].actim_xrt, 0x05030609}, + {&ch[0].ao.shu[0].ac_time_05t, 0x000106e1}, + {&ch[0].ao.catraining1, 0x0b000000}, + {&ch[0].ao.shu[0].rk[0].dqsctl, 0x00000004}, + {&ch[0].ao.shu[0].rk[1].dqsctl, 0x00000004}, + {&ch[0].ao.shu[0].odtctrl, 0xc001004f}, + {&ch[0].ao.shu[0].conf[1], 0x34000d0f}, + {&ch[0].ao.shu[0].conf[2], 0x9007640f}, + {&ch[0].ao.shu[0].scintv, 0x4e39eb36}, + {&ch[0].ao.shu[0].ckectrl, 0x33210000}, + {&ch[0].ao.ckectrl, 0x88d02440}, + {&ch[0].ao.shu[0].rankctl, 0x64300003}, + {&ch[0].ao.shu[0].rankctl, 0x64301203}, + {&ch[1].ao.shu[0].actim[0], 0x06020c07}, + {&ch[1].ao.shu[0].actim[1], 0x10080501}, + {&ch[1].ao.shu[0].actim[2], 0x07070201}, + {&ch[1].ao.shu[0].actim[3], 0x6164002c}, + {&ch[1].ao.shu[0].actim[4], 0x22650077}, + {&ch[1].ao.shu[0].actim[5], 0x0a000c0b}, + {&ch[1].ao.shu[0].actim_xrt, 0x05030609}, + {&ch[1].ao.shu[0].ac_time_05t, 0x000106e1}, + {&ch[1].ao.catraining1, 0x0b000000}, + {&ch[1].ao.shu[0].rk[0].dqsctl, 0x00000004}, + {&ch[1].ao.shu[0].rk[1].dqsctl, 0x00000004}, + {&ch[1].ao.shu[0].odtctrl, 0xc001004f}, + {&ch[1].ao.shu[0].conf[1], 0x34000d0f}, + {&ch[1].ao.shu[0].conf[2], 0x9007640f}, + {&ch[1].ao.shu[0].scintv, 0x4e39eb36}, + {&ch[1].ao.shu[0].ckectrl, 0x33210000}, + {&ch[1].ao.ckectrl, 0x88d02440}, + {&ch[1].ao.shu[0].rankctl, 0x64300003}, + {&ch[1].ao.shu[0].rankctl, 0x64301203}, + {&ch[0].ao.arbctl, 0x00000c80}, + {&ch[0].ao.rstmask, 0x00000000}, + {&ch[0].ao.arbctl, 0x00000c80}, +}; + +struct reg_init_value dramc_mode_reg_init_sequence[] = { + /* dramc power on sequence */ {&ch[0].phy.misc_ctrl1, 0x8100908c}, {&ch[1].phy.misc_ctrl1, 0x8100908c}, {&ch[0].ao.ckectrl, 0x88d02480}, @@ -632,6 +678,8 @@ {&ch[0].ao.ckectrl, 0x88d02440}, {&ch[1].ao.ckectrl, 0x88d02440}, {&ch[0].ao.mrs, 0x00000000}, + + /* CH0 dramc ZQ Calibration */ {&ch[0].ao.dramc_pd_ctrl, 0xc4000107}, {&ch[0].ao.ckectrl, 0x88d02440}, {&ch[0].ao.mrs, 0x00000000}, @@ -641,70 +689,104 @@ {&ch[0].ao.mrs, 0x00000000}, {&ch[0].ao.dramc_pd_ctrl, 0xc4000107}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR13 */ {&ch[0].ao.mrs, 0x00000d18}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR12 */ {&ch[0].ao.mrs, 0x00000c5d}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR1 */ {&ch[0].ao.mrs, 0x00000156}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR2 */ {&ch[0].ao.mrs, 0x0000020b}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR11 */ {&ch[0].ao.mrs, 0x00000b00}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR22 */ {&ch[0].ao.mrs, 0x00001638}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR14 */ {&ch[0].ao.mrs, 0x00000e5d}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR3 */ {&ch[0].ao.mrs, 0x00000330}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR13 */ {&ch[0].ao.mrs, 0x00000d58}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR12 */ {&ch[0].ao.mrs, 0x00000c5d}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR1 */ {&ch[0].ao.mrs, 0x00000156}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR2 */ {&ch[0].ao.mrs, 0x0000022d}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR11 */ {&ch[0].ao.mrs, 0x00000b23}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR22 */ {&ch[0].ao.mrs, 0x00001634}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR14 */ {&ch[0].ao.mrs, 0x00000e10}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR3 */ {&ch[0].ao.mrs, 0x00000330}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* dramc ZQ Calibration */ {&ch[0].ao.mrs, 0x01000330}, {&ch[0].ao.dramc_pd_ctrl, 0xc4000107}, {&ch[0].ao.ckectrl, 0x88d02440}, @@ -715,76 +797,112 @@ {&ch[0].ao.mrs, 0x01000330}, {&ch[0].ao.dramc_pd_ctrl, 0xc4000107}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR13 */ {&ch[0].ao.mrs, 0x01000d18}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR12 */ {&ch[0].ao.mrs, 0x01000c5d}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR1 */ {&ch[0].ao.mrs, 0x01000156}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR2 */ {&ch[0].ao.mrs, 0x0100020b}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR11 */ {&ch[0].ao.mrs, 0x01000b00}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR22 */ {&ch[0].ao.mrs, 0x01001638}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR14 */ {&ch[0].ao.mrs, 0x01000e5d}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR3 */ {&ch[0].ao.mrs, 0x01000330}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR13 */ {&ch[0].ao.mrs, 0x01000d58}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR12 */ {&ch[0].ao.mrs, 0x01000c5d}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR1 */ {&ch[0].ao.mrs, 0x01000156}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR2 */ {&ch[0].ao.mrs, 0x0100022d}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR11 */ {&ch[0].ao.mrs, 0x01000b23}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR22 */ {&ch[0].ao.mrs, 0x01001634}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR14 */ {&ch[0].ao.mrs, 0x01000e10}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR3 */ {&ch[0].ao.mrs, 0x01000330}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR13 */ {&ch[0].ao.mrs, 0x00000330}, {&ch[0].ao.ckectrl, 0x88d02440}, {&ch[0].ao.mrs, 0x00000dd8}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR13 */ {&ch[0].ao.mrs, 0x01000dd8}, {&ch[0].ao.ckectrl, 0x88d02440}, {&ch[0].ao.mrs, 0x01000dd8}, @@ -792,9 +910,12 @@ {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, {&ch[0].ao.mrs, 0x01000dd8}, + {&ch[0].ao.shu[0].hwset_mr13, 0x00d8000d}, {&ch[0].ao.shu[0].hwset_vrcg, 0x00d8000d}, {&ch[0].ao.shu[0].hwset_mr2, 0x002d0002}, + + /* CH1 dramc ZQ Calibration */ {&ch[1].ao.mrs, 0x00000000}, {&ch[1].ao.dramc_pd_ctrl, 0xc4000107}, {&ch[1].ao.ckectrl, 0x88d02440}, @@ -961,49 +1082,6 @@ {&ch[1].ao.shu[0].hwset_mr2, 0x002d0002}, {&ch[0].ao.mrs, 0x00000dd8}, {&ch[1].ao.mrs, 0x00000dd8}, - - /* update the ac timing */ - {&ch[0].ao.shu[0].actim[0], 0x06020c07}, - {&ch[0].ao.shu[0].actim[1], 0x10080501}, - {&ch[0].ao.shu[0].actim[2], 0x07070201}, - {&ch[0].ao.shu[0].actim[3], 0x6164002c}, - {&ch[0].ao.shu[0].actim[4], 0x22650077}, - {&ch[0].ao.shu[0].actim[5], 0x0a000c0b}, - {&ch[0].ao.shu[0].actim_xrt, 0x05030609}, - {&ch[0].ao.shu[0].ac_time_05t, 0x000106e1}, - {&ch[0].ao.catraining1, 0x0b000000}, - {&ch[0].ao.shu[0].rk[0].dqsctl, 0x00000004}, - {&ch[0].ao.shu[0].rk[1].dqsctl, 0x00000004}, - {&ch[0].ao.shu[0].odtctrl, 0xc001004f}, - {&ch[0].ao.shu[0].conf[1], 0x34000d0f}, - {&ch[0].ao.shu[0].conf[2], 0x9007640f}, - {&ch[0].ao.shu[0].scintv, 0x4e39eb36}, - {&ch[0].ao.shu[0].ckectrl, 0x33210000}, - {&ch[0].ao.ckectrl, 0x88d02440}, - {&ch[0].ao.shu[0].rankctl, 0x64300003}, - {&ch[0].ao.shu[0].rankctl, 0x64301203}, - {&ch[1].ao.shu[0].actim[0], 0x06020c07}, - {&ch[1].ao.shu[0].actim[1], 0x10080501}, - {&ch[1].ao.shu[0].actim[2], 0x07070201}, - {&ch[1].ao.shu[0].actim[3], 0x6164002c}, - {&ch[1].ao.shu[0].actim[4], 0x22650077}, - {&ch[1].ao.shu[0].actim[5], 0x0a000c0b}, - {&ch[1].ao.shu[0].actim_xrt, 0x05030609}, - {&ch[1].ao.shu[0].ac_time_05t, 0x000106e1}, - {&ch[1].ao.catraining1, 0x0b000000}, - {&ch[1].ao.shu[0].rk[0].dqsctl, 0x00000004}, - {&ch[1].ao.shu[0].rk[1].dqsctl, 0x00000004}, - {&ch[1].ao.shu[0].odtctrl, 0xc001004f}, - {&ch[1].ao.shu[0].conf[1], 0x34000d0f}, - {&ch[1].ao.shu[0].conf[2], 0x9007640f}, - {&ch[1].ao.shu[0].scintv, 0x4e39eb36}, - {&ch[1].ao.shu[0].ckectrl, 0x33210000}, - {&ch[1].ao.ckectrl, 0x88d02440}, - {&ch[1].ao.shu[0].rankctl, 0x64300003}, - {&ch[1].ao.shu[0].rankctl, 0x64301203}, - {&ch[0].ao.arbctl, 0x00000c80}, - {&ch[0].ao.rstmask, 0x00000000}, - {&ch[0].ao.arbctl, 0x00000c80}, };
void dramc_init(void) @@ -1011,4 +1089,10 @@ for (int i = 0; i < ARRAY_SIZE(dramc_init_sequence); i++) write32(dramc_init_sequence[i].addr, dramc_init_sequence[i].value); + + for (int i = 0; i < ARRAY_SIZE(dramc_mode_reg_init_sequence); i++) { + write32(dramc_mode_reg_init_sequence[i].addr, + dramc_mode_reg_init_sequence[i].value); + udelay(2); + } }
Hello Julius Werner, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/32284
to look at the new patch set (#2).
Change subject: mediatek/mt8183: fix mode register setting fail issue ......................................................................
mediatek/mt8183: fix mode register setting fail issue
the mode register setting of DRAM maybe failed without delay operate, need add delay after each MR write.
BUG=b:80501386 BRANCH=none TEST=Boots correctly and stress test pass on Kukui.
Change-Id: I51785e90b2014994be5018bfe543245d44626242 Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c 1 file changed, 128 insertions(+), 44 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/32284/2
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32284 )
Change subject: mediatek/mt8183: fix mode register setting fail issue ......................................................................
Patch Set 2:
(2 comments)
https://review.coreboot.org/#/c/32284/1//COMMIT_MSG Commit Message:
https://review.coreboot.org/#/c/32284/1//COMMIT_MSG@9 PS1, Line 9: the mode register setting of DRAM maybe failed without delay operate, : need add delay after each MR write. Do you mean?
Setting the DRAM mode register can fail without a delay, so add a 2 μs delay after each MR write.
Where is that documented? Why 2 μs?
https://review.coreboot.org/#/c/32284/1//COMMIT_MSG@11 PS1, Line 11: You also reorder stuff and add comments. That should be separate commits.
huayang duan has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32284 )
Change subject: mediatek/mt8183: fix mode register setting fail issue ......................................................................
Patch Set 2: Code-Review+1
huayang duan has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32284 )
Change subject: mediatek/mt8183: fix mode register setting fail issue ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/#/c/32284/1//COMMIT_MSG Commit Message:
https://review.coreboot.org/#/c/32284/1//COMMIT_MSG@9 PS1, Line 9: the mode register setting of DRAM maybe failed without delay operate, : need add delay after each MR write.
Do you mean? […]
please refer to the source code of DramcModeRegWrite() from MT8183 preloader, not current coreboot source code. the source code of preloader we have released to google last week.
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32284 )
Change subject: mediatek/mt8183: fix mode register setting fail issue ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/#/c/32284/1//COMMIT_MSG Commit Message:
https://review.coreboot.org/#/c/32284/1//COMMIT_MSG@9 PS1, Line 9: the mode register setting of DRAM maybe failed without delay operate, : need add delay after each MR write.
please refer to the source code of DramcModeRegWrite() from MT8183 preloader, not current coreboot s […]
How can I access the code, you released to Google?
huayang duan has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32284 )
Change subject: mediatek/mt8183: fix mode register setting fail issue ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/#/c/32284/1//COMMIT_MSG Commit Message:
https://review.coreboot.org/#/c/32284/1//COMMIT_MSG@9 PS1, Line 9: the mode register setting of DRAM maybe failed without delay operate, : need add delay after each MR write.
How can I access the code, you released to Google?
void DramcModeRegWrite(DRAMC_CTX_T *p, U8 u1MRIdx, U8 u1Value) { U32 counter=0; U32 u4Rank = 0; U32 u4register_024;
u4register_024 = u4IO32Read4B(DRAMC_REG_ADDR(DRAMC_REG_CKECTRL)); CKEFixOnOff(p, CKE_FIXON, CKE_WRITE_TO_ONE_CHANNEL); vIO32WriteFldAlign(DRAMC_REG_ADDR(DRAMC_REG_MRS), u1MRIdx, MRS_MRSMA); vIO32WriteFldAlign(DRAMC_REG_ADDR(DRAMC_REG_MRS), u1Value, MRS_MRSOP);
// MRW command will be fired when MRWEN 0->1 vIO32WriteFldAlign(DRAMC_REG_ADDR(DRAMC_REG_SPCMD), 1, SPCMD_MRWEN);
// wait MRW command fired. u4Rank = u4IO32ReadFldAlign(DRAMC_REG_ADDR(DRAMC_REG_MRS), MRS_MRSRK); while(u4IO32ReadFldAlign(DRAMC_REG_ADDR(DRAMC_REG_SPCMDRESP), SPCMDRESP_MRW_RESPONSE) ==0) { counter++; mcSHOW_DBG_MSG2(("wait MRW command Rank%d MR%d =0x%x fired (%d)\n", u4Rank, u1MRIdx, u1Value, counter)); mcDELAY_US(1); }
// Set MRWEN =0 for next time MRW. vIO32WriteFldAlign(DRAMC_REG_ADDR(DRAMC_REG_SPCMD), 0, SPCMD_MRWEN); vIO32Write4B(DRAMC_REG_ADDR(DRAMC_REG_CKECTRL), u4register_024); //restore CKEFIXON value }
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32284 )
Change subject: mediatek/mt8183: fix mode register setting fail issue ......................................................................
Patch Set 4:
(1 comment)
You shouldn’t score your own change-set.
https://review.coreboot.org/#/c/32284/4//COMMIT_MSG Commit Message:
https://review.coreboot.org/#/c/32284/4//COMMIT_MSG@9 PS4, Line 9: the The
You-Cheng Syu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32284 )
Change subject: mediatek/mt8183: fix mode register setting fail issue ......................................................................
Patch Set 4:
(2 comments)
https://review.coreboot.org/#/c/32284/4/src/soc/mediatek/mt8183/dramc_init_s... File src/soc/mediatek/mt8183/dramc_init_setting.c:
https://review.coreboot.org/#/c/32284/4/src/soc/mediatek/mt8183/dramc_init_s... PS4, Line 21: #include <delay.h> sort the include lines
https://review.coreboot.org/#/c/32284/4/src/soc/mediatek/mt8183/dramc_init_s... PS4, Line 668: dramc_mode_reg_init_sequence This array should be mark as 'static' if it won't be access from any other file. (So should dramc_init_sequence)
Hello Julius Werner, You-Cheng Syu, Hung-Te Lin, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/32284
to look at the new patch set (#5).
Change subject: mediatek/mt8183: fix mode register setting fail issue ......................................................................
mediatek/mt8183: fix mode register setting fail issue
The mode register setting of DRAM maybe failed without delay operate, need add delay after each MR write.
BUG=b:80501386 BRANCH=none TEST=Boots correctly and stress test pass on Kukui.
Change-Id: I51785e90b2014994be5018bfe543245d44626242 Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c 1 file changed, 129 insertions(+), 45 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/32284/5
huayang duan has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32284 )
Change subject: mediatek/mt8183: fix mode register setting fail issue ......................................................................
Patch Set 5:
(3 comments)
https://review.coreboot.org/#/c/32284/4//COMMIT_MSG Commit Message:
https://review.coreboot.org/#/c/32284/4//COMMIT_MSG@9 PS4, Line 9: the
The
Done
https://review.coreboot.org/#/c/32284/4/src/soc/mediatek/mt8183/dramc_init_s... File src/soc/mediatek/mt8183/dramc_init_setting.c:
https://review.coreboot.org/#/c/32284/4/src/soc/mediatek/mt8183/dramc_init_s... PS4, Line 21: #include <delay.h>
sort the include lines
Done
https://review.coreboot.org/#/c/32284/4/src/soc/mediatek/mt8183/dramc_init_s... PS4, Line 668: dramc_mode_reg_init_sequence
This array should be mark as 'static' if it won't be access from any other file. […]
Done
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32284 )
Change subject: mediatek/mt8183: fix mode register setting fail issue ......................................................................
Patch Set 5:
(1 comment)
https://review.coreboot.org/#/c/32284/5//COMMIT_MSG Commit Message:
https://review.coreboot.org/#/c/32284/5//COMMIT_MSG@9 PS5, Line 9: maybe failed without delay operate, : need add delay after each MR write. may fail without some delay after each MR write.
Hung-Te Lin has uploaded a new patch set (#6) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/32284 )
Change subject: mediatek/mt8183: fix mode register setting fail issue ......................................................................
mediatek/mt8183: fix mode register setting fail issue
The mode register setting of DRAM may fail without some delay after each MR write.
BUG=b:80501386 BRANCH=none TEST=Boots correctly and stress test pass on Kukui.
Change-Id: I51785e90b2014994be5018bfe543245d44626242 Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c 1 file changed, 129 insertions(+), 45 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/32284/6
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32284 )
Change subject: mediatek/mt8183: fix mode register setting fail issue ......................................................................
Patch Set 6: Code-Review+2
Huayang Duan has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32284 )
Change subject: mediatek/mt8183: fix mode register setting fail issue ......................................................................
Patch Set 6: Code-Review+2
Patrick Georgi has submitted this change and it was merged. ( https://review.coreboot.org/c/coreboot/+/32284 )
Change subject: mediatek/mt8183: fix mode register setting fail issue ......................................................................
mediatek/mt8183: fix mode register setting fail issue
The mode register setting of DRAM may fail without some delay after each MR write.
BUG=b:80501386 BRANCH=none TEST=Boots correctly and stress test pass on Kukui.
Change-Id: I51785e90b2014994be5018bfe543245d44626242 Signed-off-by: Huayang Duan huayang.duan@mediatek.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/32284 Reviewed-by: Hung-Te Lin hungte@chromium.org Reviewed-by: Huayang Duan huayang.duan@mediatek.corp-partner.google.com Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/soc/mediatek/mt8183/dramc_init_setting.c 1 file changed, 129 insertions(+), 45 deletions(-)
Approvals: build bot (Jenkins): Verified Hung-Te Lin: Looks good to me, approved Huayang Duan: Looks good to me, approved
diff --git a/src/soc/mediatek/mt8183/dramc_init_setting.c b/src/soc/mediatek/mt8183/dramc_init_setting.c index d275127..09bec01 100644 --- a/src/soc/mediatek/mt8183/dramc_init_setting.c +++ b/src/soc/mediatek/mt8183/dramc_init_setting.c @@ -14,6 +14,7 @@ */
#include <device/mmio.h> +#include <delay.h> #include <soc/emi.h> #include <soc/dramc_pi_api.h> #include <soc/dramc_register.h> @@ -24,7 +25,7 @@ u32 value; };
-struct reg_init_value dramc_init_sequence[] = { +static struct reg_init_value dramc_init_sequence[] = { {&mt8183_infracfg->dramc_wbr, 0x00000000}, {&ch[0].ao.refctrl0, 0x20712000}, {&ch[1].ao.refctrl0, 0x20712000}, @@ -620,7 +621,52 @@ {&ch[1].phy.shu[0].rk[1].b[1].dq[1], 0x22000000}, {&ch[1].phy.shu[0].b[0].dll[1], 0x00022501},
- /* dramc mode register init */ + /* update the ac timing */ + {&ch[0].ao.shu[0].actim[0], 0x06020c07}, + {&ch[0].ao.shu[0].actim[1], 0x10080501}, + {&ch[0].ao.shu[0].actim[2], 0x07070201}, + {&ch[0].ao.shu[0].actim[3], 0x6164002c}, + {&ch[0].ao.shu[0].actim[4], 0x22650077}, + {&ch[0].ao.shu[0].actim[5], 0x0a000c0b}, + {&ch[0].ao.shu[0].actim_xrt, 0x05030609}, + {&ch[0].ao.shu[0].ac_time_05t, 0x000106e1}, + {&ch[0].ao.catraining1, 0x0b000000}, + {&ch[0].ao.shu[0].rk[0].dqsctl, 0x00000004}, + {&ch[0].ao.shu[0].rk[1].dqsctl, 0x00000004}, + {&ch[0].ao.shu[0].odtctrl, 0xc001004f}, + {&ch[0].ao.shu[0].conf[1], 0x34000d0f}, + {&ch[0].ao.shu[0].conf[2], 0x9007640f}, + {&ch[0].ao.shu[0].scintv, 0x4e39eb36}, + {&ch[0].ao.shu[0].ckectrl, 0x33210000}, + {&ch[0].ao.ckectrl, 0x88d02440}, + {&ch[0].ao.shu[0].rankctl, 0x64300003}, + {&ch[0].ao.shu[0].rankctl, 0x64301203}, + {&ch[1].ao.shu[0].actim[0], 0x06020c07}, + {&ch[1].ao.shu[0].actim[1], 0x10080501}, + {&ch[1].ao.shu[0].actim[2], 0x07070201}, + {&ch[1].ao.shu[0].actim[3], 0x6164002c}, + {&ch[1].ao.shu[0].actim[4], 0x22650077}, + {&ch[1].ao.shu[0].actim[5], 0x0a000c0b}, + {&ch[1].ao.shu[0].actim_xrt, 0x05030609}, + {&ch[1].ao.shu[0].ac_time_05t, 0x000106e1}, + {&ch[1].ao.catraining1, 0x0b000000}, + {&ch[1].ao.shu[0].rk[0].dqsctl, 0x00000004}, + {&ch[1].ao.shu[0].rk[1].dqsctl, 0x00000004}, + {&ch[1].ao.shu[0].odtctrl, 0xc001004f}, + {&ch[1].ao.shu[0].conf[1], 0x34000d0f}, + {&ch[1].ao.shu[0].conf[2], 0x9007640f}, + {&ch[1].ao.shu[0].scintv, 0x4e39eb36}, + {&ch[1].ao.shu[0].ckectrl, 0x33210000}, + {&ch[1].ao.ckectrl, 0x88d02440}, + {&ch[1].ao.shu[0].rankctl, 0x64300003}, + {&ch[1].ao.shu[0].rankctl, 0x64301203}, + {&ch[0].ao.arbctl, 0x00000c80}, + {&ch[0].ao.rstmask, 0x00000000}, + {&ch[0].ao.arbctl, 0x00000c80}, +}; + +static struct reg_init_value dramc_mode_reg_init_sequence[] = { + /* dramc power on sequence */ {&ch[0].phy.misc_ctrl1, 0x8100908c}, {&ch[1].phy.misc_ctrl1, 0x8100908c}, {&ch[0].ao.ckectrl, 0x88d02480}, @@ -632,6 +678,8 @@ {&ch[0].ao.ckectrl, 0x88d02440}, {&ch[1].ao.ckectrl, 0x88d02440}, {&ch[0].ao.mrs, 0x00000000}, + + /* CH0 dramc ZQ Calibration */ {&ch[0].ao.dramc_pd_ctrl, 0xc4000107}, {&ch[0].ao.ckectrl, 0x88d02440}, {&ch[0].ao.mrs, 0x00000000}, @@ -641,70 +689,104 @@ {&ch[0].ao.mrs, 0x00000000}, {&ch[0].ao.dramc_pd_ctrl, 0xc4000107}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR13 */ {&ch[0].ao.mrs, 0x00000d18}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR12 */ {&ch[0].ao.mrs, 0x00000c5d}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR1 */ {&ch[0].ao.mrs, 0x00000156}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR2 */ {&ch[0].ao.mrs, 0x0000020b}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR11 */ {&ch[0].ao.mrs, 0x00000b00}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR22 */ {&ch[0].ao.mrs, 0x00001638}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR14 */ {&ch[0].ao.mrs, 0x00000e5d}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR3 */ {&ch[0].ao.mrs, 0x00000330}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR13 */ {&ch[0].ao.mrs, 0x00000d58}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR12 */ {&ch[0].ao.mrs, 0x00000c5d}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR1 */ {&ch[0].ao.mrs, 0x00000156}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR2 */ {&ch[0].ao.mrs, 0x0000022d}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR11 */ {&ch[0].ao.mrs, 0x00000b23}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR22 */ {&ch[0].ao.mrs, 0x00001634}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR14 */ {&ch[0].ao.mrs, 0x00000e10}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR3 */ {&ch[0].ao.mrs, 0x00000330}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* dramc ZQ Calibration */ {&ch[0].ao.mrs, 0x01000330}, {&ch[0].ao.dramc_pd_ctrl, 0xc4000107}, {&ch[0].ao.ckectrl, 0x88d02440}, @@ -715,76 +797,112 @@ {&ch[0].ao.mrs, 0x01000330}, {&ch[0].ao.dramc_pd_ctrl, 0xc4000107}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR13 */ {&ch[0].ao.mrs, 0x01000d18}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR12 */ {&ch[0].ao.mrs, 0x01000c5d}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR1 */ {&ch[0].ao.mrs, 0x01000156}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR2 */ {&ch[0].ao.mrs, 0x0100020b}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR11 */ {&ch[0].ao.mrs, 0x01000b00}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR22 */ {&ch[0].ao.mrs, 0x01001638}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR14 */ {&ch[0].ao.mrs, 0x01000e5d}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR3 */ {&ch[0].ao.mrs, 0x01000330}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR13 */ {&ch[0].ao.mrs, 0x01000d58}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR12 */ {&ch[0].ao.mrs, 0x01000c5d}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR1 */ {&ch[0].ao.mrs, 0x01000156}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR2 */ {&ch[0].ao.mrs, 0x0100022d}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR11 */ {&ch[0].ao.mrs, 0x01000b23}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR22 */ {&ch[0].ao.mrs, 0x01001634}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR14 */ {&ch[0].ao.mrs, 0x01000e10}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR3 */ {&ch[0].ao.mrs, 0x01000330}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR13 */ {&ch[0].ao.mrs, 0x00000330}, {&ch[0].ao.ckectrl, 0x88d02440}, {&ch[0].ao.mrs, 0x00000dd8}, {&ch[0].ao.spcmd, 0x00000001}, {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, + + /* MR13 */ {&ch[0].ao.mrs, 0x01000dd8}, {&ch[0].ao.ckectrl, 0x88d02440}, {&ch[0].ao.mrs, 0x01000dd8}, @@ -792,9 +910,12 @@ {&ch[0].ao.spcmd, 0x00000000}, {&ch[0].ao.ckectrl, 0x88d02440}, {&ch[0].ao.mrs, 0x01000dd8}, + {&ch[0].ao.shu[0].hwset_mr13, 0x00d8000d}, {&ch[0].ao.shu[0].hwset_vrcg, 0x00d8000d}, {&ch[0].ao.shu[0].hwset_mr2, 0x002d0002}, + + /* CH1 dramc ZQ Calibration */ {&ch[1].ao.mrs, 0x00000000}, {&ch[1].ao.dramc_pd_ctrl, 0xc4000107}, {&ch[1].ao.ckectrl, 0x88d02440}, @@ -961,49 +1082,6 @@ {&ch[1].ao.shu[0].hwset_mr2, 0x002d0002}, {&ch[0].ao.mrs, 0x00000dd8}, {&ch[1].ao.mrs, 0x00000dd8}, - - /* update the ac timing */ - {&ch[0].ao.shu[0].actim[0], 0x06020c07}, - {&ch[0].ao.shu[0].actim[1], 0x10080501}, - {&ch[0].ao.shu[0].actim[2], 0x07070201}, - {&ch[0].ao.shu[0].actim[3], 0x6164002c}, - {&ch[0].ao.shu[0].actim[4], 0x22650077}, - {&ch[0].ao.shu[0].actim[5], 0x0a000c0b}, - {&ch[0].ao.shu[0].actim_xrt, 0x05030609}, - {&ch[0].ao.shu[0].ac_time_05t, 0x000106e1}, - {&ch[0].ao.catraining1, 0x0b000000}, - {&ch[0].ao.shu[0].rk[0].dqsctl, 0x00000004}, - {&ch[0].ao.shu[0].rk[1].dqsctl, 0x00000004}, - {&ch[0].ao.shu[0].odtctrl, 0xc001004f}, - {&ch[0].ao.shu[0].conf[1], 0x34000d0f}, - {&ch[0].ao.shu[0].conf[2], 0x9007640f}, - {&ch[0].ao.shu[0].scintv, 0x4e39eb36}, - {&ch[0].ao.shu[0].ckectrl, 0x33210000}, - {&ch[0].ao.ckectrl, 0x88d02440}, - {&ch[0].ao.shu[0].rankctl, 0x64300003}, - {&ch[0].ao.shu[0].rankctl, 0x64301203}, - {&ch[1].ao.shu[0].actim[0], 0x06020c07}, - {&ch[1].ao.shu[0].actim[1], 0x10080501}, - {&ch[1].ao.shu[0].actim[2], 0x07070201}, - {&ch[1].ao.shu[0].actim[3], 0x6164002c}, - {&ch[1].ao.shu[0].actim[4], 0x22650077}, - {&ch[1].ao.shu[0].actim[5], 0x0a000c0b}, - {&ch[1].ao.shu[0].actim_xrt, 0x05030609}, - {&ch[1].ao.shu[0].ac_time_05t, 0x000106e1}, - {&ch[1].ao.catraining1, 0x0b000000}, - {&ch[1].ao.shu[0].rk[0].dqsctl, 0x00000004}, - {&ch[1].ao.shu[0].rk[1].dqsctl, 0x00000004}, - {&ch[1].ao.shu[0].odtctrl, 0xc001004f}, - {&ch[1].ao.shu[0].conf[1], 0x34000d0f}, - {&ch[1].ao.shu[0].conf[2], 0x9007640f}, - {&ch[1].ao.shu[0].scintv, 0x4e39eb36}, - {&ch[1].ao.shu[0].ckectrl, 0x33210000}, - {&ch[1].ao.ckectrl, 0x88d02440}, - {&ch[1].ao.shu[0].rankctl, 0x64300003}, - {&ch[1].ao.shu[0].rankctl, 0x64301203}, - {&ch[0].ao.arbctl, 0x00000c80}, - {&ch[0].ao.rstmask, 0x00000000}, - {&ch[0].ao.arbctl, 0x00000c80}, };
void dramc_init(void) @@ -1011,4 +1089,10 @@ for (int i = 0; i < ARRAY_SIZE(dramc_init_sequence); i++) write32(dramc_init_sequence[i].addr, dramc_init_sequence[i].value); + + for (int i = 0; i < ARRAY_SIZE(dramc_mode_reg_init_sequence); i++) { + write32(dramc_mode_reg_init_sequence[i].addr, + dramc_mode_reg_init_sequence[i].value); + udelay(2); + } }