aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris/arch-v10/boot
diff options
context:
space:
mode:
Diffstat (limited to 'arch/cris/arch-v10/boot')
-rw-r--r--arch/cris/arch-v10/boot/Makefile24
-rw-r--r--arch/cris/arch-v10/boot/compressed/Makefile48
-rw-r--r--arch/cris/arch-v10/boot/compressed/misc.c6
-rw-r--r--arch/cris/arch-v10/boot/rescue/Makefile56
-rw-r--r--arch/cris/arch-v10/boot/rescue/head.S129
-rw-r--r--arch/cris/arch-v10/boot/rescue/kimagerescue.S58
-rw-r--r--arch/cris/arch-v10/boot/rescue/testrescue.S12
7 files changed, 158 insertions, 175 deletions
diff --git a/arch/cris/arch-v10/boot/Makefile b/arch/cris/arch-v10/boot/Makefile
index e5b105851108..20c83a53caf3 100644
--- a/arch/cris/arch-v10/boot/Makefile
+++ b/arch/cris/arch-v10/boot/Makefile
@@ -1,13 +1,21 @@
1# 1#
2# arch/cris/boot/Makefile 2# arch/cris/arch-v10/boot/Makefile
3# 3#
4target = $(target_boot_dir)
5src = $(src_boot_dir)
6 4
7zImage: compressed/vmlinuz 5OBJCOPY = objcopy-cris
6OBJCOPYFLAGS = -O binary --remove-section=.bss
8 7
9compressed/vmlinuz: 8subdir- := compressed rescue
10 @$(MAKE) -f $(src)/compressed/Makefile $(target_compressed_dir)/vmlinuz 9targets := Image
11 10
12clean: 11$(obj)/Image: vmlinux FORCE
13 @$(MAKE) -f $(src)/compressed/Makefile clean 12 $(call if_changed,objcopy)
13 @echo ' Kernel: $@ is ready'
14
15$(obj)/compressed/vmlinux: $(obj)/Image FORCE
16 $(Q)$(MAKE) $(build)=$(obj)/compressed $@
17 $(Q)$(MAKE) $(build)=$(obj)/rescue $(obj)/rescue/rescue.bin
18
19$(obj)/zImage: $(obj)/compressed/vmlinux
20 @cp $< $@
21 @echo ' Kernel: $@ is ready'
diff --git a/arch/cris/arch-v10/boot/compressed/Makefile b/arch/cris/arch-v10/boot/compressed/Makefile
index 6584a44820f4..4a031cb27eb9 100644
--- a/arch/cris/arch-v10/boot/compressed/Makefile
+++ b/arch/cris/arch-v10/boot/compressed/Makefile
@@ -1,45 +1,35 @@
1# 1#
2# create a compressed vmlinuz image from the binary vmlinux.bin file 2# arch/cris/arch-v10/boot/compressed/Makefile
3# 3#
4target = $(target_compressed_dir)
5src = $(src_compressed_dir)
6 4
7CC = gcc-cris -melf $(LINUXINCLUDE) 5CC = gcc-cris -melf $(LINUXINCLUDE)
8CFLAGS = -O2 6ccflags-y += -O2
9LD = ld-cris 7LD = ld-cris
8ldflags-y += -T $(obj)/decompress.ld
9OBJECTS = $(obj)/head.o $(obj)/misc.o
10OBJCOPY = objcopy-cris 10OBJCOPY = objcopy-cris
11OBJCOPYFLAGS = -O binary --remove-section=.bss 11OBJCOPYFLAGS = -O binary --remove-section=.bss
12OBJECTS = $(target)/head.o $(target)/misc.o
13 12
14# files to compress 13quiet_cmd_image = BUILD $@
15SYSTEM = $(objtree)/vmlinux.bin 14cmd_image = cat $(obj)/decompress.bin $(obj)/piggy.gz > $@
16 15
17all: $(target_compressed_dir)/vmlinuz 16targets := vmlinux piggy.gz decompress.o decompress.bin
18 17
19$(target)/decompress.bin: $(OBJECTS) 18$(obj)/decompress.o: $(OBJECTS) FORCE
20 $(LD) -T $(src)/decompress.ld -o $(target)/decompress.o $(OBJECTS) 19 $(call if_changed,ld)
21 $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/decompress.o $(target)/decompress.bin
22 20
23# Create vmlinuz image in top-level build directory 21$(obj)/decompress.bin: $(obj)/decompress.o FORCE
24$(target_compressed_dir)/vmlinuz: $(target) piggy.img $(target)/decompress.bin 22 $(call if_changed,objcopy)
25 @echo " COMPR vmlinux.bin --> vmlinuz"
26 @cat $(target)/decompress.bin piggy.img > $(target_compressed_dir)/vmlinuz
27 @rm -f piggy.img
28 23
29$(target)/head.o: $(src)/head.S 24$(obj)/head.o: $(obj)/head.S .config
30 $(CC) -D__ASSEMBLY__ -traditional -c $< -o $@ 25 @$(CC) -D__ASSEMBLY__ -traditional -c $< -o $@
31 26
32$(target)/misc.o: $(src)/misc.c 27$(obj)/misc.o: $(obj)/misc.c .config
33 $(CC) -D__KERNEL__ -c $< -o $@ 28 @$(CC) -D__KERNEL__ -c $< -o $@
34 29
35# gzip the kernel image 30$(obj)/vmlinux: $(obj)/piggy.gz $(obj)/decompress.bin FORCE
31 $(call if_changed,image)
36 32
37piggy.img: $(SYSTEM) 33$(obj)/piggy.gz: $(obj)/../Image FORCE
38 @cat $(SYSTEM) | gzip -f -9 > piggy.img 34 $(call if_changed,gzip)
39
40$(target):
41 mkdir -p $(target)
42
43clean:
44 rm -f piggy.img $(objtree)/vmlinuz
45 35
diff --git a/arch/cris/arch-v10/boot/compressed/misc.c b/arch/cris/arch-v10/boot/compressed/misc.c
index e205d2e7e089..9a43ab19391e 100644
--- a/arch/cris/arch-v10/boot/compressed/misc.c
+++ b/arch/cris/arch-v10/boot/compressed/misc.c
@@ -1,15 +1,13 @@
1/* 1/*
2 * misc.c 2 * misc.c
3 * 3 *
4 * $Id: misc.c,v 1.6 2003/10/27 08:04:31 starvik Exp $ 4 * This is a collection of several routines from gzip-1.0.3
5 *
6 * This is a collection of several routines from gzip-1.0.3
7 * adapted for Linux. 5 * adapted for Linux.
8 * 6 *
9 * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 7 * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
10 * puts by Nick Holloway 1993, better puts by Martin Mares 1995 8 * puts by Nick Holloway 1993, better puts by Martin Mares 1995
11 * adaptation for Linux/CRIS Axis Communications AB, 1999 9 * adaptation for Linux/CRIS Axis Communications AB, 1999
12 * 10 *
13 */ 11 */
14 12
15/* where the piggybacked kernel image expects itself to live. 13/* where the piggybacked kernel image expects itself to live.
diff --git a/arch/cris/arch-v10/boot/rescue/Makefile b/arch/cris/arch-v10/boot/rescue/Makefile
index 8be9b3130312..2e5045b9e19c 100644
--- a/arch/cris/arch-v10/boot/rescue/Makefile
+++ b/arch/cris/arch-v10/boot/rescue/Makefile
@@ -1,56 +1,38 @@
1# 1#
2# Makefile for rescue code 2# Makefile for rescue (bootstrap) code
3# 3#
4target = $(target_rescue_dir)
5src = $(src_rescue_dir)
6 4
7CC = gcc-cris -mlinux $(LINUXINCLUDE) 5CC = gcc-cris -mlinux $(LINUXINCLUDE)
8CFLAGS = -O2 6ccflags-y += -O2
7asflags-y += -traditional
9LD = gcc-cris -mlinux -nostdlib 8LD = gcc-cris -mlinux -nostdlib
9ldflags-y += -T $(obj)/rescue.ld
10OBJCOPY = objcopy-cris 10OBJCOPY = objcopy-cris
11OBJCOPYFLAGS = -O binary --remove-section=.bss 11OBJCOPYFLAGS = -O binary --remove-section=.bss
12obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o
13OBJECT := $(obj)/head.o
12 14
13all: $(target)/rescue.bin $(target)/testrescue.bin $(target)/kimagerescue.bin 15targets := rescue.o rescue.bin
14 16
15$(target)/rescue.bin: $(target) $(target)/head.o 17$(obj)/rescue.o: $(OBJECT) FORCE
16 $(LD) -T $(src)/rescue.ld -o $(target)/rescue.o $(target)/head.o 18 $(call if_changed,ld)
17 $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/rescue.o $(target)/rescue.bin
18# Place a copy in top-level build directory
19 cp -p $(target)/rescue.bin $(objtree)
20 19
21$(target)/testrescue.bin: $(target) $(target)/testrescue.o 20$(obj)/rescue.bin: $(obj)/rescue.o FORCE
22 $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/testrescue.o tr.bin 21 $(call if_changed,objcopy)
22 cp -p $(obj)/rescue.bin $(objtree)
23
24$(obj)/testrescue.bin: $(obj)/testrescue.o
25 $(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/testrescue.o tr.bin
23# Pad it to 784 bytes 26# Pad it to 784 bytes
24 dd if=/dev/zero of=tmp2423 bs=1 count=784 27 dd if=/dev/zero of=tmp2423 bs=1 count=784
25 cat tr.bin tmp2423 >testrescue_tmp.bin 28 cat tr.bin tmp2423 >testrescue_tmp.bin
26 dd if=testrescue_tmp.bin of=$(target)/testrescue.bin bs=1 count=784 29 dd if=testrescue_tmp.bin of=$(obj)/testrescue.bin bs=1 count=784
27 rm tr.bin tmp2423 testrescue_tmp.bin 30 rm tr.bin tmp2423 testrescue_tmp.bin
28 31
29$(target)/kimagerescue.bin: $(target) $(target)/kimagerescue.o 32$(obj)/kimagerescue.bin: $(obj)/kimagerescue.o
30 $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/kimagerescue.o ktr.bin 33 $(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/kimagerescue.o ktr.bin
31# Pad it to 784 bytes, that's what the rescue loader expects 34# Pad it to 784 bytes, that's what the rescue loader expects
32 dd if=/dev/zero of=tmp2423 bs=1 count=784 35 dd if=/dev/zero of=tmp2423 bs=1 count=784
33 cat ktr.bin tmp2423 >kimagerescue_tmp.bin 36 cat ktr.bin tmp2423 >kimagerescue_tmp.bin
34 dd if=kimagerescue_tmp.bin of=$(target)/kimagerescue.bin bs=1 count=784 37 dd if=kimagerescue_tmp.bin of=$(obj)/kimagerescue.bin bs=1 count=784
35 rm ktr.bin tmp2423 kimagerescue_tmp.bin 38 rm ktr.bin tmp2423 kimagerescue_tmp.bin
36
37$(target):
38 mkdir -p $(target)
39
40$(target)/head.o: $(src)/head.S
41 $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
42
43$(target)/testrescue.o: $(src)/testrescue.S
44 $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
45
46$(target)/kimagerescue.o: $(src)/kimagerescue.S
47 $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
48
49clean:
50 rm -f $(target)/*.o $(target)/*.bin
51
52fastdep:
53
54modules:
55
56modules-install:
diff --git a/arch/cris/arch-v10/boot/rescue/head.S b/arch/cris/arch-v10/boot/rescue/head.S
index f223cc0c00bb..6ba7be8ac4a0 100644
--- a/arch/cris/arch-v10/boot/rescue/head.S
+++ b/arch/cris/arch-v10/boot/rescue/head.S
@@ -1,5 +1,4 @@
1/* $Id: head.S,v 1.7 2005/03/07 12:11:06 starvik Exp $ 1/*
2 *
3 * Rescue code, made to reside at the beginning of the 2 * Rescue code, made to reside at the beginning of the
4 * flash-memory. when it starts, it checks a partition 3 * flash-memory. when it starts, it checks a partition
5 * table at the first sector after the rescue sector. 4 * table at the first sector after the rescue sector.
@@ -23,20 +22,20 @@
23 * Partition table format: 22 * Partition table format:
24 * 23 *
25 * Code transparency: 24 * Code transparency:
26 * 25 *
27 * 2 bytes [opcode 'nop'] 26 * 2 bytes [opcode 'nop']
28 * 2 bytes [opcode 'di'] 27 * 2 bytes [opcode 'di']
29 * 4 bytes [opcode 'ba <offset>', 8-bit or 16-bit version] 28 * 4 bytes [opcode 'ba <offset>', 8-bit or 16-bit version]
30 * 2 bytes [opcode 'nop', delay slot] 29 * 2 bytes [opcode 'nop', delay slot]
31 * 30 *
32 * Table validation (at +10): 31 * Table validation (at +10):
33 * 32 *
34 * 2 bytes [magic/version word for partitiontable - 0xef, 0xbe] 33 * 2 bytes [magic/version word for partitiontable - 0xef, 0xbe]
35 * 2 bytes [length of all entries plus the end marker] 34 * 2 bytes [length of all entries plus the end marker]
36 * 4 bytes [checksum for the partitiontable itself] 35 * 4 bytes [checksum for the partitiontable itself]
37 * 36 *
38 * Entries, each with the following format, last has offset -1: 37 * Entries, each with the following format, last has offset -1:
39 * 38 *
40 * 4 bytes [offset in bytes, from start of flash] 39 * 4 bytes [offset in bytes, from start of flash]
41 * 4 bytes [length in bytes of partition] 40 * 4 bytes [length in bytes of partition]
42 * 4 bytes [checksum, simple longword sum] 41 * 4 bytes [checksum, simple longword sum]
@@ -47,9 +46,9 @@
47 * End marker 46 * End marker
48 * 47 *
49 * 4 bytes [-1] 48 * 4 bytes [-1]
50 * 49 *
51 * 10 bytes [0, padding] 50 * 10 bytes [0, padding]
52 * 51 *
53 * Bit 0 in flags signifies RW or RO. The rescue code only bothers 52 * Bit 0 in flags signifies RW or RO. The rescue code only bothers
54 * to check the checksum for RO partitions, since the others will 53 * to check the checksum for RO partitions, since the others will
55 * change their data without updating the checksums. A 1 in bit 0 54 * change their data without updating the checksums. A 1 in bit 0
@@ -59,26 +58,29 @@
59 * 58 *
60 * During the wait for serial input, the status LED will flash so the 59 * During the wait for serial input, the status LED will flash so the
61 * user knows something went wrong. 60 * user knows something went wrong.
62 * 61 *
63 * Copyright (C) 1999, 2000, 2001, 2002, 2003 Axis Communications AB 62 * Copyright (C) 1999-2007 Axis Communications AB
64 */ 63 */
65 64
65#ifdef CONFIG_ETRAX_AXISFLASHMAP
66
66#define ASSEMBLER_MACROS_ONLY 67#define ASSEMBLER_MACROS_ONLY
67#include <asm/arch/sv_addr_ag.h> 68#include <asm/arch/sv_addr_ag.h>
68 69
69 ;; The partitiontable is looked for at the first sector after the boot 70 ;; The partitiontable is looked for at the first sector after the boot
70 ;; sector. Sector size is 65536 bytes in all flashes we use. 71 ;; sector. Sector size is 65536 bytes in all flashes we use.
71 72
72#define PTABLE_START CONFIG_ETRAX_PTABLE_SECTOR 73#define PTABLE_START CONFIG_ETRAX_PTABLE_SECTOR
73#define PTABLE_MAGIC 0xbeef 74#define PTABLE_MAGIC 0xbeef
74 75
75 ;; The normal Etrax100 on-chip boot ROM does serial boot at 0x380000f0. 76 ;; The normal Etrax100 on-chip boot ROM does serial boot at 0x380000f0.
76 ;; That is not where we put our downloaded serial boot-code. The length is 77 ;; That is not where we put our downloaded serial boot-code.
77 ;; enough for downloading code that loads the rest of itself (after 78 ;; The length is enough for downloading code that loads the rest
78 ;; having setup the DRAM etc). It is the same length as the on-chip 79 ;; of itself (after having setup the DRAM etc).
79 ;; ROM loads, so the same host loader can be used to load a rescued 80 ;; It is the same length as the on-chip ROM loads, so the same
80 ;; product as well as one booted through the Etrax serial boot code. 81 ;; host loader can be used to load a rescued product as well as
81 82 ;; one booted through the Etrax serial boot code.
83
82#define CODE_START 0x40000000 84#define CODE_START 0x40000000
83#define CODE_LENGTH 784 85#define CODE_LENGTH 784
84 86
@@ -102,7 +104,7 @@
102#define SERRECC R_SERIAL2_REC_CTRL 104#define SERRECC R_SERIAL2_REC_CTRL
103#define SERRDAT R_SERIAL2_REC_DATA 105#define SERRDAT R_SERIAL2_REC_DATA
104#define SERSTAT R_SERIAL2_STATUS 106#define SERSTAT R_SERIAL2_STATUS
105#endif 107#endif
106#ifdef CONFIG_ETRAX_RESCUE_SER3 108#ifdef CONFIG_ETRAX_RESCUE_SER3
107#define SERXOFF R_SERIAL3_XOFF 109#define SERXOFF R_SERIAL3_XOFF
108#define SERBAUD R_SERIAL3_BAUD 110#define SERBAUD R_SERIAL3_BAUD
@@ -115,60 +117,61 @@
115#define RAM_INIT_MAGIC 0x56902387 117#define RAM_INIT_MAGIC 0x56902387
116 118
117 .text 119 .text
118 120
119 ;; This is the entry point of the rescue code 121 ;; This is the entry point of the rescue code
120 ;; 0x80000000 if loaded in flash (as it should be) 122 ;; 0x80000000 if loaded in flash (as it should be)
121 ;; since etrax actually starts at address 2 when booting from flash, we 123 ;; Since etrax actually starts at address 2 when booting from flash, we
122 ;; put a nop (2 bytes) here first so we dont accidentally skip the di 124 ;; put a nop (2 bytes) here first so we dont accidentally skip the di
123 125
124 nop 126 nop
125 di 127 di
126 128
127 jump in_cache ; enter cached area instead 129 jump in_cache ; enter cached area instead
128in_cache: 130in_cache:
129 131
130 132
131 ;; first put a jump test to give a possibility of upgrading the rescue code 133 ;; First put a jump test to give a possibility of upgrading the
132 ;; without erasing/reflashing the sector. we put a longword of -1 here and if 134 ;; rescue code without erasing/reflashing the sector.
133 ;; it is not -1, we jump using the value as jump target. since we can always 135 ;; We put a longword of -1 here and if it is not -1, we jump using
134 ;; change 1's to 0's without erasing the sector, it is possible to add new 136 ;; the value as jump target. Since we can always change 1's to 0's
137 ;; without erasing the sector, it is possible to add new
135 ;; code after this and altering the jumptarget in an upgrade. 138 ;; code after this and altering the jumptarget in an upgrade.
136 139
137jtcd: move.d [jumptarget], $r0 140jtcd: move.d [jumptarget], $r0
138 cmp.d 0xffffffff, $r0 141 cmp.d 0xffffffff, $r0
139 beq no_newjump 142 beq no_newjump
140 nop 143 nop
141 144
142 jump [$r0] 145 jump [$r0]
143 146
144jumptarget: 147jumptarget:
145 .dword 0xffffffff ; can be overwritten later to insert new code 148 .dword 0xffffffff ; can be overwritten later to insert new code
146 149
147no_newjump: 150no_newjump:
148#ifdef CONFIG_ETRAX_ETHERNET 151#ifdef CONFIG_ETRAX_ETHERNET
149 ;; Start MII clock to make sure it is running when tranceiver is reset 152 ;; Start MII clock to make sure it is running when tranceiver is reset
150 move.d 0x3, $r0 ; enable = on, phy = mii_clk 153 move.d 0x3, $r0 ; enable = on, phy = mii_clk
151 move.d $r0, [R_NETWORK_GEN_CONFIG] 154 move.d $r0, [R_NETWORK_GEN_CONFIG]
152#endif 155#endif
153 156
154 ;; We need to setup the bus registers before we start using the DRAM 157 ;; We need to setup the bus registers before we start using the DRAM
155#include "../../lib/dram_init.S" 158#include "../../lib/dram_init.S"
156 159
157 ;; we now should go through the checksum-table and check the listed 160 ;; we now should go through the checksum-table and check the listed
158 ;; partitions for errors. 161 ;; partitions for errors.
159 162
160 move.d PTABLE_START, $r3 163 move.d PTABLE_START, $r3
161 move.d [$r3], $r0 164 move.d [$r3], $r0
162 cmp.d NOP_DI, $r0 ; make sure the nop/di is there... 165 cmp.d NOP_DI, $r0 ; make sure the nop/di is there...
163 bne do_rescue 166 bne do_rescue
164 nop 167 nop
165 168
166 ;; skip the code transparency block (10 bytes). 169 ;; skip the code transparency block (10 bytes).
167 170
168 addq 10, $r3 171 addq 10, $r3
169 172
170 ;; check for correct magic 173 ;; check for correct magic
171 174
172 move.w [$r3+], $r0 175 move.w [$r3+], $r0
173 cmp.w PTABLE_MAGIC, $r0 176 cmp.w PTABLE_MAGIC, $r0
174 bne do_rescue ; didn't recognize - trig rescue 177 bne do_rescue ; didn't recognize - trig rescue
@@ -186,11 +189,11 @@ no_newjump:
186 cmp.d $r0, $r4 189 cmp.d $r0, $r4
187 bne do_rescue ; didn't match - trig rescue 190 bne do_rescue ; didn't match - trig rescue
188 nop 191 nop
189 192
190 ;; ptable is ok. validate each entry. 193 ;; ptable is ok. validate each entry.
191 194
192 moveq -1, $r7 195 moveq -1, $r7
193 196
194ploop: move.d [$r3+], $r1 ; partition offset (from ptable start) 197ploop: move.d [$r3+], $r1 ; partition offset (from ptable start)
195 bne notfirst ; check if it is the partition containing ptable 198 bne notfirst ; check if it is the partition containing ptable
196 nop ; yes.. 199 nop ; yes..
@@ -199,7 +202,7 @@ ploop: move.d [$r3+], $r1 ; partition offset (from ptable start)
199 sub.d $r8, $r2 ; minus the ptable length 202 sub.d $r8, $r2 ; minus the ptable length
200 ba bosse 203 ba bosse
201 nop 204 nop
202notfirst: 205notfirst:
203 cmp.d -1, $r1 ; the end of the ptable ? 206 cmp.d -1, $r1 ; the end of the ptable ?
204 beq flash_ok ; if so, the flash is validated 207 beq flash_ok ; if so, the flash is validated
205 move.d [$r3+], $r2 ; partition length 208 move.d [$r3+], $r2 ; partition length
@@ -213,47 +216,46 @@ bosse: move.d [$r3+], $r5 ; checksum
213 bpl 1f 216 bpl 1f
214 nop 217 nop
215 move.d $r1, $r7 ; remember boot partition offset 218 move.d $r1, $r7 ; remember boot partition offset
2161: 2191:
217
218 add.d PTABLE_START, $r1 220 add.d PTABLE_START, $r1
219 221
220 jsr checksum ; checksum the partition 222 jsr checksum ; checksum the partition
221 223
222 cmp.d $r0, $r5 224 cmp.d $r0, $r5
223 beq ploop ; checksums matched, go to next entry 225 beq ploop ; checksums matched, go to next entry
224 nop 226 nop
225 227
226 ;; otherwise fall through to the rescue code. 228 ;; otherwise fall through to the rescue code.
227 229
228do_rescue: 230do_rescue:
229 ;; setup port PA and PB default initial directions and data 231 ;; setup port PA and PB default initial directions and data
230 ;; (so we can flash LEDs, and so that DTR and others are set) 232 ;; (so we can flash LEDs, and so that DTR and others are set)
231 233
232 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DIR, $r0 234 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DIR, $r0
233 move.b $r0, [R_PORT_PA_DIR] 235 move.b $r0, [R_PORT_PA_DIR]
234 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA, $r0 236 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA, $r0
235 move.b $r0, [R_PORT_PA_DATA] 237 move.b $r0, [R_PORT_PA_DATA]
236 238
237 move.b CONFIG_ETRAX_DEF_R_PORT_PB_DIR, $r0 239 move.b CONFIG_ETRAX_DEF_R_PORT_PB_DIR, $r0
238 move.b $r0, [R_PORT_PB_DIR] 240 move.b $r0, [R_PORT_PB_DIR]
239 move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA, $r0 241 move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA, $r0
240 move.b $r0, [R_PORT_PB_DATA] 242 move.b $r0, [R_PORT_PB_DATA]
241 243
242 ;; setup the serial port at 115200 baud 244 ;; setup the serial port at 115200 baud
243 245
244 moveq 0, $r0 246 moveq 0, $r0
245 move.d $r0, [SERXOFF] 247 move.d $r0, [SERXOFF]
246 248
247 move.b 0x99, $r0 249 move.b 0x99, $r0
248 move.b $r0, [SERBAUD] ; 115.2kbaud for both transmit and receive 250 move.b $r0, [SERBAUD] ; 115.2kbaud for both transmit and receive
249 251
250 move.b 0x40, $r0 ; rec enable 252 move.b 0x40, $r0 ; rec enable
251 move.b $r0, [SERRECC] 253 move.b $r0, [SERRECC]
252 254
253 moveq 0, $r1 ; "timer" to clock out a LED red flash 255 moveq 0, $r1 ; "timer" to clock out a LED red flash
254 move.d CODE_START, $r3 ; destination counter 256 move.d CODE_START, $r3 ; destination counter
255 movu.w CODE_LENGTH, $r4; length 257 movu.w CODE_LENGTH, $r4; length
256 258
257wait_ser: 259wait_ser:
258 addq 1, $r1 260 addq 1, $r1
259#ifndef CONFIG_ETRAX_NO_LEDS 261#ifndef CONFIG_ETRAX_NO_LEDS
@@ -272,20 +274,20 @@ wait_ser:
272 nop 274 nop
2731: not $r0 ; clear bit 2751: not $r0 ; clear bit
274 and.d $r0, $r2 276 and.d $r0, $r2
2752: 2772:
276#ifdef CONFIG_ETRAX_PA_LEDS 278#ifdef CONFIG_ETRAX_PA_LEDS
277 move.b $r2, [R_PORT_PA_DATA] 279 move.b $r2, [R_PORT_PA_DATA]
278#endif 280#endif
279#ifdef CONFIG_ETRAX_PB_LEDS 281#ifdef CONFIG_ETRAX_PB_LEDS
280 move.b $r2, [R_PORT_PB_DATA] 282 move.b $r2, [R_PORT_PB_DATA]
281#endif 283#endif
282#ifdef CONFIG_ETRAX_90000000_LEDS 284#ifdef CONFIG_ETRAX_90000000_LEDS
283 move.b $r2, [0x90000000] 285 move.b $r2, [0x90000000]
284#endif 286#endif
285#endif 287#endif
286 288
287 ;; check if we got something on the serial port 289 ;; check if we got something on the serial port
288 290
289 move.b [SERSTAT], $r0 291 move.b [SERSTAT], $r0
290 btstq 0, $r0 ; data_avail 292 btstq 0, $r0 ; data_avail
291 bpl wait_ser 293 bpl wait_ser
@@ -295,14 +297,15 @@ wait_ser:
295 297
296 move.b [SERRDAT], $r0 298 move.b [SERRDAT], $r0
297 move.b $r0, [$r3+] 299 move.b $r0, [$r3+]
298 300
299 subq 1, $r4 ; decrease length 301 subq 1, $r4 ; decrease length
300 bne wait_ser 302 bne wait_ser
301 nop 303 nop
302 304
303 ;; jump into downloaded code 305 ;; jump into downloaded code
304 306
305 move.d RAM_INIT_MAGIC, $r8 ; Tell next product that DRAM is initialized 307 move.d RAM_INIT_MAGIC, $r8 ; Tell next product that DRAM is
308 ; initialized
306 jump CODE_START 309 jump CODE_START
307 310
308flash_ok: 311flash_ok:
@@ -313,7 +316,8 @@ flash_ok:
313 nop 316 nop
314 move.d PTABLE_START, $r7; otherwise use the ptable start 317 move.d PTABLE_START, $r7; otherwise use the ptable start
3151: 3181:
316 move.d RAM_INIT_MAGIC, $r8 ; Tell next product that DRAM is initialized 319 move.d RAM_INIT_MAGIC, $r8 ; Tell next product that DRAM is
320 ; initialized
317 jump $r7 ; boot! 321 jump $r7 ; boot!
318 322
319 323
@@ -327,7 +331,8 @@ checksum:
327 moveq 0, $r0 331 moveq 0, $r0
328 moveq CONFIG_ETRAX_FLASH1_SIZE, $r6 332 moveq CONFIG_ETRAX_FLASH1_SIZE, $r6
329 333
330 ;; If the first physical flash memory is exceeded wrap to the second one. 334 ;; If the first physical flash memory is exceeded wrap to the
335 ;; second one
331 btstq 26, $r1 ; Are we addressing first flash? 336 btstq 26, $r1 ; Are we addressing first flash?
332 bpl 1f 337 bpl 1f
333 nop 338 nop
@@ -351,3 +356,5 @@ checksum:
3513: move.d MEM_CSE1_START, $r1 ; wrap to second flash 3563: move.d MEM_CSE1_START, $r1 ; wrap to second flash
352 ba 2b 357 ba 2b
353 nop 358 nop
359
360#endif
diff --git a/arch/cris/arch-v10/boot/rescue/kimagerescue.S b/arch/cris/arch-v10/boot/rescue/kimagerescue.S
index cbccd6316d39..55eeff8bb08e 100644
--- a/arch/cris/arch-v10/boot/rescue/kimagerescue.S
+++ b/arch/cris/arch-v10/boot/rescue/kimagerescue.S
@@ -1,5 +1,4 @@
1/* $Id: kimagerescue.S,v 1.1 2001/12/17 13:59:27 bjornw Exp $ 1/*
2 *
3 * Rescue code to be prepended on a kimage and copied to the 2 * Rescue code to be prepended on a kimage and copied to the
4 * rescue serial port. 3 * rescue serial port.
5 * This is called from the rescue code, it will copy received data to 4 * This is called from the rescue code, it will copy received data to
@@ -7,13 +6,13 @@
7 */ 6 */
8 7
9#define ASSEMBLER_MACROS_ONLY 8#define ASSEMBLER_MACROS_ONLY
10#include <asm/sv_addr_ag.h> 9#include <asm/arch/sv_addr_ag.h>
11 10
12#define CODE_START 0x40004000 11#define CODE_START 0x40004000
13#define CODE_LENGTH 784 12#define CODE_LENGTH 784
14#define TIMEOUT_VALUE 1000 13#define TIMEOUT_VALUE 1000
15 14
16 15
17#ifdef CONFIG_ETRAX_RESCUE_SER0 16#ifdef CONFIG_ETRAX_RESCUE_SER0
18#define SERXOFF R_SERIAL0_XOFF 17#define SERXOFF R_SERIAL0_XOFF
19#define SERBAUD R_SERIAL0_BAUD 18#define SERBAUD R_SERIAL0_BAUD
@@ -34,7 +33,7 @@
34#define SERRECC R_SERIAL2_REC_CTRL 33#define SERRECC R_SERIAL2_REC_CTRL
35#define SERRDAT R_SERIAL2_REC_DATA 34#define SERRDAT R_SERIAL2_REC_DATA
36#define SERSTAT R_SERIAL2_STATUS 35#define SERSTAT R_SERIAL2_STATUS
37#endif 36#endif
38#ifdef CONFIG_ETRAX_RESCUE_SER3 37#ifdef CONFIG_ETRAX_RESCUE_SER3
39#define SERXOFF R_SERIAL3_XOFF 38#define SERXOFF R_SERIAL3_XOFF
40#define SERBAUD R_SERIAL3_BAUD 39#define SERBAUD R_SERIAL3_BAUD
@@ -48,54 +47,55 @@
48 ;; 0x80000000 if loaded in flash (as it should be) 47 ;; 0x80000000 if loaded in flash (as it should be)
49 ;; since etrax actually starts at address 2 when booting from flash, we 48 ;; since etrax actually starts at address 2 when booting from flash, we
50 ;; put a nop (2 bytes) here first so we dont accidentally skip the di 49 ;; put a nop (2 bytes) here first so we dont accidentally skip the di
51 50
52 nop 51 nop
53 di 52 di
54#ifndef CONFIG_SVINTO_SIM 53#ifndef CONFIG_SVINTO_SIM
55 ;; setup port PA and PB default initial directions and data 54 ;; setup port PA and PB default initial directions and data
56 ;; (so we can flash LEDs, and so that DTR and others are set) 55 ;; (so we can flash LEDs, and so that DTR and others are set)
57 56
58 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DIR, $r0 57 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DIR, $r0
59 move.b $r0, [R_PORT_PA_DIR] 58 move.b $r0, [R_PORT_PA_DIR]
60 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA, $r0 59 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA, $r0
61 move.b $r0, [R_PORT_PA_DATA] 60 move.b $r0, [R_PORT_PA_DATA]
62 61
63 move.b CONFIG_ETRAX_DEF_R_PORT_PB_DIR, $r0 62 move.b CONFIG_ETRAX_DEF_R_PORT_PB_DIR, $r0
64 move.b $r0, [R_PORT_PB_DIR] 63 move.b $r0, [R_PORT_PB_DIR]
65 move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA, $r0 64 move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA, $r0
66 move.b $r0, [R_PORT_PB_DATA] 65 move.b $r0, [R_PORT_PB_DATA]
67 66
68 ;; We need to setup the bus registers before we start using the DRAM 67 ;; We need to setup the bus registers before we start using the DRAM
69#include "../../lib/dram_init.S" 68#include "../../lib/dram_init.S"
70 69
71#endif 70#endif
72 ;; Setup the stack to a suitably high address. 71 ;; Setup the stack to a suitably high address.
73 ;; We assume 8 MB is the minimum DRAM in an eLinux 72 ;; We assume 8 MB is the minimum DRAM in an eLinux
74 ;; product and put the sp at the top for now. 73 ;; product and put the sp at the top for now.
75 74
76 move.d 0x40800000, $sp 75 move.d 0x40800000, $sp
77 76
78 ;; setup the serial port at 115200 baud 77 ;; setup the serial port at 115200 baud
79 78
80 moveq 0, $r0 79 moveq 0, $r0
81 move.d $r0, [SERXOFF] 80 move.d $r0, [SERXOFF]
82 81
83 move.b 0x99, $r0 82 move.b 0x99, $r0
84 move.b $r0, [SERBAUD] ; 115.2kbaud for both transmit and receive 83 move.b $r0, [SERBAUD] ; 115.2kbaud for both transmit
84 ; and receive
85 85
86 move.b 0x40, $r0 ; rec enable 86 move.b 0x40, $r0 ; rec enable
87 move.b $r0, [SERRECC] 87 move.b $r0, [SERRECC]
88 88
89 89
90 moveq 0, $r1 ; "timer" to clock out a LED red flash 90 moveq 0, $r1 ; "timer" to clock out a LED red flash
91 move.d CODE_START, $r3 ; destination counter 91 move.d CODE_START, $r3 ; destination counter
92 move.d CODE_LENGTH, $r4 ; length 92 move.d CODE_LENGTH, $r4 ; length
93 move.d TIMEOUT_VALUE, $r5 ; "timeout" until jump 93 move.d TIMEOUT_VALUE, $r5 ; "timeout" until jump
94 94
95wait_ser: 95wait_ser:
96 addq 1, $r1 96 addq 1, $r1
97 subq 1, $r5 ; decrease timeout 97 subq 1, $r5 ; decrease timeout
98 beq jump_start ; timed out 98 beq jump_start ; timed out
99 nop 99 nop
100#ifndef CONFIG_ETRAX_NO_LEDS 100#ifndef CONFIG_ETRAX_NO_LEDS
101#ifdef CONFIG_ETRAX_PA_LEDS 101#ifdef CONFIG_ETRAX_PA_LEDS
@@ -111,21 +111,21 @@ wait_ser:
111 or.d $r0, $r2 ; set bit 111 or.d $r0, $r2 ; set bit
112 ba 2f 112 ba 2f
113 nop 113 nop
1141: not $r0 ; clear bit 1141: not $r0 ; clear bit
115 and.d $r0, $r2 115 and.d $r0, $r2
1162: 1162:
117#ifdef CONFIG_ETRAX_PA_LEDS 117#ifdef CONFIG_ETRAX_PA_LEDS
118 move.b $r2, [R_PORT_PA_DATA] 118 move.b $r2, [R_PORT_PA_DATA]
119#endif 119#endif
120#ifdef CONFIG_ETRAX_PB_LEDS 120#ifdef CONFIG_ETRAX_PB_LEDS
121 move.b $r2, [R_PORT_PB_DATA] 121 move.b $r2, [R_PORT_PB_DATA]
122#endif 122#endif
123#endif 123#endif
124 124
125 ;; check if we got something on the serial port 125 ;; check if we got something on the serial port
126 126
127 move.b [SERSTAT], $r0 127 move.b [SERSTAT], $r0
128 btstq 0, $r0 ; data_avail 128 btstq 0, $r0 ; data_avail
129 bpl wait_ser 129 bpl wait_ser
130 nop 130 nop
131 131
@@ -134,7 +134,7 @@ wait_ser:
134 move.b [SERRDAT], $r0 134 move.b [SERRDAT], $r0
135 move.b $r0, [$r3+] 135 move.b $r0, [$r3+]
136 move.d TIMEOUT_VALUE, $r5 ; reset "timeout" 136 move.d TIMEOUT_VALUE, $r5 ; reset "timeout"
137 subq 1, $r4 ; decrease length 137 subq 1, $r4 ; decrease length
138 bne wait_ser 138 bne wait_ser
139 nop 139 nop
140jump_start: 140jump_start:
diff --git a/arch/cris/arch-v10/boot/rescue/testrescue.S b/arch/cris/arch-v10/boot/rescue/testrescue.S
index 566a9f341254..2d937f9afe23 100644
--- a/arch/cris/arch-v10/boot/rescue/testrescue.S
+++ b/arch/cris/arch-v10/boot/rescue/testrescue.S
@@ -1,13 +1,12 @@
1/* $Id: testrescue.S,v 1.1 2001/12/17 13:59:27 bjornw Exp $ 1/*
2 *
3 * Simple testcode to download by the rescue block. 2 * Simple testcode to download by the rescue block.
4 * Just lits some LEDs to show it was downloaded correctly. 3 * Just lights some LEDs to show it was downloaded correctly.
5 * 4 *
6 * Copyright (C) 1999 Axis Communications AB 5 * Copyright (C) 1999 Axis Communications AB
7 */ 6 */
8 7
9#define ASSEMBLER_MACROS_ONLY 8#define ASSEMBLER_MACROS_ONLY
10#include <asm/sv_addr_ag.h> 9#include <asm/arch/sv_addr_ag.h>
11 10
12 .text 11 .text
13 12
@@ -16,11 +15,10 @@
16 moveq -1, $r2 15 moveq -1, $r2
17 move.b $r2, [R_PORT_PA_DIR] 16 move.b $r2, [R_PORT_PA_DIR]
18 moveq 0, $r2 17 moveq 0, $r2
19 move.b $r2, [R_PORT_PA_DATA] 18 move.b $r2, [R_PORT_PA_DATA]
20 19
21endless: 20endless:
22 nop 21 nop
23 ba endless 22 ba endless
24 nop 23 nop
25 24
26