ddr: imx: Reload the training firmware for every PHY configuration
Subsystems (2)
PATCH v2 1/4 ddr: imx: Reload the training firmware for every PHY configuration
From: Frieder Schrempf <[email protected]>
ddr_load_train_firmware() remembers the type of the last loaded firmware image in a static variable and returns early if the same type is requested again. That is valid within a single ddr_cfg_phy() call, where the 1D image is used for several frequency setpoints in a row, but the state also survives across calls.
Boards that probe several DDR configurations call ddr_init() more than once. The power up procedure at the beginning of ddr_init() resets the DDR PHY, which leaves the image in the PHY memory in an undefined state. The second call then skips the loading, starts the PMU on whatever is left of it and the training firmware never reports a result. As the PHY also stops answering on its APB interface at that point, the boot hangs in a register read, which no software timeout can recover from.
On some specific Kontron SL i.MX8MM with 1GB or 2GB DDR, where the first init is expected to fail and the second one uses an adjusted configuration, this made the boot hang every few cycles.
Move the check into ddr_cfg_phy(), the only caller, so that the loading is still skipped for repeated setpoints of one run, but never across runs.
---
Changes in v2:
* Add missing hunk due to rebase gone wrong
--- drivers/ddr/imx/phy/ddrphy_train.c | 14 ++++++++++++-- drivers/ddr/imx/phy/helper.c | 7 ------- 2 files changed, 12 insertions(+), 9 deletions(-)
drivers/ddr/imx/phy/ddrphy_train.c +12 -2
@@ -12,6 +12,7 @@ int ddr_cfg_phy(struct dram_timing_info *dram_timing) {struct dram_cfg_param *dram_cfg;struct dram_fsp_msg *fsp_msg; +int last_fw_type =-1 ;unsigned int num;int i =0 ;int j =0 ;
@@ -33,9 +34,18 @@ int ddr_cfg_phy(struct dram_timing_info *dram_timing)/* set dram PHY input clocks to desired frequency */ ddrphy_init_set_dfi_clk (fsp_msg->drate); -/* load the dram training firmware image */ +/* +* Load the DRAM training firmware image, unless the same image has +* already been loaded for an earlier frequency setpoint of this run. +* It must be loaded again for every ddr_cfg_phy() call as the caller +* resets the PHY before this, which leaves the image in the PHY memory +* in an undefined state. +*/ dwc_ddrphy_apb_wr (0xd0000 ,0x0 ); -ddr_load_train_firmware (fsp_msg->fw_type); +if (fsp_msg->fw_type != last_fw_type) { +ddr_load_train_firmware (fsp_msg->fw_type); + last_fw_type = fsp_msg->fw_type; + }/* load the frequency set point message block parameter */ dram_cfg = fsp_msg->fsp_cfg;
drivers/ddr/imx/phy/helper.c +0 -7
@@ -50,15 +50,8 @@ void ddr_load_train_firmware(enum fw_type type)unsigned long imem_start = (unsigned long )_end + fw_offset;unsigned long dmem_start;unsigned long imem_len =IMEM_LEN , dmem_len =DMEM_LEN ; -static enum fw_type last_type =-1 ;unsigned long spl_start =0 ; -/* If FW doesn't change, we can save the loading. */ -if (last_type == type) -return ; - - last_type = type; -#ifdef CONFIG_SPL_OF_CONTROL if (gd->fdt_blob && !fdt_check_header (gd->fdt_blob)) { imem_start = roundup((unsigned long)_end +
Signature · 1 line
2.55.0
PATCH v2 2/4 ddr: imx: Move error message for failed training to calling side
From: Frieder Schrempf <[email protected]>
Move the error message from wait_ddrphy_training_complete() to the calling site in ddr_cfg_phy(). This is more robust to future changes in wait_ddrphy_training_complete() and allows us to make the message optional.
--- drivers/ddr/imx/phy/ddrphy_train.c | 4 +++- drivers/ddr/imx/phy/ddrphy_utils.c | 1 - 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/ddr/imx/phy/ddrphy_train.c +3 -1
@@ -72,8 +72,10 @@ int ddr_cfg_phy(struct dram_timing_info *dram_timing)/* Wait for the training firmware to complete */ ret =wait_ddrphy_training_complete (); -if (ret) +if (ret) { +printf ("Training FAILED\n" );return ret; + }/* Halt the microcontroller. */ dwc_ddrphy_apb_wr (0xd0099 ,0x1 );
drivers/ddr/imx/phy/ddrphy_utils.c +0 -1
@@ -97,7 +97,6 @@ int wait_ddrphy_training_complete(void)debug ("Training PASS\n" );return 0 ; }else if (mail ==0xff ) { -printf ("Training FAILED\n" );return -1 ; } }
Signature · 1 line
2.55.0
PATCH v2 3/4 ddr: imx: Allow to call ddr init without logging failure
In reply to Frieder SchrempfFrom: Frieder Schrempf <[email protected]>
In some cases we need to call ddr_init() multiple times to try different configurations. In this case failures are expected and error messages cause confusion. Introduce ddr_init_silent_fail() for those cases.
--- arch/arm/include/asm/arch-imx8m/ddr.h | 4 +++- arch/arm/include/asm/arch-imx9/ddr.h | 4 +++- drivers/ddr/imx/imx8m/ddr_init.c | 14 ++++++++++++-- drivers/ddr/imx/imx9/ddr_init.c | 14 ++++++++++++-- drivers/ddr/imx/phy/ddrphy_train.c | 5 +++-- 5 files changed, 33 insertions(+), 8 deletions(-)
arch/arm/include/asm/arch-imx8m/ddr.h +3 -1
@@ -9,6 +9,7 @@#include <asm/io.h> #include <asm/types.h> #include <asm/arch/imx-regs.h> +#include <linux/types.h> #define DDRC_DDR_SS_GPR0 0x3d000000#define DDRC_IPS_BASE_ADDR_0 0x3f400000
@@ -705,8 +706,9 @@ struct dram_timing_info {extern struct dram_timing_info dram_timing;void ddr_load_train_firmware (enum fw_type type); +int ddr_init_silent_fail (struct dram_timing_info *timing_info);int ddr_init (struct dram_timing_info *timing_info); -int ddr_cfg_phy (struct dram_timing_info *timing_info); +int ddr_cfg_phy (struct dram_timing_info *timing_info,bool log_fail);void load_lpddr4_phy_pie (void );void ddrphy_trained_csr_save (struct dram_cfg_param *param,unsigned int num);void *dram_config_save (struct dram_timing_info *info,unsigned long base);
arch/arm/include/asm/arch-imx9/ddr.h +3 -1
@@ -8,6 +8,7 @@#include <asm/io.h> #include <asm/types.h> +#include <linux/types.h> #define DDR_CTL_BASE 0x4E300000#define DDR_PHY_BASE 0x4E100000
@@ -147,8 +148,9 @@ struct ddrphy_qb_state { };void ddr_load_train_firmware (enum fw_type type); +int ddr_init_silent_fail (struct dram_timing_info *timing_info);int ddr_init (struct dram_timing_info *timing_info); -int ddr_cfg_phy (struct dram_timing_info *timing_info); +int ddr_cfg_phy (struct dram_timing_info *timing_info,bool log_fail);void load_lpddr4_phy_pie (void );void ddrphy_trained_csr_save (struct dram_cfg_param *param,unsigned int num);void *dram_config_save (struct dram_timing_info *info,unsigned long base);
drivers/ddr/imx/imx8m/ddr_init.c +12 -2
@@ -310,7 +310,7 @@ void update_umctl2_rank_space_setting(unsigned int pstat_num) } } -int ddr_init (struct dram_timing_info *dram_timing) +static int __ddr_init (struct dram_timing_info *dram_timing,bool log_fail) {unsigned int tmp, initial_drate, target_freq;int ret;
@@ -390,7 +390,7 @@ int ddr_init(struct dram_timing_info *dram_timing)*/ debug ("DDRINFO:ddrphy config start\n" ); - ret =ddr_cfg_phy (dram_timing); + ret =ddr_cfg_phy (dram_timing, log_fail);if (ret)return ret;
@@ -470,6 +470,16 @@ int ddr_init(struct dram_timing_info *dram_timing)return 0 ; } +int ddr_init (struct dram_timing_info *dram_timing) +{ +return __ddr_init (dram_timing, true); +} + +int ddr_init_silent_fail (struct dram_timing_info *dram_timing) +{ +return __ddr_init (dram_timing, false); +} +ulong ddrphy_addr_remap (uint32_t paddr_apb_from_ctlr) {return 4 * paddr_apb_from_ctlr;
drivers/ddr/imx/imx9/ddr_init.c +12 -2
@@ -335,7 +335,7 @@ void save_trained_mr12_14(struct dram_cfg_param *cfg, u32 cfg_num, u32 mr12, u32 } } -int ddr_init (struct dram_timing_info *dram_timing) +static int __ddr_init (struct dram_timing_info *dram_timing,bool log_fail) {unsigned int initial_drate;struct dram_timing_info *saved_timing;
@@ -361,7 +361,7 @@ int ddr_init(struct dram_timing_info *dram_timing)*/ debug ("DDRINFO:ddrphy config start\n" ); - ret =ddr_cfg_phy (dram_timing); + ret =ddr_cfg_phy (dram_timing, log_fail);if (ret)return ret;
@@ -412,6 +412,16 @@ int ddr_init(struct dram_timing_info *dram_timing)return 0 ; } +int ddr_init (struct dram_timing_info *dram_timing) +{ +return __ddr_init (dram_timing, true); +} + +int ddr_init_silent_fail (struct dram_timing_info *dram_timing) +{ +return __ddr_init (dram_timing, false); +} +ulong ddrphy_addr_remap (u32 paddr_apb_from_ctlr) {u32 paddr_apb_qual;
drivers/ddr/imx/phy/ddrphy_train.c +3 -2
@@ -8,7 +8,7 @@#include <asm/arch/ddr.h> #include <asm/arch/sys_proto.h> -int ddr_cfg_phy (struct dram_timing_info *dram_timing) +int ddr_cfg_phy (struct dram_timing_info *dram_timing,bool log_fail) {struct dram_cfg_param *dram_cfg;struct dram_fsp_msg *fsp_msg;
@@ -73,7 +73,8 @@ int ddr_cfg_phy(struct dram_timing_info *dram_timing)/* Wait for the training firmware to complete */ ret =wait_ddrphy_training_complete ();if (ret) { -printf ("Training FAILED\n" ); +if (log_fail || _DEBUG) +printf ("Training FAILED\n" );return ret; }
Signature · 1 line
2.55.0
Re: [PATCH v2 3/4] ddr: imx: Allow to call ddr init without logging failure
Quoted 4 lines · Frieder Schrempf
From: Frieder Schrempf <[email protected]>
In some cases we need to call
ddr_init()multiple times to try different configurations.
What different configurations ? Details please ?
Re: [PATCH v2 3/4] ddr: imx: Allow to call ddr init without logging failure
Quoted 7 lines · Marek Vasut
Quoted 4 lines · Frieder Schrempf
From: Frieder Schrempf <[email protected]>
In some cases we need to call
ddr_init()multiple times to try different configurations.What different configurations ? Details please ?
The detection of different DDR types/sizes on our SoMs has always been based on trying the init and seeing if it succeeds, falling back to the smaller sizes on failure. See here [1].
[1]
https://git.u-boot-project.org/u-boot/u-boot/-/blob/main/board/kontron/sl-mx8mm/spl.c#L72
Re: [PATCH v2 3/4] ddr: imx: Allow to call ddr init without logging failure
Quoted 4 lines · Frieder Schrempf
Quoted 3 lines · Marek Vasut
Quoted 2 lines · Frieder Schrempf
From: Frieder Schrempf <[email protected]>
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
In some cases we need to call
ddr_init()multiple times to try different configurations.What different configurations ? Details please ?
The detection of different DDR types/sizes on our SoMs has always been based on trying the init and seeing if it succeeds, falling back to the smaller sizes on failure. See here [1].
Could you maybe bring the interface up in some minimal 400 MTps or 100 MTps configuration and then read out the MR ID registers from the DRAM to discern which DRAM configuration is present on your SoM? This would be the ideal generic way of doing this, and it would be reliable since the IDs are stable and surely indicate which DRAM chip and how big it is.
Re: [PATCH v2 3/4] ddr: imx: Allow to call ddr init without logging failure
Quoted 10 lines · Marek Vasut
Quoted 9 lines · Frieder Schrempf
Quoted 7 lines · Marek Vasut
Quoted 4 lines · Frieder Schrempf
From: Frieder Schrempf <[email protected]>
In some cases we need to call
ddr_init()multiple times to try different configurations.What different configurations ? Details please ?
Quoted 8 lines
Quoted 3 lines
The detection of different DDR types/sizes on our SoMs has always been based on trying the init and seeing if it succeeds, falling back to the smaller sizes on failure. See here [1].
Could you maybe bring the interface up in some minimal 400 MTps or 100 MTps configuration and then read out the MR ID registers from the DRAM to discern which DRAM configuration is present on your SoM? This would be the ideal generic way of doing this, and it would be reliable since the IDs are stable and surely indicate which DRAM chip and how big it is.
No, unfortunately this doesn't work. We already tried. The MR ID can't be used as we have single and dual rank setups that report the same ID. We have no way of knowing how many dies are connected unless we try it.
Re: [PATCH v2 3/4] ddr: imx: Allow to call ddr init without logging failure
Quoted 20 lines · Frieder Schrempf
Quoted 10 lines · Marek Vasut
Quoted 9 lines · Frieder Schrempf
Quoted 7 lines · Marek Vasut
Quoted 4 lines · Frieder Schrempf
From: Frieder Schrempf <[email protected]>
In some cases we need to call
ddr_init()multiple times to try different configurations.What different configurations ? Details please ?
Quoted 8 lines
Quoted 3 lines
The detection of different DDR types/sizes on our SoMs has always been based on trying the init and seeing if it succeeds, falling back to the smaller sizes on failure. See here [1].
Could you maybe bring the interface up in some minimal 400 MTps or 100 MTps configuration and then read out the MR ID registers from the DRAM to discern which DRAM configuration is present on your SoM? This would be the ideal generic way of doing this, and it would be reliable since the IDs are stable and surely indicate which DRAM chip and how big it is.
Quoted 3 lines
No, unfortunately this doesn't work. We already tried. The MR ID can't be used as we have single and dual rank setups that report the same ID. We have no way of knowing how many dies are connected unless we try it.
Is the controller unable to interact with each rank separately ? I would expect in single rank setup, that read of MR ID from one rank would pass and from the other rank it would fail ?
Re: [PATCH v2 3/4] ddr: imx: Allow to call ddr init without logging failure
Quoted 22 lines · Marek Vasut
Quoted 21 lines · Frieder Schrempf
Quoted 19 lines · Marek Vasut
Quoted 4 lines · Frieder Schrempf
Quoted 3 lines · Marek Vasut
Quoted 2 lines · Frieder Schrempf
From: Frieder Schrempf <[email protected]>
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
In some cases we need to call
ddr_init()multiple times to try different configurations.What different configurations ? Details please ?
The detection of different DDR types/sizes on our SoMs has always been based on trying the init and seeing if it succeeds, falling back to the smaller sizes on failure. See here [1].
Could you maybe bring the interface up in some minimal 400 MTps or 100 MTps configuration and then read out the MR ID registers from the DRAM to discern which DRAM configuration is present on your SoM? This would be the ideal generic way of doing this, and it would be reliable since the IDs are stable and surely indicate which DRAM chip and how big it is.
Quoted 7 lines
Quoted 3 lines
No, unfortunately this doesn't work. We already tried. The MR ID can't be used as we have single and dual rank setups that report the same ID. We have no way of knowing how many dies are connected unless we try it.
Is the controller unable to interact with each rank separately ? I would expect in single rank setup, that read of MR ID from one rank would pass and from the other rank it would fail ?
I'm not sure, but even if it would work, it would require several separate init attempts only to read the IDs, so I'm not sure if there is any benefit. Also I'm not seeing anyone doing this kind of thing. It might be worth looking at, but my primary goal now is to land patch 1 of this series in order to fix the regression.
Re: [PATCH v2 3/4] ddr: imx: Allow to call ddr init without logging failure
Quoted 27 lines · Frieder Schrempf
Quoted 26 lines · Marek Vasut
Quoted 24 lines · Frieder Schrempf
Quoted 13 lines · Marek Vasut
Quoted 4 lines · Frieder Schrempf
Quoted 3 lines · Marek Vasut
Quoted 2 lines · Frieder Schrempf
From: Frieder Schrempf <[email protected]>
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
In some cases we need to call
ddr_init()multiple times to try different configurations.What different configurations ? Details please ?
The detection of different DDR types/sizes on our SoMs has always been based on trying the init and seeing if it succeeds, falling back to the smaller sizes on failure. See here [1].
Quoted 6 lines
Could you maybe bring the interface up in some minimal 400 MTps or 100 MTps configuration and then read out the MR ID registers from the DRAM to discern which DRAM configuration is present on your SoM? This would be the ideal generic way of doing this, and it would be reliable since the IDs are stable and surely indicate which DRAM chip and how big it is.
No, unfortunately this doesn't work. We already tried. The MR ID can't be used as we have single and dual rank setups that report the same ID. We have no way of knowing how many dies are connected unless we try it.
Quoted 6 lines
Quoted 3 lines
Is the controller unable to interact with each rank separately ? I would expect in single rank setup, that read of MR ID from one rank would pass and from the other rank it would fail ?
I'm not sure, but even if it would work, it would require several separate init attempts only to read the IDs
Why ? Init the bus in slowest mode with widest bus settings, then try MRRD on all available DRAM chips, then figure out which ones report valid IDs and which ones fail the MRd .
Quoted 2 lines
, so I'm not sure if there is
any benefit.
Generic solution that surely works and does not guess the DRAM size.
Quoted 3 lines
Also I'm not seeing anyone doing this kind of thing. It might be worth looking at, but my primary goal now is to land patch 1 of this series in order to fix the regression.
What regression ? (I was not CCed on that)
You can (=should) send bugfixes separately.
Fabio Estevam
reviewerRe: [PATCH v2 3/4] ddr: imx: Allow to call ddr init without logging failure
Quoted 7 lines · Marek Vasut
Why ? Init the bus in slowest mode with widest bus settings, then try MRRD on all available DRAM chips, then figure out which ones report valid IDs and which ones fail the MRd .
Quoted 2 lines
, so I'm not sure if there is
any benefit.
Quoted 7 lines
Generic solution that surely works and does not guess the DRAM size.
Quoted 3 lines
Also I'm not seeing anyone doing this kind of thing. It might be worth looking at, but my primary goal now is to land patch 1 of this series in order to fix the regression.
What regression ? (I was not CCed on that)
I think Frieder refers to the regression below (patch 1/4 of the series):
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Quoted 1 line
You can (=should) send bugfixes separately.
I agree.
Frieder, please submit bug fixes targeted at the 'main' branch and cleanup/improvements targeted at the 'next 'branch.
Re: [PATCH v2 3/4] ddr: imx: Allow to call ddr init without logging failure
Quoted 19 lines · Fabio Estevam
Quoted 7 lines · Marek Vasut
Why ? Init the bus in slowest mode with widest bus settings, then try MRRD on all available DRAM chips, then figure out which ones report valid IDs and which ones fail the MRd .
Quoted 2 lines
, so I'm not sure if there is
any benefit.Quoted 7 lines
Generic solution that surely works and does not guess the DRAM size.
Quoted 3 lines
Also I'm not seeing anyone doing this kind of thing. It might be worth looking at, but my primary goal now is to land patch 1 of this series in order to fix the regression.
What regression ? (I was not CCed on that)
I think Frieder refers to the regression below (patch 1/4 of the series):
Quoted 8 lines
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Quoted 1 line
You can (=should) send bugfixes separately.
I agree.
Frieder, please submit bug fixes targeted at the 'main' branch and cleanup/improvements targeted at the 'next 'branch.
Sure, I sent the fix only as v3 and dropped the other changes for now.
Re: [PATCH v2 3/4] ddr: imx: Allow to call ddr init without logging failure
In reply to Marek VasutQuoted 34 lines · Marek Vasut
Quoted 33 lines · Frieder Schrempf
Quoted 31 lines · Marek Vasut
Quoted 23 lines · Frieder Schrempf
Quoted 15 lines · Marek Vasut
Quoted 7 lines · Frieder Schrempf
Quoted 6 lines · Marek Vasut
Quoted 4 lines · Frieder Schrempf
From: Frieder Schrempf <[email protected]>
In some cases we need to call
ddr_init()multiple times to try different configurations.Quoted 7 lines
Quoted 1 line
What different configurations ? Details please ?
The detection of different DDR types/sizes on our SoMs has always been
based on trying the init and seeing if it succeeds, falling back to the
smaller sizes on failure. See here [1].Quoted 6 lines
Could you maybe bring the interface up in some minimal 400 MTps or 100 MTps configuration and then read out the MR ID registers from the DRAM to discern which DRAM configuration is present on your SoM? This would be the ideal generic way of doing this, and it would be reliable since the IDs are stable and surely indicate which DRAM chip and how big it is.
Quoted 3 lines
No, unfortunately this doesn't work. We already tried. The MR ID can't be used as we have single and dual rank setups that report the same ID. We have no way of knowing how many dies are connected unless we try it.
Is the controller unable to interact with each rank separately ? I would expect in single rank setup, that read of MR ID from one rank would pass and from the other rank it would fail ?
Quoted 6 lines
Quoted 2 lines
I'm not sure, but even if it would work, it would require several separate init attempts only to read the IDs
Why ? Init the bus in slowest mode with widest bus settings, then try MRRD on all available DRAM chips, then figure out which ones report valid IDs and which ones fail the MRd .
As far as I can see this doesn't work. If we use the widest bus setting (CsPresent=0x3) on a single rank module, the training fails and the DDR remains in a state where the MR read doesn't work yet.
So, actually the training failure is what already tells us that there is a single rank DDR and that's exactly what our current code does: first init with the dual rank config and if that fails, fall back to single rank.
Quoted 6 lines
Quoted 3 lines
, so I'm not sure if there is
any benefit.Generic solution that surely works and does not guess the DRAM size.
Quoted 7 lines
Quoted 3 lines
Also I'm not seeing anyone doing this kind of thing. It might be worth looking at, but my primary goal now is to land patch 1 of this series in order to fix the regression.
What regression ? (I was not CCed on that)
You can (=should) send bugfixes separately.
Right, I dropped everything but the bugfix in v3 and will continue this separately.
Re: [PATCH v2 3/4] ddr: imx: Allow to call ddr init without logging failure
On 8/26/26 10:12 AM, Frieder Schrempf wrote:
[...]
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
I'm not sure, but even if it would work, it would require several separate init attempts only to read the IDs
Why ? Init the bus in slowest mode with widest bus settings, then try MRRD on all available DRAM chips, then figure out which ones report valid IDs and which ones fail the MRd .
As far as I can see this doesn't work. If we use the widest bus setting (CsPresent=0x3) on a single rank module, the training fails and the DDR remains in a state where the MR read doesn't work yet.
Do you need training to read the IDs ? Simply force-use the slowest bus mode (100 MTps iirc), the training is only relevant for the high-speed modes.
[...]
Re: [PATCH v2 3/4] ddr: imx: Allow to call ddr init without logging failure
Quoted 11 lines · Marek Vasut
On 8/26/26 10:12 AM, Frieder Schrempf wrote:
[...]
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
I'm not sure, but even if it would work, it would require several separate init attempts only to read the IDs
Why ? Init the bus in slowest mode with widest bus settings, then try MRRD on all available DRAM chips, then figure out which ones report valid IDs and which ones fail the MRd .
Quoted 7 lines
Quoted 3 lines
As far as I can see this doesn't work. If we use the widest bus setting (CsPresent=0x3) on a single rank module, the training fails and the DDR remains in a state where the MR read doesn't work yet.
Do you need training to read the IDs ? Simply force-use the slowest bus mode (100 MTps iirc), the training is only relevant for the high-speed modes.
I don't see any existing code path for any i.MX with DDR4 that doesn't do the training before accessing MR registers. Do you have any references or examples? Do you have any sources for the claim that the training is only relevant for the high-speed modes? I couldn't find anything that supports this.
Also I would assume that doing the MRRD on an unused CS would give me back some arbitrary random values. While I could interpret an unknown value as "rank/cs not present", I don't think its reliable enough. Or do you know of any error condition being reported for failed MRRD?
Re: [PATCH v2 3/4] ddr: imx: Allow to call ddr init without logging failure
Quoted 16 lines · Frieder Schrempf
Quoted 15 lines · Marek Vasut
On 8/26/26 10:12 AM, Frieder Schrempf wrote:
[...]
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
I'm not sure, but even if it would work, it would require several separate init attempts only to read the IDs
Why ? Init the bus in slowest mode with widest bus settings, then try MRRD on all available DRAM chips, then figure out which ones report valid IDs and which ones fail the MRd .
As far as I can see this doesn't work. If we use the widest bus setting (CsPresent=0x3) on a single rank module, the training fails and the DDR remains in a state where the MR read doesn't work yet.
Quoted 8 lines
Quoted 3 lines
Do you need training to read the IDs ? Simply force-use the slowest bus mode (100 MTps iirc), the training is only relevant for the high-speed modes.
I don't see any existing code path for any i.MX with DDR4 that doesn't do the training before accessing MR registers. Do you have any references or examples? Do you have any sources for the claim that the training is only relevant for the high-speed modes? I couldn't find anything that supports this.
What happens if you simply skip the DDR training, return 0 from ddr_cfg_phy() ?
Quoted 4 lines
Also I would assume that doing the MRRD on an unused CS would give me back some arbitrary random values. While I could interpret an unknown value as "rank/cs not present", I don't think its reliable enough. Or do you know of any error condition being reported for failed MRRD?
Try it and see what happens ?
PATCH v2 4/4 imx: kontron-sl-mx8mm: Stop printing error message on first DDR init
In reply to Frieder SchrempfFrom: Frieder Schrempf <[email protected]>
The first try might fail and we are retrying for smaller DDR sizes after that. Don't print an error message to not confuse the users of 1GB and 2GB variants.
--- board/kontron/sl-mx8mm/spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
board/kontron/sl-mx8mm/spl.c +1 -1
@@ -77,7 +77,7 @@ static void spl_dram_init(void)* Try the default DDR settings in lpddr4_timing.c to * comply with the Micron 4GB DDR. */ -if (!ddr_init (&dram_timing) &&check_ram_available (SZ_4G )) { +if (!ddr_init_silent_fail (&dram_timing) &&check_ram_available (SZ_4G )) { size =4 ; }else {/*
Signature · 1 line
2.55.0