From: Vitaly Andrianov <vitalya-l0cyMroinI0@public.gmane.org>
To: ssantosh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
pawel.moll-5wv7dgnIgG8@public.gmane.org,
mark.rutland-5wv7dgnIgG8@public.gmane.org,
ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org,
galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Vitaly Andrianov <vitalya-l0cyMroinI0@public.gmane.org>,
Hao Zhang <hzhang-l0cyMroinI0@public.gmane.org>,
Murali Karicheri <m-karicheri2-l0cyMroinI0@public.gmane.org>
Subject: [PATCH v2 2/3] ARM: keystone: ecc: add ARM L1/L2 ecc interrupt handling
Date: Thu, 25 Jun 2015 10:31:49 -0400 [thread overview]
Message-ID: <1435242710-31346-3-git-send-email-vitalya@ti.com> (raw)
In-Reply-To: <1435242710-31346-1-git-send-email-vitalya-l0cyMroinI0@public.gmane.org>
This patch adds ARM L1/L2 ECC handler support interrupt handling
for Keystone II devices, the kernel will reboot if the error
is 2-bit error for L1/L2 ECC error.
Signed-off-by: Hao Zhang <hzhang-l0cyMroinI0@public.gmane.org>
Signed-off-by: Murali Karicheri <m-karicheri2-l0cyMroinI0@public.gmane.org>
Signed-off-by: Vitaly Andrianov <vitalya-l0cyMroinI0@public.gmane.org>
---
arch/arm/mach-keystone/keystone.c | 69 +++++++++++++++++++++++++++++++++++++++
1 file changed, 69 insertions(+)
diff --git a/arch/arm/mach-keystone/keystone.c b/arch/arm/mach-keystone/keystone.c
index 4534c7d..0b28fca 100644
--- a/arch/arm/mach-keystone/keystone.c
+++ b/arch/arm/mach-keystone/keystone.c
@@ -9,9 +9,12 @@
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*/
+#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/memblock.h>
+#include <linux/of_irq.h>
#include <linux/of_platform.h>
+#include <linux/reboot.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
@@ -46,6 +49,72 @@ static int keystone_platform_notifier(struct notifier_block *nb,
return NOTIFY_OK;
}
+#define L2_INTERN_ASYNC_ERROR BIT(30)
+#define AXI_ASYNC_ERROR BIT(29)
+
+static void check_ecc_error(void)
+{
+ u32 status, fault;
+
+ /* read and clear L2ECTLR CP15 register for L2 ECC error */
+ asm("mrc p15, 1, %0, c9, c0, 3" : "=r"(status));
+
+ if (status & L2_INTERN_ASYNC_ERROR) {
+ status &= ~L2_INTERN_ASYNC_ERROR;
+ asm("mcr p15, 1, %0, c9, c0, 3" : : "r" (status));
+ asm("mcr p15, 0, %0, c5, c1, 0" : "=r" (fault));
+ /*
+ * Do a machine restart as this is double bit ECC error
+ * that can't be corrected
+ */
+ pr_err("ARM Cortex A15 L1/L2 ECC error, CP15 ADFSR 0x%x\n",
+ fault);
+ machine_restart(NULL);
+ /* we should never cone here*/
+ }
+
+ if (status & AXI_ASYNC_ERROR)
+ pr_err("ARM Cortex A15 AXI async error shouldn't cause an nterrupt\n");
+}
+
+static irqreturn_t arm_l1l2_ecc_err_irq_handler(int irq, void *reg_virt)
+{
+ check_ecc_error();
+
+ return IRQ_HANDLED;
+}
+
+static int __init keystone_init_misc(void)
+{
+ struct device_node *node = NULL;
+ int error_irq = 0;
+ int ret;
+
+ /*
+ * check if we already have ecc error. Reboot if it is double bit
+ * error.
+ */
+ check_ecc_error();
+
+ /* add ARM ECC L1/L2 cache error handler */
+ node = of_find_compatible_node(NULL, NULL, "ti,keystone-sys");
+ if (node)
+ error_irq = irq_of_parse_and_map(node, 0);
+
+ if (!error_irq) {
+ pr_warn("Warning!! arm L1/L2 ECC irq number not defined\n");
+ return 0;
+ }
+
+ if (request_irq(error_irq, arm_l1l2_ecc_err_irq_handler, 0,
+ "a15-l1l2-ecc-err-irq", 0) < 0) {
+ WARN_ON("request_irq fail for arm L1/L2 ECC error irq\n");
+ }
+
+ return ret;
+}
+subsys_initcall(keystone_init_misc);
+
static void __init keystone_init(void)
{
keystone_pm_runtime_init();
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2015-06-25 14:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-25 14:31 [PATCH v2 0/3] ARM: keystone: add ecc error interrupt handling Vitaly Andrianov
2015-06-25 14:31 ` [PATCH v2 1/3] ARM: keystone: clean and sort keystone.c headers Vitaly Andrianov
[not found] ` <1435242710-31346-1-git-send-email-vitalya-l0cyMroinI0@public.gmane.org>
2015-06-25 14:31 ` Vitaly Andrianov [this message]
2015-06-25 14:31 ` [PATCH v2 3/3] ARM: keystone: ecc: add DDR3 ecc interrupt handling Vitaly Andrianov
2015-06-25 15:04 ` [PATCH v2 0/3] ARM: keystone: add ecc error " santosh shilimkar
[not found] ` <558C188B.5060107-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2015-06-25 21:02 ` Stephen Boyd
[not found] ` <558C6C4F.1090102-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-06-25 21:30 ` santosh shilimkar
[not found] ` <558C72EB.8010502-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2015-06-25 21:35 ` Stephen Boyd
[not found] ` <558C7437.2090306-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-06-26 12:20 ` Vitaly Andrianov
2015-07-02 0:14 ` Stephen Boyd
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=1435242710-31346-3-git-send-email-vitalya@ti.com \
--to=vitalya-l0cymroini0@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=hzhang-l0cyMroinI0@public.gmane.org \
--cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
--cc=m-karicheri2-l0cyMroinI0@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=pawel.moll-5wv7dgnIgG8@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=ssantosh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
/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).