Skip to contentSkip to conversation

dt-binding: edac: add NPCM ECC documentation

PATCH Joel Stanley 3 participants 6 messages Jun 4, 2019 – Jun 5, 2019 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Hi George,

Quoted 6 lines · George Hung

From: George Hung <[email protected]>

Add device tree documentation for Nuvoton BMC ECC

Can you convince one of your fellow Nuvoton contributors to review this patch?

Have you submitted this patch for mainline inclusion?

Quoted 17 lines
---
 .../bindings/edac/npcm7xx-sdram-edac.txt        | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/edac/npcm7xx-sdram-edac.txt
Documentation/devicetree/bindings/edac/npcm7xx-sdram-edac.txt new file +6 -0
new file mode 100644
index 000000000000..dd4dac59a5bd
@@ -0,0 +1,17 @@
+Nuvoton NPCM7xx SoC EDAC device driver
+
+The Nuvoton NPCM7xx SoC supports DDR4 memory with/without ECC and the driver
+uses the EDAC framework to implement the ECC detection and corrtection.
+
+Required properties:

Documentation/devicetree/bindings/edac/npcm7xx-sdram-edac.txt line 16

Quoted 10 lines
Documentation/devicetree/bindings/edac/npcm7xx-sdram-edac.txt new file +10 -0
+- compatible:  should be "nuvoton,npcm7xx-sdram-edac"
+- reg:         Memory controller register set should be <0xf0824000 0x1000>
+- interrupts:  should be MC interrupt #25
+
+Example:
+
+       mc: memory-controller@f0824000 {
+               compatible = "nuvoton,npcm7xx-sdram-edac";
+               reg = <0xf0824000 0x1000>;
+               interrupts = <0 25 4>;

I think we can use the defines for 0 and 4? GIC_SPI and IRQ_TYPE_LEVEL_HIGH.

Quoted 4 lines
Documentation/devicetree/bindings/edac/npcm7xx-sdram-edac.txt new file +1 -1
+       };
--

2.21.0

#3 lore raw

Hi Joel,

Quoted 16 lines

-----Original Message-----
From: openbmc [mailto:[email protected]] On Behalf Of Joel Stanley
Sent: Tuesday, June 04, 2019 1:38 PM
To: George Hung
Cc: OpenBMC Maillist; Tomer Maimon; Benjamin Fair; Avi Fishman; William A. Kennington III
Subject: Re: [PATCH dev-5.1 v1 2/2] dt-binding: edac: add NPCM ECC documentation

Hi George,

Quoted 1 line · George Hung
Quoted 8 lines
Quoted 5 lines

From: George Hung <[email protected]>

Add device tree documentation for Nuvoton BMC ECC

Can you convince one of your fellow Nuvoton contributors to review this patch?

Yes, I have already found the Nuvoton contributors to review my patch.

https://lists.ozlabs.org/pipermail/openbmc/2019-May/016428.html

Quoted 2 lines

Have you submitted this patch for mainline inclusion?

Yes, I have submitted this patch to mainline inclusion (linux-edac and linux-kernel)

https://marc.info/?l=linux-edac&m=155930085119343&w=2
https://marc.info/?l=linux-kernel&m=155930085019340&w=2

Quoted 27 lines
Quoted 3 lines
---
 .../bindings/edac/npcm7xx-sdram-edac.txt        | 17

+++++++++++++++++

Quoted 12 lines
 1 file changed, 17 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/edac/npcm7xx-sdram-edac.txt

diff --git a/Documentation/devicetree/bindings/edac/npcm7xx-sdram-edac.txt b/Documentation/devicetree/bindings/edac/npcm7xx-sdram-edac.txt new file mode 100644
index 000000000000..dd4dac59a5bd

Documentation/devicetree/bindings/edac/npcm7xx-sdram-edac.txt line 3

Quoted 3 lines
Documentation/devicetree/bindings/edac/npcm7xx-sdram-edac.txt new file +3 -0
@@ -0,0 +1,17 @@
+Nuvoton NPCM7xx SoC EDAC device driver
+
+The Nuvoton NPCM7xx SoC supports DDR4 memory with/without ECC and

the

Documentation/devicetree/bindings/edac/npcm7xx-sdram-edac.txt line 4

Quoted 1 line
Documentation/devicetree/bindings/edac/npcm7xx-sdram-edac.txt new file +1 -0
+driver uses the EDAC framework to implement the ECC detection and

corrtection.

Documentation/devicetree/bindings/edac/npcm7xx-sdram-edac.txt line 8

Quoted 4 lines
Documentation/devicetree/bindings/edac/npcm7xx-sdram-edac.txt new file +4 -0
+
+Required properties:
+- compatible:  should be "nuvoton,npcm7xx-sdram-edac"
+- reg:         Memory controller register set should be <0xf0824000

0x1000>

Quoted 11 lines

Documentation/devicetree/bindings/edac/npcm7xx-sdram-edac.txt line 16

Quoted 8 lines
Documentation/devicetree/bindings/edac/npcm7xx-sdram-edac.txt new file +8 -0
+- interrupts:  should be MC interrupt #25
+
+Example:
+
+       mc: memory-controller@f0824000 {
+               compatible = "nuvoton,npcm7xx-sdram-edac";
+               reg = <0xf0824000 0x1000>;
+               interrupts = <0 25 4>;

I think we can use the defines for 0 and 4? GIC_SPI and IRQ_TYPE_LEVEL_HIGH.

Because I saw other documentation doesn't use the defines necessarily. If it's needed, I can change to use them and re-submit the patch.

Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/edac/npcm7xx-sdram-edac.txt new file +1 -1
+       };
--

2.21.0

#4 lore raw

Re: [PATCH dev-5.1 v1 1/2] edac: npcm: Add Nuvoton NPCM7xx EDAC driver

In reply to a message not in the archive

Hi George,

Quoted 4 lines · George Hung

From: George Hung <[email protected]>

Add support for the Nuvoton NPCM7xx SoC EDAC driver

I would like an ack or review from someone familiar with the Nuvoton system. I can then include it in dev-5.1.

Please send this one for mainline inclusion too.

Cheers,

Joel

Quoted 505 lines

NPCM7xx ECC datasheet from nuvoton.israel-Poleg:
"Cadence DDR Controller User’s Manual For DDR3 & DDR4 Memories"

Tested: Forcing an ECC error event

Write a value to the xor_check_bits parameter that will trigger an ECC event once that word is read

For example, to force a single-bit correctable error on bit 0 of the user-word space shown, write 0x75 into that byte of the xor_check_bits parameter and then assert fwc (force write check) bit to 'b1' (mem base: 0xf0824000, xor_check_bits reg addr: 0x178)

$ devmem 0xf0824178 32 0x7501

To force a double-bit un-correctable error for the user-word space, write 0x03 into that byte of the xor_check_bits parameter

$ devmem 0xf0824178 32 0x301
---
 MAINTAINERS                 |   6 +
 drivers/edac/Kconfig        |   7 +
 drivers/edac/Makefile       |   1 +
 drivers/edac/npcm7xx_edac.c | 424 ++++++++++++++++++++++++++++++++++++
 4 files changed, 438 insertions(+)
 create mode 100644 drivers/edac/npcm7xx_edac.c
MAINTAINERS +6 -0
index 7c54dbc8f406..0a6ac3f00ed5 100644
@@ -5658,6 +5658,12 @@ L:       [email protected]
 S:     Maintained
 F:     drivers/edac/mpc85xx_edac.[ch]
 
+EDAC-NPCM7XX
+M:     George Hung <[email protected]>
+S:     Maintained
+F:     drivers/edac/npcm7xx_edac.c
+F:     Documentation/devicetree/bindings/edac/npcm7xx-sdram-edac.txt
+
 EDAC-PASEMI
 M:     Egor Martovetsky <[email protected]>
 L:     [email protected]
drivers/edac/Kconfig +7 -0
index 47eb4d13ed5f..7d666ad7f88b 100644
@@ -504,4 +504,11 @@ config EDAC_ASPEED
          First, ECC must be configured in the bootloader. Then, this driver
          will expose error counters via the EDAC kernel framework.
 
+config EDAC_NPCM7XX
+       tristate "Nuvoton NPCM7xx DDR Memory Controller"
+       depends on ARCH_NPCM7XX
+       help
+         Support for error detection and correction on the
+         Nuvoton NPCM7xx DDR memory controller.
+
 endif # EDAC
drivers/edac/Makefile +1 -0
index 89ad4a84a0f6..d7780ce035b8 100644
@@ -84,3 +84,4 @@ obj-$(CONFIG_EDAC_XGENE)              += xgene_edac.o
 obj-$(CONFIG_EDAC_TI)                  += ti_edac.o
 obj-$(CONFIG_EDAC_QCOM)                        += qcom_edac.o
 obj-$(CONFIG_EDAC_ASPEED)              += aspeed_edac.o
