All of lore.kernel.org
 help / color / mirror / Atom feed
From: eric@eukrea.com (Eric Bénard)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3] i.MX31 and i.MX35 : fix errate TLSbo65953 and ENGcm09472
Date: Fri,  8 Oct 2010 10:49:38 +0200	[thread overview]
Message-ID: <1286527778-4663-1-git-send-email-eric@eukrea.com> (raw)
In-Reply-To: <4CAC58E3.9040503@eukrea.com>

Without this exiting WFI can result in cache corruption.
Code taken from Freescale's 2.6.27 BSP and tested on i.MX35

Signed-off-by: Eric B?nard <eric@eukrea.com>
---
- v3 : fix following UWE's review
- v2 : use cpu_ismx3x() and add comments. 

 arch/arm/plat-mxc/include/mach/system.h |   32 ++++++++++++++++++++++++++++--
 1 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/arch/arm/plat-mxc/include/mach/system.h b/arch/arm/plat-mxc/include/mach/system.h
index 4acd114..95be51b 100644
--- a/arch/arm/plat-mxc/include/mach/system.h
+++ b/arch/arm/plat-mxc/include/mach/system.h
@@ -1,7 +1,7 @@
 /*
  *  Copyright (C) 1999 ARM Limited
  *  Copyright (C) 2000 Deep Blue Solutions Ltd
- *  Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
+ *  Copyright 2004-2008 Freescale Semiconductor, Inc. All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -28,8 +28,34 @@ static inline void arch_idle(void)
 		mxc91231_prepare_idle();
 	}
 #endif
-
-	cpu_do_idle();
+	/* fix i.MX31 errata TLSbo65953 and i.MX35 errata ENGcm09472 */
+	if (cpu_is_mx31() || cpu_is_mx35()) {
+		unsigned long reg = 0;
+		__asm__ __volatile__(
+			/* disable I and D cache */
+			"mrc p15, 0, %0, c1, c0, 0\n"
+			"bic %0, %0, #0x00001000\n"
+			"bic %0, %0, #0x00000004\n"
+			"mcr p15, 0, %0, c1, c0, 0\n"
+			/* invalidate I cache */
+			"mov %0, #0\n"
+			"mcr p15, 0, %0, c7, c5, 0\n"
+			/* clear and invalidate D cache */
+			"mov %0, #0\n"
+			"mcr p15, 0, %0, c7, c14, 0\n"
+			/* WFI */
+			"mov %0, #0\n"
+			"mcr p15, 0, %0, c7, c0, 4\n"
+			"nop\n" "nop\n" "nop\n" "nop\n"
+			"nop\n" "nop\n" "nop\n"
+			/* enable I and D cache */
+			"mrc p15, 0, %0, c1, c0, 0\n"
+			"orr %0, %0, #0x00001000\n"
+			"orr %0, %0, #0x00000004\n"
+			"mcr p15, 0, %0, c1, c0, 0\n"
+			: "=r" (reg));
+	} else
+		cpu_do_idle();
 }
 
 void arch_reset(char mode, const char *cmd);
-- 
1.7.0.4

  reply	other threads:[~2010-10-08  8:49 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-02 13:55 I.MX35 GPIO IRQ + Preempt -> Oops Eric Bénard
2010-10-03 11:41 ` Russell King - ARM Linux
2010-10-03 15:25   ` Eric Bénard
2010-10-03 16:20     ` Russell King - ARM Linux
2010-10-03 17:15       ` Eric Bénard
2010-10-04  7:39         ` Uwe Kleine-König
2010-10-04  8:08           ` Eric Bénard
2010-10-04 12:07             ` Eric Bénard
2010-10-05  5:06               ` Marc Reilly
2010-10-05  7:28                 ` Eric Bénard
2010-10-05  9:13                   ` Eric Bénard
2010-10-05  9:25                   ` [PATCH/RFC] i.MX31 and i.MX35 : fix errate TLSbo65953 and ENGcm09472 Eric Bénard
2010-10-05  9:45                     ` Sascha Hauer
2010-10-05 12:00                       ` [PATCH v2] " Eric Bénard
2010-10-05 18:33                         ` Uwe Kleine-König
2010-10-05 19:31                           ` Eric Bénard
2010-10-05 19:46                             ` Uwe Kleine-König
2010-10-05 20:00                               ` Eric Bénard
2010-10-05 20:04                                 ` Uwe Kleine-König
2010-10-05 20:27                                   ` Eric Bénard
2010-10-06  2:28                                     ` Nicolas Pitre
2010-10-06 11:09                                       ` Eric Bénard
2010-10-08  8:49                                         ` Eric Bénard [this message]
2010-10-07  7:27                               ` Russell King - ARM Linux
2010-10-05 16:29                     ` [PATCH/RFC] " Uwe Kleine-König
2010-10-05 16:48                       ` Eric Bénard
2010-10-05 17:40                         ` Uwe Kleine-König
2010-10-06  6:35                       ` Daniel Mack
2010-10-06  7:03                         ` Uwe Kleine-König

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=1286527778-4663-1-git-send-email-eric@eukrea.com \
    --to=eric@eukrea.com \
    --cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.