DDR configuration refactor and 16GB dual-rank support
cover DDR configuration refactor and 16GB dual-rank support
From: Emanuele Ghidoli <[email protected]>
This series refactors the DDR configuration handling for the Toradex Aquila AM69 board and adds support for a 16GB dual-rank memory configuration, while changing the HW_CFG pins value to DDR configurations mapping.
Emanuele Ghidoli (2):
board: toradex: aquila-am69: refactor memory configuration
board: toradex: aquila-am69: Add support for 16GB dual rank memory
configuration
board/toradex/aquila-am69/Makefile | 1 + board/toradex/aquila-am69/aquila-am69.c | 26 ++++++--- board/toradex/aquila-am69/aquila_ddrs.h | 15 ++++++ board/toradex/aquila-am69/aquila_ddrs_16GB.h | 11 ---- .../aquila-am69/aquila_ddrs_16GB_rank_2.c | 54 +++++++++++++++++++ board/toradex/aquila-am69/aquila_ddrs_8GB.h | 11 ---- 6 files changed, 88 insertions(+), 30 deletions(-) create mode 100644 board/toradex/aquila-am69/aquila_ddrs.h delete mode 100644 board/toradex/aquila-am69/aquila_ddrs_16GB.h create mode 100644 board/toradex/aquila-am69/aquila_ddrs_16GB_rank_2.c delete mode 100644 board/toradex/aquila-am69/aquila_ddrs_8GB.h
Signature · 1 line
2.43.0
PATCH 1/2 board: toradex: aquila-am69: refactor memory configuration
From: Emanuele Ghidoli <[email protected]>
The memory controller configuration doesn't depend only on the memory size, so refactor the code to use the memory configuration read from the HW_CFG pin instead of the memory size.
Additionally, make use of one header file for all the memory configurations.
--- board/toradex/aquila-am69/aquila-am69.c | 18 +++++++++++------- board/toradex/aquila-am69/aquila_ddrs.h | 14 ++++++++++++++ board/toradex/aquila-am69/aquila_ddrs_16GB.h | 11 ----------- board/toradex/aquila-am69/aquila_ddrs_8GB.h | 11 ----------- 4 files changed, 25 insertions(+), 29 deletions(-) create mode 100644 board/toradex/aquila-am69/aquila_ddrs.h delete mode 100644 board/toradex/aquila-am69/aquila_ddrs_16GB.h delete mode 100644 board/toradex/aquila-am69/aquila_ddrs_8GB.h
board/toradex/aquila-am69/aquila-am69.c +11 -7
@@ -17,8 +17,7 @@#include <spl.h> #include "../common/tdx-common.h" -#include "aquila_ddrs_16GB.h" -#include "aquila_ddrs_8GB.h" +#include "aquila_ddrs.h" #include "ddrs_patch.h" #define CTRL_MMR_CFG0_MCU_ADC1_CTRL 0x40F040B4
@@ -27,14 +26,19 @@#define HW_CFG_MEM_SZ_16GB 0x01#define HW_CFG_MEM_SZ_8GB 0x02 -#define HW_CFG_MEM_SZ_MASK 0x03 +#define HW_CFG_MEM_CFG_MASK 0x03DECLARE_GLOBAL_DATA_PTR ;static u8 hw_cfg; +static u8 aquila_am69_memory_cfg (void ) +{ +return hw_cfg &HW_CFG_MEM_CFG_MASK ; +} +static u64 aquila_am69_memory_size (void ) { -switch (hw_cfg &HW_CFG_MEM_SZ_MASK ) { +switch (aquila_am69_memory_cfg ()) {case HW_CFG_MEM_SZ_32GB :return SZ_32G ;case HW_CFG_MEM_SZ_16GB :
@@ -79,12 +83,12 @@ static void update_ddr_timings(void)int ret =0 ;void *fdt = (void *)gd->fdt_blob; -switch (aquila_am69_memory_size ()) { -case SZ_8G : +switch (aquila_am69_memory_cfg ()) { +case HW_CFG_MEM_SZ_8GB : ret =aquila_am69_fdt_apply_ddr_patch (fdt, aquila_am69_ddrss_patch_8GB,MULTI_DDR_CFG_INTRLV_SIZE_8GB );break ; -case SZ_16G : +case HW_CFG_MEM_SZ_16GB : ret =aquila_am69_fdt_apply_ddr_patch (fdt, aquila_am69_ddrss_patch_16GB,MULTI_DDR_CFG_INTRLV_SIZE_16GB );break ;
board/toradex/aquila-am69/aquila_ddrs.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* Copyright (c) Toradex - https://www.toradex.com/ +*/ +#ifndef __AQUILA_DDRS_H +#define __AQUILA_DDRS_H + +#define MULTI_DDR_CFG_INTRLV_SIZE_8GB 9 +#define MULTI_DDR_CFG_INTRLV_SIZE_16GB 11 + +extern struct ddrss_patch *aquila_am69_ddrss_patch_8GB[4 ]; +extern struct ddrss_patch *aquila_am69_ddrss_patch_16GB[4 ]; + +#endif // __AQUILA_DDRS_H
board/toradex/aquila-am69/aquila_ddrs_16GB.h deleted +0 -11
@@ -1,11 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* -* Copyright (C) 2025 Toradex - https://www.toradex.com/ -*/ -#ifndef __AQUILA_DDRS_16GB_H -#define __AQUILA_DDRS_16GB_H - -#define MULTI_DDR_CFG_INTRLV_SIZE_16GB 11 -extern struct ddrss_patch *aquila_am69_ddrss_patch_16GB[4 ]; - -#endif // __AQUILA_DDRS_16GB_H
board/toradex/aquila-am69/aquila_ddrs_8GB.h deleted +0 -11
@@ -1,11 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* -* Copyright (C) 2025 Toradex - https://www.toradex.com/ -*/ -#ifndef __AQUILA_DDRS_8GB_H -#define __AQUILA_DDRS_8GB_H - -#define MULTI_DDR_CFG_INTRLV_SIZE_8GB 9 -extern struct ddrss_patch *aquila_am69_ddrss_patch_8GB[4 ]; - -#endif // __AQUILA_DDRS_8GB_H
Signature · 1 line
2.43.0
PATCH 2/2 board: toradex: aquila-am69: Add support for 16GB dual rank memory configuration
In reply to Emanuele GhidoliFrom: Emanuele Ghidoli <[email protected]>
Move the existing 16GB single-rank configuration to HW_CFG 0x03 and use the previous HW_CFG 0x01 value for the new 16GB dual-rank configuration.
There is no hardware using the former 16GB single-rank configuration, so reuse the HW_CFG value for the new 16GB dual-rank configuration, which will be used in production.
--- board/toradex/aquila-am69/Makefile | 1 + board/toradex/aquila-am69/aquila-am69.c | 8 ++- board/toradex/aquila-am69/aquila_ddrs.h | 1 + .../aquila-am69/aquila_ddrs_16GB_rank_2.c | 54 +++++++++++++++++++ 4 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 board/toradex/aquila-am69/aquila_ddrs_16GB_rank_2.c
board/toradex/aquila-am69/Makefile +1 -0
@@ -6,4 +6,5 @@ obj-y += aquila-am69.o obj-y += ddrs_patch.o obj-y += aquila_ddrs_16GB.o +obj-y += aquila_ddrs_16GB_rank_2.o obj-y += aquila_ddrs_8GB.o
board/toradex/aquila-am69/aquila-am69.c +7 -1
@@ -23,8 +23,9 @@#define CTRL_MMR_CFG0_MCU_ADC1_CTRL 0x40F040B4#define HW_CFG_MEM_SZ_32GB 0x00 -#define HW_CFG_MEM_SZ_16GB 0x01 +#define HW_CFG_MEM_SZ_16GB_RANK_2 0x01#define HW_CFG_MEM_SZ_8GB 0x02 +#define HW_CFG_MEM_SZ_16GB 0x03#define HW_CFG_MEM_CFG_MASK 0x03
@@ -41,6 +42,7 @@ static u64 aquila_am69_memory_size(void)switch (aquila_am69_memory_cfg ()) {case HW_CFG_MEM_SZ_32GB :return SZ_32G ; +case HW_CFG_MEM_SZ_16GB_RANK_2 :case HW_CFG_MEM_SZ_16GB :return SZ_16G ;case HW_CFG_MEM_SZ_8GB :
@@ -88,6 +90,10 @@ static void update_ddr_timings(void) ret =aquila_am69_fdt_apply_ddr_patch (fdt, aquila_am69_ddrss_patch_8GB,MULTI_DDR_CFG_INTRLV_SIZE_8GB );break ; +case HW_CFG_MEM_SZ_16GB_RANK_2 : + ret =aquila_am69_fdt_apply_ddr_patch (fdt, aquila_am69_ddrss_patch_16GB_rank_2, +MULTI_DDR_CFG_INTRLV_SIZE_16GB ); +break ;case HW_CFG_MEM_SZ_16GB : ret =aquila_am69_fdt_apply_ddr_patch (fdt, aquila_am69_ddrss_patch_16GB,MULTI_DDR_CFG_INTRLV_SIZE_16GB );
board/toradex/aquila-am69/aquila_ddrs.h +1 -0
@@ -10,5 +10,6 @@extern struct ddrss_patch *aquila_am69_ddrss_patch_8GB[4 ];extern struct ddrss_patch *aquila_am69_ddrss_patch_16GB[4 ]; +extern struct ddrss_patch *aquila_am69_ddrss_patch_16GB_rank_2[4 ];#endif // __AQUILA_DDRS_H
board/toradex/aquila-am69/aquila_ddrs_16GB_rank_2.c new file +54 -0
54 lines not on this page · raw message
Signature · 1 line
2.43.0
Quoted 6 lines · Emanuele Ghidoli
From: Emanuele Ghidoli <[email protected]>
This series refactors the DDR configuration handling for the Toradex Aquila AM69 board and adds support for a 16GB dual-rank memory configuration, while changing the
HW_CFGpins value to DDR configurations mapping.
Quoted 8 lines · Emanuele Ghidoli
From: Emanuele Ghidoli <[email protected]>
This series refactors the DDR configuration handling for the Toradex Aquila AM69 board and adds support for a 16GB dual-rank memory configuration, while changing the
HW_CFGpins value to DDR configurations mapping.[...]
Applied to u-boot/next, thanks!
[1/2] board: toradex: aquila-am69: refactor memory configuration
commit: f1fa4221485822317629f4d2c5d7087170915c66
[2/2] board: toradex: aquila-am69: Add support for 16GB dual rank memory configuration
commit: 39e014f43a15e79b82946922ef7062ae0969ac99Signature · 1 line
Tom