+obj-$(CONFIG_EDAC_NPCM7XX)              += npcm7xx_edac.o
drivers/edac/npcm7xx_edac.c new file +424 -1
new file mode 100644
index 000000000000..2d2deb81e49c
@@ -0,0 +1,424 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2019 Quanta Computer lnc.
+ */
+
+#include <linux/edac.h>
+#include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/of_address.h>
+#include <linux/of_device.h>
+
+#include "edac_module.h"
+
+#define ECC_ENABLE                     BIT(24)
+#define ECC_EN_INT_MASK                0x7fffff87
+
+#define INT_STATUS_ADDR                116
+#define INT_ACK_ADDR                   117
+#define INT_MASK_ADDR                  118
+
+#define ECC_EN_ADDR                    93
+#define ECC_C_ADDR_ADDR                98
+#define ECC_C_DATA_ADDR                100
+#define ECC_C_ID_ADDR                  101
+#define ECC_C_SYND_ADDR                99
+#define ECC_U_ADDR_ADDR                95
+#define ECC_U_DATA_ADDR                97
+#define ECC_U_ID_ADDR                  101
+#define ECC_U_SYND_ADDR                96
+
+#define ECC_ERROR                      -1
+#define EDAC_MSG_SIZE                  256
+#define EDAC_MOD_NAME                  "npcm7xx-edac"
+
+struct ecc_error_signature_info {
+       u32 ecc_addr;
+       u32 ecc_data;
+       u32 ecc_id;
+       u32 ecc_synd;
+};
+
+struct npcm7xx_ecc_int_status {
+       u32 int_mask;
+       u32 int_status;
+       u32 int_ack;
+       u32 ce_cnt;
+       u32 ue_cnt;
+       struct ecc_error_signature_info ceinfo;
+       struct ecc_error_signature_info ueinfo;
+};
+
+struct npcm7xx_edac_priv {
+       void __iomem *baseaddr;
+       char message[EDAC_MSG_SIZE];
+       struct npcm7xx_ecc_int_status stat;
+};
+
+/**
+ * npcm7xx_edac_get_ecc_syndrom - Get the current ecc error info
+ * @base:      Pointer to the base address of the ddr memory controller
+ * @p:         Pointer to the Nuvoton ecc status structure
+ *
+ * Determines there is any ecc error or not
+ *
+ * Return: ECC detection status
+ */
+static int npcm7xx_edac_get_ecc_syndrom(void __iomem *base,
+                                       struct npcm7xx_ecc_int_status *p)
+{
+       int status = 0;
+       u32 int_status = 0;
+
+       int_status = readl(base + 4*INT_STATUS_ADDR);
+       writel(int_status, base + 4*INT_ACK_ADDR);
+       edac_dbg(3, "int_status: %#08x\n", int_status);
+
+       if ((int_status & (1 << 6)) == (1 << 6)) {
+               edac_dbg(3, "6-Mult uncorrectable detected.\n");
+               p->ue_cnt++;
+               status = ECC_ERROR;
+       }
+
+       if ((int_status & (1 << 5)) == (1 << 5)) {
+               edac_dbg(3, "5-An uncorrectable detected\n");
+               p->ue_cnt++;
+               status = ECC_ERROR;
+       }
+
+       if ((int_status & (1 << 4)) == (1 << 4)) {
+               edac_dbg(3, "4-mult correctable detected.\n");
+               p->ce_cnt++;
+               status = ECC_ERROR;
+       }
+
+       if ((int_status & (1 << 3)) == (1 << 3)) {
+               edac_dbg(3, "3-A correctable detected.\n");
+               p->ce_cnt++;
+               status = ECC_ERROR;
+       }
+
+       if (status == ECC_ERROR) {
+               u32 ecc_id;
+
+               p->ceinfo.ecc_addr = readl(base + 4*ECC_C_ADDR_ADDR);
+               p->ceinfo.ecc_data = readl(base + 4*ECC_C_DATA_ADDR);
+               p->ceinfo.ecc_synd = readl(base + 4*ECC_C_SYND_ADDR);
+
+               p->ueinfo.ecc_addr = readl(base + 4*ECC_U_ADDR_ADDR);
+               p->ueinfo.ecc_data = readl(base + 4*ECC_U_DATA_ADDR);
+               p->ueinfo.ecc_synd = readl(base + 4*ECC_U_SYND_ADDR);
+
+               /* ECC_C_ID_ADDR has same value as ECC_U_ID_ADDR */
+               ecc_id = readl(base + 4*ECC_C_ID_ADDR);
+               p->ueinfo.ecc_id = ecc_id & 0xffff;
+               p->ceinfo.ecc_id = ecc_id >> 16;
+       }
+
+       return status;
+}
+
+/**
+ * npcm7xx_edac_handle_error - Handle controller error types CE and UE
+ * @mci:       Pointer to the edac memory controller instance
+ * @p:         Pointer to the Nuvoton ecc status structure
+ *
+ * Handles the controller ECC correctable and un correctable error.
+ */
+static void npcm7xx_edac_handle_error(struct mem_ctl_info *mci,
+                                   struct npcm7xx_ecc_int_status *p)
+{
+       struct npcm7xx_edac_priv *priv = mci->pvt_info;
+       u32 page, offset;
+
+       if (p->ce_cnt) {
+               snprintf(priv->message, EDAC_MSG_SIZE,
+                       "DDR ECC: synd=%#08x addr=%#08x data=%#08x source_id=%#08x ",
+                       p->ceinfo.ecc_synd, p->ceinfo.ecc_addr,
+                       p->ceinfo.ecc_data, p->ceinfo.ecc_id);
+
+               page = p->ceinfo.ecc_addr >> PAGE_SHIFT;
+               offset = p->ceinfo.ecc_addr & ~PAGE_MASK;
+               edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci,
+                                    p->ce_cnt, page, offset,
+                                    p->ceinfo.ecc_synd,
+                                    0, 0, -1,
+                                    priv->message, "");
+       }
+
+       if (p->ue_cnt) {
+               snprintf(priv->message, EDAC_MSG_SIZE,
+                       "DDR ECC: synd=%#08x addr=%#08x data=%#08x source_id=%#08x ",
+                       p->ueinfo.ecc_synd, p->ueinfo.ecc_addr,
+                       p->ueinfo.ecc_data, p->ueinfo.ecc_id);
+
+               page = p->ueinfo.ecc_addr >> PAGE_SHIFT;
+               offset = p->ueinfo.ecc_addr & ~PAGE_MASK;
+               edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci,
+                                    p->ue_cnt, page, offset,
+                                    p->ueinfo.ecc_synd,
+                                    0, 0, -1,
+                                    priv->message, "");
+       }
+
+       memset(p, 0, sizeof(*p));
+}
+
+/**
+ * npcm7xx_edac_check - Check controller for ECC errors
+ * @mci:       Pointer to the edac memory controller instance
+ *
+ * This routine is used to check and post ECC errors and is called by
+ * this driver's CE and UE interrupt handler.
+ */
+static void npcm7xx_edac_check(struct mem_ctl_info *mci)
+{
+       struct npcm7xx_edac_priv *priv = mci->pvt_info;
+       int status = 0;
+
+       status = npcm7xx_edac_get_ecc_syndrom(priv->baseaddr, &priv->stat);
+       if (status != ECC_ERROR)
+               return;
+
+       npcm7xx_edac_handle_error(mci, &priv->stat);
+}
+
+/**
+ * npcm7xx_edac_isr - CE/UE interrupt service routine
+ * @irq:    The virtual interrupt number being serviced.
+ * @dev_id: A pointer to the EDAC memory controller instance
+ *          associated with the interrupt being handled.
+ *
+ * This routine implements the interrupt handler for both correctable
+ * (CE) and uncorrectable (UE) ECC errors for the Nuvoton Cadence DDR
+ * controller. It simply calls through to the routine used to check,
+ * report and clear the ECC status.
+ *
+ * Unconditionally returns IRQ_HANDLED.
+ */
+static irqreturn_t npcm7xx_edac_isr(int irq, void *dev_id)
+{
+       struct mem_ctl_info *mci = dev_id;
+       int npcm_edac_report = 0;
+
+       npcm_edac_report = edac_get_report_status();
+       if (npcm_edac_report != EDAC_REPORTING_DISABLED)
+               npcm7xx_edac_check(mci);
+
+       return IRQ_HANDLED;
+}
+
+static int npcm7xx_edac_register_irq(struct mem_ctl_info *mci,
+                                       struct platform_device *pdev)
+{
+       int status = 0;
+       int mc_irq;
+       struct npcm7xx_edac_priv *priv = mci->pvt_info;
+
+       /* Only enable MC interrupts with ECC - clear int_mask[6:3] */
+       writel(ECC_EN_INT_MASK, priv->baseaddr + 4*INT_MASK_ADDR);
+
+       mc_irq = platform_get_irq(pdev, 0);
+
+       if (!mc_irq) {
+               edac_printk(KERN_ERR, EDAC_MC, "Unable to map interrupts.\n");
+               status = -ENODEV;
+               goto fail;
+       }
+
+       status = devm_request_irq(&pdev->dev, mc_irq, npcm7xx_edac_isr, 0,
+                              "npcm-memory-controller", mci);
+
+       if (status < 0) {
+               edac_printk(KERN_ERR, EDAC_MC,
+                                     "Unable to request irq %d for ECC",
+                                     mc_irq);
+               status = -ENODEV;
+               goto fail;
+       }
+
+       return 0;
+
+fail:
+       return status;
+}
+
+static const struct of_device_id npcm7xx_edac_of_match[] = {
+       { .compatible = "nuvoton,npcm7xx-sdram-edac"},
+       { /* end of table */ }
+};
+
+MODULE_DEVICE_TABLE(of, npcm7xx_edac_of_match);
+
+/**
+ * npcm7xx_edac_mc_init - Initialize driver instance
+ * @mci:       Pointer to the edac memory controller instance
+ * @pdev:      Pointer to the platform_device struct
+ *
+ * Performs initialization of the EDAC memory controller instance and
+ * related driver-private data associated with the memory controller the
+ * instance is bound to.
+ *
+ * Returns 0 if OK; otherwise, < 0 on error.
+ */
+static int npcm7xx_edac_mc_init(struct mem_ctl_info *mci,
+                                struct platform_device *pdev)
+{
+       const struct of_device_id *id;
+
+       id = of_match_device(npcm7xx_edac_of_match, &pdev->dev);
+       if (!id)
+               return -ENODEV;
+
+       /* Initialize controller capabilities and configuration */
+       mci->mtype_cap = MEM_FLAG_DDR4;
+       mci->edac_ctl_cap = EDAC_FLAG_SECDED;
+       mci->edac_cap = EDAC_FLAG_SECDED;
+       mci->scrub_cap = SCRUB_FLAG_HW_SRC;
+       mci->scrub_mode = SCRUB_HW_SRC;
+       mci->ctl_name = id->compatible;
+       mci->dev_name = dev_name(&pdev->dev);
+       mci->mod_name = EDAC_MOD_NAME;
+
+       edac_op_state = EDAC_OPSTATE_INT;
+
+       return 0;
+}
+
+/**
+ * npcm7xx_edac_get_eccstate - Return the controller ecc enable/disable status
+ * @base:      Pointer to the ddr memory controller base address
+ *
+ * Get the ECC enable/disable status for the controller
+ *
+ * Return: a ecc status boolean i.e true/false - enabled/disabled.
+ */
+static bool npcm7xx_edac_get_eccstate(void __iomem *base)
+{
+       u32 ecc_en;
+       bool state = false;
+
+       ecc_en = readl(base + 4*ECC_EN_ADDR);
+       if (ecc_en & ECC_ENABLE) {
+               edac_printk(KERN_INFO, EDAC_MC, "ECC reporting and correcting on. ");
+               state = true;
+       }
+
+       return state;
+}
+
+/**
+ * npcm7xx_edac_mc_probe - Check controller and bind driver
+ * @pdev:      Pointer to the platform_device struct
+ *
+ * Probes a specific controller instance for binding with the driver.
+ *
+ * Return: 0 if the controller instance was successfully bound to the
+ * driver; otherwise, < 0 on error.
+ */
+static int npcm7xx_edac_mc_probe(struct platform_device *pdev)
+{
+       struct mem_ctl_info *mci;
+       struct edac_mc_layer layers[1];
+       struct npcm7xx_edac_priv *priv;
+       struct resource *res;
+       void __iomem *baseaddr;
+       int rc;
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       baseaddr = devm_ioremap_resource(&pdev->dev, res);
+       if (IS_ERR(baseaddr)) {
+               edac_printk(KERN_ERR, EDAC_MOD_NAME,
+                           "DDR controller regs not defined\n");
+               return PTR_ERR(baseaddr);
+       }
+
+       /*
+        * Check if ECC is enabled.
+        * If not, there is no useful monitoring that can be done
+        * for this controller.
+        */
+       if (!npcm7xx_edac_get_eccstate(baseaddr)) {
+               edac_printk(KERN_INFO, EDAC_MC, "ECC disabled\n");
+               return -ENXIO;
+       }
+
+       /*
+        * Allocate an EDA controller instance and perform the appropriate
+        * initialization.
+        */
+       layers[0].type = EDAC_MC_LAYER_ALL_MEM;
+       layers[0].size = 1;
+
+       mci = edac_mc_alloc(0, ARRAY_SIZE(layers), layers,
+                           sizeof(struct npcm7xx_edac_priv));
+       if (!mci) {
+               edac_printk(KERN_ERR, EDAC_MC,
+                           "Failed memory allocation for mc instance\n");
+               return -ENOMEM;
+       }
+
+       mci->pdev = &pdev->dev;
+       priv = mci->pvt_info;
+       priv->baseaddr = baseaddr;
+       platform_set_drvdata(pdev, mci);
+
+       rc = npcm7xx_edac_mc_init(mci, pdev);
+       if (rc) {
+               edac_printk(KERN_ERR, EDAC_MC,
+                           "Failed to initialize instance\n");
+               goto free_edac_mc;
+       }
+
+       /* Attempt to register it with the EDAC subsystem */
+       rc = edac_mc_add_mc(mci);
+       if (rc) {
+               edac_printk(KERN_ERR, EDAC_MC,
+                           "Failed to register with EDAC core\n");
+               goto free_edac_mc;
+       }
+
+       /* Register interrupts */
+       rc = npcm7xx_edac_register_irq(mci, pdev);
+       if (rc)
+               goto free_edac_mc;
+
+       return 0;
+
+free_edac_mc:
+       edac_mc_free(mci);
+
+       return rc;
+}
+
+/**
+ * npcm7xx_edac_mc_remove - Unbind driver from controller
+ * @pdev:      Pointer to the platform_device struct
+ *
+ * Return: Unconditionally 0
+ */
+static int npcm7xx_edac_mc_remove(struct platform_device *pdev)
+{
+       struct mem_ctl_info *mci = platform_get_drvdata(pdev);
+
+       edac_mc_del_mc(&pdev->dev);
+       edac_mc_free(mci);
+
+       return 0;
+}
+
+static struct platform_driver npcm7xx_edac_driver = {
+       .probe = npcm7xx_edac_mc_probe,
+       .remove = npcm7xx_edac_mc_remove,
+       .driver = {
+                  .name = EDAC_MOD_NAME,
+                  .of_match_table = npcm7xx_edac_of_match,
+       },
+};
+
+module_platform_driver(npcm7xx_edac_driver);
+
+MODULE_AUTHOR("Quanta Computer Inc.");
+MODULE_DESCRIPTION("Nuvoton NPCM7xx EDAC Driver");
+MODULE_LICENSE("GPL v2");
--

