Skip to contentSkip to conversation

ram: Configure ECC

PATCH Superseded Joel Stanley 4 participants 12 messages Aug 17, 2022 – Sep 21, 2022 Arm/Aspeed machine support

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Joel Stanley

author maintainer
#0 lore raw

cover ram: Configure ECC

Joel Stanley (2):
aspeed/sdram: Use device tree to configure ECC
ram/aspeed: Remove ECC config option

 drivers/ram/aspeed/sdram_ast2500.c | 18 ++++++++++--------
 drivers/ram/aspeed/sdram_ast2600.c | 19 +++++++++++--------
 drivers/ram/aspeed/Kconfig         | 20 --------------------
 3 files changed, 21 insertions(+), 36 deletions(-)
Signature · 1 line
2.35.1
author maintainer
#1 lore raw

PATCH 1/2 aspeed/sdram: Use device tree to configure ECC

Instead of configuring ECC based on the build config, use a device tree property to selectively enable ECC at runtime.

There are two properties:

  aspeed,ecc-enabled;
  aspeed,ecc-size = "512";

The enabled property is a boolean that enables ECC if it is present.

The size is the number of MB that should be covered by ECC. Setting it to zero, or omitting it, defaults the ECC size to "auto detect".

  edac: sdram@1e6e0000 {
    compatible = "aspeed,ast2600-sdram-edac";
    reg = <0x1e6e0000 0x174>;
    interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
    aspeed,ecc-enabled;
    aspeed,ecc-size = "512";
  };
---
 drivers/ram/aspeed/sdram_ast2500.c | 14 ++++++++++----
 drivers/ram/aspeed/sdram_ast2600.c | 14 ++++++++++----
 drivers/ram/aspeed/Kconfig         | 13 -------------
 3 files changed, 20 insertions(+), 21 deletions(-)
drivers/ram/aspeed/sdram_ast2500.c +10 -4
index 435e1a8cfc1d..ca3b54295bf0 100644
@@ -279,16 +279,16 @@ static void ast2500_sdrammc_calc_size(struct dram_info *info)
 }
 
 #ifdef CONFIG_ASPEED_ECC
