[RFC PATCH 01/11] soc: mediatek: dram-ecc: add the DRAM ECC driver skeleton
Krzysztof Kozlowski
krzk at kernel.org
Mon Nov 2 05:41:21 PST 2026
On 02/11/2026 10:23, santino.wang wrote:
> From: Santino Wang <santino.wang at mediatek.com>
>
> On the MediaTek mt8992 SoC the secure firmware (ATF) owns the DRAM
> controller ECC interrupts and reports each corrected (CE) or
> uncorrectable (UCE) error to the OS as an ACPI GHES record. The
> following patches add the driver that consumes those records.
>
> Add only the module skeleton here: the Kconfig entry, the Makefiles, a
> class device that the later patches attach their sysfs attributes to,
> and the MAINTAINERS entry.
>
> Signed-off-by: Santino Wang <santino.wang at mediatek.com>
> ---
> MAINTAINERS | 9 ++++
> drivers/soc/mediatek/Kconfig | 2 +
> drivers/soc/mediatek/Makefile | 1 +
> drivers/soc/mediatek/dram-ecc/Kconfig | 16 ++++++
> drivers/soc/mediatek/dram-ecc/Makefile | 3 ++
> drivers/soc/mediatek/dram-ecc/core/Makefile | 6 +++
> drivers/soc/mediatek/dram-ecc/core/main.c | 53 +++++++++++++++++++
> .../soc/mediatek/dram-ecc/core/mtk_dram_ecc.h | 24 +++++++++
> 8 files changed, 114 insertions(+)
> create mode 100644 drivers/soc/mediatek/dram-ecc/Kconfig
> create mode 100644 drivers/soc/mediatek/dram-ecc/Makefile
> create mode 100644 drivers/soc/mediatek/dram-ecc/core/Makefile
> create mode 100644 drivers/soc/mediatek/dram-ecc/core/main.c
> create mode 100644 drivers/soc/mediatek/dram-ecc/core/mtk_dram_ecc.h
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index aaf2825ac945..e7d25be97f24 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -17026,6 +17026,15 @@ S: Maintained
> F: Documentation/devicetree/bindings/dma/mediatek,*
> F: drivers/dma/mediatek/
>
> +MEDIATEK DRAM ECC DRIVER
> +M: Santino Wang <santino.wang at mediatek.com>
> +L: linux-kernel at vger.kernel.org
> +L: linux-arm-kernel at lists.infradead.org (moderated for non-subscribers)
> +L: linux-mediatek at lists.infradead.org (moderated for non-subscribers)
> +S: Maintained
> +F: drivers/soc/mediatek/dram-ecc/
> +F: include/uapi/linux/mtk_dram_ecc_netlink.h
> +
> MEDIATEK ETHERNET DRIVER
> M: Felix Fietkau <nbd at nbd.name>
> M: Lorenzo Bianconi <lorenzo at kernel.org>
> diff --git a/drivers/soc/mediatek/Kconfig b/drivers/soc/mediatek/Kconfig
> index d7293977f06e..91aed7d29be0 100644
> --- a/drivers/soc/mediatek/Kconfig
> +++ b/drivers/soc/mediatek/Kconfig
> @@ -89,4 +89,6 @@ config MTK_SOCINFO
> information about the SoC to the userspace including the
> manufacturer name, marketing name and soc name.
>
> +source "drivers/soc/mediatek/dram-ecc/Kconfig"
> +
> endmenu
> diff --git a/drivers/soc/mediatek/Makefile b/drivers/soc/mediatek/Makefile
> index 0665573e3c4b..880342bed606 100644
> --- a/drivers/soc/mediatek/Makefile
> +++ b/drivers/soc/mediatek/Makefile
> @@ -9,3 +9,4 @@ obj-$(CONFIG_MTK_MMSYS) += mtk-mmsys.o
> obj-$(CONFIG_MTK_MMSYS) += mtk-mutex.o
> obj-$(CONFIG_MTK_SVS) += mtk-svs.o
> obj-$(CONFIG_MTK_SOCINFO) += mtk-socinfo.o
> +obj-y += dram-ecc/
> diff --git a/drivers/soc/mediatek/dram-ecc/Kconfig b/drivers/soc/mediatek/dram-ecc/Kconfig
> new file mode 100644
> index 000000000000..c015c66635b2
> --- /dev/null
> +++ b/drivers/soc/mediatek/dram-ecc/Kconfig
> @@ -0,0 +1,16 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +#
> +# MediaTek DRAM ECC error handling driver
> +# See plat/mediatek/drivers/dram_ecc/ in ATF for the SMC handler side.
> +#
> +
> +# core/ -> mtk_dram_ecc.ko
> +config MTK_DRAM_ECC
> + tristate "MediaTek DRAM ECC Error Handling Driver"
> + depends on HAVE_ARM_SMCCC && ACPI_APEI_GHES
> + default m
> + help
> + Driver for MediaTek DRAM ECC runtime error handling. It works
> + with the secure firmware (ATF), which owns the DRAM controller
> + ECC interrupts and reports each corrected or uncorrectable
> + error to the OS as an ACPI GHES record.
Why is EDAC-like driver outside of edac subsystem? drivers/soc/ is not a
dumping ground.
> +
> +static int __init mtk_dram_ecc_init(void)
> +{
> + int ret;
> +
> + mtk_dram_ecc_class = class_create("mtk-dram-ecc");
> + if (IS_ERR(mtk_dram_ecc_class))
> + return PTR_ERR(mtk_dram_ecc_class);
> +
> + mtk_dram_ecc_dev = device_create(mtk_dram_ecc_class, NULL,
> + MKDEV(0, 0), &mtk_ecc_data,
> + "mtk-dram-ecc0");
> + if (IS_ERR(mtk_dram_ecc_dev)) {
> + ret = PTR_ERR(mtk_dram_ecc_dev);
> + goto err_class;
> + }
> +
> + dev_info(mtk_dram_ecc_dev, "initialized\n");
No, that's not a code style which exists in upstream.
> + return 0;
> +
> +err_class:
> + class_destroy(mtk_dram_ecc_class);
> + return ret;
> +}
> +
> +static void __exit mtk_dram_ecc_exit(void)
> +{
> + device_destroy(mtk_dram_ecc_class, MKDEV(0, 0));
> + class_destroy(mtk_dram_ecc_class);
> +}
> +
Best regards,
Krzysztof
More information about the linux-arm-kernel
mailing list