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 v8 05/10] EDAC/aspeed: Let each chip provide its own interrupt handling
Date: Sat, 5 Dec 2026 08:53:37 +0800 [thread overview]
Message-ID: <20261205-edac-v8-5-8a27981a6053@aspeedtech.com> (raw)
In-Reply-To: <20261205-edac-v8-0-8a27981a6053@aspeedtech.com>
Prepare for the AST2700, which has separate registers to read, clear
and mask its interrupts, so it can't share the interrupt handler or the
code that enables the interrupt with the older chips.
Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>
---
drivers/edac/aspeed_edac.c | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/drivers/edac/aspeed_edac.c b/drivers/edac/aspeed_edac.c
index 92c85fb51e50..faec30dffbcb 100644
--- a/drivers/edac/aspeed_edac.c
+++ b/drivers/edac/aspeed_edac.c
@@ -30,6 +30,8 @@
#define ASPEED_MCR_INTR_CTRL_CNT_UNREC GENMASK(15, 12)
#define ASPEED_MCR_INTR_CTRL_ENABLE (BIT(0) | BIT(1))
+struct driver_priv;
+
struct aspeed_mc {
u32 conf_reg;
u32 conf_ecc;
@@ -37,6 +39,8 @@ struct aspeed_mc {
enum mem_type dram_type[2];
unsigned long mtype_cap;
bool unlock_needed;
+ irqreturn_t (*irq_handler)(int irq, void *arg);
+ void (*set_irq)(struct driver_priv *priv, bool enable);
};
struct driver_priv {
@@ -134,7 +138,7 @@ static void count_un_rec(struct mem_ctl_info *mci, u8 un_rec_cnt,
}
}
-static irqreturn_t mcr_isr(int irq, void *arg)
+static irqreturn_t ast2400_irq_handler(int irq, void *arg)
{
struct mem_ctl_info *mci = arg;
struct driver_priv *priv = mci->pvt_info;
@@ -180,6 +184,12 @@ static irqreturn_t mcr_isr(int irq, void *arg)
return IRQ_HANDLED;
}
+static void ast2400_set_irq(struct driver_priv *priv, bool enable)
+{
+ mcr_update_bits(priv, ASPEED_MCR_INTR_CTRL, ASPEED_MCR_INTR_CTRL_ENABLE,
+ enable ? ASPEED_MCR_INTR_CTRL_ENABLE : 0);
+}
+
static int config_irq(void *ctx, struct platform_device *pdev)
{
struct mem_ctl_info *mci = ctx;
@@ -193,15 +203,15 @@ static int config_irq(void *ctx, struct platform_device *pdev)
if (irq < 0)
return irq;
- rc = request_irq(irq, mcr_isr, IRQF_TRIGGER_HIGH, DRV_NAME, ctx);
+ rc = request_irq(irq, priv->mc->irq_handler, IRQF_TRIGGER_HIGH,
+ DRV_NAME, ctx);
if (rc)
return rc;
priv->irq = irq;
/* enable interrupts */
- mcr_update_bits(priv, ASPEED_MCR_INTR_CTRL, ASPEED_MCR_INTR_CTRL_ENABLE,
- ASPEED_MCR_INTR_CTRL_ENABLE);
+ priv->mc->set_irq(priv, true);
return 0;
}
@@ -347,8 +357,7 @@ static void aspeed_remove(struct platform_device *pdev)
struct driver_priv *priv = mci->pvt_info;
/* disable interrupts */
- mcr_update_bits(priv, ASPEED_MCR_INTR_CTRL,
- ASPEED_MCR_INTR_CTRL_ENABLE, 0);
+ priv->mc->set_irq(priv, false);
free_irq(priv->irq, mci);
@@ -364,6 +373,8 @@ static const struct aspeed_mc ast2400_mc = {
.dram_type = { MEM_DDR3, MEM_DDR4 },
.mtype_cap = MEM_FLAG_DDR3 | MEM_FLAG_DDR4,
.unlock_needed = true,
+ .irq_handler = ast2400_irq_handler,
+ .set_irq = ast2400_set_irq,
};
static const struct aspeed_mc ast2600_mc = {
@@ -372,6 +383,8 @@ static const struct aspeed_mc ast2600_mc = {
.conf_dram_type = ASPEED_MCR_CONF_DRAM_TYPE,
.dram_type = { MEM_DDR3, MEM_DDR4 },
.mtype_cap = MEM_FLAG_DDR3 | MEM_FLAG_DDR4,
+ .irq_handler = ast2400_irq_handler,
+ .set_irq = ast2400_set_irq,
};
static const struct of_device_id aspeed_of_match[] = {
--
2.34.1
next prev parent reply other threads:[~2026-12-05 0:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-05 0:53 [PATCH v8 00/10] Add Aspeed AST2700 SDRAM EDAC support Ryan Chen
2026-12-05 0:53 ` [PATCH v8 01/10] EDAC/aspeed: Add a driver private struct Ryan Chen
2026-12-05 0:53 ` [PATCH v8 02/10] EDAC/aspeed: Replace regmap with direct register access Ryan Chen
2026-12-05 0:53 ` [PATCH v8 03/10] EDAC/aspeed: Put the differences between chips in a table Ryan Chen
2026-12-05 0:53 ` [PATCH v8 04/10] EDAC/aspeed: Don't unlock the interrupt control register on AST2600 Ryan Chen
2026-12-05 0:53 ` Ryan Chen [this message]
2026-12-05 0:53 ` [PATCH v8 06/10] EDAC/aspeed: Allow reporting an error without an address Ryan Chen
2026-12-05 0:53 ` [PATCH v8 07/10] EDAC/aspeed: Allow error addresses above 4 GiB Ryan Chen
2026-12-05 0:53 ` [PATCH v8 08/10] EDAC/aspeed: Disable interrupts before requesting the interrupt line Ryan Chen
2026-12-05 0:53 ` [PATCH v8 09/10] EDAC/aspeed: Add AST2700 support Ryan Chen
2026-12-05 1:10 ` sashiko-bot
2026-12-05 0:53 ` [PATCH v8 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=20261205-edac-v8-5-8a27981a6053@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