-static void ast2500_sdrammc_ecc_enable(struct dram_info *info)
+static void ast2500_sdrammc_ecc_enable(struct dram_info *info, u32 conf_size_mb)
 {
 	struct ast2500_sdrammc_regs *regs = info->regs;
 	size_t conf_size;
 	u32 reg;
 	
-	conf_size = CONFIG_ASPEED_ECC_SIZE * SDRAM_SIZE_1MB;
+	conf_size = conf_size_mb * SDRAM_SIZE_1MB;
 	if (conf_size > info->info.size) {
 		printf("warning: ECC configured %dMB but actual size is %dMB\n",
-		       CONFIG_ASPEED_ECC_SIZE,
+		       conf_size_mb,
 		       info->info.size / SDRAM_SIZE_1MB);
 		conf_size = info->info.size;
 	} else if (conf_size == 0) {
@@ -371,8 +371,14 @@ static int ast2500_sdrammc_init_ddr4(struct dram_info *info)
 	writel(SDRAM_MISC_DDR4_TREFRESH, &info->regs->misc_control);
 
 #ifdef CONFIG_ASPEED_ECC
-	ast2500_sdrammc_ecc_enable(info);
+	if (dev_read_bool(dev, "aspeed,ecc-enabled")) {
+		u32 ecc_size;
+
+		ecc_size = dev_read_u32_default(dev, "aspeed,ecc-size", 0);
+		ast2500_sdrammc_ecc_enable(priv, ecc_size);
+	}
 #endif
+
 	/* Enable all requests except video & display */
 	writel(SDRAM_REQ_USB20_EHCI1
 	       | SDRAM_REQ_USB20_EHCI2
drivers/ram/aspeed/sdram_ast2600.c +10 -4
index 5118b14f8708..6287c45365dd 100644
@@ -860,16 +860,16 @@ static void ast2600_sdrammc_update_size(struct dram_info *info)
 	info->info.size = hw_size;
 }
 #ifdef CONFIG_ASPEED_ECC
-static void ast2600_sdrammc_ecc_enable(struct dram_info *info)
+static void ast2600_sdrammc_ecc_enable(struct dram_info *info, u32 conf_size_mb)
 {
 	struct ast2600_sdrammc_regs *regs = info->regs;
 	size_t conf_size;
 	u32 reg;
 
-	conf_size = CONFIG_ASPEED_ECC_SIZE * SDRAM_SIZE_1MB;
+	conf_size = conf_size_mb * SDRAM_SIZE_1MB;
 	if (conf_size > info->info.size) {
 		printf("warning: ECC configured %dMB but actual size is %dMB\n",
-		       CONFIG_ASPEED_ECC_SIZE,
+		       conf_size,
 		       info->info.size / SDRAM_SIZE_1MB);
 		conf_size = info->info.size;
 	} else if (conf_size == 0) {
@@ -989,8 +989,14 @@ L_ast2600_sdramphy_train:
 #endif
 
 #ifdef CONFIG_ASPEED_ECC
-	ast2600_sdrammc_ecc_enable(priv);
+	if (dev_read_bool(dev, "aspeed,ecc-enabled")) {
+		u32 ecc_size;
+
+		ecc_size = dev_read_u32_default(dev, "aspeed,ecc-size", 0);
+		ast2600_sdrammc_ecc_enable(priv, ecc_size);
+	}
 #endif
+
 	setbits_le32(priv->scu + AST_SCU_HANDSHAKE, SCU_HANDSHAKE_MASK);
 	clrbits_le32(&regs->intr_ctrl, MCR50_RESET_ALL_INTR);
 	ast2600_sdrammc_lock(priv);
drivers/ram/aspeed/Kconfig +0 -13
index 924e82b19430..54c7769b5bbe 100644
@@ -51,19 +51,6 @@ config ASPEED_ECC
 	help
 	  enable SDRAM ECC function
 
-if ASPEED_ECC
-config ASPEED_ECC_SIZE
-	int "ECC size: 0=driver auto-caluated"
-	depends on ASPEED_ECC
-	default 0
-	help
-	  SDRAM size with the error correcting code enabled. The unit is 
-	  in Megabytes.  Noted that only the 8/9 of the configured size 
-	  can be used by the system.  The remaining 1/9 will be used by 
-	  the ECC engine.  If the size is set to 0, the sdram driver will 
-	  calculate the SDRAM size and set the whole range be ECC enabled.
-endif
-
 choice
 	prompt "DDR4 PHY side ODT"
 	default ASPEED_DDR4_PHY_ODT40
Signature · 1 line
2.35.1
#2 lore raw

Re: [PATCH u-boot v2019.04-aspeed-openbmc 1/2] aspeed/sdram: Use device tree to configure ECC

Quoted 5 lines · Joel Stanley

Instead of configuring ECC based on the build config, use a device tree property to selectively enable ECC at runtime.

There are two properties:

Quoted 7 lines
   aspeed,ecc-enabled;
   aspeed,ecc-size = "512";

The enabled property is a boolean that enables ECC if it is present.

The size is the number of MB that should be covered by ECC. Setting it to zero, or omitting it, defaults the ECC size to "auto detect".

What's the use case for enabling ECC only on part of the DRAM or not using max possible DRAM space?

Couldn't this be just simple update based on what DTS memory node has?

/* Update available size */
info->info.size = (((info->info.size / 9) * 8) >> 20) << 20;

Regards,
Dhananjay

author maintainer
#3 lore raw

Re: [PATCH u-boot v2019.04-aspeed-openbmc 1/2] aspeed/sdram: Use device tree to configure ECC

Quoted 10 lines · Dhananjay Phadke
Quoted 8 lines · Joel Stanley

Instead of configuring ECC based on the build config, use a device tree property to selectively enable ECC at runtime.

There are two properties:

   aspeed,ecc-enabled;
   aspeed,ecc-size = "512";
Quoted 7 lines
Quoted 4 lines

The enabled property is a boolean that enables ECC if it is present.

The size is the number of MB that should be covered by ECC. Setting it to zero, or omitting it, defaults the ECC size to "auto detect".

What's the use case for enabling ECC only on part of the DRAM or not using max possible DRAM space?

I don't know. I have wondered the same, it's a good question for aspeed.

The objective of this patchset is to support the existing options with runtime configuration, I think any change in functionality is a separate issue.

Quoted 7 lines

Couldn't this be just simple update based on what DTS memory node has?

/* Update available size */
info->info.size = (((info->info.size / 9) * 8) >> 20) << 20;

Regards,
Dhananjay

#4 lore raw

Re: [PATCH u-boot v2019.04-aspeed-openbmc 1/2] aspeed/sdram: Use device tree to configure ECC

In reply to Dhananjay Phadke
Quoted 9 lines · Dhananjay Phadke
Quoted 8 lines · Joel Stanley

Instead of configuring ECC based on the build config, use a device tree property to selectively enable ECC at runtime.

There are two properties:

   aspeed,ecc-enabled;
   aspeed,ecc-size = "512";
Quoted 8 lines
Quoted 4 lines

The enabled property is a boolean that enables ECC if it is present.

The size is the number of MB that should be covered by ECC. Setting it to zero, or omitting it, defaults the ECC size to "auto detect".

What's the use case for enabling ECC only on part of the DRAM or not using max possible DRAM space?

I have some hand-wavy concerns about the impact of ECC on the configuration of the AHB bridges, but that needs to be investigated with some experiments.

As Joel said, some feedback from Aspeed on the use-cases would be handy.

Andrew

#5 lore raw

Re: [PATCH u-boot v2019.04-aspeed-openbmc 1/2] aspeed/sdram: Use device tree to configure ECC

In reply to Joel Stanley
Quoted 21 lines · Joel Stanley

Instead of configuring ECC based on the build config, use a device tree property to selectively enable ECC at runtime.

There are two properties:

  aspeed,ecc-enabled;
  aspeed,ecc-size = "512";

The enabled property is a boolean that enables ECC if it is present.

The size is the number of MB that should be covered by ECC. Setting it to zero, or omitting it, defaults the ECC size to "auto detect".

  edac: sdram@1e6e0000 {
    compatible = "aspeed,ast2600-sdram-edac";
    reg = <0x1e6e0000 0x174>;
    interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
    aspeed,ecc-enabled;
    aspeed,ecc-size = "512";
  };
Quoted 1 line

Nice. Sure makes building generic SPL easier.

Quoted 34 lines
---
 drivers/ram/aspeed/sdram_ast2500.c | 14 ++++++++++----
 drivers/ram/aspeed/sdram_ast2600.c | 14 ++++++++++----
 drivers/ram/aspeed/Kconfig         | 13 -------------
 3 files changed, 20 insertions(+), 21 deletions(-)
drivers/ram/aspeed/sdram_ast2500.c +3 -3
index 435e1a8cfc1d..ca3b54295bf0 100644
@@ -279,16 +279,16 @@ static void ast2500_sdrammc_calc_size(struct 
 dram_info *info)
 }
 
 #ifdef CONFIG_ASPEED_ECC
-static void ast2500_sdrammc_ecc_enable(struct dram_info *info)
+static void ast2500_sdrammc_ecc_enable(struct dram_info *info, u32 
 conf_size_mb)
 {
 	struct ast2500_sdrammc_regs *regs = info->regs;
 	size_t conf_size;
 	u32 reg;
 
-	conf_size = CONFIG_ASPEED_ECC_SIZE * SDRAM_SIZE_1MB;
+	conf_size = conf_size_mb * SDRAM_SIZE_1MB;
 	if (conf_size > info->info.size) {
 		printf("warning: ECC configured %dMB but actual size is %dMB\n",
-		       CONFIG_ASPEED_ECC_SIZE,
+		       conf_size_mb,
 		       info->info.size / SDRAM_SIZE_1MB);
drivers/ram/aspeed/sdram_ast2500.c +0 -0
 		conf_size = info->info.size;
 	} else if (conf_size == 0) {

drivers/ram/aspeed/sdram_ast2500.c static int ast2500_sdrammc_init_ddr4(struct · line 378

Quoted 9 lines
drivers/ram/aspeed/sdram_ast2500.c +4 -1
@@ -371,8 +371,14 @@ static int ast2500_sdrammc_init_ddr4(struct 
 dram_info *info)
 	writel(SDRAM_MISC_DDR4_TREFRESH, &info->regs->misc_control);
 
 #ifdef CONFIG_ASPEED_ECC
-	ast2500_sdrammc_ecc_enable(info);
+	if (dev_read_bool(dev, "aspeed,ecc-enabled")) {
+		u32 ecc_size;
+
+		ecc_size = dev_read_u32_default(dev, "aspeed,ecc-size", 0);

Bit of a nitpick, but given there's no binding documentation, can we encode the unit in the property name ("aspeed,ecc-size-mb"?)? Or perhaps switch to specifying it in bytes? Or amend the kernel binding documentation to add the property and get that merged (troll option)?

Quoted 61 lines
drivers/ram/aspeed/sdram_ast2500.c +3 -0
+		ast2500_sdrammc_ecc_enable(priv, ecc_size);
+	}
 #endif
+
 	/* Enable all requests except video & display */
 	writel(SDRAM_REQ_USB20_EHCI1
drivers/ram/aspeed/sdram_ast2500.c +0 -0
 	       | SDRAM_REQ_USB20_EHCI2
drivers/ram/aspeed/sdram_ast2600.c +3 -3
index 5118b14f8708..6287c45365dd 100644
@@ -860,16 +860,16 @@ static void ast2600_sdrammc_update_size(struct 
 dram_info *info)
 	info->info.size = hw_size;
 }
 #ifdef CONFIG_ASPEED_ECC
-static void ast2600_sdrammc_ecc_enable(struct dram_info *info)
+static void ast2600_sdrammc_ecc_enable(struct dram_info *info, u32 
 conf_size_mb)
 {
 	struct ast2600_sdrammc_regs *regs = info->regs;
 	size_t conf_size;
 	u32 reg;
 
-	conf_size = CONFIG_ASPEED_ECC_SIZE * SDRAM_SIZE_1MB;
+	conf_size = conf_size_mb * SDRAM_SIZE_1MB;
 	if (conf_size > info->info.size) {
 		printf("warning: ECC configured %dMB but actual size is %dMB\n",
-		       CONFIG_ASPEED_ECC_SIZE,
+		       conf_size,
 		       info->info.size / SDRAM_SIZE_1MB);
drivers/ram/aspeed/sdram_ast2600.c +7 -1
 		conf_size = info->info.size;
 	} else if (conf_size == 0) {
@@ -989,8 +989,14 @@ L_ast2600_sdramphy_train:
 #endif
 
 #ifdef CONFIG_ASPEED_ECC
-	ast2600_sdrammc_ecc_enable(priv);
+	if (dev_read_bool(dev, "aspeed,ecc-enabled")) {
+		u32 ecc_size;
+
+		ecc_size = dev_read_u32_default(dev, "aspeed,ecc-size", 0);
+		ast2600_sdrammc_ecc_enable(priv, ecc_size);
+	}
 #endif
+
 	setbits_le32(priv->scu + AST_SCU_HANDSHAKE, SCU_HANDSHAKE_MASK);
 	clrbits_le32(&regs->intr_ctrl, MCR50_RESET_ALL_INTR);
 	ast2600_sdrammc_lock(priv);
drivers/ram/aspeed/Kconfig +0 -3
index 924e82b19430..54c7769b5bbe 100644
@@ -51,19 +51,6 @@ config ASPEED_ECC
 	help
 	  enable SDRAM ECC function
 
-if ASPEED_ECC
-config ASPEED_ECC_SIZE
-	int "ECC size: 0=driver auto-caluated"

drivers/ram/aspeed/Kconfig config ASPEED_ECC · line 66

Quoted 10 lines
drivers/ram/aspeed/Kconfig +0 -10
-	depends on ASPEED_ECC
-	default 0
-	help
-	  SDRAM size with the error correcting code enabled. The unit is 
-	  in Megabytes.  Noted that only the 8/9 of the configured size 
-	  can be used by the system.  The remaining 1/9 will be used by 
-	  the ECC engine.  If the size is set to 0, the sdram driver will 
-	  calculate the SDRAM size and set the whole range be ECC enabled.
-endif
-

Are there any defconfigs and devictrees that need updating?

Otherwise, LGTM.

Andrew

#6 lore raw

Re: [PATCH u-boot v2019.04-aspeed-openbmc 1/2] aspeed/sdram: Use device tree to configure ECC

In reply to Joel Stanley

Just a minor comment in the ast2600 file, the variable should be conf_size_mb instead of conf_size.

Quoted 81 lines · Joel Stanley

Instead of configuring ECC based on the build config, use a device tree property to selectively enable ECC at runtime.

There are two properties:

aspeed,ecc-enabled;
aspeed,ecc-size = "512";

The enabled property is a boolean that enables ECC if it is present.

The size is the number of MB that should be covered by ECC. Setting it to zero, or omitting it, defaults the ECC size to "auto detect".

 edac: sdram@1e6e0000 {
   compatible = "aspeed,ast2600-sdram-edac";
   reg = <0x1e6e0000 0x174>;
   interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
   aspeed,ecc-enabled;
   aspeed,ecc-size = "512";

};

---

drivers/ram/aspeed/sdram_ast2500.c | 14 ++++++++++----
drivers/ram/aspeed/sdram_ast2600.c | 14 ++++++++++----
drivers/ram/aspeed/Kconfig         | 13 -------------
3 files changed, 20 insertions(+), 21 deletions(-)
drivers/ram/aspeed/sdram_ast2500.c +10 -4
index 435e1a8cfc1d..ca3b54295bf0 100644
@@ -279,16 +279,16 @@ static void ast2500_sdrammc_calc_size(struct dram_info *info)
 }
 
 #ifdef CONFIG_ASPEED_ECC
-static void ast2500_sdrammc_ecc_enable(struct dram_info *info)
+static void ast2500_sdrammc_ecc_enable(struct dram_info *info, u32 conf_size_mb)
 {
 	struct ast2500_sdrammc_regs *regs = info->regs;
 	size_t conf_size;
 	u32 reg;
 
-	conf_size = CONFIG_ASPEED_ECC_SIZE * SDRAM_SIZE_1MB;
+	conf_size = conf_size_mb * SDRAM_SIZE_1MB;
 	if (conf_size > info->info.size) {
 		printf("warning: ECC configured %dMB but actual size is %dMB\n",
-		       CONFIG_ASPEED_ECC_SIZE,
+		       conf_size_mb,
 		       info->info.size / SDRAM_SIZE_1MB);
 		conf_size = info->info.size;
 	} else if (conf_size == 0) {
@@ -371,8 +371,14 @@ static int ast2500_sdrammc_init_ddr4(struct dram_info *info)
 	writel(SDRAM_MISC_DDR4_TREFRESH, &info->regs->misc_control);
 
 #ifdef CONFIG_ASPEED_ECC
-	ast2500_sdrammc_ecc_enable(info);
+	if (dev_read_bool(dev, "aspeed,ecc-enabled")) {
+		u32 ecc_size;
+
+		ecc_size = dev_read_u32_default(dev, "aspeed,ecc-size", 0);
+		ast2500_sdrammc_ecc_enable(priv, ecc_size);
+	}
 #endif
+
 	/* Enable all requests except video & display */
 	writel(SDRAM_REQ_USB20_EHCI1
 	       | SDRAM_REQ_USB20_EHCI2
drivers/ram/aspeed/sdram_ast2600.c +1 -1
index 5118b14f8708..6287c45365dd 100644
@@ -860,16 +860,16 @@ static void ast2600_sdrammc_update_size(struct dram_info *info)
 	info->info.size = hw_size;
 }
 #ifdef CONFIG_ASPEED_ECC
-static void ast2600_sdrammc_ecc_enable(struct dram_info *info)
+static void ast2600_sdrammc_ecc_enable(struct dram_info *info, u32 conf_size_mb)
 {

drivers/ram/aspeed/sdram_ast2600.c static void ast2600_sdrammc_update_size(struct dram_info *info) · line 872

Quoted 10 lines
drivers/ram/aspeed/sdram_ast2600.c +2 -2
 	struct ast2600_sdrammc_regs *regs = info->regs;
 	size_t conf_size;
 	u32 reg;
 
-	conf_size = CONFIG_ASPEED_ECC_SIZE * SDRAM_SIZE_1MB;
+	conf_size = conf_size_mb * SDRAM_SIZE_1MB;
 	if (conf_size > info->info.size) {
 		printf("warning: ECC configured %dMB but actual size is %dMB\n",
-		       CONFIG_ASPEED_ECC_SIZE,
+		       conf_size,

This should be “conf_size_mb,”?

Quoted 46 lines
drivers/ram/aspeed/sdram_ast2600.c +7 -1
 		       info->info.size / SDRAM_SIZE_1MB);
 		conf_size = info->info.size;
 	} else if (conf_size == 0) {
@@ -989,8 +989,14 @@ L_ast2600_sdramphy_train:
 #endif
 
 #ifdef CONFIG_ASPEED_ECC
-	ast2600_sdrammc_ecc_enable(priv);
+	if (dev_read_bool(dev, "aspeed,ecc-enabled")) {
+		u32 ecc_size;
+
+		ecc_size = dev_read_u32_default(dev, "aspeed,ecc-size", 0);
+		ast2600_sdrammc_ecc_enable(priv, ecc_size);
+	}
 #endif
+
 	setbits_le32(priv->scu + AST_SCU_HANDSHAKE, SCU_HANDSHAKE_MASK);
 	clrbits_le32(&regs->intr_ctrl, MCR50_RESET_ALL_INTR);
 	ast2600_sdrammc_lock(priv);
drivers/ram/aspeed/Kconfig +0 -13
index 924e82b19430..54c7769b5bbe 100644
@@ -51,19 +51,6 @@ config ASPEED_ECC
 	help
 	  enable SDRAM ECC function
 
-if ASPEED_ECC
-config ASPEED_ECC_SIZE
-	int "ECC size: 0=driver auto-caluated"
-	depends on ASPEED_ECC
-	default 0
-	help
-	  SDRAM size with the error correcting code enabled. The unit is 
-	  in Megabytes.  Noted that only the 8/9 of the configured size 
-	  can be used by the system.  The remaining 1/9 will be used by 
-	  the ECC engine.  If the size is set to 0, the sdram driver will 
-	  calculate the SDRAM size and set the whole range be ECC enabled.
-endif
-

choice
prompt "DDR4 PHY side ODT"
default ASPEED_DDR4_PHY_ODT40

Signature · 1 line
2.35.1
author maintainer
#7 lore raw

Re: [PATCH u-boot v2019.04-aspeed-openbmc 1/2] aspeed/sdram: Use device tree to configure ECC

Quoted 8 lines · Adriana Kobylak
Quoted 8 lines

#ifdef CONFIG_ASPEED_ECC

drivers/ram/aspeed/sdram_ast2600.c +1 -1
-static void ast2600_sdrammc_ecc_enable(struct dram_info *info)
+static void ast2600_sdrammc_ecc_enable(struct dram_info *info, u32 conf_size_mb)
{
      struct ast2600_sdrammc_regs *regs = info->regs;
      size_t conf_size;
      u32 reg;
Quoted 8 lines

drivers/ram/aspeed/sdram_ast2600.c static void ast2600_sdrammc_update_size(struct dram_info *info) · line 872

Quoted 6 lines
drivers/ram/aspeed/sdram_ast2600.c +2 -2
-     conf_size = CONFIG_ASPEED_ECC_SIZE * SDRAM_SIZE_1MB;
+     conf_size = conf_size_mb * SDRAM_SIZE_1MB;
      if (conf_size > info->info.size) {
              printf("warning: ECC configured %dMB but actual size is %dMB\n",
-                    CONFIG_ASPEED_ECC_SIZE,
+                    conf_size,

This should be “conf_size_mb,”?

Thanks, I've fixed that when applying.

Quoted 6 lines
Quoted 6 lines
                     info->info.size / SDRAM_SIZE_1MB);
              conf_size = info->info.size;
      } else if (conf_size == 0) {
(quoted diff) +0 -0
@@ -989,8 +989,14 @@ L_ast2600_sdramphy_train:
 #endif
author maintainer
#8 lore raw

PATCH 2/2 ram/aspeed: Remove ECC config option

In reply to Joel Stanley

Always build the code now that it is enabled by device tree.

---
 drivers/ram/aspeed/sdram_ast2500.c | 4 ----
 drivers/ram/aspeed/sdram_ast2600.c | 5 +----
 drivers/ram/aspeed/Kconfig         | 7 -------
 3 files changed, 1 insertion(+), 15 deletions(-)
drivers/ram/aspeed/sdram_ast2500.c +0 -4
index ca3b54295bf0..f76054d80b68 100644
@@ -278,7 +278,6 @@ static void ast2500_sdrammc_calc_size(struct dram_info *info)
 			 << SDRAM_CONF_CAP_SHIFT));
 }
 
-#ifdef CONFIG_ASPEED_ECC
 static void ast2500_sdrammc_ecc_enable(struct dram_info *info, u32 conf_size_mb)
 {
 	struct ast2500_sdrammc_regs *regs = info->regs;
@@ -313,7 +312,6 @@ static void ast2500_sdrammc_ecc_enable(struct dram_info *info, u32 conf_size_mb)
 	writel(0x400, &regs->ecc_test_ctrl);
 	printf("ECC enable, ");
 }
-#endif
 
 static int ast2500_sdrammc_init_ddr4(struct dram_info *info)
 {
@@ -370,14 +368,12 @@ static int ast2500_sdrammc_init_ddr4(struct dram_info *info)
 
 	writel(SDRAM_MISC_DDR4_TREFRESH, &info->regs->misc_control);
 
-#ifdef CONFIG_ASPEED_ECC
 	if (dev_read_bool(dev, "aspeed,ecc-enabled")) {
 		u32 ecc_size;
 
 		ecc_size = dev_read_u32_default(dev, "aspeed,ecc-size", 0);
 		ast2500_sdrammc_ecc_enable(priv, ecc_size);
 	}
-#endif
 
 	/* Enable all requests except video & display */
 	writel(SDRAM_REQ_USB20_EHCI1
drivers/ram/aspeed/sdram_ast2600.c +1 -4
index 6287c45365dd..7f599ff24d69 100644
@@ -859,7 +859,7 @@ static void ast2600_sdrammc_update_size(struct dram_info *info)
 
 	info->info.size = hw_size;
 }
-#ifdef CONFIG_ASPEED_ECC
+
 static void ast2600_sdrammc_ecc_enable(struct dram_info *info, u32 conf_size_mb)
 {
 	struct ast2600_sdrammc_regs *regs = info->regs;
@@ -890,7 +890,6 @@ static void ast2600_sdrammc_ecc_enable(struct dram_info *info, u32 conf_size_mb)
 	writel(BIT(31), &regs->intr_ctrl);
 	writel(0, &regs->intr_ctrl);
 }
-#endif
 
 static int ast2600_sdrammc_probe(struct udevice *dev)
 {
@@ -988,14 +987,12 @@ L_ast2600_sdramphy_train:
 	}
 #endif
 
-#ifdef CONFIG_ASPEED_ECC
 	if (dev_read_bool(dev, "aspeed,ecc-enabled")) {
 		u32 ecc_size;
 
 		ecc_size = dev_read_u32_default(dev, "aspeed,ecc-size", 0);
 		ast2600_sdrammc_ecc_enable(priv, ecc_size);
 	}
-#endif
 
 	setbits_le32(priv->scu + AST_SCU_HANDSHAKE, SCU_HANDSHAKE_MASK);
 	clrbits_le32(&regs->intr_ctrl, MCR50_RESET_ALL_INTR);
drivers/ram/aspeed/Kconfig +0 -7
index 54c7769b5bbe..25238bf28d32 100644
@@ -44,13 +44,6 @@ config ASPEED_BYPASS_SELFTEST
 	  Say Y here to bypass DRAM self test to speed up the boot time
 endif
 
-config ASPEED_ECC
-	bool "aspeed SDRAM error correcting code"
-	depends on DM && OF_CONTROL && ARCH_ASPEED
-	default n
-	help
-	  enable SDRAM ECC function
-
 choice
 	prompt "DDR4 PHY side ODT"
 	default ASPEED_DDR4_PHY_ODT40
Signature · 1 line
2.35.1
#9 lore raw

Re: [PATCH u-boot v2019.04-aspeed-openbmc 2/2] ram/aspeed: Remove ECC config option

Quoted 94 lines · Joel Stanley

Always build the code now that it is enabled by device tree.

---
 drivers/ram/aspeed/sdram_ast2500.c | 4 ----
 drivers/ram/aspeed/sdram_ast2600.c | 5 +----
 drivers/ram/aspeed/Kconfig         | 7 -------
 3 files changed, 1 insertion(+), 15 deletions(-)
drivers/ram/aspeed/sdram_ast2500.c +0 -1
index ca3b54295bf0..f76054d80b68 100644
@@ -278,7 +278,6 @@ static void ast2500_sdrammc_calc_size(struct 
 dram_info *info)
 			 << SDRAM_CONF_CAP_SHIFT));
 }
 
-#ifdef CONFIG_ASPEED_ECC
 static void ast2500_sdrammc_ecc_enable(struct dram_info *info, u32 
 conf_size_mb)

{

drivers/ram/aspeed/sdram_ast2500.c +0 -1
 	struct ast2500_sdrammc_regs *regs = info->regs;
@@ -313,7 +312,6 @@ static void ast2500_sdrammc_ecc_enable(struct 
 dram_info *info, u32 conf_size_mb)
 	writel(0x400, &regs->ecc_test_ctrl);
 	printf("ECC enable, ");
 }
-#endif
 
 static int ast2500_sdrammc_init_ddr4(struct dram_info *info)

{

drivers/ram/aspeed/sdram_ast2500.c +0 -2
@@ -370,14 +368,12 @@ static int ast2500_sdrammc_init_ddr4(struct 
 dram_info *info)
 
 	writel(SDRAM_MISC_DDR4_TREFRESH, &info->regs->misc_control);
 
-#ifdef CONFIG_ASPEED_ECC
 	if (dev_read_bool(dev, "aspeed,ecc-enabled")) {
 		u32 ecc_size;
 
 		ecc_size = dev_read_u32_default(dev, "aspeed,ecc-size", 0);
 		ast2500_sdrammc_ecc_enable(priv, ecc_size);
 	}
-#endif
 
 	/* Enable all requests except video & display */
drivers/ram/aspeed/sdram_ast2500.c +0 -0
 	writel(SDRAM_REQ_USB20_EHCI1
drivers/ram/aspeed/sdram_ast2600.c +1 -1
index 6287c45365dd..7f599ff24d69 100644
@@ -859,7 +859,7 @@ static void ast2600_sdrammc_update_size(struct 
 dram_info *info)
 
 	info->info.size = hw_size;
 }
-#ifdef CONFIG_ASPEED_ECC
+
 static void ast2600_sdrammc_ecc_enable(struct dram_info *info, u32 
 conf_size_mb)

{

drivers/ram/aspeed/sdram_ast2600.c +0 -1
 	struct ast2600_sdrammc_regs *regs = info->regs;
@@ -890,7 +890,6 @@ static void ast2600_sdrammc_ecc_enable(struct 
 dram_info *info, u32 conf_size_mb)
 	writel(BIT(31), &regs->intr_ctrl);
 	writel(0, &regs->intr_ctrl);
 }
-#endif
 
 static int ast2600_sdrammc_probe(struct udevice *dev)

{

drivers/ram/aspeed/sdram_ast2600.c +0 -2
@@ -988,14 +987,12 @@ L_ast2600_sdramphy_train:
 	}
 #endif
 
-#ifdef CONFIG_ASPEED_ECC
 	if (dev_read_bool(dev, "aspeed,ecc-enabled")) {
 		u32 ecc_size;
 
 		ecc_size = dev_read_u32_default(dev, "aspeed,ecc-size", 0);
 		ast2600_sdrammc_ecc_enable(priv, ecc_size);
 	}
-#endif
 
 	setbits_le32(priv->scu + AST_SCU_HANDSHAKE, SCU_HANDSHAKE_MASK);
 	clrbits_le32(&regs->intr_ctrl, MCR50_RESET_ALL_INTR);
drivers/ram/aspeed/Kconfig +0 -0
index 54c7769b5bbe..25238bf28d32 100644

drivers/ram/aspeed/Kconfig config ASPEED_BYPASS_SELFTEST · line 53

Quoted 10 lines
drivers/ram/aspeed/Kconfig +0 -7
@@ -44,13 +44,6 @@ config ASPEED_BYPASS_SELFTEST
 	  Say Y here to bypass DRAM self test to speed up the boot time
 endif
 
-config ASPEED_ECC
-	bool "aspeed SDRAM error correcting code"
-	depends on DM && OF_CONTROL && ARCH_ASPEED
-	default n
-	help
-	  enable SDRAM ECC function
-

Do we need any config refreshes?

Andrew

#10 lore raw

Re: [PATCH u-boot v2019.04-aspeed-openbmc 2/2] ram/aspeed: Remove ECC config option

Quoted 104 lines · Andrew Jeffery
Quoted 97 lines · Joel Stanley

Always build the code now that it is enabled by device tree.

---

drivers/ram/aspeed/sdram_ast2500.c | 4 ----
drivers/ram/aspeed/sdram_ast2600.c | 5 +----
drivers/ram/aspeed/Kconfig         | 7 -------
3 files changed, 1 insertion(+), 15 deletions(-)
drivers/ram/aspeed/sdram_ast2500.c +0 -1
index ca3b54295bf0..f76054d80b68 100644
@@ -278,7 +278,6 @@ static void ast2500_sdrammc_calc_size(struct 
 dram_info *info)
 			 << SDRAM_CONF_CAP_SHIFT));
 }
 
-#ifdef CONFIG_ASPEED_ECC

static void ast2500_sdrammc_ecc_enable(struct dram_info *info, u32 conf_size_mb)

{
	struct ast2500_sdrammc_regs *regs = info->regs;
drivers/ram/aspeed/sdram_ast2500.c +0 -1
@@ -313,7 +312,6 @@ static void ast2500_sdrammc_ecc_enable(struct 
 dram_info *info, u32 conf_size_mb)
 	writel(0x400, &regs->ecc_test_ctrl);
 	printf("ECC enable, ");
 }
-#endif
 
 static int ast2500_sdrammc_init_ddr4(struct dram_info *info)

{

drivers/ram/aspeed/sdram_ast2500.c +0 -2
@@ -370,14 +368,12 @@ static int ast2500_sdrammc_init_ddr4(struct 
 dram_info *info)
 
 	writel(SDRAM_MISC_DDR4_TREFRESH, &info->regs->misc_control);
 
-#ifdef CONFIG_ASPEED_ECC
 	if (dev_read_bool(dev, "aspeed,ecc-enabled")) {
 		u32 ecc_size;
 
 		ecc_size = dev_read_u32_default(dev, "aspeed,ecc-size", 0);
 		ast2500_sdrammc_ecc_enable(priv, ecc_size);
 	}
-#endif
 
 	/* Enable all requests except video & display */

writel(SDRAM_REQ_USB20_EHCI1

drivers/ram/aspeed/sdram_ast2600.c +1 -1
index 6287c45365dd..7f599ff24d69 100644
@@ -859,7 +859,7 @@ static void ast2600_sdrammc_update_size(struct 
 dram_info *info)
 
 	info->info.size = hw_size;
 }
-#ifdef CONFIG_ASPEED_ECC
+

static void ast2600_sdrammc_ecc_enable(struct dram_info *info, u32 conf_size_mb)

{
	struct ast2600_sdrammc_regs *regs = info->regs;
drivers/ram/aspeed/sdram_ast2600.c +0 -1
@@ -890,7 +890,6 @@ static void ast2600_sdrammc_ecc_enable(struct 
 dram_info *info, u32 conf_size_mb)
 	writel(BIT(31), &regs->intr_ctrl);
 	writel(0, &regs->intr_ctrl);
 }
-#endif
 
 static int ast2600_sdrammc_probe(struct udevice *dev)

{

drivers/ram/aspeed/sdram_ast2600.c +0 -2
@@ -988,14 +987,12 @@ L_ast2600_sdramphy_train:
 	}
 #endif
 
-#ifdef CONFIG_ASPEED_ECC
 	if (dev_read_bool(dev, "aspeed,ecc-enabled")) {
 		u32 ecc_size;
 
 		ecc_size = dev_read_u32_default(dev, "aspeed,ecc-size", 0);
 		ast2600_sdrammc_ecc_enable(priv, ecc_size);
 	}
-#endif
 
 	setbits_le32(priv->scu + AST_SCU_HANDSHAKE, SCU_HANDSHAKE_MASK);
 	clrbits_le32(&regs->intr_ctrl, MCR50_RESET_ALL_INTR);
drivers/ram/aspeed/Kconfig +0 -0
index 54c7769b5bbe..25238bf28d32 100644
@@ -44,13 +44,6 @@ config ASPEED_BYPASS_SELFTEST
 	  Say Y here to bypass DRAM self test to speed up the boot time

endif

Quoted 9 lines

drivers/ram/aspeed/Kconfig config ASPEED_BYPASS_SELFTEST · line 53

Quoted 7 lines
drivers/ram/aspeed/Kconfig +0 -7
-config ASPEED_ECC
-	bool "aspeed SDRAM error correcting code"
-	depends on DM && OF_CONTROL && ARCH_ASPEED
-	default n
-	help
-	  enable SDRAM ECC function
-

Do we need any config refreshes?

Yeah, the configs/evb-ast2600* have this options and would need to be updated.

Quoted 2 lines

Andrew

author maintainer
#11 lore raw

Re: [PATCH u-boot v2019.04-aspeed-openbmc 2/2] ram/aspeed: Remove ECC config option

In reply to Andrew Jeffery
Quoted 10 lines · Andrew Jeffery

drivers/ram/aspeed/Kconfig config ASPEED_BYPASS_SELFTEST · line 53

Quoted 7 lines · Joel Stanley
drivers/ram/aspeed/Kconfig +0 -7
-config ASPEED_ECC
-     bool "aspeed SDRAM error correcting code"
-     depends on DM && OF_CONTROL && ARCH_ASPEED
-     default n
-     help
-       enable SDRAM ECC function
-

Do we need any config refreshes?

Thanks for pointing that out.

I'll leave it to Dylan and the aspeed team to decide what to do there. Assuming they still maintain and test those configurations, they will need to add a new device tree that enables ECC.

Cheers,

Joel