Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
wdenk | 3d81826 | 2002-09-22 23:07:35 +0000 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2002 |
| 4 | * Sysgo Real-Time Solutions, GmbH <www.elinos.com> |
| 5 | * Marius Groeger <mgroeger@sysgo.de> |
| 6 | * |
| 7 | * (C) Copyright 2002 |
Detlev Zundel | f1b3f2b | 2009-05-13 10:54:10 +0200 | [diff] [blame] | 8 | * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de> |
wdenk | 3d81826 | 2002-09-22 23:07:35 +0000 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | /* |
| 12 | * CPU specific code |
| 13 | */ |
| 14 | |
| 15 | #include <common.h> |
| 16 | #include <command.h> |
Jean-Christophe PLAGNIOL-VILLARD | 9053b5a | 2009-04-05 13:02:43 +0200 | [diff] [blame] | 17 | #include <asm/system.h> |
wdenk | 3d81826 | 2002-09-22 23:07:35 +0000 | [diff] [blame] | 18 | |
Jean-Christophe PLAGNIOL-VILLARD | e6b5f1b | 2009-04-05 13:06:31 +0200 | [diff] [blame] | 19 | static void cache_flush(void); |
wdenk | 3d81826 | 2002-09-22 23:07:35 +0000 | [diff] [blame] | 20 | |
wdenk | 3d81826 | 2002-09-22 23:07:35 +0000 | [diff] [blame] | 21 | int cleanup_before_linux (void) |
| 22 | { |
| 23 | /* |
| 24 | * this function is called just before we call linux |
| 25 | * it prepares the processor for linux |
| 26 | * |
| 27 | * we turn off caches etc ... |
| 28 | */ |
| 29 | |
wdenk | 3d81826 | 2002-09-22 23:07:35 +0000 | [diff] [blame] | 30 | disable_interrupts (); |
| 31 | |
| 32 | /* turn off I/D-cache */ |
Jean-Christophe PLAGNIOL-VILLARD | e6b5f1b | 2009-04-05 13:06:31 +0200 | [diff] [blame] | 33 | icache_disable(); |
| 34 | dcache_disable(); |
wdenk | 3d81826 | 2002-09-22 23:07:35 +0000 | [diff] [blame] | 35 | /* flush I/D-cache */ |
Jean-Christophe PLAGNIOL-VILLARD | e6b5f1b | 2009-04-05 13:06:31 +0200 | [diff] [blame] | 36 | cache_flush(); |
Wolfgang Denk | adf20a1 | 2005-09-25 01:48:28 +0200 | [diff] [blame] | 37 | |
Jean-Christophe PLAGNIOL-VILLARD | e6b5f1b | 2009-04-05 13:06:31 +0200 | [diff] [blame] | 38 | return 0; |
wdenk | 3d81826 | 2002-09-22 23:07:35 +0000 | [diff] [blame] | 39 | } |
| 40 | |
Jean-Christophe PLAGNIOL-VILLARD | e6b5f1b | 2009-04-05 13:06:31 +0200 | [diff] [blame] | 41 | /* flush I/D-cache */ |
| 42 | static void cache_flush (void) |
wdenk | 3d81826 | 2002-09-22 23:07:35 +0000 | [diff] [blame] | 43 | { |
Jean-Christophe PLAGNIOL-VILLARD | e6b5f1b | 2009-04-05 13:06:31 +0200 | [diff] [blame] | 44 | unsigned long i = 0; |
wdenk | 3d81826 | 2002-09-22 23:07:35 +0000 | [diff] [blame] | 45 | |
Jean-Christophe PLAGNIOL-VILLARD | e6b5f1b | 2009-04-05 13:06:31 +0200 | [diff] [blame] | 46 | asm ("mcr p15, 0, %0, c7, c7, 0": :"r" (i)); |
wdenk | 3d81826 | 2002-09-22 23:07:35 +0000 | [diff] [blame] | 47 | } |