Linux EDAC development
 help / color / mirror / Atom feed
From: Ryan Chen <ryan_chen@aspeedtech.com>
To: Stefan Schaeckeler <sschaeck@cisco.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>, Joel Stanley <joel@jms.id.au>,
	Andrew Jeffery <andrew@codeconstruct.com.au>,
	Borislav Petkov <bp@alien8.de>, Tony Luck <tony.luck@intel.com>,
	Billy Tsai <billy_tsai@aspeedtech.com>
Cc: <devicetree@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-aspeed@lists.ozlabs.org>, <linux-kernel@vger.kernel.org>,
	<linux-edac@vger.kernel.org>,
	Ryan Chen <ryan_chen@aspeedtech.com>
Subject: [PATCH v7 04/10] EDAC/aspeed: Don't unlock the interrupt control register on AST2600
Date: Mon, 30 Nov 2026 15:24:31 +0800	[thread overview]
Message-ID: <20261130-edac-v7-4-3aaf6d243f07@aspeedtech.com> (raw)
In-Reply-To: <20261130-edac-v7-0-3aaf6d243f07@aspeedtech.com>

On the AST2600 the interrupt control register can be written without
the unlock key. Unlocking also makes the rest of the memory controller
settings writable, so skip it where it isn't needed.

Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>
---
Tested on an AST2600 by injecting a correctable error with the memory
controller's error injection:

  # mw 1e6e0000 fc600309; mw 1e6e00b0 81
  EDAC MC0: 1 CE address(es) not available on mc#0csrow#0channel#0 (csrow:0 channel:0 page:0x0 offset:0x0 grain:16 syndrome:0x0)
  EDAC MC0: 1 CE on mc#0csrow#0channel#0 (csrow:0 channel:0 page:0xb2b2f offset:0x180 grain:16 syndrome:0x0)
---
 drivers/edac/aspeed_edac.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/edac/aspeed_edac.c b/drivers/edac/aspeed_edac.c
index f4ef9430258a..e3158265dde8 100644
--- a/drivers/edac/aspeed_edac.c
+++ b/drivers/edac/aspeed_edac.c
@@ -36,6 +36,7 @@ struct aspeed_edac_chip {
 	u32 conf_dram_type;
 	enum mem_type dram_type[2];
 	unsigned long mtype_cap;
+	bool intr_ctrl_locked;
 };
 
 struct aspeed_edac {
@@ -58,12 +59,14 @@ static void mcr_update_bits(struct aspeed_edac *priv, u32 reg, u32 mask,
 	tmp = (tmp & ~mask) | (val & mask);
 
 	/* enable write to MCR register set */
-	writel(ASPEED_MCR_PROT_PASSWD, priv->regs + ASPEED_MCR_PROT);
+	if (priv->chip->intr_ctrl_locked)
+		writel(ASPEED_MCR_PROT_PASSWD, priv->regs + ASPEED_MCR_PROT);
 
 	writel(tmp, priv->regs + reg);
 
 	/* disable write to MCR register set */
-	writel(~ASPEED_MCR_PROT_PASSWD, priv->regs + ASPEED_MCR_PROT);
+	if (priv->chip->intr_ctrl_locked)
+		writel(~ASPEED_MCR_PROT_PASSWD, priv->regs + ASPEED_MCR_PROT);
 
 	spin_unlock_irqrestore(&priv->lock, flags);
 }
@@ -360,12 +363,21 @@ static const struct aspeed_edac_chip ast2400_edac = {
 	.conf_dram_type = ASPEED_MCR_CONF_DRAM_TYPE,
 	.dram_type = { MEM_DDR3, MEM_DDR4 },
 	.mtype_cap = MEM_FLAG_DDR3 | MEM_FLAG_DDR4,
+	.intr_ctrl_locked = true,
+};
+
+static const struct aspeed_edac_chip ast2600_edac = {
+	.conf_reg = ASPEED_MCR_CONF,
+	.conf_ecc = ASPEED_MCR_CONF_ECC,
+	.conf_dram_type = ASPEED_MCR_CONF_DRAM_TYPE,
+	.dram_type = { MEM_DDR3, MEM_DDR4 },
+	.mtype_cap = MEM_FLAG_DDR3 | MEM_FLAG_DDR4,
 };
 
 static const struct of_device_id aspeed_of_match[] = {
 	{ .compatible = "aspeed,ast2400-sdram-edac", .data = &ast2400_edac },
 	{ .compatible = "aspeed,ast2500-sdram-edac", .data = &ast2400_edac },
-	{ .compatible = "aspeed,ast2600-sdram-edac", .data = &ast2400_edac },
+	{ .compatible = "aspeed,ast2600-sdram-edac", .data = &ast2600_edac },
 	{},
 };
 

-- 
2.34.1


  parent reply	other threads:[~2026-11-30  7:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  7:24 [PATCH v7 00/10] Add Aspeed AST2700 SDRAM EDAC support Ryan Chen
2026-11-30  7:24 ` [PATCH v7 01/10] EDAC/aspeed: Stop keeping driver state in global variables Ryan Chen
2026-11-30  7:24 ` [PATCH v7 02/10] EDAC/aspeed: Replace regmap with direct register access Ryan Chen
2026-11-30  7:24 ` [PATCH v7 03/10] EDAC/aspeed: Put the differences between chips in a table Ryan Chen
2026-11-30  7:24 ` Ryan Chen [this message]
2026-11-30  7:24 ` [PATCH v7 05/10] EDAC/aspeed: Let each chip provide its own interrupt handling Ryan Chen
2026-11-30  7:24 ` [PATCH v7 06/10] EDAC/aspeed: Allow reporting an error without an address Ryan Chen
2026-11-30  7:24 ` [PATCH v7 07/10] EDAC/aspeed: Allow error addresses above 4 GiB Ryan Chen
2026-11-30  7:24 ` [PATCH v7 08/10] EDAC/aspeed: Disable interrupts before requesting the interrupt line Ryan Chen
2026-11-30  7:24 ` [PATCH v7 09/10] EDAC/aspeed: Add AST2700 support Ryan Chen
2026-11-30  7:24 ` [PATCH v7 10/10] MAINTAINERS: Step down as Aspeed AST2500 EDAC driver maintainer Ryan Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261130-edac-v7-4-3aaf6d243f07@aspeedtech.com \
    --to=ryan_chen@aspeedtech.com \
    --cc=andrew@codeconstruct.com.au \
    --cc=billy_tsai@aspeedtech.com \
    --cc=bp@alien8.de \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=joel@jms.id.au \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-aspeed@lists.ozlabs.org \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sschaeck@cisco.com \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox