mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM: i.MX8M: Fix the RAM size calculation for DDR3
@ 2025-11-27 14:18 Maud Spierings via B4 Relay
  2025-11-28  7:11 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Maud Spierings via B4 Relay @ 2025-11-27 14:18 UTC (permalink / raw)
  To: Sascha Hauer, BAREBOX; +Cc: Maud Spierings

From: Maud Spierings <maudspierings@gocontroll.com>

The default value in the MSTR register for DDRC_MSTR_DEVICE_CONFIG is
16bit which causes the calculation to be half of the actual RAM. Add the
BIT() define for DDR3 and add it to the workaround for calculating the
correct amount of RAM like LPDDR4.

Signed-off-by: Maud Spierings <maudspierings@gocontroll.com>
---
 arch/arm/mach-imx/esdctl.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-imx/esdctl.c b/arch/arm/mach-imx/esdctl.c
index 4c4c3528e1..935c3d3257 100644
--- a/arch/arm/mach-imx/esdctl.c
+++ b/arch/arm/mach-imx/esdctl.c
@@ -325,6 +325,7 @@ static int vf610_ddrmc_add_mem(void *mmdcbase, const struct imx_esdctl_data *dat
 #define DDRC_ADDRMAP0_CS_BIT0			GENMASK(4, 0)
 
 #define DDRC_MSTR				0x0000
+#define DDRC_MSTR_DDR3				BIT(0)
 #define DDRC_MSTR_DDR4				BIT(4)
 #define DDRC_MSTR_LPDDR4			BIT(5)
 #define DDRC_MSTR_DATA_BUS_WIDTH		GENMASK(13, 12)
@@ -508,8 +509,8 @@ static resource_size_t imx8m_ddrc_sdram_size(void __iomem *ddrc, unsigned buswid
 		FIELD_GET(DDRC_ADDRMAP6_LPDDR4_6GB_12GB_24GB, addrmap[6]);
 	u32 mstr = readl(ddrc + DDRC_MSTR);
 
-	/* Device config is ignored and taken as 32-bit for LPDDR4 */
-	if (mstr & DDRC_MSTR_LPDDR4)
+	/* Device config is ignored and taken as 32-bit for LPDDR4 and DDR3 */
+	if (mstr & DDRC_MSTR_LPDDR4 || mstr & DDRC_MSTR_DDR3)
 		imx_ddrc_set_mstr_device_config(&mstr, buswidth);
 
 	return imx_ddrc_sdram_size(ddrc, addrmap,

---
base-commit: 5d89bec4985d850d59813e34c6b5213d8e8f48f0
change-id: 20251127-ddr3_size-cc0318906f50

Best regards,
-- 
Maud Spierings <maudspierings@gocontroll.com>





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ARM: i.MX8M: Fix the RAM size calculation for DDR3
  2025-11-27 14:18 [PATCH] ARM: i.MX8M: Fix the RAM size calculation for DDR3 Maud Spierings via B4 Relay
@ 2025-11-28  7:11 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2025-11-28  7:11 UTC (permalink / raw)
  To: BAREBOX, Maud Spierings via B4 Relay; +Cc: Maud Spierings


On Thu, 27 Nov 2025 15:18:52 +0100, Maud Spierings via B4 Relay wrote:
> The default value in the MSTR register for DDRC_MSTR_DEVICE_CONFIG is
> 16bit which causes the calculation to be half of the actual RAM. Add the
> BIT() define for DDR3 and add it to the workaround for calculating the
> correct amount of RAM like LPDDR4.
> 
> 

Applied, thanks!

[1/1] ARM: i.MX8M: Fix the RAM size calculation for DDR3
      https://git.pengutronix.de/cgit/barebox/commit/?id=35460da74285 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-11-28  7:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-27 14:18 [PATCH] ARM: i.MX8M: Fix the RAM size calculation for DDR3 Maud Spierings via B4 Relay
2025-11-28  7:11 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox