wdenk | 4a9cbbe | 2002-08-27 09:48:53 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2002 |
| 3 | * Sysgo Real-Time Solutions, GmbH <www.elinos.com> |
| 4 | * Marius Groeger <mgroeger@sysgo.de> |
| 5 | * |
| 6 | * (C) Copyright 2002 |
| 7 | * Sysgo Real-Time Solutions, GmbH <www.elinos.com> |
| 8 | * Alex Zuepke <azu@sysgo.de> |
| 9 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 10 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | 4a9cbbe | 2002-08-27 09:48:53 +0000 | [diff] [blame] | 11 | */ |
| 12 | |
| 13 | /* |
| 14 | * CPU specific code |
| 15 | */ |
| 16 | |
| 17 | #include <common.h> |
| 18 | #include <command.h> |
Jean-Christophe PLAGNIOL-VILLARD | 677e62f | 2009-04-05 13:02:43 +0200 | [diff] [blame] | 19 | #include <asm/system.h> |
wdenk | 4a9cbbe | 2002-08-27 09:48:53 +0000 | [diff] [blame] | 20 | |
Wolfgang Denk | d87080b | 2006-03-31 18:32:53 +0200 | [diff] [blame] | 21 | #ifdef CONFIG_USE_IRQ |
| 22 | DECLARE_GLOBAL_DATA_PTR; |
| 23 | #endif |
| 24 | |
Jean-Christophe PLAGNIOL-VILLARD | b3acb6c | 2009-04-05 13:06:31 +0200 | [diff] [blame] | 25 | static void cache_flush(void); |
| 26 | |
wdenk | 4a9cbbe | 2002-08-27 09:48:53 +0000 | [diff] [blame] | 27 | int cleanup_before_linux (void) |
| 28 | { |
| 29 | /* |
| 30 | * this function is called just before we call linux |
| 31 | * it prepares the processor for linux |
| 32 | * |
| 33 | * just disable everything that can disturb booting linux |
| 34 | */ |
| 35 | |
wdenk | 4a9cbbe | 2002-08-27 09:48:53 +0000 | [diff] [blame] | 36 | disable_interrupts (); |
| 37 | |
| 38 | /* turn off I-cache */ |
Jean-Christophe PLAGNIOL-VILLARD | b3acb6c | 2009-04-05 13:06:31 +0200 | [diff] [blame] | 39 | icache_disable(); |
| 40 | dcache_disable(); |
wdenk | 4a9cbbe | 2002-08-27 09:48:53 +0000 | [diff] [blame] | 41 | |
| 42 | /* flush I-cache */ |
Jean-Christophe PLAGNIOL-VILLARD | b3acb6c | 2009-04-05 13:06:31 +0200 | [diff] [blame] | 43 | cache_flush(); |
wdenk | 4a9cbbe | 2002-08-27 09:48:53 +0000 | [diff] [blame] | 44 | |
| 45 | return (0); |
| 46 | } |
| 47 | |
Jean-Christophe PLAGNIOL-VILLARD | b3acb6c | 2009-04-05 13:06:31 +0200 | [diff] [blame] | 48 | /* flush I/D-cache */ |
| 49 | static void cache_flush (void) |
Jean-Christophe PLAGNIOL-VILLARD | 677e62f | 2009-04-05 13:02:43 +0200 | [diff] [blame] | 50 | { |
Jean-Christophe PLAGNIOL-VILLARD | b3acb6c | 2009-04-05 13:06:31 +0200 | [diff] [blame] | 51 | unsigned long i = 0; |
Jean-Christophe PLAGNIOL-VILLARD | 677e62f | 2009-04-05 13:02:43 +0200 | [diff] [blame] | 52 | |
Jean-Christophe PLAGNIOL-VILLARD | b3acb6c | 2009-04-05 13:06:31 +0200 | [diff] [blame] | 53 | asm ("mcr p15, 0, %0, c7, c5, 0": :"r" (i)); |
wdenk | 4a9cbbe | 2002-08-27 09:48:53 +0000 | [diff] [blame] | 54 | } |