Skip to contentSkip to conversation

imx: drivers: ddr: ddr driver update

PATCH Superseded Peng Fan 1 participant 4 messages May 12, 2020

Subsystems (2)
lore
Share & tools
lore

Peng Fan

author
#0 lore raw

v2 cover imx: drivers: ddr: ddr driver update

V2:
Drop patch to print dram rate
remove board ddr ecc part from patch enabling inline ecc feature

This is to upstream NXP vendor tree ddr driver related fix and update

Jacky Bai (2):
driver: ddr: imx: skip ddr_ss_gpr config on imx8mn
driver: ddr: imx: correct the pwrctl setting of selfref_en on imx8m

Jian Li (3):
imx8mp: enable rd_port_urgent
imx8mp: DDR performance tunning
imx8mp: Disables use of MR4 TUF flag (MR4[7]) bit

Oliver Chen (1):
drivers: ddr: imx Workaround for i.MX8M DDRPHY rank to rank issue

Sherry Sun (1):
drivers: ddr: imx8mp: Add inline ECC feature support

 arch/arm/include/asm/arch-imx8m/ddr.h      |  10 ++
 board/freescale/imx8mp_evk/lpddr4_timing.c |   5 +-
 drivers/ddr/imx/imx8m/Kconfig              |   7 ++
 drivers/ddr/imx/imx8m/ddr_init.c           |  79 +++++++++++++-
 drivers/ddr/imx/imx8m/ddrphy_train.c       |   7 ++
 drivers/ddr/imx/imx8m/ddrphy_utils.c       | 164 +++++++++++++++++++++++++++++
 6 files changed, 268 insertions(+), 4 deletions(-)
Signature · 1 line
2.16.4
author
#1 lore raw

PATCH v2 1/7 driver: ddr: imx: skip ddr_ss_gpr config on imx8mn

From: Jacky Bai <[email protected]>

There is no DDR_SS_GPR0 exits on i.MX8MN, so skip setting this register on i.MX8MN.

---
 drivers/ddr/imx/imx8m/ddr_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ddr/imx/imx8m/ddr_init.c +1 -1
index af8c1427d2..ba5ae05035 100644
@@ -73,7 +73,7 @@ int ddr_init(struct dram_timing_info *dram_timing)
 
 	/* if ddr type is LPDDR4, do it */
 	tmp = reg32_read(DDRC_MSTR(0));
-	if (tmp & (0x1 << 5))
+	if (tmp & (0x1 << 5) && !is_imx8mn())
 		reg32_write(DDRC_DDR_SS_GPR0, 0x01); /* LPDDR4 mode */
 
 	/* determine the initial boot frequency */
Signature · 1 line
2.16.4
author
#2 lore raw

PATCH v2 2/7 driver: ddr: imx: correct the pwrctl setting of selfref_en on imx8m

In reply to Peng Fan

From: Jacky Bai <[email protected]>

The 'selfref_en' should be bit'0', so correct the setting to enable the auto self-refresh.

---
 drivers/ddr/imx/imx8m/ddr_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ddr/imx/imx8m/ddr_init.c +1 -1
index ba5ae05035..06b4341b11 100644
@@ -162,7 +162,7 @@ int ddr_init(struct dram_timing_info *dram_timing)
 	/* Step26: Set back register in Step4 to the original values if desired */
 	reg32_write(DDRC_RFSHCTL3(0), 0x0000000);
 	/* enable selfref_en by default */
-	setbits_le32(DDRC_PWRCTL(0), 0x1 << 3);
+	setbits_le32(DDRC_PWRCTL(0), 0x1);
 
 	/* enable port 0 */
 	reg32_write(DDRC_PCTRL_0(0), 0x00000001);
Signature · 1 line
2.16.4
author
#3 lore raw

PATCH v2 3/7 drivers: ddr: imx8mp: Add inline ECC feature support

In reply to Peng Fan

From: Sherry Sun <[email protected]>

the DRAM Controller in i.MX8MP will support a feature called "Inline ECC". This is supported for all 3 supported DRAM technologies (LPDDR4, DDR4 and DDR3L). When this feature is enabled by software, the DRAM Controller reserves 12.5% of DRAM capacity for ECC information, and presents only the non-ECC portion (lower 87.5% of the installed capacity of DRAM) to the rest of the SoC.
The DRAM memory can be divided into 8 regions so that if a use case only requires ECC protection on a subset of memory, then only that subset of memory need support inline ECC. If this occurs, then there is no performance penalty accessing the non-ECC-protected memory (no need to access ECC for this portion of the memory map). This is all configured with the DRAM Controller.

---
 arch/arm/include/asm/arch-imx8m/ddr.h |  7 ++++
 drivers/ddr/imx/imx8m/Kconfig         |  7 ++++
 drivers/ddr/imx/imx8m/ddr_init.c      | 72 +++++++++++++++++++++++++++++++++++
 3 files changed, 86 insertions(+)
arch/arm/include/asm/arch-imx8m/ddr.h +7 -0
index 7a2a2d8edc..04c9c962cf 100644
@@ -529,6 +529,8 @@ enum msg_response {
 #define DDRC_SBRWDATA0(X)        (DDRC_IPS_BASE_ADDR(X) + 0xf2c)
 #define DDRC_SBRWDATA1(X)        (DDRC_IPS_BASE_ADDR(X) + 0xf30)
 #define DDRC_PDCH(X)             (DDRC_IPS_BASE_ADDR(X) + 0xf34)
+#define DDRC_SBRSTART0(X)        (DDRC_IPS_BASE_ADDR(X) + 0xf38)
+#define DDRC_SBRRANGE0(X)        (DDRC_IPS_BASE_ADDR(X) + 0xf40)
 
 #define DDRC_FREQ1_DERATEEN(X)         (DDRC_IPS_BASE_ADDR(X) + 0x2020)
 #define DDRC_FREQ1_DERATEINT(X)        (DDRC_IPS_BASE_ADDR(X) + 0x2024)
@@ -708,6 +710,11 @@ int ddr_cfg_phy(struct dram_timing_info *timing_info);
 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);
+void board_dram_ecc_scrub(void);
+void ddrc_inline_ecc_scrub(unsigned int start_address,
+			   unsigned int range_address);
+void ddrc_inline_ecc_scrub_end(unsigned int start_address,
+			       unsigned int range_address);
 
 /* utils function for ddr phy training */
 int wait_ddrphy_training_complete(void);
drivers/ddr/imx/imx8m/Kconfig +7 -0
index 5bf61eb258..a5f5524fbe 100644
@@ -29,4 +29,11 @@ config SAVED_DRAM_TIMING_BASE
 	  info into memory for low power use. OCRAM_S is used for this
 	  purpose on i.MX8MM.
 	default 0x180000
+
+config IMX8M_DRAM_INLINE_ECC
+	bool "imx8mp inline ECC"
+	depends on IMX8MP && IMX8M_LPDDR4
+	help
+	  Select this config if you want to use inline ecc feature for
+	  imx8mp-evk board.
 endmenu
drivers/ddr/imx/imx8m/ddr_init.c +72 -0

84 lines not on this page · raw message

Signature · 1 line
2.16.4