2.21.0

#5 lore raw

RE: [PATCH dev-5.1 v1 1/2] edac: npcm: Add Nuvoton NPCM7xx EDAC driver

Hi Joel,

Quoted 16 lines

-----Original Message-----
From: openbmc [mailto:[email protected]] On Behalf Of Joel Stanley
Sent: Tuesday, June 04, 2019 1:39 PM
To: George Hung
Cc: OpenBMC Maillist; Tomer Maimon; Benjamin Fair; Avi Fishman; William A. Kennington III
Subject: Re: [PATCH dev-5.1 v1 1/2] edac: npcm: Add Nuvoton NPCM7xx EDAC driver

Hi George,

Quoted 1 line · George Hung
Quoted 6 lines
Quoted 3 lines

From: George Hung <[email protected]>

Add support for the Nuvoton NPCM7xx SoC EDAC driver

I would like an ack or review from someone familiar with the Nuvoton system. I can then include it in dev-5.1.

I have already found the Nuvoton contributor to review my patch.

https://lists.ozlabs.org/pipermail/openbmc/2019-May/016427.html

Quoted 2 lines

Please send this one for mainline inclusion too.

I have sent this patch to mainline inclusion (linux-edac and linux-kernel)

https://marc.info/?l=linux-edac&m=155930084419338&w=2
https://marc.info/?l=linux-kernel&m=155930084719339&w=2

BRs

George Hung

Quoted 529 lines

Cheers,

Joel

Quoted 36 lines

NPCM7xx ECC datasheet from nuvoton.israel-Poleg:
"Cadence DDR Controller User’s Manual For DDR3 & DDR4 Memories"

Tested: Forcing an ECC error event

Write a value to the xor_check_bits parameter that will trigger an ECC event once that word is read

For example, to force a single-bit correctable error on bit 0 of the user-word space shown, write 0x75 into that byte of the xor_check_bits parameter and then assert fwc (force write check) bit to 'b1' (mem
base: 0xf0824000, xor_check_bits reg addr: 0x178)

$ devmem 0xf0824178 32 0x7501

To force a double-bit un-correctable error for the user-word space, write 0x03 into that byte of the xor_check_bits parameter

$ devmem 0xf0824178 32 0x301
---
 MAINTAINERS                 |   6 +
 drivers/edac/Kconfig        |   7 +
 drivers/edac/Makefile       |   1 +
 drivers/edac/npcm7xx_edac.c | 424
++++++++++++++++++++++++++++++++++++
 4 files changed, 438 insertions(+)
 create mode 100644 drivers/edac/npcm7xx_edac.c
MAINTAINERS index renamed from MAINTAINERS +0 -0

7c54dbc8f406..0a6ac3f00ed5 100644

MAINTAINERS L: [email protected] · line 5665

Quoted 8 lines
MAINTAINERS +5 -0
@@ -5658,6 +5658,12 @@ L:       [email protected]
 S:     Maintained
 F:     drivers/edac/mpc85xx_edac.[ch]
 
+EDAC-NPCM7XX
+M:     George Hung <[email protected]>
+S:     Maintained
+F:     drivers/edac/npcm7xx_edac.c
+F:

Documentation/devicetree/bindings/edac/npcm7xx-sdram-edac.txt

drivers/edac/Kconfig config EDAC_ASPEED · line 504

Quoted 10 lines
MAINTAINERS +1 -0
+
 EDAC-PASEMI
 M:     Egor Martovetsky <[email protected]>
 L:     [email protected]
drivers/edac/Kconfig index renamed from drivers/edac/Kconfig +0 -0

47eb4d13ed5f..7d666ad7f88b 100644

drivers/edac/Kconfig +0 -0
@@ -504,4 +504,11 @@ config EDAC_ASPEED
          First, ECC must be configured in the bootloader. Then, this

driver

