linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: thor.thayer@linux.intel.com
To: bp@alien8.de, mchehab@kernel.org
Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org,
	thor.thayer@linux.intel.com.com,
	Thor Thayer <thor.thayer@linux.intel.com>
Subject: [PATCHv3] EDAC, altera: Fix peripheral warnings for Cyclone5
Date: Wed,  5 Apr 2017 13:01:02 -0500	[thread overview]
Message-ID: <1491415262-5018-1-git-send-email-thor.thayer@linux.intel.com> (raw)

From: Thor Thayer <thor.thayer@linux.intel.com>

The peripherals EDACs only exist on the Arria10 SoCFPGA. The Cyclone5
initialization has EDAC warnings when the peripherals aren't found
in the device tree. Fix by checking for Arria10 in the init functions.

Signed-off-by: Thor Thayer <thor.thayer@linux.intel.com>
---
v2  Change valid_model() return value from int to bool
    Change valid_model() name to is_a10_model() for clarity.
    Simplify expression - remove check for non-zero
v3  Use a simpler of_machine_is_compatible() expression.
    Rename is_a10_model() to socfpga_is_a10().
---
 drivers/edac/altera_edac.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
index c5a5b91..7717b094 100644
--- a/drivers/edac/altera_edac.c
+++ b/drivers/edac/altera_edac.c
@@ -1023,13 +1023,23 @@ static int __maybe_unused altr_init_memory_port(void __iomem *ioaddr, int port)
 	return ret;
 }
 
+static int socfpga_is_a10(void)
+{
+	return of_machine_is_compatible("altr,socfpga-arria10");
+}
+
 static int validate_parent_available(struct device_node *np);
 static const struct of_device_id altr_edac_a10_device_of_match[];
 static int __init __maybe_unused altr_init_a10_ecc_device_type(char *compat)
 {
 	int irq;
-	struct device_node *child, *np = of_find_compatible_node(NULL, NULL,
-					"altr,socfpga-a10-ecc-manager");
+	struct device_node *child, *np;
+
+	if (!socfpga_is_a10())
+		return -ENODEV;
+
+	np = of_find_compatible_node(NULL, NULL,
+				     "altr,socfpga-a10-ecc-manager");
 	if (!np) {
 		edac_printk(KERN_ERR, EDAC_DEVICE, "ECC Manager not found\n");
 		return -ENODEV;
@@ -1545,8 +1555,12 @@ static irqreturn_t altr_edac_a10_ecc_irq_portb(int irq, void *dev_id)
 static int __init socfpga_init_sdmmc_ecc(void)
 {
 	int rc = -ENODEV;
-	struct device_node *child = of_find_compatible_node(NULL, NULL,
-						"altr,socfpga-sdmmc-ecc");
+	struct device_node *child;
+
+	if (!socfpga_is_a10())
+		return -ENODEV;
+
+	child = of_find_compatible_node(NULL, NULL, "altr,socfpga-sdmmc-ecc");
 	if (!child) {
 		edac_printk(KERN_WARNING, EDAC_DEVICE, "SDMMC node not found\n");
 		return -ENODEV;
-- 
1.9.1

             reply	other threads:[~2017-04-05 17:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-05 18:01 thor.thayer [this message]
2017-04-06 10:04 ` [PATCHv3] EDAC, altera: Fix peripheral warnings for Cyclone5 Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1491415262-5018-1-git-send-email-thor.thayer@linux.intel.com \
    --to=thor.thayer@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=thor.thayer@linux.intel.com.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).