diff options
author | Josh Boyer <jwboyer@linux.vnet.ibm.com> | 2007-08-20 08:28:05 -0400 |
---|---|---|
committer | Josh Boyer <jwboyer@linux.vnet.ibm.com> | 2007-08-20 08:28:05 -0400 |
commit | 869680c16fb028ac4ad9a449283e0514789c654a (patch) | |
tree | 626c63899d404c74868b662ecb4a83717532e3d4 /arch/powerpc/boot/4xx.c | |
parent | 3cc248ae6eaac4175047d1fdc4fadd8a94651f83 (diff) |
[POWERPC] Rename 44x bootwrapper
Rename the 44x.c wrapper file to 4xx.c. This will allow us to add common
functions in a single file that can be shared across all of 4xx.
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'arch/powerpc/boot/4xx.c')
-rw-r--r-- | arch/powerpc/boot/4xx.c | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/arch/powerpc/boot/4xx.c b/arch/powerpc/boot/4xx.c new file mode 100644 index 000000000000..9f64e840bef6 --- /dev/null +++ b/arch/powerpc/boot/4xx.c | |||
@@ -0,0 +1,85 @@ | |||
1 | /* | ||
2 | * Copyright 2007 David Gibson, IBM Corporation. | ||
3 | * | ||
4 | * Based on earlier code: | ||
5 | * Matt Porter <mporter@kernel.crashing.org> | ||
6 | * Copyright 2002-2005 MontaVista Software Inc. | ||
7 | * | ||
8 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> | ||
9 | * Copyright (c) 2003, 2004 Zultys Technologies | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License | ||
13 | * as published by the Free Software Foundation; either version | ||
14 | * 2 of the License, or (at your option) any later version. | ||
15 | */ | ||
16 | #include <stddef.h> | ||
17 | #include "types.h" | ||
18 | #include "string.h" | ||
19 | #include "stdio.h" | ||
20 | #include "ops.h" | ||
21 | #include "reg.h" | ||
22 | #include "dcr.h" | ||
23 | |||
24 | /* Read the 44x memory controller to get size of system memory. */ | ||
25 | void ibm44x_fixup_memsize(void) | ||
26 | { | ||
27 | int i; | ||
28 | unsigned long memsize, bank_config; | ||
29 | |||
30 | memsize = 0; | ||
31 | for (i = 0; i < ARRAY_SIZE(sdram_bxcr); i++) { | ||
32 | mtdcr(DCRN_SDRAM0_CFGADDR, sdram_bxcr[i]); | ||
33 | bank_config = mfdcr(DCRN_SDRAM0_CFGDATA); | ||
34 | |||
35 | if (bank_config & SDRAM_CONFIG_BANK_ENABLE) | ||
36 | memsize += SDRAM_CONFIG_BANK_SIZE(bank_config); | ||
37 | } | ||
38 | |||
39 | dt_fixup_memory(0, memsize); | ||
40 | } | ||
41 | |||
42 | #define SPRN_DBCR0 0x134 | ||
43 | #define DBCR0_RST_SYSTEM 0x30000000 | ||
44 | |||
45 | void ibm44x_dbcr_reset(void) | ||
46 | { | ||
47 | unsigned long tmp; | ||
48 | |||
49 | asm volatile ( | ||
50 | "mfspr %0,%1\n" | ||
51 | "oris %0,%0,%2@h\n" | ||
52 | "mtspr %1,%0" | ||
53 | : "=&r"(tmp) : "i"(SPRN_DBCR0), "i"(DBCR0_RST_SYSTEM) | ||
54 | ); | ||
55 | |||
56 | } | ||
57 | |||
58 | /* Read 4xx EBC bus bridge registers to get mappings of the peripheral | ||
59 | * banks into the OPB address space */ | ||
60 | void ibm4xx_fixup_ebc_ranges(const char *ebc) | ||
61 | { | ||
62 | void *devp; | ||
63 | u32 bxcr; | ||
64 | u32 ranges[EBC_NUM_BANKS*4]; | ||
65 | u32 *p = ranges; | ||
66 | int i; | ||
67 | |||
68 | for (i = 0; i < EBC_NUM_BANKS; i++) { | ||
69 | mtdcr(DCRN_EBC0_CFGADDR, EBC_BXCR(i)); | ||
70 | bxcr = mfdcr(DCRN_EBC0_CFGDATA); | ||
71 | |||
72 | if ((bxcr & EBC_BXCR_BU) != EBC_BXCR_BU_OFF) { | ||
73 | *p++ = i; | ||
74 | *p++ = 0; | ||
75 | *p++ = bxcr & EBC_BXCR_BAS; | ||
76 | *p++ = EBC_BXCR_BANK_SIZE(bxcr); | ||
77 | } | ||
78 | } | ||
79 | |||
80 | devp = finddevice(ebc); | ||
81 | if (! devp) | ||
82 | fatal("Couldn't locate EBC node %s\n\r", ebc); | ||
83 | |||
84 | setprop(devp, "ranges", ranges, (p - ranges) * sizeof(u32)); | ||
85 | } | ||