diff mbox series

[3/3] EDAC/sifive: Add support for SiFive BEU in SiFive platform EDAC

Message ID 1605182457-86046-3-git-send-email-yash.shah@sifive.com (mailing list archive)
State New, archived
Headers show
Series [1/3] dt-bindings: riscv: Add DT documentation for SiFive Bus Error Unit | expand

Commit Message

Yash Shah Nov. 12, 2020, noon UTC
Register for ECC error events from SiFive BEU in SiFive platform EDAC
driver.

Signed-off-by: Yash Shah <yash.shah@sifive.com>
---
 drivers/edac/Kconfig       |  2 +-
 drivers/edac/sifive_edac.c | 13 +++++++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)

Comments

Borislav Petkov Nov. 23, 2020, 8:54 p.m. UTC | #1
On Thu, Nov 12, 2020 at 05:30:57PM +0530, Yash Shah wrote:
> Register for ECC error events from SiFive BEU in SiFive platform EDAC
> driver.
> 
> Signed-off-by: Yash Shah <yash.shah@sifive.com>
> ---
>  drivers/edac/Kconfig       |  2 +-
>  drivers/edac/sifive_edac.c | 13 +++++++++++--
>  2 files changed, 12 insertions(+), 3 deletions(-)

Acked-by: Borislav Petkov <bp@suse.de>
diff mbox series

Patch

diff --git a/drivers/edac/Kconfig b/drivers/edac/Kconfig
index 7a47680..8f662ff 100644
--- a/drivers/edac/Kconfig
+++ b/drivers/edac/Kconfig
@@ -469,7 +469,7 @@  config EDAC_ALTERA_SDMMC
 
 config EDAC_SIFIVE
 	bool "Sifive platform EDAC driver"
-	depends on EDAC=y && SIFIVE_L2
+	depends on EDAC=y && (SIFIVE_L2 || SIFIVE_BEU)
 	help
 	  Support for error detection and correction on the SiFive SoCs.
 
diff --git a/drivers/edac/sifive_edac.c b/drivers/edac/sifive_edac.c
index 3a3dcb1..0f6d457 100644
--- a/drivers/edac/sifive_edac.c
+++ b/drivers/edac/sifive_edac.c
@@ -11,6 +11,7 @@ 
 #include <linux/platform_device.h>
 #include "edac_module.h"
 #include <soc/sifive/sifive_l2_cache.h>
+#include <soc/sifive/sifive_beu.h>
 
 #define DRVNAME "sifive_edac"
 
@@ -67,7 +68,11 @@  static int ecc_register(struct platform_device *pdev)
 		goto err;
 	}
 
-	register_sifive_l2_error_notifier(&p->notifier);
+	if (IS_ENABLED(CONFIG_SIFIVE_L2))
+		register_sifive_l2_error_notifier(&p->notifier);
+
+	if (IS_ENABLED(CONFIG_SIFIVE_BEU))
+		register_sifive_beu_error_notifier(&p->notifier);
 
 	return 0;
 
@@ -81,7 +86,11 @@  static int ecc_unregister(struct platform_device *pdev)
 {
 	struct sifive_edac_priv *p = platform_get_drvdata(pdev);
 
-	unregister_sifive_l2_error_notifier(&p->notifier);
+	if (IS_ENABLED(CONFIG_SIFIVE_L2))
+		unregister_sifive_l2_error_notifier(&p->notifier);
+	if (IS_ENABLED(CONFIG_SIFIVE_BEU))
+		unregister_sifive_beu_error_notifier(&p->notifier);
+
 	edac_device_del_device(&pdev->dev);
 	edac_device_free_ctl_info(p->dci);