aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThor Thayer <thor.thayer@linux.intel.com>2019-02-25 13:56:45 -0500
committerBorislav Petkov <bp@suse.de>2019-02-26 10:18:57 -0500
commit580b5cf50ca8f4781961382d54959683341b3126 (patch)
tree37f6e534a18c33d015a212656522d174f5f67459
parent7f736599d632dde93bda79cca54fd5dcfd937e06 (diff)
EDAC/altera: Add separate SDRAM EDAC config
The CONFIG_ALTERA_EDAC Kconfig symbol always enables the SDRAM EDAC functionality. On the newer architectures, however, there are cases where the peripheral EDAC functionality is enabled but SDRAM needs to be disabled. Move SDRAM functions so they can be contained inside the conditional CONFIG. Create new CONFIG option just for SDRAM. [ bp: Massage commit message. ] Signed-off-by: Thor Thayer <thor.thayer@linux.intel.com> Signed-off-by: Borislav Petkov <bp@suse.de> Cc: James Morse <james.morse@arm.com> Cc: Mauro Carvalho Chehab <mchehab@kernel.org> Cc: dinguyen@kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-edac <linux-edac@vger.kernel.org> Cc: linux@armlinux.org.uk Link: https://lkml.kernel.org/r/1551121006-4657-2-git-send-email-thor.thayer@linux.intel.com
-rw-r--r--drivers/edac/Kconfig14
-rw-r--r--drivers/edac/altera_edac.c67
2 files changed, 47 insertions, 34 deletions
diff --git a/drivers/edac/Kconfig b/drivers/edac/Kconfig
index 102a47a09f25..47eb4d13ed5f 100644
--- a/drivers/edac/Kconfig
+++ b/drivers/edac/Kconfig
@@ -391,9 +391,17 @@ config EDAC_ALTERA
391 depends on EDAC=y && (ARCH_SOCFPGA || ARCH_STRATIX10) 391 depends on EDAC=y && (ARCH_SOCFPGA || ARCH_STRATIX10)
392 help 392 help
393 Support for error detection and correction on the 393 Support for error detection and correction on the
394 Altera SOCs. This must be selected for SDRAM ECC. 394 Altera SOCs. This is the global enable for the
395 Note that the preloader must initialize the SDRAM 395 various Altera peripherals.
396 before loading the kernel. 396
397config EDAC_ALTERA_SDRAM
398 bool "Altera SDRAM ECC"
399 depends on EDAC_ALTERA=y
400 help
401 Support for error detection and correction on the
402 Altera SDRAM Memory for Altera SoCs. Note that the
403 preloader must initialize the SDRAM before loading
404 the kernel.
397 405
398config EDAC_ALTERA_L2C 406config EDAC_ALTERA_L2C
399 bool "Altera L2 Cache ECC" 407 bool "Altera L2 Cache ECC"
diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
index 98e0bd8d9f50..1bcf9aea0cdf 100644
--- a/drivers/edac/altera_edac.c
+++ b/drivers/edac/altera_edac.c
@@ -29,6 +29,7 @@
29#define EDAC_MOD_STR "altera_edac" 29#define EDAC_MOD_STR "altera_edac"
30#define EDAC_DEVICE "Altera" 30#define EDAC_DEVICE "Altera"
31 31
32#ifdef CONFIG_EDAC_ALTERA_SDRAM
32static const struct altr_sdram_prv_data c5_data = { 33static const struct altr_sdram_prv_data c5_data = {
33 .ecc_ctrl_offset = CV_CTLCFG_OFST, 34 .ecc_ctrl_offset = CV_CTLCFG_OFST,
34 .ecc_ctl_en_mask = CV_CTLCFG_ECC_AUTO_EN, 35 .ecc_ctl_en_mask = CV_CTLCFG_ECC_AUTO_EN,
@@ -468,6 +469,39 @@ static int altr_sdram_remove(struct platform_device *pdev)
468 return 0; 469 return 0;
469} 470}
470 471
472/*
473 * If you want to suspend, need to disable EDAC by removing it
474 * from the device tree or defconfig.
475 */
476#ifdef CONFIG_PM
477static int altr_sdram_prepare(struct device *dev)
478{
479 pr_err("Suspend not allowed when EDAC is enabled.\n");
480
481 return -EPERM;
482}
483
484static const struct dev_pm_ops altr_sdram_pm_ops = {
485 .prepare = altr_sdram_prepare,
486};
487#endif
488
489static struct platform_driver altr_sdram_edac_driver = {
490 .probe = altr_sdram_probe,
491 .remove = altr_sdram_remove,
492 .driver = {
493 .name = "altr_sdram_edac",
494#ifdef CONFIG_PM
495 .pm = &altr_sdram_pm_ops,
496#endif
497 .of_match_table = altr_sdram_ctrl_of_match,
498 },
499};
500
501module_platform_driver(altr_sdram_edac_driver);
502
503#endif /* CONFIG_EDAC_ALTERA_SDRAM */
504
471/**************** Stratix 10 EDAC Memory Controller Functions ************/ 505/**************** Stratix 10 EDAC Memory Controller Functions ************/
472 506
473/** 507/**
@@ -530,37 +564,6 @@ static const struct regmap_config s10_sdram_regmap_cfg = {
530 564
531/************** </Stratix10 EDAC Memory Controller Functions> ***********/ 565/************** </Stratix10 EDAC Memory Controller Functions> ***********/
532 566
533/*
534 * If you want to suspend, need to disable EDAC by removing it
535 * from the device tree or defconfig.
536 */
537#ifdef CONFIG_PM
538static int altr_sdram_prepare(struct device *dev)
539{
540 pr_err("Suspend not allowed when EDAC is enabled.\n");
541
542 return -EPERM;
543}
544
545static const struct dev_pm_ops altr_sdram_pm_ops = {
546 .prepare = altr_sdram_prepare,
547};
548#endif
549
550static struct platform_driver altr_sdram_edac_driver = {
551 .probe = altr_sdram_probe,
552 .remove = altr_sdram_remove,
553 .driver = {
554 .name = "altr_sdram_edac",
555#ifdef CONFIG_PM
556 .pm = &altr_sdram_pm_ops,
557#endif
558 .of_match_table = altr_sdram_ctrl_of_match,
559 },
560};
561
562module_platform_driver(altr_sdram_edac_driver);
563
564/************************* EDAC Parent Probe *************************/ 567/************************* EDAC Parent Probe *************************/
565 568
566static const struct of_device_id altr_edac_device_of_match[]; 569static const struct of_device_id altr_edac_device_of_match[];
@@ -2143,11 +2146,13 @@ static int altr_edac_a10_probe(struct platform_device *pdev)
2143 2146
2144 altr_edac_a10_device_add(edac, child); 2147 altr_edac_a10_device_add(edac, child);
2145 2148
2149#ifdef CONFIG_EDAC_ALTERA_SDRAM
2146 else if ((of_device_is_compatible(child, "altr,sdram-edac-a10")) || 2150 else if ((of_device_is_compatible(child, "altr,sdram-edac-a10")) ||
2147 (of_device_is_compatible(child, "altr,sdram-edac-s10"))) 2151 (of_device_is_compatible(child, "altr,sdram-edac-s10")))
2148 of_platform_populate(pdev->dev.of_node, 2152 of_platform_populate(pdev->dev.of_node,
2149 altr_sdram_ctrl_of_match, 2153 altr_sdram_ctrl_of_match,
2150 NULL, &pdev->dev); 2154 NULL, &pdev->dev);
2155#endif
2151 } 2156 }
2152 2157
2153 return 0; 2158 return 0;