drivers/edac/Makefile obj-$(CONFIG_EDAC_XGENE) +=

Quoted 15 lines
drivers/edac/Kconfig +7 -0
          will expose error counters via the EDAC kernel framework.
 
+config EDAC_NPCM7XX
+       tristate "Nuvoton NPCM7xx DDR Memory Controller"
+       depends on ARCH_NPCM7XX
+       help
+         Support for error detection and correction on the
+         Nuvoton NPCM7xx DDR memory controller.
+
 endif # EDAC
drivers/edac/Makefile index renamed from drivers/edac/Makefile +0 -0

89ad4a84a0f6..d7780ce035b8 100644

drivers/edac/Makefile +0 -0
@@ -84,3 +84,4 @@ obj-$(CONFIG_EDAC_XGENE)              +=

xgene_edac.o

drivers/edac/Makefile obj-$(CONFIG_EDAC_XGENE) += · line 85

Quoted 2 lines
drivers/edac/Makefile +0 -0
 obj-$(CONFIG_EDAC_TI)                  += ti_edac.o
 obj-$(CONFIG_EDAC_QCOM)                        +=

qcom_edac.o

Quoted 64 lines
drivers/edac/Makefile +1 -0
 obj-$(CONFIG_EDAC_ASPEED)              += aspeed_edac.o
+obj-$(CONFIG_EDAC_NPCM7XX)              += npcm7xx_edac.o
drivers/edac/npcm7xx_edac.c new file +57 -0
new file mode 100644 index 000000000000..2d2deb81e49c
@@ -0,0 +1,424 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2019 Quanta Computer lnc.
+ */
+
+#include <linux/edac.h>
+#include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/of_address.h>
+#include <linux/of_device.h>
+
+#include "edac_module.h"
+
+#define ECC_ENABLE                     BIT(24)
+#define ECC_EN_INT_MASK                0x7fffff87
+
+#define INT_STATUS_ADDR                116
+#define INT_ACK_ADDR                   117
+#define INT_MASK_ADDR                  118
+
+#define ECC_EN_ADDR                    93
+#define ECC_C_ADDR_ADDR                98
+#define ECC_C_DATA_ADDR                100
+#define ECC_C_ID_ADDR                  101
+#define ECC_C_SYND_ADDR                99
+#define ECC_U_ADDR_ADDR                95
+#define ECC_U_DATA_ADDR                97
+#define ECC_U_ID_ADDR                  101
+#define ECC_U_SYND_ADDR                96
+
+#define ECC_ERROR                      -1
+#define EDAC_MSG_SIZE                  256
+#define EDAC_MOD_NAME                  "npcm7xx-edac"
+
+struct ecc_error_signature_info {
+       u32 ecc_addr;
+       u32 ecc_data;
+       u32 ecc_id;
+       u32 ecc_synd;
+};
+
+struct npcm7xx_ecc_int_status {
+       u32 int_mask;
+       u32 int_status;
+       u32 int_ack;
+       u32 ce_cnt;
+       u32 ue_cnt;
+       struct ecc_error_signature_info ceinfo;
+       struct ecc_error_signature_info ueinfo; };
+
+struct npcm7xx_edac_priv {
+       void __iomem *baseaddr;
+       char message[EDAC_MSG_SIZE];
+       struct npcm7xx_ecc_int_status stat; };
+
+/**

drivers/edac/npcm7xx_edac.c line 67

Quoted 10 lines
drivers/edac/npcm7xx_edac.c new file +10 -0
+ * npcm7xx_edac_get_ecc_syndrom - Get the current ecc error info
+ * @base:      Pointer to the base address of the ddr memory controller
+ * @p:         Pointer to the Nuvoton ecc status structure
+ *
+ * Determines there is any ecc error or not
+ *
+ * Return: ECC detection status
+ */
+static int npcm7xx_edac_get_ecc_syndrom(void __iomem *base,
+                                       struct

npcm7xx_ecc_int_status

Quoted 26 lines
drivers/edac/npcm7xx_edac.c new file +26 -0
+*p) {
+       int status = 0;
+       u32 int_status = 0;
+
+       int_status = readl(base + 4*INT_STATUS_ADDR);
+       writel(int_status, base + 4*INT_ACK_ADDR);
+       edac_dbg(3, "int_status: %#08x\n", int_status);
+
+       if ((int_status & (1 << 6)) == (1 << 6)) {
+               edac_dbg(3, "6-Mult uncorrectable detected.\n");
+               p->ue_cnt++;
+               status = ECC_ERROR;
+       }
+
+       if ((int_status & (1 << 5)) == (1 << 5)) {
+               edac_dbg(3, "5-An uncorrectable detected\n");
+               p->ue_cnt++;
+               status = ECC_ERROR;
+       }
+
+       if ((int_status & (1 << 4)) == (1 << 4)) {
+               edac_dbg(3, "4-mult correctable detected.\n");
+               p->ce_cnt++;
+               status = ECC_ERROR;
+       }
+

drivers/edac/npcm7xx_edac.c line 103

Quoted 10 lines
drivers/edac/npcm7xx_edac.c new file +10 -0
+       if ((int_status & (1 << 3)) == (1 << 3)) {
+               edac_dbg(3, "3-A correctable detected.\n");
+               p->ce_cnt++;
+               status = ECC_ERROR;
+       }
+
+       if (status == ECC_ERROR) {
+               u32 ecc_id;
+
+               p->ceinfo.ecc_addr = readl(base +

4*ECC_C_ADDR_ADDR);

drivers/edac/npcm7xx_edac.c line 104

Quoted 1 line
drivers/edac/npcm7xx_edac.c new file +1 -0
+               p->ceinfo.ecc_data = readl(base +

4*ECC_C_DATA_ADDR);

drivers/edac/npcm7xx_edac.c line 105

Quoted 1 line
drivers/edac/npcm7xx_edac.c new file +1 -0
+               p->ceinfo.ecc_synd = readl(base +

4*ECC_C_SYND_ADDR);

drivers/edac/npcm7xx_edac.c line 107

Quoted 2 lines
drivers/edac/npcm7xx_edac.c new file +2 -0
+
+               p->ueinfo.ecc_addr = readl(base +

4*ECC_U_ADDR_ADDR);

drivers/edac/npcm7xx_edac.c line 108

Quoted 1 line
drivers/edac/npcm7xx_edac.c new file +1 -0
+               p->ueinfo.ecc_data = readl(base +

4*ECC_U_DATA_ADDR);

drivers/edac/npcm7xx_edac.c line 109

Quoted 1 line
drivers/edac/npcm7xx_edac.c new file +1 -0
+               p->ueinfo.ecc_synd = readl(base +

4*ECC_U_SYND_ADDR);

drivers/edac/npcm7xx_edac.c line 111

Quoted 2 lines
drivers/edac/npcm7xx_edac.c new file +2 -0
+
+               /* ECC_C_ID_ADDR has same value as ECC_U_ID_ADDR

*/

Quoted 7 lines
drivers/edac/npcm7xx_edac.c new file +7 -0
+               ecc_id = readl(base + 4*ECC_C_ID_ADDR);
+               p->ueinfo.ecc_id = ecc_id & 0xffff;
+               p->ceinfo.ecc_id = ecc_id >> 16;
+       }
+
+       return status;
+}

drivers/edac/npcm7xx_edac.c line 128

Quoted 10 lines
drivers/edac/npcm7xx_edac.c new file +10 -0
+
+/**
+ * npcm7xx_edac_handle_error - Handle controller error types CE and UE
+ * @mci:       Pointer to the edac memory controller instance
+ * @p:         Pointer to the Nuvoton ecc status structure
+ *
+ * Handles the controller ECC correctable and un correctable error.
+ */
+static void npcm7xx_edac_handle_error(struct mem_ctl_info *mci,
+                                   struct npcm7xx_ecc_int_status

*p)

drivers/edac/npcm7xx_edac.c line 135

