mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-25 06:00:43 +00:00
stm32mp1: ram: add tuning in DDR interactive mode
Add command tuning for DDR interactive mode, used during board bring-up or with CubeMX DDR tools to execute software tuning for the DDR configuration: - software read DQS Gating (replace the built-in one) - Bit de-skew - Eye Training or DQS training Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
This commit is contained in:
parent
0d44752442
commit
187c41d783
6 changed files with 1414 additions and 1 deletions
|
@ -37,3 +37,13 @@ config STM32MP1_DDR_TESTS
|
|||
help
|
||||
activate test support for interactive support in
|
||||
STM32MP1 DDR controller driver: command test
|
||||
|
||||
config STM32MP1_DDR_TUNING
|
||||
bool "STM32MP1 DDR driver : support of tuning"
|
||||
depends on STM32MP1_DDR_INTERACTIVE
|
||||
default y
|
||||
help
|
||||
activate tuning command in STM32MP1 DDR interactive mode
|
||||
used for DDR tuning tools
|
||||
- DQ Deskew algorithm
|
||||
- DQS Trimming
|
||||
|
|
|
@ -8,6 +8,7 @@ obj-y += stm32mp1_ddr.o
|
|||
|
||||
obj-$(CONFIG_STM32MP1_DDR_INTERACTIVE) += stm32mp1_interactive.o
|
||||
obj-$(CONFIG_STM32MP1_DDR_TESTS) += stm32mp1_tests.o
|
||||
obj-$(CONFIG_STM32MP1_DDR_TUNING) += stm32mp1_tuning.o
|
||||
|
||||
ifneq ($(DDR_INTERACTIVE),)
|
||||
CFLAGS_stm32mp1_interactive.o += -DCONFIG_STM32MP1_DDR_INTERACTIVE_FORCE=y
|
||||
|
|
|
@ -332,6 +332,7 @@ struct stm32mp1_ddrphy {
|
|||
|
||||
#define DDRPHYC_DXNGCR_DXEN BIT(0)
|
||||
|
||||
#define DDRPHYC_DXNDLLCR_DLLSRST BIT(30)
|
||||
#define DDRPHYC_DXNDLLCR_DLLDIS BIT(31)
|
||||
#define DDRPHYC_DXNDLLCR_SDPHASE_MASK GENMASK(17, 14)
|
||||
#define DDRPHYC_DXNDLLCR_SDPHASE_SHIFT 14
|
||||
|
|
|
@ -54,6 +54,9 @@ enum ddr_command stm32mp1_get_command(char *cmd, int argc)
|
|||
[DDR_CMD_GO] = "go",
|
||||
#ifdef CONFIG_STM32MP1_DDR_TESTS
|
||||
[DDR_CMD_TEST] = "test",
|
||||
#endif
|
||||
#ifdef CONFIG_STM32MP1_DDR_TUNING
|
||||
[DDR_CMD_TUNING] = "tuning",
|
||||
#endif
|
||||
};
|
||||
/* min and max number of argument */
|
||||
|
@ -70,6 +73,9 @@ enum ddr_command stm32mp1_get_command(char *cmd, int argc)
|
|||
[DDR_CMD_GO] = { 0, 0 },
|
||||
#ifdef CONFIG_STM32MP1_DDR_TESTS
|
||||
[DDR_CMD_TEST] = { 0, 255 },
|
||||
#endif
|
||||
#ifdef CONFIG_STM32MP1_DDR_TUNING
|
||||
[DDR_CMD_TUNING] = { 0, 255 },
|
||||
#endif
|
||||
};
|
||||
int i;
|
||||
|
@ -114,6 +120,9 @@ static void stm32mp1_do_usage(void)
|
|||
"reset reboots machine\n"
|
||||
#ifdef CONFIG_STM32MP1_DDR_TESTS
|
||||
"test [help] | <n> [...] lists (with help) or executes test <n>\n"
|
||||
#endif
|
||||
#ifdef CONFIG_STM32MP1_DDR_TUNING
|
||||
"tuning [help] | <n> [...] lists (with help) or execute tuning <n>\n"
|
||||
#endif
|
||||
"\nwith for [type|reg]:\n"
|
||||
" all registers if absent\n"
|
||||
|
@ -297,7 +306,7 @@ end:
|
|||
return step;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_STM32MP1_DDR_TESTS)
|
||||
#if defined(CONFIG_STM32MP1_DDR_TESTS) || defined(CONFIG_STM32MP1_DDR_TUNING)
|
||||
static const char * const s_result[] = {
|
||||
[TEST_PASSED] = "Pass",
|
||||
[TEST_FAILED] = "Failed",
|
||||
|
@ -457,6 +466,15 @@ bool stm32mp1_ddr_interactive(void *priv,
|
|||
break;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32MP1_DDR_TUNING
|
||||
case DDR_CMD_TUNING:
|
||||
if (!stm32mp1_check_step(step, STEP_DDR_READY))
|
||||
continue;
|
||||
stm32mp1_ddr_subcmd(priv, argc, argv,
|
||||
tuning, tuning_nb);
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -28,4 +28,7 @@ struct test_desc {
|
|||
extern const struct test_desc test[];
|
||||
extern const int test_nb;
|
||||
|
||||
extern const struct test_desc tuning[];
|
||||
extern const int tuning_nb;
|
||||
|
||||
#endif
|
||||
|
|
1380
drivers/ram/stm32mp1/stm32mp1_tuning.c
Normal file
1380
drivers/ram/stm32mp1/stm32mp1_tuning.c
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue