2 * (C) Copyright 2008 Texas Insturments
5 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
6 * Marius Groeger <mgroeger@sysgo.de>
9 * Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
11 * See file CREDITS for list of people who contributed to this
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License as
16 * published by the Free Software Foundation; either version 2 of
17 * the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
35 #include <asm/arch/sys_proto.h>
36 #include <asm/cache.h>
38 void l2_cache_enable(void)
41 volatile unsigned int j;
43 /* ES2 onwards we can disable/enable L2 ourselves */
44 if (get_cpu_rev() >= CPU_3XX_ES20) {
45 __asm__ __volatile__("mrc p15, 0, %0, c1, c0, 1":"=r"(i));
46 __asm__ __volatile__("orr %0, %0, #0x2":"=r"(i));
47 __asm__ __volatile__("mcr p15, 0, %0, c1, c0, 1":"=r"(i));
49 /* Save r0, r12 and restore them after usage */
50 __asm__ __volatile__("mov %0, r12":"=r"(j));
51 __asm__ __volatile__("mov %0, r0":"=r"(i));
54 * GP Device ROM code API usage here
55 * r12 = AUXCR Write function and r0 value
57 __asm__ __volatile__("mov r12, #0x3");
58 __asm__ __volatile__("mrc p15, 0, r0, c1, c0, 1");
59 __asm__ __volatile__("orr r0, r0, #0x2");
60 /* SMI instruction to call ROM Code API */
61 __asm__ __volatile__(".word 0xE1600070");
62 __asm__ __volatile__("mov r0, %0":"=r"(i));
63 __asm__ __volatile__("mov r12, %0":"=r"(j));
68 void l2_cache_disable(void)
71 volatile unsigned int j;
73 /* ES2 onwards we can disable/enable L2 ourselves */
74 if (get_cpu_rev() >= CPU_3XX_ES20) {
75 __asm__ __volatile__("mrc p15, 0, %0, c1, c0, 1":"=r"(i));
76 __asm__ __volatile__("bic %0, %0, #0x2":"=r"(i));
77 __asm__ __volatile__("mcr p15, 0, %0, c1, c0, 1":"=r"(i));
79 /* Save r0, r12 and restore them after usage */
80 __asm__ __volatile__("mov %0, r12":"=r"(j));
81 __asm__ __volatile__("mov %0, r0":"=r"(i));
84 * GP Device ROM code API usage here
85 * r12 = AUXCR Write function and r0 value
87 __asm__ __volatile__("mov r12, #0x3");
88 __asm__ __volatile__("mrc p15, 0, r0, c1, c0, 1");
89 __asm__ __volatile__("bic r0, r0, #0x2");
90 /* SMI instruction to call ROM Code API */
91 __asm__ __volatile__(".word 0xE1600070");
92 __asm__ __volatile__("mov r0, %0":"=r"(i));
93 __asm__ __volatile__("mov r12, %0":"=r"(j));