Quoted 7 lines
drivers/edac/npcm7xx_edac.c new file +7 -0
+{
+       struct npcm7xx_edac_priv *priv = mci->pvt_info;
+       u32 page, offset;
+
+       if (p->ce_cnt) {
+               snprintf(priv->message, EDAC_MSG_SIZE,
+                       "DDR ECC: synd=%#08x addr=%#08x

data=%#08x source_id=%#08x ",

drivers/edac/npcm7xx_edac.c line 141

Quoted 6 lines
drivers/edac/npcm7xx_edac.c new file +6 -0
+                       p->ceinfo.ecc_synd, p->ceinfo.ecc_addr,
+                       p->ceinfo.ecc_data, p->ceinfo.ecc_id);
+
+               page = p->ceinfo.ecc_addr >> PAGE_SHIFT;
+               offset = p->ceinfo.ecc_addr & ~PAGE_MASK;
+               edac_mc_handle_error(HW_EVENT_ERR_CORRECTED,

mci,

drivers/edac/npcm7xx_edac.c line 150

Quoted 9 lines
drivers/edac/npcm7xx_edac.c new file +9 -0
+                                    p->ce_cnt, page, offset,
+                                    p->ceinfo.ecc_synd,
+                                    0, 0, -1,
+                                    priv->message, "");
+       }
+
+       if (p->ue_cnt) {
+               snprintf(priv->message, EDAC_MSG_SIZE,
+                       "DDR ECC: synd=%#08x addr=%#08x

data=%#08x source_id=%#08x ",

drivers/edac/npcm7xx_edac.c line 156

Quoted 6 lines
drivers/edac/npcm7xx_edac.c new file +6 -0
+                       p->ueinfo.ecc_synd, p->ueinfo.ecc_addr,
+                       p->ueinfo.ecc_data, p->ueinfo.ecc_id);
+
+               page = p->ueinfo.ecc_addr >> PAGE_SHIFT;
+               offset = p->ueinfo.ecc_addr & ~PAGE_MASK;
+

edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci,

Quoted 11 lines
drivers/edac/npcm7xx_edac.c new file +11 -0
+                                    p->ue_cnt, page, offset,
+                                    p->ueinfo.ecc_synd,
+                                    0, 0, -1,
+                                    priv->message, "");
+       }
+
+       memset(p, 0, sizeof(*p));
+}
+
+/**
+ * npcm7xx_edac_check - Check controller for ECC errors

drivers/edac/npcm7xx_edac.c line 177

Quoted 10 lines
drivers/edac/npcm7xx_edac.c new file +10 -0
+ * @mci:       Pointer to the edac memory controller instance
+ *
+ * This routine is used to check and post ECC errors and is called by
+ * this driver's CE and UE interrupt handler.
+ */
+static void npcm7xx_edac_check(struct mem_ctl_info *mci) {
+       struct npcm7xx_edac_priv *priv = mci->pvt_info;
+       int status = 0;
+
+       status = npcm7xx_edac_get_ecc_syndrom(priv->baseaddr,

&priv->stat);

Quoted 21 lines
drivers/edac/npcm7xx_edac.c new file +21 -0
+       if (status != ECC_ERROR)
+               return;
+
+       npcm7xx_edac_handle_error(mci, &priv->stat); }
+
+/**
+ * npcm7xx_edac_isr - CE/UE interrupt service routine
+ * @irq:    The virtual interrupt number being serviced.
+ * @dev_id: A pointer to the EDAC memory controller instance
+ *          associated with the interrupt being handled.
+ *
+ * This routine implements the interrupt handler for both correctable
+ * (CE) and uncorrectable (UE) ECC errors for the Nuvoton Cadence DDR
+ * controller. It simply calls through to the routine used to check,
+ * report and clear the ECC status.
+ *
+ * Unconditionally returns IRQ_HANDLED.
+ */
+static irqreturn_t npcm7xx_edac_isr(int irq, void *dev_id) {
+       struct mem_ctl_info *mci = dev_id;
+       int npcm_edac_report = 0;

drivers/edac/npcm7xx_edac.c line 208

Quoted 10 lines
drivers/edac/npcm7xx_edac.c new file +10 -0
+
+       npcm_edac_report = edac_get_report_status();
+       if (npcm_edac_report != EDAC_REPORTING_DISABLED)
+               npcm7xx_edac_check(mci);
+
+       return IRQ_HANDLED;
+}
+
+static int npcm7xx_edac_register_irq(struct mem_ctl_info *mci,
+                                       struct platform_device

*pdev)

drivers/edac/npcm7xx_edac.c line 215

Quoted 7 lines
drivers/edac/npcm7xx_edac.c new file +7 -0
+{
+       int status = 0;
+       int mc_irq;
+       struct npcm7xx_edac_priv *priv = mci->pvt_info;
+
+       /* Only enable MC interrupts with ECC - clear int_mask[6:3] */
+       writel(ECC_EN_INT_MASK, priv->baseaddr +

4*INT_MASK_ADDR);

drivers/edac/npcm7xx_edac.c line 220

Quoted 5 lines
drivers/edac/npcm7xx_edac.c new file +5 -0
+
+       mc_irq = platform_get_irq(pdev, 0);
+
+       if (!mc_irq) {
+               edac_printk(KERN_ERR, EDAC_MC, "Unable to map

interrupts.\n");

drivers/edac/npcm7xx_edac.c line 225

Quoted 5 lines
drivers/edac/npcm7xx_edac.c new file +5 -0
+               status = -ENODEV;
+               goto fail;
+       }
+
+       status = devm_request_irq(&pdev->dev, mc_irq,

npcm7xx_edac_isr, 0,

drivers/edac/npcm7xx_edac.c line 230

Quoted 5 lines
drivers/edac/npcm7xx_edac.c new file +5 -0
+                              "npcm-memory-controller", mci);
+
+       if (status < 0) {
+               edac_printk(KERN_ERR, EDAC_MC,
+                                     "Unable to request irq %d

for ECC",

Quoted 45 lines
drivers/edac/npcm7xx_edac.c new file +45 -0
+                                     mc_irq);
+               status = -ENODEV;
+               goto fail;
+       }
+
+       return 0;
+
+fail:
+       return status;
+}
+
+static const struct of_device_id npcm7xx_edac_of_match[] = {
+       { .compatible = "nuvoton,npcm7xx-sdram-edac"},
+       { /* end of table */ }
+};
+
+MODULE_DEVICE_TABLE(of, npcm7xx_edac_of_match);
+
+/**
+ * npcm7xx_edac_mc_init - Initialize driver instance
+ * @mci:       Pointer to the edac memory controller instance
+ * @pdev:      Pointer to the platform_device struct
+ *
+ * Performs initialization of the EDAC memory controller instance and
+ * related driver-private data associated with the memory controller
+the
+ * instance is bound to.
+ *
+ * Returns 0 if OK; otherwise, < 0 on error.
+ */
+static int npcm7xx_edac_mc_init(struct mem_ctl_info *mci,
+                                struct platform_device *pdev) {
+       const struct of_device_id *id;
+
+       id = of_match_device(npcm7xx_edac_of_match, &pdev->dev);
+       if (!id)
+               return -ENODEV;
+
+       /* Initialize controller capabilities and configuration */
+       mci->mtype_cap = MEM_FLAG_DDR4;
+       mci->edac_ctl_cap = EDAC_FLAG_SECDED;
+       mci->edac_cap = EDAC_FLAG_SECDED;
+       mci->scrub_cap = SCRUB_FLAG_HW_SRC;
+       mci->scrub_mode = SCRUB_HW_SRC;
+       mci->ctl_name = id->compatible;

drivers/edac/npcm7xx_edac.c line 285

Quoted 10 lines
drivers/edac/npcm7xx_edac.c new file +10 -0
+       mci->dev_name = dev_name(&pdev->dev);
+       mci->mod_name = EDAC_MOD_NAME;
+
+       edac_op_state = EDAC_OPSTATE_INT;
+
+       return 0;
+}
+
+/**
+ * npcm7xx_edac_get_eccstate - Return the controller ecc enable/disable

status

drivers/edac/npcm7xx_edac.c line 298

Quoted 13 lines
drivers/edac/npcm7xx_edac.c new file +13 -0
+ * @base:      Pointer to the ddr memory controller base address
+ *
+ * Get the ECC enable/disable status for the controller
+ *
+ * Return: a ecc status boolean i.e true/false - enabled/disabled.
+ */
+static bool npcm7xx_edac_get_eccstate(void __iomem *base) {
+       u32 ecc_en;
+       bool state = false;
+
+       ecc_en = readl(base + 4*ECC_EN_ADDR);
+       if (ecc_en & ECC_ENABLE) {
+               edac_printk(KERN_INFO, EDAC_MC, "ECC reporting and

correcting on. ");

Quoted 33 lines
drivers/edac/npcm7xx_edac.c new file +33 -0
+               state = true;
+       }
+
+       return state;
+}
+
+/**
+ * npcm7xx_edac_mc_probe - Check controller and bind driver
+ * @pdev:      Pointer to the platform_device struct
+ *
+ * Probes a specific controller instance for binding with the driver.
+ *
+ * Return: 0 if the controller instance was successfully bound to the
+ * driver; otherwise, < 0 on error.
+ */
+static int npcm7xx_edac_mc_probe(struct platform_device *pdev) {
+       struct mem_ctl_info *mci;
+       struct edac_mc_layer layers[1];
+       struct npcm7xx_edac_priv *priv;
+       struct resource *res;
+       void __iomem *baseaddr;
+       int rc;
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       baseaddr = devm_ioremap_resource(&pdev->dev, res);
+       if (IS_ERR(baseaddr)) {
+               edac_printk(KERN_ERR, EDAC_MOD_NAME,
+                           "DDR controller regs not defined\n");
+               return PTR_ERR(baseaddr);
+       }
+
+       /*
+        * Check if ECC is enabled.

drivers/edac/npcm7xx_edac.c line 341

Quoted 10 lines
drivers/edac/npcm7xx_edac.c new file +10 -0
+        * If not, there is no useful monitoring that can be done
+        * for this controller.
+        */
+       if (!npcm7xx_edac_get_eccstate(baseaddr)) {
+               edac_printk(KERN_INFO, EDAC_MC, "ECC disabled\n");
+               return -ENXIO;
+       }
+
+       /*
+        * Allocate an EDA controller instance and perform the

appropriate

drivers/edac/npcm7xx_edac.c line 351

Quoted 10 lines
drivers/edac/npcm7xx_edac.c new file +10 -0
+        * initialization.
+        */
+       layers[0].type = EDAC_MC_LAYER_ALL_MEM;
+       layers[0].size = 1;
+
+       mci = edac_mc_alloc(0, ARRAY_SIZE(layers), layers,
+                           sizeof(struct npcm7xx_edac_priv));
+       if (!mci) {
+               edac_printk(KERN_ERR, EDAC_MC,
+                           "Failed memory allocation for mc

instance\n");

Quoted 53 lines
drivers/edac/npcm7xx_edac.c new file +53 -0
+               return -ENOMEM;
+       }
+
+       mci->pdev = &pdev->dev;
+       priv = mci->pvt_info;
+       priv->baseaddr = baseaddr;
+       platform_set_drvdata(pdev, mci);
+
+       rc = npcm7xx_edac_mc_init(mci, pdev);
+       if (rc) {
+               edac_printk(KERN_ERR, EDAC_MC,
+                           "Failed to initialize instance\n");
+               goto free_edac_mc;
+       }
+
+       /* Attempt to register it with the EDAC subsystem */
+       rc = edac_mc_add_mc(mci);
+       if (rc) {
+               edac_printk(KERN_ERR, EDAC_MC,
+                           "Failed to register with EDAC core\n");
+               goto free_edac_mc;
+       }
+
+       /* Register interrupts */
+       rc = npcm7xx_edac_register_irq(mci, pdev);
+       if (rc)
+               goto free_edac_mc;
+
+       return 0;
+
+free_edac_mc:
+       edac_mc_free(mci);
+
+       return rc;
+}
+
+/**
+ * npcm7xx_edac_mc_remove - Unbind driver from controller
+ * @pdev:      Pointer to the platform_device struct
+ *
+ * Return: Unconditionally 0
+ */
+static int npcm7xx_edac_mc_remove(struct platform_device *pdev) {
+       struct mem_ctl_info *mci = platform_get_drvdata(pdev);
+
+       edac_mc_del_mc(&pdev->dev);
+       edac_mc_free(mci);
+
+       return 0;
+}
+
+static struct platform_driver npcm7xx_edac_driver = {
+       .probe = npcm7xx_edac_mc_probe,

drivers/edac/npcm7xx_edac.c line 414

Quoted 10 lines
drivers/edac/npcm7xx_edac.c new file +10 -0
+       .remove = npcm7xx_edac_mc_remove,
+       .driver = {
+                  .name = EDAC_MOD_NAME,
+                  .of_match_table = npcm7xx_edac_of_match,
+       },
+};
+
+module_platform_driver(npcm7xx_edac_driver);
+
+MODULE_AUTHOR("Quanta Computer Inc.");

MODULE_DESCRIPTION("Nuvoton

Quoted 4 lines
drivers/edac/npcm7xx_edac.c new file +1 -1
+NPCM7xx EDAC Driver"); MODULE_LICENSE("GPL v2");
--

2.21.0

#6 lore raw

Re: [PATCH dev-5.1 v1 1/2] edac: npcm: Add Nuvoton NPCM7xx EDAC driver

Hi George,

You should have add the maintainers to the mailing list using 'scripts/get_maintainer.pl patches__x/*'

Quoted 572 lines · George Hung (洪忠敬)

Hi Joel,

Quoted 16 lines

-----Original Message-----
From: openbmc [mailto:[email protected]] On Behalf Of Joel Stanley
Sent: Tuesday, June 04, 2019 1:39 PM
To: George Hung
Cc: OpenBMC Maillist; Tomer Maimon; Benjamin Fair; Avi Fishman; William A. Kennington III
Subject: Re: [PATCH dev-5.1 v1 1/2] edac: npcm: Add Nuvoton NPCM7xx EDAC driver

Hi George,

Quoted 1 line · George Hung
Quoted 6 lines
Quoted 3 lines

From: George Hung <[email protected]>

Add support for the Nuvoton NPCM7xx SoC EDAC driver

I would like an ack or review from someone familiar with the Nuvoton system. I can then include it in dev-5.1.

I have already found the Nuvoton contributor to review my patch.

https://lists.ozlabs.org/pipermail/openbmc/2019-May/016427.html

Quoted 2 lines

Please send this one for mainline inclusion too.

I have sent this patch to mainline inclusion (linux-edac and linux-kernel)

https://marc.info/?l=linux-edac&m=155930084419338&w=2
https://marc.info/?l=linux-kernel&m=155930084719339&w=2

BRs

George Hung

Quoted 529 lines

Cheers,

Joel

Quoted 36 lines

NPCM7xx ECC datasheet from nuvoton.israel-Poleg:
"Cadence DDR Controller User’s Manual For DDR3 & DDR4 Memories"

Tested: Forcing an ECC error event

Write a value to the xor_check_bits parameter that will trigger an ECC event once that word is read

For example, to force a single-bit correctable error on bit 0 of the user-word space shown, write 0x75 into that byte of the xor_check_bits parameter and then assert fwc (force write check) bit to 'b1' (mem
base: 0xf0824000, xor_check_bits reg addr: 0x178)

$ devmem 0xf0824178 32 0x7501

To force a double-bit un-correctable error for the user-word space, write 0x03 into that byte of the xor_check_bits parameter

$ devmem 0xf0824178 32 0x301
---
 MAINTAINERS                 |   6 +
 drivers/edac/Kconfig        |   7 +
 drivers/edac/Makefile       |   1 +
 drivers/edac/npcm7xx_edac.c | 424
++++++++++++++++++++++++++++++++++++
 4 files changed, 438 insertions(+)
 create mode 100644 drivers/edac/npcm7xx_edac.c
MAINTAINERS index renamed from MAINTAINERS +0 -0

7c54dbc8f406..0a6ac3f00ed5 100644

MAINTAINERS L: [email protected] · line 5665

Quoted 8 lines
MAINTAINERS +5 -0
@@ -5658,6 +5658,12 @@ L:       [email protected]
 S:     Maintained
 F:     drivers/edac/mpc85xx_edac.[ch]
 
+EDAC-NPCM7XX
+M:     George Hung <[email protected]>
+S:     Maintained
+F:     drivers/edac/npcm7xx_edac.c
+F:

Documentation/devicetree/bindings/edac/npcm7xx-sdram-edac.txt

drivers/edac/Kconfig config EDAC_ASPEED · line 504

Quoted 10 lines
MAINTAINERS +1 -0
+
 EDAC-PASEMI
 M:     Egor Martovetsky <[email protected]>
 L:     [email protected]
drivers/edac/Kconfig index renamed from drivers/edac/Kconfig +0 -0

47eb4d13ed5f..7d666ad7f88b 100644

drivers/edac/Kconfig +0 -0
@@ -504,4 +504,11 @@ config EDAC_ASPEED
          First, ECC must be configured in the bootloader. Then, this

driver

drivers/edac/Makefile obj-$(CONFIG_EDAC_XGENE) +=

Quoted 15 lines
drivers/edac/Kconfig +7 -0
          will expose error counters via the EDAC kernel framework.
 
+config EDAC_NPCM7XX
+       tristate "Nuvoton NPCM7xx DDR Memory Controller"
+       depends on ARCH_NPCM7XX
+       help
+         Support for error detection and correction on the
+         Nuvoton NPCM7xx DDR memory controller.
+
 endif # EDAC
drivers/edac/Makefile index renamed from drivers/edac/Makefile +0 -0

89ad4a84a0f6..d7780ce035b8 100644

drivers/edac/Makefile +0 -0
@@ -84,3 +84,4 @@ obj-$(CONFIG_EDAC_XGENE)              +=

xgene_edac.o

drivers/edac/Makefile obj-$(CONFIG_EDAC_XGENE) += · line 85

Quoted 2 lines
drivers/edac/Makefile +0 -0
 obj-$(CONFIG_EDAC_TI)                  += ti_edac.o
 obj-$(CONFIG_EDAC_QCOM)                        +=

qcom_edac.o

Quoted 64 lines
drivers/edac/Makefile +1 -0
 obj-$(CONFIG_EDAC_ASPEED)              += aspeed_edac.o
+obj-$(CONFIG_EDAC_NPCM7XX)              += npcm7xx_edac.o
drivers/edac/npcm7xx_edac.c new file +57 -0
new file mode 100644 index 000000000000..2d2deb81e49c
@@ -0,0 +1,424 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2019 Quanta Computer lnc.
+ */
+
+#include <linux/edac.h>
+#include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/of_address.h>
+#include <linux/of_device.h>
+
+#include "edac_module.h"
+
+#define ECC_ENABLE                     BIT(24)
+#define ECC_EN_INT_MASK                0x7fffff87
+
+#define INT_STATUS_ADDR                116
+#define INT_ACK_ADDR                   117
+#define INT_MASK_ADDR                  118
+
+#define ECC_EN_ADDR                    93
+#define ECC_C_ADDR_ADDR                98
+#define ECC_C_DATA_ADDR                100
+#define ECC_C_ID_ADDR                  101
+#define ECC_C_SYND_ADDR                99
+#define ECC_U_ADDR_ADDR                95
+#define ECC_U_DATA_ADDR                97
+#define ECC_U_ID_ADDR                  101
+#define ECC_U_SYND_ADDR                96
+
+#define ECC_ERROR                      -1
+#define EDAC_MSG_SIZE                  256
+#define EDAC_MOD_NAME                  "npcm7xx-edac"
+
+struct ecc_error_signature_info {
+       u32 ecc_addr;
+       u32 ecc_data;
+       u32 ecc_id;
+       u32 ecc_synd;
+};
+
+struct npcm7xx_ecc_int_status {
+       u32 int_mask;
+       u32 int_status;
+       u32 int_ack;
+       u32 ce_cnt;
+       u32 ue_cnt;
+       struct ecc_error_signature_info ceinfo;
+       struct ecc_error_signature_info ueinfo; };
+
+struct npcm7xx_edac_priv {
+       void __iomem *baseaddr;
+       char message[EDAC_MSG_SIZE];
+       struct npcm7xx_ecc_int_status stat; };
+
+/**

drivers/edac/npcm7xx_edac.c line 67

Quoted 10 lines
drivers/edac/npcm7xx_edac.c new file +10 -0
+ * npcm7xx_edac_get_ecc_syndrom - Get the current ecc error info
+ * @base:      Pointer to the base address of the ddr memory controller
+ * @p:         Pointer to the Nuvoton ecc status structure
+ *
+ * Determines there is any ecc error or not
+ *
+ * Return: ECC detection status
+ */
+static int npcm7xx_edac_get_ecc_syndrom(void __iomem *base,
+                                       struct

npcm7xx_ecc_int_status

Quoted 26 lines
drivers/edac/npcm7xx_edac.c new file +26 -0
+*p) {
+       int status = 0;
+       u32 int_status = 0;
+
+       int_status = readl(base + 4*INT_STATUS_ADDR);
+       writel(int_status, base + 4*INT_ACK_ADDR);
+       edac_dbg(3, "int_status: %#08x\n", int_status);
+
+       if ((int_status & (1 << 6)) == (1 << 6)) {
+               edac_dbg(3, "6-Mult uncorrectable detected.\n");
+               p->ue_cnt++;
+               status = ECC_ERROR;
+       }
+
+       if ((int_status & (1 << 5)) == (1 << 5)) {
+               edac_dbg(3, "5-An uncorrectable detected\n");
+               p->ue_cnt++;
+               status = ECC_ERROR;
+       }
+
+       if ((int_status & (1 << 4)) == (1 << 4)) {
+               edac_dbg(3, "4-mult correctable detected.\n");
+               p->ce_cnt++;
+               status = ECC_ERROR;
+       }
+

drivers/edac/npcm7xx_edac.c line 103

Quoted 10 lines
drivers/edac/npcm7xx_edac.c new file +10 -0
+       if ((int_status & (1 << 3)) == (1 << 3)) {
+               edac_dbg(3, "3-A correctable detected.\n");
+               p->ce_cnt++;
+               status = ECC_ERROR;
+       }
+
+       if (status == ECC_ERROR) {
+               u32 ecc_id;
+
+               p->ceinfo.ecc_addr = readl(base +

4*ECC_C_ADDR_ADDR);

drivers/edac/npcm7xx_edac.c line 104

Quoted 1 line
drivers/edac/npcm7xx_edac.c new file +1 -0
+               p->ceinfo.ecc_data = readl(base +

4*ECC_C_DATA_ADDR);

drivers/edac/npcm7xx_edac.c line 105

Quoted 1 line
drivers/edac/npcm7xx_edac.c new file +1 -0
+               p->ceinfo.ecc_synd = readl(base +

4*ECC_C_SYND_ADDR);

drivers/edac/npcm7xx_edac.c line 107

Quoted 2 lines
drivers/edac/npcm7xx_edac.c new file +2 -0
+
+               p->ueinfo.ecc_addr = readl(base +

4*ECC_U_ADDR_ADDR);

drivers/edac/npcm7xx_edac.c line 108

Quoted 1 line
drivers/edac/npcm7xx_edac.c new file +1 -0
+               p->ueinfo.ecc_data = readl(base +

4*ECC_U_DATA_ADDR);

drivers/edac/npcm7xx_edac.c line 109

Quoted 1 line
drivers/edac/npcm7xx_edac.c new file +1 -0
+               p->ueinfo.ecc_synd = readl(base +

4*ECC_U_SYND_ADDR);

drivers/edac/npcm7xx_edac.c line 111

Quoted 2 lines
drivers/edac/npcm7xx_edac.c new file +2 -0
+
+               /* ECC_C_ID_ADDR has same value as ECC_U_ID_ADDR

*/

Quoted 7 lines
drivers/edac/npcm7xx_edac.c new file +7 -0
+               ecc_id = readl(base + 4*ECC_C_ID_ADDR);
+               p->ueinfo.ecc_id = ecc_id & 0xffff;
+               p->ceinfo.ecc_id = ecc_id >> 16;
+       }
+
+       return status;
+}

drivers/edac/npcm7xx_edac.c line 128

Quoted 10 lines
drivers/edac/npcm7xx_edac.c new file +10 -0
+
+/**
+ * npcm7xx_edac_handle_error - Handle controller error types CE and UE
+ * @mci:       Pointer to the edac memory controller instance
+ * @p:         Pointer to the Nuvoton ecc status structure
+ *
+ * Handles the controller ECC correctable and un correctable error.
+ */
+static void npcm7xx_edac_handle_error(struct mem_ctl_info *mci,
+                                   struct npcm7xx_ecc_int_status

*p)

drivers/edac/npcm7xx_edac.c line 135

Quoted 7 lines
drivers/edac/npcm7xx_edac.c new file +7 -0
+{
+       struct npcm7xx_edac_priv *priv = mci->pvt_info;
+       u32 page, offset;
+
+       if (p->ce_cnt) {
+               snprintf(priv->message, EDAC_MSG_SIZE,
+                       "DDR ECC: synd=%#08x addr=%#08x

data=%#08x source_id=%#08x ",

drivers/edac/npcm7xx_edac.c line 141

Quoted 6 lines
drivers/edac/npcm7xx_edac.c new file +6 -0
+                       p->ceinfo.ecc_synd, p->ceinfo.ecc_addr,
+                       p->ceinfo.ecc_data, p->ceinfo.ecc_id);
+
+               page = p->ceinfo.ecc_addr >> PAGE_SHIFT;
+               offset = p->ceinfo.ecc_addr & ~PAGE_MASK;
+               edac_mc_handle_error(HW_EVENT_ERR_CORRECTED,

mci,

drivers/edac/npcm7xx_edac.c line 150

Quoted 9 lines
drivers/edac/npcm7xx_edac.c new file +9 -0
+                                    p->ce_cnt, page, offset,
+                                    p->ceinfo.ecc_synd,
+                                    0, 0, -1,
+                                    priv->message, "");
+       }
+
+       if (p->ue_cnt) {
+               snprintf(priv->message, EDAC_MSG_SIZE,
+                       "DDR ECC: synd=%#08x addr=%#08x

data=%#08x source_id=%#08x ",

drivers/edac/npcm7xx_edac.c line 156

Quoted 6 lines
drivers/edac/npcm7xx_edac.c new file +6 -0
+                       p->ueinfo.ecc_synd, p->ueinfo.ecc_addr,
+                       p->ueinfo.ecc_data, p->ueinfo.ecc_id);
+
+               page = p->ueinfo.ecc_addr >> PAGE_SHIFT;
+               offset = p->ueinfo.ecc_addr & ~PAGE_MASK;
+

edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci,

Quoted 11 lines
drivers/edac/npcm7xx_edac.c new file +11 -0
+                                    p->ue_cnt, page, offset,
+                                    p->ueinfo.ecc_synd,
+                                    0, 0, -1,
+                                    priv->message, "");
+       }
+
+       memset(p, 0, sizeof(*p));
+}
+
+/**
+ * npcm7xx_edac_check - Check controller for ECC errors

drivers/edac/npcm7xx_edac.c line 177

Quoted 10 lines
drivers/edac/npcm7xx_edac.c new file +10 -0
+ * @mci:       Pointer to the edac memory controller instance
+ *
+ * This routine is used to check and post ECC errors and is called by
+ * this driver's CE and UE interrupt handler.
+ */
+static void npcm7xx_edac_check(struct mem_ctl_info *mci) {
+       struct npcm7xx_edac_priv *priv = mci->pvt_info;
+       int status = 0;
+
+       status = npcm7xx_edac_get_ecc_syndrom(priv->baseaddr,

&priv->stat);

Quoted 21 lines
drivers/edac/npcm7xx_edac.c new file +21 -0
+       if (status != ECC_ERROR)
+               return;
+
+       npcm7xx_edac_handle_error(mci, &priv->stat); }
+
+/**
+ * npcm7xx_edac_isr - CE/UE interrupt service routine
+ * @irq:    The virtual interrupt number being serviced.
+ * @dev_id: A pointer to the EDAC memory controller instance
+ *          associated with the interrupt being handled.
+ *
+ * This routine implements the interrupt handler for both correctable
+ * (CE) and uncorrectable (UE) ECC errors for the Nuvoton Cadence DDR
+ * controller. It simply calls through to the routine used to check,
+ * report and clear the ECC status.
+ *
+ * Unconditionally returns IRQ_HANDLED.
+ */
+static irqreturn_t npcm7xx_edac_isr(int irq, void *dev_id) {
+       struct mem_ctl_info *mci = dev_id;
+       int npcm_edac_report = 0;

drivers/edac/npcm7xx_edac.c line 208

Quoted 10 lines
drivers/edac/npcm7xx_edac.c new file +10 -0
+
+       npcm_edac_report = edac_get_report_status();
+       if (npcm_edac_report != EDAC_REPORTING_DISABLED)
+               npcm7xx_edac_check(mci);
+
+       return IRQ_HANDLED;
+}
+
+static int npcm7xx_edac_register_irq(struct mem_ctl_info *mci,
+                                       struct platform_device

*pdev)

drivers/edac/npcm7xx_edac.c line 215

Quoted 7 lines
drivers/edac/npcm7xx_edac.c new file +7 -0
+{
+       int status = 0;
+       int mc_irq;
+       struct npcm7xx_edac_priv *priv = mci->pvt_info;
+
+       /* Only enable MC interrupts with ECC - clear int_mask[6:3] */
+       writel(ECC_EN_INT_MASK, priv->baseaddr +

4*INT_MASK_ADDR);

drivers/edac/npcm7xx_edac.c line 220

Quoted 5 lines
drivers/edac/npcm7xx_edac.c new file +5 -0
+
+       mc_irq = platform_get_irq(pdev, 0);
+
+       if (!mc_irq) {
+               edac_printk(KERN_ERR, EDAC_MC, "Unable to map

interrupts.\n");

drivers/edac/npcm7xx_edac.c line 225

Quoted 5 lines
drivers/edac/npcm7xx_edac.c new file +5 -0
+               status = -ENODEV;
+               goto fail;
+       }
+
+       status = devm_request_irq(&pdev->dev, mc_irq,

npcm7xx_edac_isr, 0,

drivers/edac/npcm7xx_edac.c line 230

Quoted 5 lines
drivers/edac/npcm7xx_edac.c new file +5 -0
+                              "npcm-memory-controller", mci);
+
+       if (status < 0) {
+               edac_printk(KERN_ERR, EDAC_MC,
+                                     "Unable to request irq %d

for ECC",

Quoted 45 lines
drivers/edac/npcm7xx_edac.c new file +45 -0
+                                     mc_irq);
+               status = -ENODEV;
+               goto fail;
+       }
+
+       return 0;
+
+fail:
+       return status;
+}
+
+static const struct of_device_id npcm7xx_edac_of_match[] = {
+       { .compatible = "nuvoton,npcm7xx-sdram-edac"},
+       { /* end of table */ }
+};
+
+MODULE_DEVICE_TABLE(of, npcm7xx_edac_of_match);
+
+/**
+ * npcm7xx_edac_mc_init - Initialize driver instance
+ * @mci:       Pointer to the edac memory controller instance
+ * @pdev:      Pointer to the platform_device struct
+ *
+ * Performs initialization of the EDAC memory controller instance and
+ * related driver-private data associated with the memory controller
+the
+ * instance is bound to.
+ *
+ * Returns 0 if OK; otherwise, < 0 on error.
+ */
+static int npcm7xx_edac_mc_init(struct mem_ctl_info *mci,
+                                struct platform_device *pdev) {
+       const struct of_device_id *id;
+
+       id = of_match_device(npcm7xx_edac_of_match, &pdev->dev);
+       if (!id)
+               return -ENODEV;
+
+       /* Initialize controller capabilities and configuration */
+       mci->mtype_cap = MEM_FLAG_DDR4;
+       mci->edac_ctl_cap = EDAC_FLAG_SECDED;
+       mci->edac_cap = EDAC_FLAG_SECDED;
+       mci->scrub_cap = SCRUB_FLAG_HW_SRC;
+       mci->scrub_mode = SCRUB_HW_SRC;
+       mci->ctl_name = id->compatible;

drivers/edac/npcm7xx_edac.c line 285

Quoted 10 lines
drivers/edac/npcm7xx_edac.c new file +10 -0
+       mci->dev_name = dev_name(&pdev->dev);
+       mci->mod_name = EDAC_MOD_NAME;
+
+       edac_op_state = EDAC_OPSTATE_INT;
+
+       return 0;
+}
+
+/**
+ * npcm7xx_edac_get_eccstate - Return the controller ecc enable/disable

status

drivers/edac/npcm7xx_edac.c line 298

Quoted 13 lines
drivers/edac/npcm7xx_edac.c new file +13 -0
+ * @base:      Pointer to the ddr memory controller base address
+ *
+ * Get the ECC enable/disable status for the controller
+ *
+ * Return: a ecc status boolean i.e true/false - enabled/disabled.
+ */
+static bool npcm7xx_edac_get_eccstate(void __iomem *base) {
+       u32 ecc_en;
+       bool state = false;
+
+       ecc_en = readl(base + 4*ECC_EN_ADDR);
+       if (ecc_en & ECC_ENABLE) {
+               edac_printk(KERN_INFO, EDAC_MC, "ECC reporting and

correcting on. ");

Quoted 33 lines
drivers/edac/npcm7xx_edac.c new file +33 -0
+               state = true;
+       }
+
+       return state;
+}
+
+/**
+ * npcm7xx_edac_mc_probe - Check controller and bind driver
+ * @pdev:      Pointer to the platform_device struct
+ *
+ * Probes a specific controller instance for binding with the driver.
+ *
+ * Return: 0 if the controller instance was successfully bound to the
+ * driver; otherwise, < 0 on error.
+ */
+static int npcm7xx_edac_mc_probe(struct platform_device *pdev) {
+       struct mem_ctl_info *mci;
+       struct edac_mc_layer layers[1];
+       struct npcm7xx_edac_priv *priv;
+       struct resource *res;
+       void __iomem *baseaddr;
+       int rc;
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       baseaddr = devm_ioremap_resource(&pdev->dev, res);
+       if (IS_ERR(baseaddr)) {
+               edac_printk(KERN_ERR, EDAC_MOD_NAME,
+                           "DDR controller regs not defined\n");
+               return PTR_ERR(baseaddr);
+       }
+
+       /*
+        * Check if ECC is enabled.

drivers/edac/npcm7xx_edac.c line 341

Quoted 10 lines
drivers/edac/npcm7xx_edac.c new file +10 -0
+        * If not, there is no useful monitoring that can be done
+        * for this controller.
+        */
+       if (!npcm7xx_edac_get_eccstate(baseaddr)) {
+               edac_printk(KERN_INFO, EDAC_MC, "ECC disabled\n");
+               return -ENXIO;
+       }
+
+       /*
+        * Allocate an EDA controller instance and perform the

appropriate

drivers/edac/npcm7xx_edac.c line 351

Quoted 10 lines
drivers/edac/npcm7xx_edac.c new file +10 -0
+        * initialization.
+        */
+       layers[0].type = EDAC_MC_LAYER_ALL_MEM;
+       layers[0].size = 1;
+
+       mci = edac_mc_alloc(0, ARRAY_SIZE(layers), layers,
+                           sizeof(struct npcm7xx_edac_priv));
+       if (!mci) {
+               edac_printk(KERN_ERR, EDAC_MC,
+                           "Failed memory allocation for mc

instance\n");

Quoted 53 lines
drivers/edac/npcm7xx_edac.c new file +53 -0
+               return -ENOMEM;
+       }
+
+       mci->pdev = &pdev->dev;
+       priv = mci->pvt_info;
+       priv->baseaddr = baseaddr;
+       platform_set_drvdata(pdev, mci);
+
+       rc = npcm7xx_edac_mc_init(mci, pdev);
+       if (rc) {
+               edac_printk(KERN_ERR, EDAC_MC,
+                           "Failed to initialize instance\n");
+               goto free_edac_mc;
+       }
+
+       /* Attempt to register it with the EDAC subsystem */
+       rc = edac_mc_add_mc(mci);
+       if (rc) {
+               edac_printk(KERN_ERR, EDAC_MC,
+                           "Failed to register with EDAC core\n");
+               goto free_edac_mc;
+       }
+
+       /* Register interrupts */
+       rc = npcm7xx_edac_register_irq(mci, pdev);
+       if (rc)
+               goto free_edac_mc;
+
+       return 0;
+
+free_edac_mc:
+       edac_mc_free(mci);
+
+       return rc;
+}
+
+/**
+ * npcm7xx_edac_mc_remove - Unbind driver from controller
+ * @pdev:      Pointer to the platform_device struct
+ *
+ * Return: Unconditionally 0
+ */
+static int npcm7xx_edac_mc_remove(struct platform_device *pdev) {
+       struct mem_ctl_info *mci = platform_get_drvdata(pdev);
+
+       edac_mc_del_mc(&pdev->dev);
+       edac_mc_free(mci);
+
+       return 0;
+}
+
+static struct platform_driver npcm7xx_edac_driver = {
+       .probe = npcm7xx_edac_mc_probe,

drivers/edac/npcm7xx_edac.c line 414

Quoted 10 lines
drivers/edac/npcm7xx_edac.c new file +10 -0
+       .remove = npcm7xx_edac_mc_remove,
+       .driver = {
+                  .name = EDAC_MOD_NAME,
+                  .of_match_table = npcm7xx_edac_of_match,
+       },
+};
+
+module_platform_driver(npcm7xx_edac_driver);
+
+MODULE_AUTHOR("Quanta Computer Inc.");

MODULE_DESCRIPTION("Nuvoton

Quoted 4 lines
drivers/edac/npcm7xx_edac.c new file +1 -1
+NPCM7xx EDAC Driver"); MODULE_LICENSE("GPL v2");
--

2.21.0

Signature · 2 lines
Regards,
Avi
#7 lore raw

Re: [PATCH dev-5.1 v1 1/2] edac: npcm: Add Nuvoton NPCM7xx EDAC driver

In reply to George Hung (洪忠敬)
Quoted 8 lines · George Hung (洪忠敬)
Quoted 4 lines
Quoted 1 line

Add support for the Nuvoton NPCM7xx SoC EDAC driver

I would like an ack or review from someone familiar with the Nuvoton system. I can then include it in dev-5.1.

I have already found the Nuvoton contributor to review my patch.

https://lists.ozlabs.org/pipermail/openbmc/2019-May/016427.html

Cool. I did not recieve this email due to a glitch, but I see it in patchwork. I've now merged the EDAC driver to dev-5.1.

You might need to resend the upstream patches to the correct maintainers so they can get merged for 5.3.

Cheers,

Joel