2 * (C) Copyright 2004 Texas Insturments
5 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
6 * Marius Groeger <mgroeger@sysgo.de>
9 * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
11 * (C) Copyright 2008-2010 Freescale Semiconductor, Inc.
13 * See file CREDITS for list of people who contributed to this
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
38 #include <asm/system.h>
39 #include <asm/cache-cp15.h>
42 #define dcache_invalidate_all_l1() \
45 /* Clean and Invalidate Entire Data Cache */ \
46 asm volatile ("mcr p15, 0, %0, c7, c14, 0;" \
50 asm volatile ("mcr p15, 0, %0, c8, c7, 0;" \
53 : "memory"); /* Invalidate i+d-TLBs */ \
56 #define dcache_disable_l1() \
59 asm volatile ("mcr p15, 0, %0, c7, c6, 0;" \
61 : "r"(i)); /* clear data cache */ \
62 asm volatile ("mrc p15, 0, %0, c1, c0, 0;" \
64 i &= (~0x0004); /* disable DCache */ \
65 /* but not MMU and alignment faults */ \
66 asm volatile ("mcr p15, 0, %0, c1, c0, 0;" \
71 #define icache_invalidate_all_l1() \
73 /* this macro can discard dirty cache lines (N/A for ICache) */ \
75 asm volatile ("mcr p15, 0, %0, c7, c5, 0;" \
77 : "r"(i)); /* flush ICache */ \
78 asm volatile ("mcr p15, 0, %0, c8, c5, 0;" \
80 : "r"(i)); /* flush ITLB only */ \
81 asm volatile ("mcr p15, 0, %0, c7, c5, 4;" \
83 : "r"(i)); /* flush prefetch buffer */ \
85 "nop;" /* next few instructions may be via cache */ \
93 #define cache_flush() \
95 dcache_invalidate_all_l1(); \
96 icache_invalidate_all_l1(); \
99 int cleanup_before_linux (void)
102 * this function is called just before we call linux
103 * it prepares the processor for linux
105 * we turn off caches etc ...
108 disable_interrupts ();
112 extern void lcd_disable(void);
113 extern void lcd_panel_disable(void);
115 lcd_disable(); /* proper disable of lcd & panel */
119 /* flush I/D-cache */
122 /* turn off I/D-cache */
129 /*Workaround to enable L2CC during kernel decompressing*/
130 #ifdef fixup_before_linux