Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4a66b5d9 authored by Eric Bénard's avatar Eric Bénard Committed by Sascha Hauer
Browse files

i.MX31 and i.MX35 : fix errate TLSbo65953 and ENGcm09472



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: default avatarEric Bénard <eric@eukrea.com>
parent ec4aac20
Loading
Loading
Loading
Loading
+29 −3
Original line number Diff line number Diff line
/*
 *  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,7 +28,33 @@ static inline void arch_idle(void)
		mxc91231_prepare_idle();
	}
#endif

	/* 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();
}