huayang duan has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: mediatek/mt8183: Clean the calibration result if calibration or mem test fail ......................................................................
mediatek/mt8183: Clean the calibration result if calibration or mem test fail
If DRAM calibration fail or mem test fail by using the params store at flash, should clean the calibration result which store at flash and triggle system reset to regenerate new params.
BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui.
Change-Id: I8e1d4f5bc7b45f45a8bfef74e86ec0ff6a556af4 --- M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/memory.c 2 files changed, 15 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/81/35481/1
diff --git a/src/soc/mediatek/mt8183/dramc_pi_calibration_api.c b/src/soc/mediatek/mt8183/dramc_pi_calibration_api.c old mode 100644 new mode 100755 index 2bd185c..4769620 --- a/src/soc/mediatek/mt8183/dramc_pi_calibration_api.c +++ b/src/soc/mediatek/mt8183/dramc_pi_calibration_api.c @@ -17,6 +17,7 @@ #include <console/console.h> #include <delay.h> #include <device/mmio.h> +#include <reset.h> #include <soc/emi.h> #include <soc/dramc_register.h> #include <soc/dramc_pi_api.h> @@ -1964,7 +1965,12 @@ dramc_engine2_end(chn); write32(&ch[chn].ao.dummy_rd, dummy_rd_backup);
- assert(sum != 0); + if (sum == 0) { + clean_calibration_data(); + dramc_show("system will be reboot in 5 secoeds.\n"); + delay(5); + do_board_reset(); + }
if (sum <= 3) best_step = first + (sum >> 1); diff --git a/src/soc/mediatek/mt8183/memory.c b/src/soc/mediatek/mt8183/memory.c index 67f6c65..6a37c4e 100644 --- a/src/soc/mediatek/mt8183/memory.c +++ b/src/soc/mediatek/mt8183/memory.c @@ -15,6 +15,8 @@
#include <assert.h> #include <console/console.h> +#include <delay.h> +#include <reset.h> #include <soc/dramc_pi_api.h> #include <soc/emi.h> #include <symbols.h> @@ -43,7 +45,12 @@ printk(BIOS_DEBUG, "[MEM] complex R/W mem test %s : %d\n", (i == 0) ? "pass" : "fail", i);
- ASSERT(i == 0); + if (i != 0) { + clean_calibration_data(); + dramc_show("system will be reboot in 5 secoeds.\n"); + delay(5); + do_board_reset(); + }
addr += rank_size[r]; }
Hello Yu-Ping Wu, Julius Werner, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35481
to look at the new patch set (#7).
Change subject: mediatek/mt8183: Clean the calibration result if calibration or mem test fail ......................................................................
mediatek/mt8183: Clean the calibration result if calibration or mem test fail
If DRAM calibration fail or mem test fail by using the params store at flash, should clean the calibration result which store at flash and triggle system reset to regenerate new params.
BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui.
Change-Id: I8e1d4f5bc7b45f45a8bfef74e86ec0ff6a556af4 Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/memory.c 2 files changed, 15 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/81/35481/7
Yu-Ping Wu has uploaded a new patch set (#8) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: mediatek/mt8183: Clean the calibration result if calibration or mem test fail ......................................................................
mediatek/mt8183: Clean the calibration result if calibration or mem test fail
If DRAM calibration fail or mem test fail by using the params store at flash, should clean the calibration result which store at flash and triggle system reset to regenerate new params.
BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui.
Change-Id: I8e1d4f5bc7b45f45a8bfef74e86ec0ff6a556af4 --- M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/memory.c 2 files changed, 15 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/81/35481/8
Hello Yu-Ping Wu, Julius Werner, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35481
to look at the new patch set (#10).
Change subject: mediatek/mt8183: Clean the calibration result if calibration or mem test fail ......................................................................
mediatek/mt8183: Clean the calibration result if calibration or mem test fail
If DRAM calibration fail or mem test fail by using the params store at flash, should clean the calibration result which store at flash and triggle system reset to regenerate new params.
BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui.
Change-Id: I8e1d4f5bc7b45f45a8bfef74e86ec0ff6a556af4 Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/memory.c 2 files changed, 15 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/81/35481/10
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: mediatek/mt8183: Clean the calibration result if calibration or mem test fail ......................................................................
Patch Set 10:
(5 comments)
A spell checker would have found some of the typos.
https://review.coreboot.org/c/coreboot/+/35481/10//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/35481/10//COMMIT_MSG@10 PS10, Line 10: store stores?
Better:
… the calibration result stored in flash, and
https://review.coreboot.org/c/coreboot/+/35481/10//COMMIT_MSG@11 PS10, Line 11: triggle trigger
https://review.coreboot.org/c/coreboot/+/35481/10/src/soc/mediatek/mt8183/dr... File src/soc/mediatek/mt8183/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/35481/10/src/soc/mediatek/mt8183/dr... PS10, Line 1970: dramc_show("system will be reboot in 5 secoeds.\n"); System is going to reboot in 5 seconds.
https://review.coreboot.org/c/coreboot/+/35481/10/src/soc/mediatek/mt8183/dr... PS10, Line 1971: delay(5); Why such a high delay? Please add a comment and elaborate in the commit message.
https://review.coreboot.org/c/coreboot/+/35481/10/src/soc/mediatek/mt8183/dr... PS10, Line 1971: 5 Please add a macro or variable/constant, and also use that in the debug message.
Hello Yu-Ping Wu, Julius Werner, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35481
to look at the new patch set (#11).
Change subject: mediatek/mt8183: Clean the calibration result if calibration or mem test fail ......................................................................
mediatek/mt8183: Clean the calibration result if calibration or mem test fail
If DRAM calibration fail or mem test fail by using the params store at flash, should clean the calibration result stored in flash and trigger system reset to regenerate new calibration params.
BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui.
Change-Id: I8e1d4f5bc7b45f45a8bfef74e86ec0ff6a556af4 Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/memory.c 2 files changed, 13 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/81/35481/11
Huayang Duan has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: mediatek/mt8183: Clean the calibration result if calibration or mem test fail ......................................................................
Patch Set 11:
(3 comments)
Patch Set 10:
(5 comments)
A spell checker would have found some of the typos.
https://review.coreboot.org/c/coreboot/+/35481/10/src/soc/mediatek/mt8183/dr... File src/soc/mediatek/mt8183/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/35481/10/src/soc/mediatek/mt8183/dr... PS10, Line 1970: dramc_show("system will be reboot in 5 secoeds.\n");
System is going to reboot in 5 seconds.
Done
https://review.coreboot.org/c/coreboot/+/35481/10/src/soc/mediatek/mt8183/dr... PS10, Line 1971: 5
Please add a macro or variable/constant, and also use that in the debug message.
Done
https://review.coreboot.org/c/coreboot/+/35481/10/src/soc/mediatek/mt8183/dr... PS10, Line 1971: delay(5);
Why such a high delay? Please add a comment and elaborate in the commit message.
Done
Hello Yu-Ping Wu, Julius Werner, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35481
to look at the new patch set (#12).
Change subject: mediatek/mt8183: Clean the calibration result if calibration or mem test fail ......................................................................
mediatek/mt8183: Clean the calibration result if calibration or mem test fail
If DRAM calibration fail or mem test fail by using the params store at flash, should clean the calibration result stored in flash and trigger system reset to regenerate new calibration params.
BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui.
Change-Id: I8e1d4f5bc7b45f45a8bfef74e86ec0ff6a556af4 Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/memory.c 2 files changed, 13 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/81/35481/12
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: mediatek/mt8183: Clean the calibration result if calibration or mem test fail ......................................................................
Patch Set 12:
(3 comments)
https://review.coreboot.org/c/coreboot/+/35481/12//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/35481/12//COMMIT_MSG@9 PS12, Line 9: If DRAM calibration fail or mem test fail by using the params store at flash, : should clean the calibration result stored in flash and : trigger system reset to regenerate new calibration params. Please use a text width of 75 characters.
https://review.coreboot.org/c/coreboot/+/35481/12/src/soc/mediatek/mt8183/dr... File src/soc/mediatek/mt8183/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/35481/12/src/soc/mediatek/mt8183/dr... PS12, Line 1970: dramc_show("system is going to reboot due to DRAM calibration fail.\n"); Please further rephrase. Maybe:
Rebooting system due to wrong calibration data
Rebooting system due to failed calibration
https://review.coreboot.org/c/coreboot/+/35481/12/src/soc/mediatek/mt8183/me... File src/soc/mediatek/mt8183/memory.c:
https://review.coreboot.org/c/coreboot/+/35481/12/src/soc/mediatek/mt8183/me... PS12, Line 50: "memory test fail.\n"); Maybe:
Rebooting system due to failed memory test
Huayang Duan has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: mediatek/mt8183: Clean the calibration result if calibration or mem test fail ......................................................................
Patch Set 14:
(3 comments)
https://review.coreboot.org/c/coreboot/+/35481/12//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/35481/12//COMMIT_MSG@9 PS12, Line 9: If DRAM calibration fail or mem test fail by using the params store at flash, : should clean the calibration result stored in flash and : trigger system reset to regenerate new calibration params.
Please use a text width of 75 characters.
Done
https://review.coreboot.org/c/coreboot/+/35481/12/src/soc/mediatek/mt8183/dr... File src/soc/mediatek/mt8183/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/35481/12/src/soc/mediatek/mt8183/dr... PS12, Line 1970: dramc_show("system is going to reboot due to DRAM calibration fail.\n");
Please further rephrase. Maybe: […]
Done
https://review.coreboot.org/c/coreboot/+/35481/12/src/soc/mediatek/mt8183/me... File src/soc/mediatek/mt8183/memory.c:
https://review.coreboot.org/c/coreboot/+/35481/12/src/soc/mediatek/mt8183/me... PS12, Line 50: "memory test fail.\n");
Maybe: […]
Done
Hello Yu-Ping Wu, Julius Werner, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35481
to look at the new patch set (#17).
Change subject: mediatek/mt8183: Clean the calibration result if calibration or mem test fail ......................................................................
mediatek/mt8183: Clean the calibration result if calibration or mem test fail
If DRAM calibration fail or mem test fail by using the params which stored at flash, should clean the calibration params which stored in flash and trigger system reset to regenerate new calibration params.
BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui.
Change-Id: I8e1d4f5bc7b45f45a8bfef74e86ec0ff6a556af4 Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/mainboard/google/kukui/romstage.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/memory.c 4 files changed, 19 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/81/35481/17
Hello Yu-Ping Wu, Julius Werner, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35481
to look at the new patch set (#18).
Change subject: mediatek/mt8183: Clean the calibration result if calibration or mem test fail ......................................................................
mediatek/mt8183: Clean the calibration result if calibration or mem test fail
If DRAM calibration fail or mem test fail by using the params which stored at flash, should clean the calibration params which stored in flash and trigger system to regenerate new calibration params by full calibration.
BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui.
Change-Id: I8e1d4f5bc7b45f45a8bfef74e86ec0ff6a556af4 Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/mainboard/google/kukui/romstage.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/memory.c 4 files changed, 19 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/81/35481/18
Yu-Ping Wu has uploaded a new patch set (#20) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: mediatek/mt8183: Clean the calibration result if calibration or mem test fail ......................................................................
mediatek/mt8183: Clean the calibration result if calibration or mem test fail
If DRAM calibration fail or mem test fail by using the params which stored at flash, should clean the calibration params which stored in flash and trigger system to regenerate new calibration params by full calibration.
BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui.
Change-Id: I8e1d4f5bc7b45f45a8bfef74e86ec0ff6a556af4 Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/mainboard/google/kukui/romstage.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/memory.c 4 files changed, 18 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/81/35481/20
Yu-Ping Wu has uploaded a new patch set (#28) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: mediatek/mt8183: Clean cached calibration results if mem test fails ......................................................................
mediatek/mt8183: Clean cached calibration results if mem test fails
If DRAM calibration fails or mem test fails using the cached calibration results stored in flash, clean the cached results and rerun DRAM full calibration.
BUG=b:80501386,b:139099592 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I8e1d4f5bc7b45f45a8bfef74e86ec0ff6a556af4 Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/mainboard/google/kukui/romstage.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/memory.c 4 files changed, 31 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/81/35481/28
Yu-Ping Wu has uploaded a new patch set (#29) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: mediatek/mt8183: Clean cached calibration results if mem test fails ......................................................................
mediatek/mt8183: Clean cached calibration results if mem test fails
If DRAM calibration fails or mem test fails using the cached calibration results stored in flash, clean the cached results and rerun DRAM full calibration.
BUG=b:80501386,b:139099592 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I8e1d4f5bc7b45f45a8bfef74e86ec0ff6a556af4 Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/mainboard/google/kukui/romstage.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/memory.c 4 files changed, 31 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/81/35481/29
Yu-Ping Wu has uploaded a new patch set (#34) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: mediatek/mt8183: Clean cached calibration results if mem test fails ......................................................................
mediatek/mt8183: Clean cached calibration results if mem test fails
If DRAM calibration fails or mem test fails using the cached calibration results stored in flash, clean the cached results and rerun DRAM full calibration.
BUG=b:80501386,b:139099592 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I8e1d4f5bc7b45f45a8bfef74e86ec0ff6a556af4 Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/mainboard/google/kukui/romstage.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/memory.c 4 files changed, 31 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/81/35481/34
Yu-Ping Wu has uploaded a new patch set (#35) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: soc/mediatek/mt8183: Clean cached calibration results if mem test fails ......................................................................
soc/mediatek/mt8183: Clean cached calibration results if mem test fails
If DRAM calibration fails or mem test fails using the cached calibration results stored in flash, clean the cached results and rerun DRAM full calibration.
BUG=b:80501386,b:139099592 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I8e1d4f5bc7b45f45a8bfef74e86ec0ff6a556af4 Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/mainboard/google/kukui/romstage.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/memory.c 4 files changed, 30 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/81/35481/35
Yu-Ping Wu has uploaded a new patch set (#39) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: soc/mediatek/mt8183: Clean cached calibration results if mem test fails ......................................................................
soc/mediatek/mt8183: Clean cached calibration results if mem test fails
If DRAM calibration fails or mem test fails using the cached calibration results stored in flash, clean the cached results and rerun DRAM full calibration.
BUG=b:80501386,b:139099592 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I8e1d4f5bc7b45f45a8bfef74e86ec0ff6a556af4 Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/mainboard/google/kukui/romstage.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/memory.c 4 files changed, 24 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/81/35481/39
Yu-Ping Wu has uploaded a new patch set (#41) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: soc/mediatek/mt8183: Clean cached calibration results if mem test fails ......................................................................
soc/mediatek/mt8183: Clean cached calibration results if mem test fails
If DRAM calibration fails or mem test fails using the cached calibration results stored in flash, clean the cached results and rerun DRAM full calibration.
BUG=b:80501386,b:139099592 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I8e1d4f5bc7b45f45a8bfef74e86ec0ff6a556af4 Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/dramc_pi_api.h M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/memory.c 5 files changed, 39 insertions(+), 17 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/81/35481/41
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: soc/mediatek/mt8183: Clean cached calibration results if mem test fails ......................................................................
Patch Set 43:
(2 comments)
https://review.coreboot.org/c/coreboot/+/35481/27/src/mainboard/google/kukui... File src/mainboard/google/kukui/romstage.c:
https://review.coreboot.org/c/coreboot/+/35481/27/src/mainboard/google/kukui... PS27, Line 57: read_calibration_data_from_flash
Do we need to read from flash again?
Done
https://review.coreboot.org/c/coreboot/+/35481/27/src/mainboard/google/kukui... PS27, Line 58: params_result->freq_params
This only checks for DRAM_DFS_SHUFFLE_1 (freq_params is an array), and why do we need to check this?
Done
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: soc/mediatek/mt8183: Clean cached calibration results if mem test fails ......................................................................
Patch Set 45:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35481/45/src/soc/mediatek/mt8183/me... File src/soc/mediatek/mt8183/memory.c:
https://review.coreboot.org/c/coreboot/+/35481/45/src/soc/mediatek/mt8183/me... PS45, Line 160: 0 use 0xff, which is the native uninitialized data on SPI flash.
BTW, I wonder if we should do this now.
If this fails, we'll go "run full calibration", and it should write a new calibration data if success, so clearing to zero now is not needed.
So will it make more sense to always clear when full calibration failed? (step further, we may consider having a special STATUS indicating we can stop testing full calib until next version).
Yu-Ping Wu has uploaded a new patch set (#47) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: soc/mediatek/mt8183: Clean cached calibration results if mem test fails ......................................................................
soc/mediatek/mt8183: Clean cached calibration results if mem test fails
If DRAM calibration fails or mem test fails using the cached calibration results stored in flash, clean the cached results and rerun DRAM full calibration. If partial calibration fails or the mem test following it fails, hang forever.
BUG=b:80501386,b:139099592 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I8e1d4f5bc7b45f45a8bfef74e86ec0ff6a556af4 Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/dramc_pi_api.h M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/memory.c 5 files changed, 43 insertions(+), 19 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/81/35481/47
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: soc/mediatek/mt8183: Clean cached calibration results if mem test fails ......................................................................
Patch Set 47:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35481/45/src/soc/mediatek/mt8183/me... File src/soc/mediatek/mt8183/memory.c:
https://review.coreboot.org/c/coreboot/+/35481/45/src/soc/mediatek/mt8183/me... PS45, Line 160: 0
use 0xff, which is the native uninitialized data on SPI flash. […]
1. If 'dparam' is not cleared now, is there a way to clear the flash? We're using 'fmap_overwrite_area()' now and I didn't find an API to directly clear fmap. I thought this memset was only for clearing the flash.
2. If we use a special STATUS to prevent running full-k if it failed previously, those failed devices would always run partial-k (until next version). If the mem test somehow passed, it would be even harder for us to know that full-k failed on those devices, right?
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: soc/mediatek/mt8183: Clean cached calibration results if mem test fails ......................................................................
Patch Set 47:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35481/45/src/soc/mediatek/mt8183/me... File src/soc/mediatek/mt8183/memory.c:
https://review.coreboot.org/c/coreboot/+/35481/45/src/soc/mediatek/mt8183/me... PS45, Line 160: 0
- If 'dparam' is not cleared now, is there a way to clear the flash?
I think my question is why do we need to clear it? What's the issue if we don't clear?
We're using 'fmap_overwrite_area()' now and I didn't find an API to directly clear fmap. I thought this memset was only for clearing the flash.
After full-k it should rewrite the area with expected value, isn't it?
- If we use a special STATUS to prevent running full-k if it failed previously, those failed devices would always run partial-k (until next version). If the mem test somehow passed, it would be even harder for us to know that full-k failed on those devices, right?
Then what's the alternative? I can't see how clearing dparam would help in this case?
Yu-Ping Wu has uploaded a new patch set (#48) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: soc/mediatek/mt8183: Handle memory test failure ......................................................................
soc/mediatek/mt8183: Handle memory test failure
If DRAM calibration fails or mem test fails using the cached calibration results stored in flash, clean the cached results and rerun DRAM full calibration. If partial calibration fails or the mem test following it fails, hang forever.
BUG=b:80501386,b:139099592 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I8e1d4f5bc7b45f45a8bfef74e86ec0ff6a556af4 Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/dramc_pi_api.h M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/memory.c 5 files changed, 39 insertions(+), 20 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/81/35481/48
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: soc/mediatek/mt8183: Handle memory test failure ......................................................................
Patch Set 48:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35481/45/src/soc/mediatek/mt8183/me... File src/soc/mediatek/mt8183/memory.c:
https://review.coreboot.org/c/coreboot/+/35481/45/src/soc/mediatek/mt8183/me... PS45, Line 160: 0
- If 'dparam' is not cleared now, is there a way to clear the flash? […]
Done
Yu-Ping Wu has uploaded a new patch set (#49) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: soc/mediatek/mt8183: Handle memory test failure ......................................................................
soc/mediatek/mt8183: Handle memory test failure
If DRAM calibration fails or mem test fails using the cached calibration results stored in flash, clean the cached results and rerun DRAM full calibration. If partial calibration fails or the mem test following it fails, hang forever.
BUG=b:80501386,b:139099592 BRANCH=kukui TEST=Boots correctly on Kukui
Change-Id: I8e1d4f5bc7b45f45a8bfef74e86ec0ff6a556af4 Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/dramc_pi_api.h M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/memory.c 5 files changed, 39 insertions(+), 20 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/81/35481/49
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: soc/mediatek/mt8183: Handle memory test failure ......................................................................
Patch Set 49: Code-Review+2
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: soc/mediatek/mt8183: Handle memory test failure ......................................................................
Patch Set 49:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35481/49//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/35481/49//COMMIT_MSG@11 PS49, Line 11: If partial calibration fails or the mem test following it : fails, hang forever. Why is that a good idea?
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: soc/mediatek/mt8183: Handle memory test failure ......................................................................
Patch Set 49:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35481/49//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/35481/49//COMMIT_MSG@11 PS49, Line 11: If partial calibration fails or the mem test following it : fails, hang forever.
Why is that a good idea?
That means we have no any other ways to initialize DRAM (usually implies hardware failure). Instead of falling into reboot loop and drains out of battery, it seems better to just hang so user may notice that and send to RMA.
Yu-Ping Wu has uploaded a new patch set (#50) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: soc/mediatek/mt8183: Handle memory test failure ......................................................................
soc/mediatek/mt8183: Handle memory test failure
If DRAM calibration fails or mem test fails using the cached calibration results stored in flash, rerun DRAM full calibration. If partial calibration fails or the mem test following it fails, hang forever.
Partial calibration acts as a fallback approach in case of full calibration failure. Therefore, if it fails, there would be no other ways to initialize DRAM. Instead of falling into reboot loop and draining out of battery, it is better to just hang so that the end user may notice that and send to RMA.
BUG=b:80501386,b:139099592 BRANCH=kukui TEST=Boots correctly on Kukui
Change-Id: I8e1d4f5bc7b45f45a8bfef74e86ec0ff6a556af4 Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/dramc_pi_api.h M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/memory.c 5 files changed, 39 insertions(+), 20 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/81/35481/50
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: soc/mediatek/mt8183: Handle memory test failure ......................................................................
Patch Set 50:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35481/49//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/35481/49//COMMIT_MSG@11 PS49, Line 11: If partial calibration fails or the mem test following it : fails, hang forever.
That means we have no any other ways to initialize DRAM (usually implies hardware failure). […]
Ack
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: soc/mediatek/mt8183: Handle memory test failure ......................................................................
Patch Set 50:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35481/49//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/35481/49//COMMIT_MSG@11 PS49, Line 11: If partial calibration fails or the mem test following it : fails, hang forever.
That means we have no any other ways to initialize DRAM (usually implies hardware failure). […]
@paul I've updated the commit message to explain the reason.
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: soc/mediatek/mt8183: Handle memory test failure ......................................................................
Patch Set 50:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35481/49//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/35481/49//COMMIT_MSG@11 PS49, Line 11: If partial calibration fails or the mem test following it : fails, hang forever.
@paul I've updated the commit message to explain the reason.
Done
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: soc/mediatek/mt8183: Handle memory test failure ......................................................................
Patch Set 50: Code-Review+1
(1 comment)
https://review.coreboot.org/c/coreboot/+/35481/50//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/35481/50//COMMIT_MSG@16 PS50, Line 16: draining out of battery Doesn’t the hang also drain the battery?
If the EC(?) could signal RAM failure with some LED that would be helpful too. But it’s unrelated.
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: soc/mediatek/mt8183: Handle memory test failure ......................................................................
Patch Set 50:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35481/50//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/35481/50//COMMIT_MSG@16 PS50, Line 16: draining out of battery
Doesn’t the hang also drain the battery? […]
the reboot process would consume more power consumption, and may cause I/O on more peripherals (for example SPI), especially causing TPM issues.
there's currently no standard way of handling DRAM initialization error on chromebooks, but I think we should just hang(halt) or poweroff. Let's try hang for now.
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: soc/mediatek/mt8183: Handle memory test failure ......................................................................
Patch Set 52: Code-Review+2
Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/35481 )
Change subject: soc/mediatek/mt8183: Handle memory test failure ......................................................................
soc/mediatek/mt8183: Handle memory test failure
If DRAM calibration fails or mem test fails using the cached calibration results stored in flash, rerun DRAM full calibration. If partial calibration fails or the mem test following it fails, hang forever.
Partial calibration acts as a fallback approach in case of full calibration failure. Therefore, if it fails, there would be no other ways to initialize DRAM. Instead of falling into reboot loop and draining out of battery, it is better to just hang so that the end user may notice that and send to RMA.
BUG=b:80501386,b:139099592 BRANCH=kukui TEST=Boots correctly on Kukui
Change-Id: I8e1d4f5bc7b45f45a8bfef74e86ec0ff6a556af4 Signed-off-by: Huayang Duan huayang.duan@mediatek.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/35481 Reviewed-by: Hung-Te Lin hungte@chromium.org Reviewed-by: Paul Menzel paulepanter@users.sourceforge.net Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/dramc_pi_api.h M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/memory.c 5 files changed, 39 insertions(+), 20 deletions(-)
Approvals: build bot (Jenkins): Verified Paul Menzel: Looks good to me, but someone else must approve Hung-Te Lin: Looks good to me, approved
diff --git a/src/soc/mediatek/mt8183/dramc_pi_calibration_api.c b/src/soc/mediatek/mt8183/dramc_pi_calibration_api.c index 6537af0..711e4bc 100644 --- a/src/soc/mediatek/mt8183/dramc_pi_calibration_api.c +++ b/src/soc/mediatek/mt8183/dramc_pi_calibration_api.c @@ -1969,11 +1969,13 @@ }
static u8 dramc_rx_datlat_cal(u8 chn, u8 rank, u8 freq_group, - const struct sdram_params *params, const bool fast_calib) + const struct sdram_params *params, const bool fast_calib, + bool *test_passed) { - u32 datlat, begin = 0, first = 0, sum = 0, best_step; + u32 datlat, begin = 0, first = 0, sum = 0, best_step; u32 datlat_start = 7;
+ *test_passed = true; best_step = read32(&ch[chn].ao.shu[0].conf[1]) & SHU_CONF1_DATLAT_MASK;
dramc_dbg("[DATLAT] start. CH%d RK%d DATLAT Default: 0x%x\n", @@ -2010,7 +2012,11 @@
dramc_engine2_end(chn, dummy_rd_backup);
- assert(sum != 0); + *test_passed = (sum != 0); + if (!*test_passed) { + dramc_show("DRAM memory test failed\n"); + return 0; + }
if (sum <= 3) best_step = first + (sum >> 1); @@ -2111,7 +2117,7 @@ (0xff << 8) | (0x9 << 2) | ROEN); }
-void dramc_calibrate_all_channels(const struct sdram_params *pams, u8 freq_group) +int dramc_calibrate_all_channels(const struct sdram_params *pams, u8 freq_group) { bool fast_calib; switch (pams->source) { @@ -2123,9 +2129,10 @@ break; default: die("Invalid DRAM param source %u\n", pams->source); - return; + return -1; }
+ bool test_passed; u8 rx_datlat[RANK_MAX] = {0}; for (u8 chn = 0; chn < CHANNEL_MAX; chn++) { for (u8 rk = RANK_0; rk < RANK_MAX; rk++) { @@ -2144,7 +2151,9 @@ dramc_window_perbit_cal(chn, rk, freq_group, TX_WIN_DQ_ONLY, pams, fast_calib); rx_datlat[rk] = dramc_rx_datlat_cal(chn, rk, freq_group, - pams, fast_calib); + pams, fast_calib, &test_passed); + if (!test_passed) + return -2; dramc_window_perbit_cal(chn, rk, freq_group, RX_WIN_TEST_ENG, pams, fast_calib); } @@ -2152,4 +2161,5 @@ dramc_rx_dqs_gating_post_process(chn, freq_group); dramc_dual_rank_rx_datlat_cal(chn, freq_group, rx_datlat[0], rx_datlat[1]); } + return 0; } diff --git a/src/soc/mediatek/mt8183/emi.c b/src/soc/mediatek/mt8183/emi.c index 52baeb1..4b08a10 100644 --- a/src/soc/mediatek/mt8183/emi.c +++ b/src/soc/mediatek/mt8183/emi.c @@ -342,12 +342,14 @@ clrbits_le32(&ch[chn].emi.chn_conb, 0xff << 24); }
-static void do_calib(const struct sdram_params *params, u8 freq_group) +static int do_calib(const struct sdram_params *params, u8 freq_group) { dramc_show("Start K, current clock is:%d\n", params->frequency); - dramc_calibrate_all_channels(params, freq_group); + if (dramc_calibrate_all_channels(params, freq_group) != 0) + return -1; dramc_ac_timing_optimize(freq_group); dramc_show("K finish with clock:%d\n", params->frequency); + return 0; }
static void after_calib(void) @@ -356,7 +358,7 @@ dramc_runtime_config(); }
-void mt_set_emi(const struct dramc_param *dparam) +int mt_set_emi(const struct dramc_param *dparam) { const u8 *freq_tbl; const int shuffle = DRAM_DFS_SHUFFLE_1; @@ -372,7 +374,9 @@ params = &dparam->freq_params[shuffle];
init_dram(params, current_freqsel); - do_calib(params, current_freqsel); + if (do_calib(params, current_freqsel) != 0) + return -1;
after_calib(); + return 0; } diff --git a/src/soc/mediatek/mt8183/include/soc/dramc_pi_api.h b/src/soc/mediatek/mt8183/include/soc/dramc_pi_api.h index 1ce5f67..afd6718 100644 --- a/src/soc/mediatek/mt8183/include/soc/dramc_pi_api.h +++ b/src/soc/mediatek/mt8183/include/soc/dramc_pi_api.h @@ -110,7 +110,7 @@ void dramc_sw_impedance_cal(const struct sdram_params *params, u8 term_option); void dramc_apply_config_before_calibration(u8 freq_group); void dramc_apply_config_after_calibration(void); -void dramc_calibrate_all_channels(const struct sdram_params *pams, +int dramc_calibrate_all_channels(const struct sdram_params *pams, u8 freq_group); void dramc_hw_gating_onoff(u8 chn, bool onoff); void dramc_enable_phy_dcm(bool bEn); diff --git a/src/soc/mediatek/mt8183/include/soc/emi.h b/src/soc/mediatek/mt8183/include/soc/emi.h index 2821511..1a364fb 100644 --- a/src/soc/mediatek/mt8183/include/soc/emi.h +++ b/src/soc/mediatek/mt8183/include/soc/emi.h @@ -88,7 +88,7 @@ size_t sdram_size(void); const struct sdram_params *get_sdram_config(void); void enable_emi_dcm(void); -void mt_set_emi(const struct dramc_param *dparam); +int mt_set_emi(const struct dramc_param *dparam); void mt_mem_init(struct dramc_param_ops *dparam_ops);
#endif /* SOC_MEDIATEK_MT8183_EMI_H */ diff --git a/src/soc/mediatek/mt8183/memory.c b/src/soc/mediatek/mt8183/memory.c index 19f7326..bd5c74c 100644 --- a/src/soc/mediatek/mt8183/memory.c +++ b/src/soc/mediatek/mt8183/memory.c @@ -19,10 +19,9 @@ #include <soc/dramc_param.h> #include <soc/dramc_pi_api.h> #include <soc/emi.h> -#include <string.h> #include <symbols.h>
-static void mt_mem_test(void) +static int mt_mem_test(void) { u64 rank_size[RANK_MAX];
@@ -43,11 +42,16 @@ printk(BIOS_DEBUG, "[MEM] complex R/W mem test %s : %d\n", (i == 0) ? "pass" : "fail", i);
- ASSERT(i == 0); + if (i != 0) { + dramc_show("DRAM memory test failed\n"); + return -1; + }
addr += rank_size[r]; } } + + return 0; }
static void dump_param_header(const struct dramc_param *dparam) @@ -147,9 +151,8 @@ if (dram_run_fast_calibration(dparam, config) == 0) { printk(BIOS_INFO, "DRAM calibraion params loaded from flash\n"); - mt_set_emi(dparam); - mt_mem_test(); - return; + if (mt_set_emi(dparam) == 0 && mt_mem_test() == 0) + return; } } else { printk(BIOS_WARNING, @@ -174,6 +177,8 @@
/* Init params from sdram configs and run partial calibration */ init_sdram_params(dparam->freq_params, get_sdram_config()); - mt_set_emi(dparam); - mt_mem_test(); + if (mt_set_emi(dparam) != 0) + die("Set emi failed with params from sdram config\n"); + if (mt_mem_test() != 0) + die("Memory test failed with params from sdram config\n"); }