Commit 580b5cf5 authored by Thor Thayer's avatar Thor Thayer Committed by Borislav Petkov

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: default avatarThor Thayer <thor.thayer@linux.intel.com>
Signed-off-by: default avatarBorislav 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
parent 7f736599
...@@ -391,9 +391,17 @@ config EDAC_ALTERA ...@@ -391,9 +391,17 @@ config EDAC_ALTERA
depends on EDAC=y && (ARCH_SOCFPGA || ARCH_STRATIX10) depends on EDAC=y && (ARCH_SOCFPGA || ARCH_STRATIX10)
help help
Support for error detection and correction on the Support for error detection and correction on the
Altera SOCs. This must be selected for SDRAM ECC. Altera SOCs. This is the global enable for the
Note that the preloader must initialize the SDRAM various Altera peripherals.
before loading the kernel.
config EDAC_ALTERA_SDRAM
bool "Altera SDRAM ECC"
depends on EDAC_ALTERA=y
help
Support for error detection and correction on the
Altera SDRAM Memory for Altera SoCs. Note that the
preloader must initialize the SDRAM before loading
the kernel.
config EDAC_ALTERA_L2C config EDAC_ALTERA_L2C
bool "Altera L2 Cache ECC" bool "Altera L2 Cache ECC"
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#define EDAC_MOD_STR "altera_edac" #define EDAC_MOD_STR "altera_edac"
#define EDAC_DEVICE "Altera" #define EDAC_DEVICE "Altera"
#ifdef CONFIG_EDAC_ALTERA_SDRAM
static const struct altr_sdram_prv_data c5_data = { static const struct altr_sdram_prv_data c5_data = {
.ecc_ctrl_offset = CV_CTLCFG_OFST, .ecc_ctrl_offset = CV_CTLCFG_OFST,
.ecc_ctl_en_mask = CV_CTLCFG_ECC_AUTO_EN, .ecc_ctl_en_mask = CV_CTLCFG_ECC_AUTO_EN,
...@@ -468,6 +469,39 @@ static int altr_sdram_remove(struct platform_device *pdev) ...@@ -468,6 +469,39 @@ static int altr_sdram_remove(struct platform_device *pdev)
return 0; return 0;
} }
/*
* If you want to suspend, need to disable EDAC by removing it
* from the device tree or defconfig.
*/
#ifdef CONFIG_PM
static int altr_sdram_prepare(struct device *dev)
{
pr_err("Suspend not allowed when EDAC is enabled.\n");
return -EPERM;
}
static const struct dev_pm_ops altr_sdram_pm_ops = {
.prepare = altr_sdram_prepare,
};
#endif
static struct platform_driver altr_sdram_edac_driver = {
.probe = altr_sdram_probe,
.remove = altr_sdram_remove,
.driver = {
.name = "altr_sdram_edac",
#ifdef CONFIG_PM
.pm = &altr_sdram_pm_ops,
#endif
.of_match_table = altr_sdram_ctrl_of_match,
},
};
module_platform_driver(altr_sdram_edac_driver);
#endif /* CONFIG_EDAC_ALTERA_SDRAM */
/**************** Stratix 10 EDAC Memory Controller Functions ************/ /**************** Stratix 10 EDAC Memory Controller Functions ************/
/** /**
...@@ -530,37 +564,6 @@ static const struct regmap_config s10_sdram_regmap_cfg = { ...@@ -530,37 +564,6 @@ static const struct regmap_config s10_sdram_regmap_cfg = {
/************** </Stratix10 EDAC Memory Controller Functions> ***********/ /************** </Stratix10 EDAC Memory Controller Functions> ***********/
/*
* If you want to suspend, need to disable EDAC by removing it
* from the device tree or defconfig.
*/
#ifdef CONFIG_PM
static int altr_sdram_prepare(struct device *dev)
{
pr_err("Suspend not allowed when EDAC is enabled.\n");
return -EPERM;
}
static const struct dev_pm_ops altr_sdram_pm_ops = {
.prepare = altr_sdram_prepare,
};
#endif
static struct platform_driver altr_sdram_edac_driver = {
.probe = altr_sdram_probe,
.remove = altr_sdram_remove,
.driver = {
.name = "altr_sdram_edac",
#ifdef CONFIG_PM
.pm = &altr_sdram_pm_ops,
#endif
.of_match_table = altr_sdram_ctrl_of_match,
},
};
module_platform_driver(altr_sdram_edac_driver);
/************************* EDAC Parent Probe *************************/ /************************* EDAC Parent Probe *************************/
static const struct of_device_id altr_edac_device_of_match[]; static 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,11 +2146,13 @@ static int altr_edac_a10_probe(struct platform_device *pdev)
altr_edac_a10_device_add(edac, child); altr_edac_a10_device_add(edac, child);
#ifdef CONFIG_EDAC_ALTERA_SDRAM
else if ((of_device_is_compatible(child, "altr,sdram-edac-a10")) || else if ((of_device_is_compatible(child, "altr,sdram-edac-a10")) ||
(of_device_is_compatible(child, "altr,sdram-edac-s10"))) (of_device_is_compatible(child, "altr,sdram-edac-s10")))
of_platform_populate(pdev->dev.of_node, of_platform_populate(pdev->dev.of_node,
altr_sdram_ctrl_of_match, altr_sdram_ctrl_of_match,
NULL, &pdev->dev); NULL, &pdev->dev);
#endif
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment