]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/hal/fr30/skmb91302/v2_0/include/platform.inc
Initial revision
[karo-tx-redboot.git] / packages / hal / fr30 / skmb91302 / v2_0 / include / platform.inc
1 #ifndef CYGONCE_HAL_PLATFORM_INC
2 #define CYGONCE_HAL_PLATFORM_INC
3 ##=============================================================================
4 ##
5 ##      platform.inc
6 ##
7 ##      Fujitsu Starterkit MB91302 board assembler header file
8 ##
9 ##=============================================================================
10 #####ECOSGPLCOPYRIGHTBEGIN####
11 ## -------------------------------------------
12 ## This file is part of eCos, the Embedded Configurable Operating System.
13 ## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
14 ## Copyright (C) 2007 eCosCentric Ltd.
15 ##
16 ## eCos is free software; you can redistribute it and/or modify it under
17 ## the terms of the GNU General Public License as published by the Free
18 ## Software Foundation; either version 2 or (at your option) any later version.
19 ##
20 ## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
21 ## WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 ## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
23 ## for more details.
24 ##
25 ## You should have received a copy of the GNU General Public License along
26 ## with eCos; if not, write to the Free Software Foundation, Inc.,
27 ## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
28 ##
29 ## As a special exception, if other files instantiate templates or use macros
30 ## or inline functions from this file, or you compile this file and link it
31 ## with other works to produce a work based on this file, this file does not
32 ## by itself cause the resulting work to be covered by the GNU General Public
33 ## License. However the source code for this file must still be made available
34 ## in accordance with section (3) of the GNU General Public License.
35 ##
36 ## This exception does not invalidate any other reasons why a work based on
37 ## this file might be covered by the GNU General Public License.
38 ##
39 ## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
40 ## at http://sources.redhat.com/ecos/ecos-license/
41 ## -------------------------------------------
42 #####ECOSGPLCOPYRIGHTEND####
43 ##=============================================================================
44 #######DESCRIPTIONBEGIN####
45 ##
46 ## Author(s):   larsi
47 ## Contributors:
48 ## Date:        2007-07-09
49 ## Purpose:     Fujitsu Starterkit MB91302 board definitions.
50 ## Description: This file contains various definitions and macros that are
51 ##              useful for writing assembly code for the skmb91302 board.
52 ## Usage:
53 ##              #include <cyg/hal/platform.inc>
54 ##
55 ##
56 ##
57 ######DESCRIPTIONEND####
58 ##
59 ##=============================================================================
60
61 #include <cyg/hal/fr30.inc>
62
63
64 ##------------------------------------------------------------------------------
65 ## ext Bus (memory controller) initialisation macros
66 ##
67 ## flash part
68
69
70 #define CYGPKG_HAL_FR30_FLASH_INIT_DEFINED
71 ## flash init is empty for this platform because it is initialized in the
72 ## special hal_fr30_ram_startup_trampoline to map flash to 0x1000000
73 .macro hal_flash_init
74 .endm
75
76 ## and the following macro is used in the special
77 ## hal_fr30_ram_startup_trampoline for flash initialisation
78 .macro hal_flash_init_from_ram
79
80     ldi:20  #FR30_MB91301_ASR0, r10 ; CS0 area starts at
81     ldi:20  0x100,   r0             ; 0x01000000
82     sth     r0,     @r10            ;
83
84     ldi:20  #FR30_MB91301_ACR0, r11 ; configuration parameters for CS0
85     ldi:20  #0x7422,    r1          ; 8MB(0x0-0x7FFFFF),16bit data bus,
86     sth     r1,     @r11            ; pre-fetch off, single access,
87                                     ; write enable, big endian,
88                                     ; normal access(asynchronous),
89                                     ; WR pin enabled for write,
90                                     ; wait by RDY pin disabled
91
92     ldi:20  #FR30_MB91301_AWR0, r12 ; first access auto-wait 3cyc
93     ldi:20  #0x3378,    r2          ; inpage access auto-wait 3cyc
94     sth     r2,     @r12            ; read/write idle 1cyc
95                                     ; write recover 3cyc
96                                     ; async write strobe outp enabled
97                                     ; CS delay enabled
98                                     ; CS read/write setup delay 0
99                                     ; RD/WR -> CS hold extension 0 cyc
100
101     ldi:20  #FR30_MB91301_PFR9, r13 ; WRn, BAAE, ASXE enable
102     ldi:8   #0x7e,  r3              ;
103     stb     r3,     @r13            ;
104
105 ## following would chip select enable
106 ## we only use cs0 until here, which is already set by reset
107
108 .endm
109
110
111 ## sdram part
112
113
114 #define CYGPKG_HAL_FR30_MEMC_INIT_DEFINED
115
116 .macro hal_memc_init
117
118 ## The following instruction is without function. It is only to reference
119 ## hal_fr30_rom_startup_trampoline, because when not referenced the linker
120 ## does not include the file platform.S in the link. If somewhen some other
121 ## referenced code appears in platform.S the instruction here can be deleted
122 ## (including the surrounding macro)!
123
124 #if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM)
125     ldi:32  #hal_fr30_rom_startup_trampoline, r10
126 #endif
127
128     ldi:20  #FR30_MB91301_ASR6, r10 ; CS6 area starts at
129     ldi:20  0x200,   r0             ; 0x02000000
130     sth     r0,     @r10            ;
131
132     ldi:20  #FR30_MB91301_ACR6, r11 ; configuration parameters for CS6
133     ldi:20  #0x7868,    r1          ; 64MB(0x2000000-0x27FFFFF),32bit data bus,
134     sth     r1,     @r11            ; pre-fetch on, single access(no burst),
135                                     ; write enable, big endian,
136                                     ; FCRAM setting
137
138     ldi:20  #FR30_MB91301_AWR6, r12 ; first access auto-wait 1cyc ??
139     ldi:20  #0x1159,    r2          ; inpage access auto-wait 1cyc ??
140     sth     r2,     @r12            ; read/write idle 1cyc ??
141                                     ; write recover 1cyc ??
142                                     ; async write strobe outp enabled ??
143                                     ; CS delay disabled ??
144                                     ; CS read/write setup delay 0 ??
145                                     ; RD/WR -> CS hold extension 1 cyc ??
146                                     ; see Hardware Manual page 156ff
147
148     ldi:20  #FR30_MB91301_MCRA, r13 ; 8 columns, single write,
149     ldi:8   #0x07,  r3              ; 4 banks for burst write,
150     stb     r3,     @r13            ; 4 active banks
151
152     ldi:20  #FR30_MB91301_PFR9, r10 ; enable WRn, BAAE, ASXE,
153     ldi:8   #0x7e,  r0              ; sysclk, MCKE, MCKEE
154     stb     r0,     @r10
155
156     ldi:20  #FR30_MB91301_PFR8, r11 ; enable WR3XE, WR2XE, WR1XE
157     ldi:8   #0xe0,  r1
158     stb     r1, @r11
159
160     ldi:20  #FR30_MB91301_CSER, r12 ; switch on CS6 & CS0
161     ldi:8   #0x41,  r2
162     stb     r2,     @r12
163
164     ldi:20  #FR30_MB91301_RCR,  r13 ; power on SDRAM I/F
165     ldi:20  #0xe247,    r3          ; 0xe247 -> 0xe24f
166     sth     r3,     @r13
167     ldi:20  #0xe24f,    r3
168     sth     r3,     @r13
169
170 .endm
171
172 #------------------------------------------------------------------------------
173 ## Vector table for storage. platform.S defines a vector table and wants to
174 ## override the one from variant.S with this define
175
176 #define CYGPKG_HAL_FR30_ROM_VECTORS_DEFINED
177
178 #------------------------------------------------------------------------------
179 # Difference of the flash memory from the linkers LMA (loadmemoryaddress) after
180 # the new mapping in (mapping is done in hal_fr30_ram_startup_trampoline).
181
182 #define CYGPKG_HAL_FR30_LMA_OFFSET  0x1000000
183
184
185
186 #------------------------------------------------------------------------------
187 #endif // ifndef CYGONCE_HAL_PLATFORM_INC
188 # end of platform.inc