Linux-2.6.12-rc2
[safe/jmp/linux-2.6] / arch / h8300 / platform / h8s / edosk2674 / crt0_ram.S
1 /*
2  *  linux/arch/h8300/platform/h8s/edosk2674/crt0_ram.S
3  *
4  *  Yoshinori Sato <ysato@users.sourceforge.jp>
5  *
6  *  Platform depend startup
7  *  Target Archtecture: EDOSK-2674
8  *  Memory Layout     : RAM
9  */
10
11 #define ASSEMBLY
12
13 #include <linux/config.h>
14 #include <asm/linkage.h>
15 #include <asm/regs267x.h>
16                         
17 #if !defined(CONFIG_BLKDEV_RESERVE)
18 #if defined(CONFIG_GDB_DEBUG)
19 #define RAMEND (__ramend - 0xc000)
20 #else
21 #define RAMEND __ramend
22 #endif
23 #else
24 #define RAMEND CONFIG_BLKDEV_RESERVE_ADDRESS
25 #endif
26         
27         .global SYMBOL_NAME(_start)
28         .global SYMBOL_NAME(_command_line)
29         .global SYMBOL_NAME(_platform_gpio_table)
30         .global SYMBOL_NAME(_target_name)
31         
32         .h8300s
33
34         .section .text
35         .file   "crt0_ram.S"
36
37         /* CPU Reset entry */
38 SYMBOL_NAME_LABEL(_start)
39         mov.l   #RAMEND,sp
40         ldc     #0x80,ccr
41         ldc     #0x00,exr
42
43         /* Peripheral Setup */
44         bclr    #4,@INTCR:8     /* interrupt mode 2 */
45         bset    #5,@INTCR:8
46         bclr    #0,@IER+1:16
47         bset    #1,@ISCRL+1:16  /* IRQ0 Positive Edge */
48         bclr    #0,@ISCRL+1:16
49
50 #if defined(CONFIG_MTD_UCLINUX)
51         /* move romfs image */
52         jsr     @__move_romfs   
53 #endif
54         
55         /* .bss clear */
56         mov.l   #__sbss,er5
57         mov.l   er5,er6
58         mov.l   #__ebss,er4
59         sub.l   er5,er4
60         shlr    #2,er4
61         sub.l   er0,er0
62 1:      
63         mov.l   er0,@er5
64         adds    #4,er5
65         dec.l   #1,er4
66         bne     1b
67
68         /* copy kernel commandline */
69         mov.l   #COMMAND_START,er5
70         mov.l   #SYMBOL_NAME(command_line),er6
71         mov.w   #512,r4
72         eepmov.w
73
74         /* uClinux kernel start */
75         ldc     #0x90,ccr       /* running kernel */
76         mov.l   #SYMBOL_NAME(init_thread_union),sp
77         add.l   #0x2000,sp
78         jsr     @_start_kernel
79 _exit:
80
81         jmp     _exit
82
83         rts
84
85         /* I/O port assign information */
86 __platform_gpio_table:  
87         mov.l   #gpio_table,er0
88         rts
89
90 gpio_table:
91         ;; P1DDR
92         ;;      used,ddr
93         .byte   0x00,0x00
94         ;; P2DDR
95         .byte   0x00,0x00
96         ;; P3DDR
97         .byte   0x3f,0x3a
98         ;; dummy
99         .byte   0x00,0x00
100         ;; P5DDR
101         .byte   0x00,0x00
102         ;; P6DDR
103         .byte   0x00,0x00
104         ;; P7DDR
105         .byte   0x00,0x00
106         ;; P8DDR
107         .byte   0x00,0x00
108         ;; dummy
109         .byte   0x00,0x00
110         ;; PADDR
111         .byte   0xff,0xff
112         ;; PBDDR
113         .byte   0xff,0x00
114         ;; PCDDR
115         .byte   0xff,0x00
116         ;; PDDDR
117         .byte   0xff,0x00
118         ;; PEDDR
119         .byte   0xff,0x00
120         ;; PFDDR
121         .byte   0xff,0xff
122         ;; PGDDR
123         .byte   0x0f,0x0f
124         ;; PHDDR
125         .byte   0x0f,0x0f
126
127 __target_name:  
128         .asciz  "EDOSK-2674"
129         
130         .section .bootvec,"ax"
131         jmp     @SYMBOL_NAME(_start)