Skip to contentSkip to conversation

EDAC, altera: wrap edac pm with a CONFIG_PM

PATCH In review [email protected] 4 participants 5 messages Jun 5, 2015 – Jun 8, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 EDAC, altera: wrap edac pm with a CONFIG_PM

From: Alan Tull <[email protected]>

Suspend-to-RAM and EDAC support are mutually exclusive on SOCFPGA. If the EDAC is enabled, it will prevent the platform from going into suspend.

---
Hi Boris,

Please apply this patch to your for-next? This was part of Alan Tull's suspend-to-ram patch that I was going to take through arm-soc. But if I left the patch as it was, it would have caused a merge conflict for v4.2.

Thanks,
Dinh

---
 drivers/edac/altera_edac.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/edac/altera_edac.c +20 -0
index 182c741..23ef091 100644
@@ -477,11 +477,31 @@ static int altr_sdram_remove(struct platform_device *pdev)
 	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,
 	},
 };
Signature · 1 line
2.2.1
maintainer
#1 lore raw
Quoted 5 lines · On Fri, Jun 05, 2015 at 08:49:15AM -0500, [email protected] wrote:

From: Alan Tull <[email protected]>

Suspend-to-RAM and EDAC support are mutually exclusive on SOCFPGA. If the EDAC is enabled, it will prevent the platform from going into suspend.

Btw, what is exactly the problem with EDAC being enabled and not being able to suspend? Is it a hardware issue?

Because if it is sw one, we probably could change the EDAC core to accomodate power management. On x86 we don't need to do anything special to EDAC wrt PM though - we simply suspend.

Thanks.

Signature · 5 lines
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
#2 lore raw

Hi Boris,

Quoted 7 lines · Borislav Petkov
Quoted 5 lines · On Fri, Jun 05, 2015 at 08:49:15AM -0500, [email protected] wrote:

From: Alan Tull <[email protected]>

Suspend-to-RAM and EDAC support are mutually exclusive on SOCFPGA. If the EDAC is enabled, it will prevent the platform from going into suspend.

Quoted 9 lines

Btw, what is exactly the problem with EDAC being enabled and not being able to suspend? Is it a hardware issue?

Because if it is sw one, we probably could change the EDAC core to accomodate power management. On x86 we don't need to do anything special to EDAC wrt PM though - we simply suspend.

Thanks.

Yes, in our case, it is a hardware issue but I'm still gathering information.

The IRQ vectors for OCRAM reside on DDR and in Suspend-to-RAM mode we're executing out of OCRAM. If an ECC error occurs, we can't handle it so it was decided to make them mutually exclusive.

Thor

maintainer
#3 lore raw
Quoted 6 lines · Thor Thayer

Yes, in our case, it is a hardware issue but I'm still gathering information.

The IRQ vectors for OCRAM reside on DDR and in Suspend-to-RAM mode we're executing out of OCRAM. If an ECC error occurs, we can't handle it so it was decided to make them mutually exclusive.

Thanks Thor,

that's actually a good-enough explanation for me - I was just making sure that it is not some silly EDAC core limitation preventing you guys from doing suspend.

Anyway, I've committed the version below, if you still feel you want to improve the explanation, no problem - it is the topmost patch on the branch and I can amend it easily.

---
From: Alan Tull <[email protected]>
Date: Fri, 5 Jun 2015 08:49:15 -0500
Subject: [PATCH] EDAC, altera: Do not allow suspend when EDAC is enabled

Suspend-to-RAM and EDAC support are mutually exclusive on SOCFPGA. If EDAC is enabled, it will prevent the platform from going into suspend.

The reason is that the IRQ vectors for OCRAM reside on DDR and in Suspend-to-RAM mode we're executing out of OCRAM. If an ECC error occurs, we can't handle it so it was decided to make them mutually exclusive.

---
 drivers/edac/altera_edac.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/edac/altera_edac.c +20 -0
index 182c741adf3e..23ef0917483c 100644
@@ -477,11 +477,31 @@ static int altr_sdram_remove(struct platform_device *pdev)
 	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,
 	},
 };
Signature · 8 lines
2.3.5

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
#4 lore raw
Quoted 10 lines · Borislav Petkov
Quoted 6 lines · Thor Thayer

Yes, in our case, it is a hardware issue but I'm still gathering information.

The IRQ vectors for OCRAM reside on DDR and in Suspend-to-RAM mode we're executing out of OCRAM. If an ECC error occurs, we can't handle it so it was decided to make them mutually exclusive.

Thanks Thor,

Quoted 8 lines

that's actually a good-enough explanation for me - I was just making sure that it is not some silly EDAC core limitation preventing you guys from doing suspend.

Anyway, I've committed the version below, if you still feel you want to improve the explanation, no problem - it is the topmost patch on the branch and I can amend it easily.

Thanks Boris. That looks good.

Regards,
Alan

Quoted 72 lines

---
From: Alan Tull <[email protected]>
Date: Fri, 5 Jun 2015 08:49:15 -0500
Subject: [PATCH] EDAC, altera: Do not allow suspend when EDAC is enabled

Suspend-to-RAM and EDAC support are mutually exclusive on SOCFPGA. If EDAC is enabled, it will prevent the platform from going into suspend.

The reason is that the IRQ vectors for OCRAM reside on DDR and in Suspend-to-RAM mode we're executing out of OCRAM. If an ECC error occurs, we can't handle it so it was decided to make them mutually exclusive.

---
 drivers/edac/altera_edac.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/edac/altera_edac.c +20 -0
index 182c741adf3e..23ef0917483c 100644
@@ -477,11 +477,31 @@ static int altr_sdram_remove(struct platform_device *pdev)
 	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,
 	},
 };
Signature · 8 lines
2.3.5

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--