diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2007-05-08 00:10:01 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-05-08 00:47:32 -0400 |
commit | f6dfc80554b27da11dbb36ebae166b23ec3aa9ca (patch) | |
tree | 2ca363b4e2d634988c40c9a03106c719b0324ebd /arch/powerpc/boot | |
parent | ea20ff5d0338a0fbd78783df657f94ffa7967dd9 (diff) |
[POWERPC] Support for the Ebony 440GP reference board in arch/powerpc
This adds platform support code for the Ebony (440GP) evaluation
board. This includes both code in arch/powerpc/platforms/44x for
board initialization, and zImage wrapper code to correctly tweak the
flattened device tree based on information from the firmware. The
zImage supports both IBM OpenBIOS (aka "treeboot") and old versions of
uboot which don't support a flattened device tree.
Signed-off-by: David Gibson <dwg@au1.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/boot')
-rw-r--r-- | arch/powerpc/boot/44x.c | 40 | ||||
-rw-r--r-- | arch/powerpc/boot/44x.h | 16 | ||||
-rw-r--r-- | arch/powerpc/boot/Makefile | 19 | ||||
-rw-r--r-- | arch/powerpc/boot/cuboot-ebony.c | 42 | ||||
-rw-r--r-- | arch/powerpc/boot/dcr.h | 87 | ||||
-rw-r--r-- | arch/powerpc/boot/ebony.c | 129 | ||||
-rw-r--r-- | arch/powerpc/boot/mktree.c | 10 | ||||
-rw-r--r-- | arch/powerpc/boot/treeboot-ebony.c | 34 | ||||
-rwxr-xr-x | arch/powerpc/boot/wrapper | 8 |
9 files changed, 375 insertions, 10 deletions
diff --git a/arch/powerpc/boot/44x.c b/arch/powerpc/boot/44x.c new file mode 100644 index 000000000000..d51377d9024f --- /dev/null +++ b/arch/powerpc/boot/44x.c | |||
@@ -0,0 +1,40 @@ | |||
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 | } | ||
diff --git a/arch/powerpc/boot/44x.h b/arch/powerpc/boot/44x.h new file mode 100644 index 000000000000..7b129ad043e1 --- /dev/null +++ b/arch/powerpc/boot/44x.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * PowerPC 44x related functions | ||
3 | * | ||
4 | * Copyright 2007 David Gibson, IBM Corporation. | ||
5 | * | ||
6 | * This file is licensed under the terms of the GNU General Public | ||
7 | * License version 2. This program is licensed "as is" without any | ||
8 | * warranty of any kind, whether express or implied. | ||
9 | */ | ||
10 | #ifndef _PPC_BOOT_44X_H_ | ||
11 | #define _PPC_BOOT_44X_H_ | ||
12 | |||
13 | void ibm44x_fixup_memsize(void); | ||
14 | void ebony_init(void *mac0, void *mac1); | ||
15 | |||
16 | #endif /* _PPC_BOOT_44X_H_ */ | ||
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index ccd757c193e7..5c384aad1184 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile | |||
@@ -42,8 +42,10 @@ $(addprefix $(obj)/,$(zlib) gunzip_util.o main.o): \ | |||
42 | 42 | ||
43 | src-wlib := string.S crt0.S stdio.c main.c flatdevtree.c flatdevtree_misc.c \ | 43 | src-wlib := string.S crt0.S stdio.c main.c flatdevtree.c flatdevtree_misc.c \ |
44 | ns16550.c serial.c simple_alloc.c div64.S util.S \ | 44 | ns16550.c serial.c simple_alloc.c div64.S util.S \ |
45 | gunzip_util.c elf_util.c $(zlib) devtree.c | 45 | gunzip_util.c elf_util.c $(zlib) devtree.c \ |
46 | src-plat := of.c cuboot-83xx.c cuboot-85xx.c holly.c | 46 | 44x.c ebony.c |
47 | src-plat := of.c cuboot-83xx.c cuboot-85xx.c holly.c \ | ||
48 | cuboot-ebony.c treeboot-ebony.c | ||
47 | src-boot := $(src-wlib) $(src-plat) empty.c | 49 | src-boot := $(src-wlib) $(src-plat) empty.c |
48 | 50 | ||
49 | src-boot := $(addprefix $(obj)/, $(src-boot)) | 51 | src-boot := $(addprefix $(obj)/, $(src-boot)) |
@@ -135,6 +137,7 @@ image-$(CONFIG_DEFAULT_UIMAGE) += uImage | |||
135 | ifneq ($(CONFIG_DEVICE_TREE),"") | 137 | ifneq ($(CONFIG_DEVICE_TREE),"") |
136 | image-$(CONFIG_PPC_83xx) += cuImage.83xx | 138 | image-$(CONFIG_PPC_83xx) += cuImage.83xx |
137 | image-$(CONFIG_PPC_85xx) += cuImage.85xx | 139 | image-$(CONFIG_PPC_85xx) += cuImage.85xx |
140 | image-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony | ||
138 | endif | 141 | endif |
139 | 142 | ||
140 | # For 32-bit powermacs, build the COFF and miboot images | 143 | # For 32-bit powermacs, build the COFF and miboot images |
@@ -144,7 +147,8 @@ image-$(CONFIG_PPC_PMAC) += zImage.coff zImage.miboot | |||
144 | endif | 147 | endif |
145 | 148 | ||
146 | initrd- := $(patsubst zImage%, zImage.initrd%, $(image-n) $(image-)) | 149 | initrd- := $(patsubst zImage%, zImage.initrd%, $(image-n) $(image-)) |
147 | initrd-y := $(patsubst zImage%, zImage.initrd%, $(image-y)) | 150 | initrd-y := $(patsubst zImage%, zImage.initrd%, \ |
151 | $(patsubst treeImage%, treeImage.initrd%, $(image-y))) | ||
148 | initrd-y := $(filter-out $(image-y), $(initrd-y)) | 152 | initrd-y := $(filter-out $(image-y), $(initrd-y)) |
149 | targets += $(image-y) $(initrd-y) | 153 | targets += $(image-y) $(initrd-y) |
150 | 154 | ||
@@ -181,6 +185,12 @@ dts = $(if $(shell echo $(CONFIG_DEVICE_TREE) | grep '^/'),\ | |||
181 | $(obj)/cuImage.%: vmlinux $(dts) $(wrapperbits) | 185 | $(obj)/cuImage.%: vmlinux $(dts) $(wrapperbits) |
182 | $(call if_changed,wrap,cuboot-$*,$(dts)) | 186 | $(call if_changed,wrap,cuboot-$*,$(dts)) |
183 | 187 | ||
188 | $(obj)/treeImage.%: vmlinux $(dts) $(wrapperbits) | ||
189 | $(call if_changed,wrap,treeboot-$*,$(dts)) | ||
190 | |||
191 | $(obj)/treeImage.initrd.%: vmlinux $(dts) $(wrapperbits) | ||
192 | $(call if_changed,wrap,treeboot-$*,$(dts),,$(obj)/ramdisk.image.gz) | ||
193 | |||
184 | $(obj)/zImage: $(addprefix $(obj)/, $(image-y)) | 194 | $(obj)/zImage: $(addprefix $(obj)/, $(image-y)) |
185 | @rm -f $@; ln $< $@ | 195 | @rm -f $@; ln $< $@ |
186 | $(obj)/zImage.initrd: $(addprefix $(obj)/, $(initrd-y)) | 196 | $(obj)/zImage.initrd: $(addprefix $(obj)/, $(initrd-y)) |
@@ -190,7 +200,8 @@ install: $(CONFIGURE) $(addprefix $(obj)/, $(image-y)) | |||
190 | sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $< | 200 | sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $< |
191 | 201 | ||
192 | # anything not in $(targets) | 202 | # anything not in $(targets) |
193 | clean-files += $(image-) $(initrd-) zImage zImage.initrd cuImage.* | 203 | clean-files += $(image-) $(initrd-) zImage zImage.initrd cuImage.* \ |
204 | treeImage.* | ||
194 | 205 | ||
195 | # clean up files cached by wrapper | 206 | # clean up files cached by wrapper |
196 | clean-kernel := vmlinux.strip vmlinux.bin | 207 | clean-kernel := vmlinux.strip vmlinux.bin |
diff --git a/arch/powerpc/boot/cuboot-ebony.c b/arch/powerpc/boot/cuboot-ebony.c new file mode 100644 index 000000000000..4464c5f67acb --- /dev/null +++ b/arch/powerpc/boot/cuboot-ebony.c | |||
@@ -0,0 +1,42 @@ | |||
1 | /* | ||
2 | * Old U-boot compatibility for Ebony | ||
3 | * | ||
4 | * Author: David Gibson <david@gibson.dropbear.id.au> | ||
5 | * | ||
6 | * Copyright 2007 David Gibson, IBM Corporatio. | ||
7 | * Based on cuboot-83xx.c, which is: | ||
8 | * Copyright (c) 2007 Freescale Semiconductor, Inc. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify it | ||
11 | * under the terms of the GNU General Public License version 2 as published | ||
12 | * by the Free Software Foundation. | ||
13 | */ | ||
14 | |||
15 | #include "ops.h" | ||
16 | #include "stdio.h" | ||
17 | #include "44x.h" | ||
18 | |||
19 | #define TARGET_44x | ||
20 | #include "ppcboot.h" | ||
21 | |||
22 | static bd_t bd; | ||
23 | extern char _end[]; | ||
24 | |||
25 | BSS_STACK(4096); | ||
26 | |||
27 | void platform_init(unsigned long r3, unsigned long r4, unsigned long r5, | ||
28 | unsigned long r6, unsigned long r7) | ||
29 | { | ||
30 | unsigned long end_of_ram = bd.bi_memstart + bd.bi_memsize; | ||
31 | unsigned long avail_ram = end_of_ram - (unsigned long)_end; | ||
32 | |||
33 | memcpy(&bd, (bd_t *)r3, sizeof(bd)); | ||
34 | loader_info.initrd_addr = r4; | ||
35 | loader_info.initrd_size = r4 ? r5 : 0; | ||
36 | loader_info.cmdline = (char *)r6; | ||
37 | loader_info.cmdline_len = r7 - r6; | ||
38 | |||
39 | simple_alloc_init(_end, avail_ram, 32, 64); | ||
40 | |||
41 | ebony_init(&bd.bi_enetaddr, &bd.bi_enet1addr); | ||
42 | } | ||
diff --git a/arch/powerpc/boot/dcr.h b/arch/powerpc/boot/dcr.h new file mode 100644 index 000000000000..877bc97b1e97 --- /dev/null +++ b/arch/powerpc/boot/dcr.h | |||
@@ -0,0 +1,87 @@ | |||
1 | #ifndef _PPC_BOOT_DCR_H_ | ||
2 | #define _PPC_BOOT_DCR_H_ | ||
3 | |||
4 | #define mfdcr(rn) \ | ||
5 | ({ \ | ||
6 | unsigned long rval; \ | ||
7 | asm volatile("mfdcr %0,%1" : "=r"(rval) : "i"(rn)); \ | ||
8 | rval; \ | ||
9 | }) | ||
10 | #define mtdcr(rn, val) \ | ||
11 | asm volatile("mtdcr %0,%1" : : "i"(rn), "r"(val)) | ||
12 | |||
13 | /* 440GP/440GX SDRAM controller DCRs */ | ||
14 | #define DCRN_SDRAM0_CFGADDR 0x010 | ||
15 | #define DCRN_SDRAM0_CFGDATA 0x011 | ||
16 | |||
17 | #define SDRAM0_B0CR 0x40 | ||
18 | #define SDRAM0_B1CR 0x44 | ||
19 | #define SDRAM0_B2CR 0x48 | ||
20 | #define SDRAM0_B3CR 0x4c | ||
21 | |||
22 | static const unsigned long sdram_bxcr[] = { SDRAM0_B0CR, SDRAM0_B1CR, SDRAM0_B2CR, SDRAM0_B3CR }; | ||
23 | |||
24 | #define SDRAM_CONFIG_BANK_ENABLE 0x00000001 | ||
25 | #define SDRAM_CONFIG_SIZE_MASK 0x000e0000 | ||
26 | #define SDRAM_CONFIG_BANK_SIZE(reg) \ | ||
27 | (0x00400000 << ((reg & SDRAM_CONFIG_SIZE_MASK) >> 17)) | ||
28 | |||
29 | /* 440GP Clock, PM, chip control */ | ||
30 | #define DCRN_CPC0_SR 0x0b0 | ||
31 | #define DCRN_CPC0_ER 0x0b1 | ||
32 | #define DCRN_CPC0_FR 0x0b2 | ||
33 | #define DCRN_CPC0_SYS0 0x0e0 | ||
34 | #define CPC0_SYS0_TUNE 0xffc00000 | ||
35 | #define CPC0_SYS0_FBDV_MASK 0x003c0000 | ||
36 | #define CPC0_SYS0_FWDVA_MASK 0x00038000 | ||
37 | #define CPC0_SYS0_FWDVB_MASK 0x00007000 | ||
38 | #define CPC0_SYS0_OPDV_MASK 0x00000c00 | ||
39 | #define CPC0_SYS0_EPDV_MASK 0x00000300 | ||
40 | /* Helper macros to compute the actual clock divider values from the | ||
41 | * encodings in the CPC0 register */ | ||
42 | #define CPC0_SYS0_FBDV(reg) \ | ||
43 | ((((((reg) & CPC0_SYS0_FBDV_MASK) >> 18) - 1) & 0xf) + 1) | ||
44 | #define CPC0_SYS0_FWDVA(reg) \ | ||
45 | (8 - (((reg) & CPC0_SYS0_FWDVA_MASK) >> 15)) | ||
46 | #define CPC0_SYS0_FWDVB(reg) \ | ||
47 | (8 - (((reg) & CPC0_SYS0_FWDVB_MASK) >> 12)) | ||
48 | #define CPC0_SYS0_OPDV(reg) \ | ||
49 | ((((reg) & CPC0_SYS0_OPDV_MASK) >> 10) + 1) | ||
50 | #define CPC0_SYS0_EPDV(reg) \ | ||
51 | ((((reg) & CPC0_SYS0_EPDV_MASK) >> 8) + 1) | ||
52 | #define CPC0_SYS0_EXTSL 0x00000080 | ||
53 | #define CPC0_SYS0_RW_MASK 0x00000060 | ||
54 | #define CPC0_SYS0_RL 0x00000010 | ||
55 | #define CPC0_SYS0_ZMIISL_MASK 0x0000000c | ||
56 | #define CPC0_SYS0_BYPASS 0x00000002 | ||
57 | #define CPC0_SYS0_NTO1 0x00000001 | ||
58 | #define DCRN_CPC0_SYS1 0x0e1 | ||
59 | #define DCRN_CPC0_CUST0 0x0e2 | ||
60 | #define DCRN_CPC0_CUST1 0x0e3 | ||
61 | #define DCRN_CPC0_STRP0 0x0e4 | ||
62 | #define DCRN_CPC0_STRP1 0x0e5 | ||
63 | #define DCRN_CPC0_STRP2 0x0e6 | ||
64 | #define DCRN_CPC0_STRP3 0x0e7 | ||
65 | #define DCRN_CPC0_GPIO 0x0e8 | ||
66 | #define DCRN_CPC0_PLB 0x0e9 | ||
67 | #define DCRN_CPC0_CR1 0x0ea | ||
68 | #define DCRN_CPC0_CR0 0x0eb | ||
69 | #define CPC0_CR0_SWE 0x80000000 | ||
70 | #define CPC0_CR0_CETE 0x40000000 | ||
71 | #define CPC0_CR0_U1FCS 0x20000000 | ||
72 | #define CPC0_CR0_U0DTE 0x10000000 | ||
73 | #define CPC0_CR0_U0DRE 0x08000000 | ||
74 | #define CPC0_CR0_U0DC 0x04000000 | ||
75 | #define CPC0_CR0_U1DTE 0x02000000 | ||
76 | #define CPC0_CR0_U1DRE 0x01000000 | ||
77 | #define CPC0_CR0_U1DC 0x00800000 | ||
78 | #define CPC0_CR0_U0EC 0x00400000 | ||
79 | #define CPC0_CR0_U1EC 0x00200000 | ||
80 | #define CPC0_CR0_UDIV_MASK 0x001f0000 | ||
81 | #define CPC0_CR0_UDIV(reg) \ | ||
82 | ((((reg) & CPC0_CR0_UDIV_MASK) >> 16) + 1) | ||
83 | #define DCRN_CPC0_MIRQ0 0x0ec | ||
84 | #define DCRN_CPC0_MIRQ1 0x0ed | ||
85 | #define DCRN_CPC0_JTAGID 0x0ef | ||
86 | |||
87 | #endif /* _PPC_BOOT_DCR_H_ */ | ||
diff --git a/arch/powerpc/boot/ebony.c b/arch/powerpc/boot/ebony.c new file mode 100644 index 000000000000..b1251ee7a102 --- /dev/null +++ b/arch/powerpc/boot/ebony.c | |||
@@ -0,0 +1,129 @@ | |||
1 | /* | ||
2 | * Copyright 2007 David Gibson, IBM Corporation. | ||
3 | * | ||
4 | * Based on earlier code: | ||
5 | * Copyright (C) Paul Mackerras 1997. | ||
6 | * | ||
7 | * Matt Porter <mporter@kernel.crashing.org> | ||
8 | * Copyright 2002-2005 MontaVista Software Inc. | ||
9 | * | ||
10 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> | ||
11 | * Copyright (c) 2003, 2004 Zultys Technologies | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or | ||
14 | * modify it under the terms of the GNU General Public License | ||
15 | * as published by the Free Software Foundation; either version | ||
16 | * 2 of the License, or (at your option) any later version. | ||
17 | */ | ||
18 | #include <stdarg.h> | ||
19 | #include <stddef.h> | ||
20 | #include "types.h" | ||
21 | #include "elf.h" | ||
22 | #include "string.h" | ||
23 | #include "stdio.h" | ||
24 | #include "page.h" | ||
25 | #include "ops.h" | ||
26 | #include "reg.h" | ||
27 | #include "dcr.h" | ||
28 | #include "44x.h" | ||
29 | |||
30 | extern char _dtb_start[]; | ||
31 | extern char _dtb_end[]; | ||
32 | |||
33 | static u8 *ebony_mac0, *ebony_mac1; | ||
34 | |||
35 | /* Calculate 440GP clocks */ | ||
36 | void ibm440gp_fixup_clocks(unsigned int sysclk, unsigned int ser_clk) | ||
37 | { | ||
38 | u32 sys0 = mfdcr(DCRN_CPC0_SYS0); | ||
39 | u32 cr0 = mfdcr(DCRN_CPC0_CR0); | ||
40 | u32 cpu, plb, opb, ebc, tb, uart0, uart1, m; | ||
41 | u32 opdv = CPC0_SYS0_OPDV(sys0); | ||
42 | u32 epdv = CPC0_SYS0_EPDV(sys0); | ||
43 | |||
44 | if (sys0 & CPC0_SYS0_BYPASS) { | ||
45 | /* Bypass system PLL */ | ||
46 | cpu = plb = sysclk; | ||
47 | } else { | ||
48 | if (sys0 & CPC0_SYS0_EXTSL) | ||
49 | /* PerClk */ | ||
50 | m = CPC0_SYS0_FWDVB(sys0) * opdv * epdv; | ||
51 | else | ||
52 | /* CPU clock */ | ||
53 | m = CPC0_SYS0_FBDV(sys0) * CPC0_SYS0_FWDVA(sys0); | ||
54 | cpu = sysclk * m / CPC0_SYS0_FWDVA(sys0); | ||
55 | plb = sysclk * m / CPC0_SYS0_FWDVB(sys0); | ||
56 | } | ||
57 | |||
58 | opb = plb / opdv; | ||
59 | ebc = opb / epdv; | ||
60 | |||
61 | /* FIXME: Check if this is for all 440GP, or just Ebony */ | ||
62 | if ((mfpvr() & 0xf0000fff) == 0x40000440) | ||
63 | /* Rev. B 440GP, use external system clock */ | ||
64 | tb = sysclk; | ||
65 | else | ||
66 | /* Rev. C 440GP, errata force us to use internal clock */ | ||
67 | tb = cpu; | ||
68 | |||
69 | if (cr0 & CPC0_CR0_U0EC) | ||
70 | /* External UART clock */ | ||
71 | uart0 = ser_clk; | ||
72 | else | ||
73 | /* Internal UART clock */ | ||
74 | uart0 = plb / CPC0_CR0_UDIV(cr0); | ||
75 | |||
76 | if (cr0 & CPC0_CR0_U1EC) | ||
77 | /* External UART clock */ | ||
78 | uart1 = ser_clk; | ||
79 | else | ||
80 | /* Internal UART clock */ | ||
81 | uart1 = plb / CPC0_CR0_UDIV(cr0); | ||
82 | |||
83 | printf("PPC440GP: SysClk = %dMHz (%x)\n\r", | ||
84 | (sysclk + 500000) / 1000000, sysclk); | ||
85 | |||
86 | dt_fixup_cpu_clocks(cpu, tb, 0); | ||
87 | |||
88 | dt_fixup_clock("/plb", plb); | ||
89 | dt_fixup_clock("/plb/opb", opb); | ||
90 | dt_fixup_clock("/plb/opb/ebc", ebc); | ||
91 | dt_fixup_clock("/plb/opb/serial@40000200", uart0); | ||
92 | dt_fixup_clock("/plb/opb/serial@40000300", uart1); | ||
93 | } | ||
94 | |||
95 | static void ebony_fixups(void) | ||
96 | { | ||
97 | // FIXME: sysclk should be derived by reading the FPGA registers | ||
98 | unsigned long sysclk = 33000000; | ||
99 | |||
100 | ibm440gp_fixup_clocks(sysclk, 6 * 1843200); | ||
101 | ibm44x_fixup_memsize(); | ||
102 | dt_fixup_mac_addresses(ebony_mac0, ebony_mac1); | ||
103 | } | ||
104 | |||
105 | #define SPRN_DBCR0 0x134 | ||
106 | #define DBCR0_RST_SYSTEM 0x30000000 | ||
107 | |||
108 | static void ebony_exit(void) | ||
109 | { | ||
110 | unsigned long tmp; | ||
111 | |||
112 | asm volatile ( | ||
113 | "mfspr %0,%1\n" | ||
114 | "oris %0,%0,%2@h\n" | ||
115 | "mtspr %1,%0" | ||
116 | : "=&r"(tmp) : "i"(SPRN_DBCR0), "i"(DBCR0_RST_SYSTEM) | ||
117 | ); | ||
118 | |||
119 | } | ||
120 | |||
121 | void ebony_init(void *mac0, void *mac1) | ||
122 | { | ||
123 | platform_ops.fixups = ebony_fixups; | ||
124 | platform_ops.exit = ebony_exit; | ||
125 | ebony_mac0 = mac0; | ||
126 | ebony_mac1 = mac1; | ||
127 | ft_init(_dtb_start, _dtb_end - _dtb_start, 32); | ||
128 | serial_console_init(); | ||
129 | } | ||
diff --git a/arch/powerpc/boot/mktree.c b/arch/powerpc/boot/mktree.c index 4cb892993651..45d06a8c7cd1 100644 --- a/arch/powerpc/boot/mktree.c +++ b/arch/powerpc/boot/mktree.c | |||
@@ -46,8 +46,8 @@ int main(int argc, char *argv[]) | |||
46 | struct stat st; | 46 | struct stat st; |
47 | boot_block_t bt; | 47 | boot_block_t bt; |
48 | 48 | ||
49 | if (argc < 3) { | 49 | if (argc < 5) { |
50 | fprintf(stderr, "usage: %s <zImage-file> <boot-image> [entry-point]\n",argv[0]); | 50 | fprintf(stderr, "usage: %s <zImage-file> <boot-image> <load address> <entry point>\n",argv[0]); |
51 | exit(1); | 51 | exit(1); |
52 | } | 52 | } |
53 | 53 | ||
@@ -61,10 +61,8 @@ int main(int argc, char *argv[]) | |||
61 | bt.bb_magic = htonl(0x0052504F); | 61 | bt.bb_magic = htonl(0x0052504F); |
62 | 62 | ||
63 | /* If we have the optional entry point parameter, use it */ | 63 | /* If we have the optional entry point parameter, use it */ |
64 | if (argc == 4) | 64 | bt.bb_dest = htonl(strtoul(argv[3], NULL, 0)); |
65 | bt.bb_dest = bt.bb_entry_point = htonl(strtoul(argv[3], NULL, 0)); | 65 | bt.bb_entry_point = htonl(strtoul(argv[4], NULL, 0)); |
66 | else | ||
67 | bt.bb_dest = bt.bb_entry_point = htonl(0x500000); | ||
68 | 66 | ||
69 | /* We know these from the linker command. | 67 | /* We know these from the linker command. |
70 | * ...and then move it up into memory a little more so the | 68 | * ...and then move it up into memory a little more so the |
diff --git a/arch/powerpc/boot/treeboot-ebony.c b/arch/powerpc/boot/treeboot-ebony.c new file mode 100644 index 000000000000..8436a9c55192 --- /dev/null +++ b/arch/powerpc/boot/treeboot-ebony.c | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * Old U-boot compatibility for Ebony | ||
3 | * | ||
4 | * Author: David Gibson <david@gibson.dropbear.id.au> | ||
5 | * | ||
6 | * Copyright 2007 David Gibson, IBM Corporatio. | ||
7 | * Based on cuboot-83xx.c, which is: | ||
8 | * Copyright (c) 2007 Freescale Semiconductor, Inc. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify it | ||
11 | * under the terms of the GNU General Public License version 2 as published | ||
12 | * by the Free Software Foundation. | ||
13 | */ | ||
14 | |||
15 | #include "ops.h" | ||
16 | #include "stdio.h" | ||
17 | #include "44x.h" | ||
18 | |||
19 | extern char _end[]; | ||
20 | |||
21 | BSS_STACK(4096); | ||
22 | |||
23 | #define OPENBIOS_MAC_BASE 0xfffffe0c | ||
24 | #define OPENBIOS_MAC_OFFSET 0xc | ||
25 | |||
26 | void platform_init(void) | ||
27 | { | ||
28 | unsigned long end_of_ram = 0x8000000; | ||
29 | unsigned long avail_ram = end_of_ram - (unsigned long)_end; | ||
30 | |||
31 | simple_alloc_init(_end, avail_ram, 32, 64); | ||
32 | ebony_init((u8 *)OPENBIOS_MAC_BASE, | ||
33 | (u8 *)(OPENBIOS_MAC_BASE + OPENBIOS_MAC_OFFSET)); | ||
34 | } | ||
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper index 1ea208096b15..2ed8b8b3f0ec 100755 --- a/arch/powerpc/boot/wrapper +++ b/arch/powerpc/boot/wrapper | |||
@@ -231,4 +231,12 @@ cuboot*) | |||
231 | mkimage -A ppc -O linux -T kernel -C gzip -a "$base" -e "$entry" \ | 231 | mkimage -A ppc -O linux -T kernel -C gzip -a "$base" -e "$entry" \ |
232 | $uboot_version -d "$ofile".bin.gz "$ofile" | 232 | $uboot_version -d "$ofile".bin.gz "$ofile" |
233 | ;; | 233 | ;; |
234 | treeboot*) | ||
235 | mv "$ofile" "$ofile.elf" | ||
236 | $object/mktree "$ofile.elf" "$ofile" "$base" "$entry" | ||
237 | if [ -z "$cacheit" ]; then | ||
238 | rm -f "$ofile.elf" | ||
239 | fi | ||
240 | exit 0 | ||
241 | ;; | ||
234 | esac | 242 | esac |