wdenk | 2d5b561 | 2003-10-14 19:43:55 +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 | 2d5b561 | 2003-10-14 19:43:55 +0000 | [diff] [blame] | 11 | */ |
| 12 | |
| 13 | /* |
| 14 | * CPU specific code |
| 15 | */ |
| 16 | |
| 17 | #include <common.h> |
| 18 | #include <command.h> |
Ben Warren | cc94074 | 2008-09-05 01:55:22 -0400 | [diff] [blame] | 19 | #include <netdev.h> |
wdenk | 2d5b561 | 2003-10-14 19:43:55 +0000 | [diff] [blame] | 20 | #include <asm/arch/ixp425.h> |
Jean-Christophe PLAGNIOL-VILLARD | 677e62f | 2009-04-05 13:02:43 +0200 | [diff] [blame] | 21 | #include <asm/system.h> |
wdenk | 2d5b561 | 2003-10-14 19:43:55 +0000 | [diff] [blame] | 22 | |
Jean-Christophe PLAGNIOL-VILLARD | b3acb6c | 2009-04-05 13:06:31 +0200 | [diff] [blame] | 23 | static void cache_flush(void); |
| 24 | |
Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 25 | #if defined(CONFIG_DISPLAY_CPUINFO) |
| 26 | int print_cpuinfo (void) |
| 27 | { |
| 28 | unsigned long id; |
| 29 | int speed = 0; |
| 30 | |
| 31 | asm ("mrc p15, 0, %0, c0, c0, 0":"=r" (id)); |
| 32 | |
| 33 | puts("CPU: Intel IXP425 at "); |
| 34 | switch ((id & 0x000003f0) >> 4) { |
| 35 | case 0x1c: |
Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 36 | speed = 533; |
| 37 | break; |
| 38 | |
| 39 | case 0x1d: |
Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 40 | speed = 400; |
| 41 | break; |
| 42 | |
| 43 | case 0x1f: |
Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 44 | speed = 266; |
| 45 | break; |
| 46 | } |
| 47 | |
| 48 | if (speed) |
| 49 | printf("%d MHz\n", speed); |
| 50 | else |
| 51 | puts("unknown revision\n"); |
| 52 | |
| 53 | return 0; |
| 54 | } |
| 55 | #endif /* CONFIG_DISPLAY_CPUINFO */ |
| 56 | |
wdenk | 2d5b561 | 2003-10-14 19:43:55 +0000 | [diff] [blame] | 57 | int cleanup_before_linux (void) |
| 58 | { |
| 59 | /* |
| 60 | * this function is called just before we call linux |
| 61 | * it prepares the processor for linux |
| 62 | * |
| 63 | * just disable everything that can disturb booting linux |
| 64 | */ |
| 65 | |
wdenk | 2d5b561 | 2003-10-14 19:43:55 +0000 | [diff] [blame] | 66 | disable_interrupts (); |
| 67 | |
| 68 | /* turn off I-cache */ |
Jean-Christophe PLAGNIOL-VILLARD | b3acb6c | 2009-04-05 13:06:31 +0200 | [diff] [blame] | 69 | icache_disable(); |
| 70 | dcache_disable(); |
wdenk | 2d5b561 | 2003-10-14 19:43:55 +0000 | [diff] [blame] | 71 | |
| 72 | /* flush I-cache */ |
Jean-Christophe PLAGNIOL-VILLARD | b3acb6c | 2009-04-05 13:06:31 +0200 | [diff] [blame] | 73 | cache_flush(); |
wdenk | 2d5b561 | 2003-10-14 19:43:55 +0000 | [diff] [blame] | 74 | |
Jean-Christophe PLAGNIOL-VILLARD | b3acb6c | 2009-04-05 13:06:31 +0200 | [diff] [blame] | 75 | return 0; |
wdenk | 2d5b561 | 2003-10-14 19:43:55 +0000 | [diff] [blame] | 76 | } |
| 77 | |
Jean-Christophe PLAGNIOL-VILLARD | b3acb6c | 2009-04-05 13:06:31 +0200 | [diff] [blame] | 78 | /* flush I/D-cache */ |
| 79 | static void cache_flush (void) |
wdenk | 2d5b561 | 2003-10-14 19:43:55 +0000 | [diff] [blame] | 80 | { |
Jean-Christophe PLAGNIOL-VILLARD | b3acb6c | 2009-04-05 13:06:31 +0200 | [diff] [blame] | 81 | unsigned long i = 0; |
wdenk | 2d5b561 | 2003-10-14 19:43:55 +0000 | [diff] [blame] | 82 | |
Jean-Christophe PLAGNIOL-VILLARD | b3acb6c | 2009-04-05 13:06:31 +0200 | [diff] [blame] | 83 | asm ("mcr p15, 0, %0, c7, c5, 0": :"r" (i)); |
wdenk | 2d5b561 | 2003-10-14 19:43:55 +0000 | [diff] [blame] | 84 | } |
| 85 | |
| 86 | /* FIXME */ |
wdenk | a119190 | 2005-01-09 17:12:27 +0000 | [diff] [blame] | 87 | /* |
wdenk | 2d5b561 | 2003-10-14 19:43:55 +0000 | [diff] [blame] | 88 | void pci_init(void) |
| 89 | { |
| 90 | return; |
| 91 | } |
wdenk | a119190 | 2005-01-09 17:12:27 +0000 | [diff] [blame] | 92 | */ |
Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 93 | |
Ben Warren | cc94074 | 2008-09-05 01:55:22 -0400 | [diff] [blame] | 94 | int cpu_eth_init(bd_t *bis) |
| 95 | { |
| 96 | #ifdef CONFIG_IXP4XX_NPE |
| 97 | npe_initialize(bis); |
| 98 | #endif |
| 99 | return 0; |
| 100 | } |