OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [frv/] [mb93091/] [current/] [include/] [platform.inc] - Blame information for rev 838

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
#ifndef _CYGONCE_PLATFORM_INC_H_
2
#define _CYGONCE_PLATFORM_INC_H_
3
// #========================================================================
4
// #
5
// #    platform.inc
6
// #
7
// #    Fujitsu platform specific setups (assembler macros)
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 Free Software Foundation, Inc.
14
//
15
// eCos is free software; you can redistribute it and/or modify it under
16
// the terms of the GNU General Public License as published by the Free
17
// Software Foundation; either version 2 or (at your option) any later
18
// version.
19
//
20
// eCos is distributed in the hope that it will be useful, but WITHOUT
21
// ANY 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
26
// along with eCos; if not, write to the Free Software Foundation, Inc.,
27
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
28
//
29
// As a special exception, if other files instantiate templates or use
30
// macros or inline functions from this file, or you compile this file
31
// and link it with other works to produce a work based on this file,
32
// this file does not by itself cause the resulting work to be covered by
33
// the GNU General Public License. However the source code for this file
34
// must still be made available in accordance with section (3) of the GNU
35
// General Public License v2.
36
//
37
// This exception does not invalidate any other reasons why a work based
38
// on this file might be covered by the GNU General Public License.
39
// -------------------------------------------
40
// ####ECOSGPLCOPYRIGHTEND####
41
// #========================================================================
42
// ######DESCRIPTIONBEGIN####
43
// #
44
// # Author(s):     gthomas
45
// # Contributors:  gthomas
46
// # Date:          2001-09-16
47
// # Purpose:       Fujitsu (FRV400) platform specific setups
48
// # Description:   This file defines various macros used by the generic
49
// #                HAL startup code.
50
// #
51
// #####DESCRIPTIONEND####
52
// #
53
// #========================================================================
54
 
55
// This does not work in standalone mode on CB70.
56
//#define DEBUG_LEDS
57
 
58
// Display a value in the system LEDs
59
        .macro  LED n
60
#ifdef DEBUG_LEDS
61
        li      _MB93091_FPGA_GPHL,gr15
62
        lduhi   @(gr15,0),gr14
63
        srli    gr14,#8,gr14
64
        andicc  gr14,#0x80,gr14,icc0
65
        bne     icc0,0,999f
66
        sethi   #(_MB93091_MB_LEDS>>16),gr15
67
        setlo   #(_MB93091_MB_LEDS&0xFFFF),gr15
68
        setlos  #\n,gr14
69
        not     gr14,gr14
70
        sti     gr14,@(gr15,0)
71
      999:
72
#endif
73
        membar
74
        .endm
75
 
76
// Platform initialization - only the necessary bits required to get the
77
// board started from a cold reset.
78
        .macro  platform_init
79
        li      0x7FFF,gr4      // First, a good long spin
80
05:     nop
81
        subi    gr4,1,gr4
82
        cmp     gr4,gr0,icc0
83
        bne     icc0,0,05b
84
 
85
// First work out what kind of board we are, and set the bitmask which
86
// determines which elements from _platform_tab we use. In gr8:
87
//  bit 0 -- FR401, 64MiB   (CB11)
88
//  bit 1 -- FR403+, 128MiB (CB30,CB60)
89
//  bit 2 -- FR405,  64MiB  (CB70)
90
//  bit 3 -- FR555,  256MiB (CB41)
91
//  bit 4 -- VDK motherboard
92
//  bit 5 -- FR451-P 128MiB
93
 
94
        movsg   psr,gr4
95
        srli    gr4,#24,gr4
96
 
97
        setlos  #0x18,gr8
98
        cmpi    gr4,#0x31,icc0 // FR555
99
        beq     icc0,#0,plf_set
100
        cmpi    gr4,#0x11,icc0 // FR501
101
        beq     icc0,#0,plf_set
102
        cmpi    gr4,#0x12,icc0 // FR501A
103
        beq     icc0,#0,plf_set
104
 
105
        setlos  #0x11,gr8
106
        cmpi    gr4,#0x20,icc0 // FR401
107
        beq     icc0,#0,plf_set
108
        cmpi    gr4,#0x21,icc0 // FR401A
109
        beq     icc0,#0,plf_set
110
 
111
        setlos  #0x12,gr8
112
        cmpi    gr4,#0x22,icc0 // FR403
113
        beq     icc0,#0,plf_set
114
        cmpi    gr4,#0x50,icc0 // FR451
115
        beq     icc0,#0,plf_set_maybe_cb70
116
        cmpi    gr4,#0x40,icc0 // FR405
117
        bne     icc0,#0,plf_set // if _not_ FR405, try this one and pray
118
 
119
plf_set_maybe_cb70:
120
        // OK, it's an FR405 or an FR451.
121
        // Need to distinguish between CB60/CB70 or CB451-FPGA/CB451-F
122
        li      _MB93091_FPGA_VDKID,gr4
123
        lduhi   @(gr4,0),gr5
124
        cmpi    gr5,#0x46,icc0 // CB70 has this and it's 0x0046. CB60 doesn't.
125
        bne     icc0,#0,plf_set
126
        setlos  #0x04,gr8 // It's a CB70
127
        li      _MB93091_FPGA_GPHL,gr4
128
        lduhi   @(gr4,0),gr5
129
        andicc  gr5,#0x0100,gr0,icc0
130
        bne     icc0,0,no_mobo
131
        ori     gr8,0x10,gr8    // Add in the motherboard bit
132
 no_mobo:
133
        srli    gr5,#8,gr5
134
        andicc  gr5,#0x02,gr5,icc0
135
        bne     icc0,0,plf_set
136
        ori     gr8,0x20,gr8    // Add in the 451-P (extra SDRAM) bit
137
 
138
         // gr8 now holds correct bitmask
139
 
140
 plf_set:
141
        call    10f             // position independent way to get @_platform_tab
142
_platform_tab_fr4xx:
143
//
144
// SDRAM setups for FR4xx
145
//
146
//      .long   _MB93091_MB_LEDS,0x3003
147
//      .long   _FRV400_SDRAM_BR0,0x00000000    // SDRAM 0x0XXXXXXX
148
//      .long   _FRV400_SDRAM_AM0,0x0FF00000
149
 
150
//
151
// LOCAL bus setups for FR4xx
152
//
153
        .long   7,_FRV400_LBUS_CR0,0x03010D01     // ROM/FLASH 0xFF000000..0xFFFFFFFF
154
                                // 16 bits wide, 13 wait states, 1 idle
155
 
156
        .long   7,_FRV400_LBUS_BR1,0x10000000     // PCI bridge 0x10000000..0x100FFFFF
157
        .long   7,_FRV400_LBUS_AM1,0x000FFFFF
158
        .long   7,_FRV400_LBUS_CR1,0x00000000
159
 
160
        .long   7,_FRV400_LBUS_BR2,0x20000000     // SRAM, FPGA, PCI 0x20000000..0x2FFFFFFF
161
        .long   7,_FRV400_LBUS_AM2,0x0FFFFFFF
162
        .long   7,_FRV400_LBUS_CR2,0x00000000
163
 
164
        // organize rest into something sane
165
        .long   7,_FRV400_LBUS_BR3,0xF0300000
166
        .long   7,_FRV400_LBUS_AM3,0x000FFFFF
167
        .long   7,_FRV400_LBUS_CR3,0x00000000
168
 
169
        .long   6,_FRV400_LBUS_BR4,0xF0400000
170
        .long   6,_FRV400_LBUS_AM4,0x000FFFFF
171
        .long   6,_FRV400_LBUS_CR4,0x00000000
172
 
173
        .long   6,_FRV400_LBUS_BR5,0xF0500000
174
        .long   6,_FRV400_LBUS_AM5,0x000FFFFF
175
        .long   6,_FRV400_LBUS_CR5,0x00000000
176
 
177
        .long   4,_FRV400_LBUS_BR6,0xF0600000     // DM9000 on CB70 CPU card
178
        .long   4,_FRV400_LBUS_AM6,0x000FFFFF
179
        .long   4,_FRV400_LBUS_CR6,0x00400707
180
 
181
        .long   6,_FRV400_LBUS_BR7,0xF0700000
182
        .long   6,_FRV400_LBUS_AM7,0x000FFFFF
183
        .long   6,_FRV400_LBUS_CR7,0x00000000
184
 
185
        .long   7,_FRV400_GPIO_SIR,0x000c954f     // Routing for Rx0, Rx1, CTS
186
        .long   7,_FRV400_GPIO_SOR,0x00036ab0     // Routing for Tx0, Tx1, RTS, TOUT0, TOUT1
187
 
188
        .long   7,_FRV400_SDRAM_CTL,0x05022000    // SDRAM mode/control
189
        .long   4,_FRV400_SDRAM_AN0,0x00010201
190
        .long   2,_FRV400_SDRAM_AN0,0x00010102
191
        .long   1,_FRV400_SDRAM_AN0,0x00010101
192
        .long   7,_FRV400_SDRAM_BR0,0x00000000
193
        .long   7,_FRV400_SDRAM_AM0,0x03ffffff
194
        .long   2,_FRV400_SDRAM_AN1,0x00010102
195
        .long 0x20,_FRV400_SDRAM_AN1,0x00010201
196
        .long 0x22,_FRV400_SDRAM_BR1,0x04000000
197
        .long 0x22,_FRV400_SDRAM_AM1,0x03ffffff
198
        .long   7,_FRV400_SDRAM_ART,0x00000820
199
        .long   7,_FRV400_SDRAM_RCN,0x00000000
200
        .long   5,_FRV400_SDRAM_MS, 0x00020200
201
        .long   2,_FRV400_SDRAM_MS, 0x00010000
202
 //        .long   1,_FRV400_SDRAM_MS, 0x00020201
203
        .long   6,_FRV400_SDRAM_CFG,0x80000100
204
        .long   1,_FRV400_SDRAM_CFG,0x80000000
205
//?     .long   7,_FRV400_CLK_CTRL, 0x00000001     // External clock divisor (/2)
206
//
207
// SDRAM setups for FR5xx
208
//
209
        .long   8,_FRV550_SDRAM_ARS0,0x00000000    // SDRAM 0x0XXXXXXX
210
        .long   8,_FRV550_SDRAM_AMK0,0x000000FF
211
 
212
//
213
// LOCAL bus setups for FR5xx
214
//
215
        .long   8,_FRV550_LBUS_CR0,0x03010701     // ROM/FLASH 0xFF000000..0xFFFFFFFF
216
                                // 16 bits wide, 7 wait states, 1 idle
217
 
218
        .long   8,_FRV550_LBUS_BR1,0x10000000     // PCI bridge 0x10000000..0x100FFFFF
219
        .long   8,_FRV550_LBUS_AM1,0x000FFFFF
220
        .long   8,_FRV550_LBUS_CR1,0x00000000
221
 
222
        .long   8,_FRV550_LBUS_BR2,0x20000000     // SRAM, FPGA, PCI 0x20000000..0x2FFFFFFF
223
        .long   8,_FRV550_LBUS_AM2,0x0FFFFFFF
224
        .long   8,_FRV550_LBUS_CR2,0x00000000
225
 
226
        .long   8,_FRV550_LBUS_BR3,0x00000000     // SDRAM?
227
        .long   8,_FRV550_LBUS_AM3,0xFFFFFFFF
228
        .long   8,_FRV550_LBUS_CR3,0x00000F07
229
 
230
        .long   8,_FRV550_GPIO_SIR,0x000c957f     // Routing for Rx0, Rx1, CTS
231
        .long   8,_FRV550_GPIO_SOR,0x00336ab0     // Routing for Tx0, Tx1, RTS, TOUT0, TOUT1
232
 
233
        .long   8,_FRV550_SDRAM_CTL,0x000C6320    // SDRAM mode/control
234
        .long   8,_FRV550_SDRAM_AN, 0x32323232    // assume BA[0:1], RA[12:0], CA[9:0] (32Mbit*64)
235
        .long   8,_FRV550_SDRAM_ART,0x00000616
236
 
237
        .long   8,_FRV550_SDRAM_RCN,0x00000100
238
        .long   8,_FRV550_SDRAM_CFG,0x00000000
239
        .long   8,_FRV550_SDRAM_MS, 0x00003300
240
 
241
//?     .long   8,_FRV550_CLK_CTRL, 0x00000001     // External clock divisor (/2)
242
 
243
//
244
// PCI controller/bridge
245
//
246
//      .long   0x10,_MB93091_MB_LEDS,0x100b
247
        .long   0x10,_MB93091_PCI_SLBUS_CONFIG,    0x000800E2           // This matches the docs
248
//      .long   0x10,_MB93091_PCI_SLBUS_CONFIG,    0x000000E0           // This matches the samples
249
        .long   0x10,_MB93091_PCI_ECS0_CONFIG,     0x00000000
250
        .long   0x10,_MB93091_PCI_ECS1_CONFIG,     0x000003C1
251
        .long   0x10,_MB93091_PCI_ECS2_CONFIG,     0x000001C1
252
        .long   0x10,_MB93091_PCI_ECS0_RANGE,      0x00000000
253
        .long   0x10,_MB93091_PCI_ECS0_ADDR,       0x00000000
254
        .long   0x10,_MB93091_PCI_ECS1_RANGE,      0x00007FFE
255
        .long   0x10,_MB93091_PCI_ECS1_ADDR,       0x08108000
256
        .long   0x10,_MB93091_PCI_ECS2_RANGE,      0x00007FFE
257
        .long   0x10,_MB93091_PCI_ECS2_ADDR,       0x08100000
258
        .long   0x10,_MB93091_PCI_PCIIO_RANGE,     0x0001FFFE
259
        .long   0x10,_MB93091_PCI_PCIIO_ADDR,      0x00120000
260
        .long   0x10,_MB93091_PCI_PCIMEM_RANGE,    0x0003FFFE
261
        .long   0x10,_MB93091_PCI_PCIMEM_ADDR,     0x00140000
262
        .long   0x10,_MB93091_PCI_PCIIO_PCI_ADDR,  0x24000001
263
        .long   0x10,_MB93091_PCI_PCIMEM_PCI_ADDR, 0x28000000
264
        .long   0x10,_MB93091_MB_PCI_ARBITER,      0x00000001
265
        .long   0x10,_MB93091_MB_PCI_ARBITER,      0x00000001
266
        .long   0x10,_MB93091_PCI_SLBUS_CONFIG, 0x800800E2
267
//      .long   0x10,_MB93091_PCI_SLBUS_CONFIG, 0x800000E0
268
        // Turn the LEDs off.
269
        .long   0x10,_MB93091_MB_LEDS,0x0000ffff
270
 
271
// End list with SDRAM controller poll address
272
 
273
        .long   7,0,_FRV400_SDRAM_STS
274
        .long   8,0,_FRV550_SDRAM_STS
275
 
276
 
277
10:     movsg   lr,gr4                  // _platform_tab -> list of initializations
278
20:     ldi     @(gr4,4),gr5            // Register
279
        ldi     @(gr4,8),gr6            // Value
280
        ldi     @(gr4,0),gr7            // Platform Bitmask
281
        and     gr7,gr8,gr7
282
        cmpi    gr7,#0,icc0
283
        beq     icc0,0,25f              // Skip over tuples not for us
284
        cmp     gr5,gr0,icc0            // End of list (with SDRAM poll addr)?
285
        beq     icc0,0,30f
286
        sti     gr6,@(gr5,0)
287
25:     addi    gr4,3*4,gr4
288
        bra     20b                     // Next item
289
 
290
30:     ldi     @(gr6,0),gr5            // gr6 == _FRVxxx_SDRAM_STS
291
        cmp     gr5,gr0,icc0
292
        bne     icc0,0,30b              // Wait for SDRAM ready
293
        call    40f
294
 
295
 
296
40:
297
 
298
// Clear all AMPR registers. They must not overlap.
299
        movgs   gr0,DAMPR0
300
        movgs   gr0,DAMPR1
301
        movgs   gr0,DAMPR2
302
        movgs   gr0,DAMPR3
303
        movgs   gr0,DAMPR4
304
        movgs   gr0,DAMPR5
305
        movgs   gr0,DAMPR6
306
        movgs   gr0,DAMPR7
307
        movgs   gr0,IAMPR0
308
        movgs   gr0,IAMPR1
309
        movgs   gr0,IAMPR2
310
        movgs   gr0,IAMPR3
311
        movgs   gr0,IAMPR4
312
        movgs   gr0,IAMPR5
313
        movgs   gr0,IAMPR6
314
        movgs   gr0,IAMPR7
315
 
316
        li      0x000000C9,gr4          // Set 0x0XXXXXXX supervisor only, cache - SDRAM
317
        movgs   gr4,DAMPR1
318
 
319
        li      0xF000007D,gr4          // Set 0xF0XXXXXX supervisor only, no cache - chip selects (16MB)
320
        movgs   gr4,DAMPR2
321
 
322
        li      0x200000BD,gr4          // Set 0x2XXXXXXX supervisor only, no cache - Motherboard resources
323
        movgs   gr4,DAMPR6
324
 
325
        LED 0x1003
326
 
327
        li      0x100000BD,gr4          // Set 0x1XXXXXXX supervisor only, no cache - PCI bridge
328
        movgs   gr4,DAMPR7
329
 
330
        andi    gr8,#8,gr7      // Check CPU type again. 0x8 is FR5xx
331
        cmpi    gr7,#0,icc0
332
        beq     icc0,#0,70f
333
 
334
// And the rest, for FR555...
335
        movgs   gr0,IAMPR8
336
        movgs   gr0,IAMPR9
337
        movgs   gr0,IAMPR10
338
        movgs   gr0,IAMPR11
339
        movgs   gr0,IAMPR12
340
        movgs   gr0,IAMPR13
341
        movgs   gr0,IAMPR14
342
        movgs   gr0,IAMPR15
343
        movgs   gr0,DAMPR8
344
        movgs   gr0,DAMPR9
345
        movgs   gr0,DAMPR10
346
        movgs   gr0,DAMPR11
347
        movgs   gr0,DAMPR12
348
        movgs   gr0,DAMPR13
349
        movgs   gr0,DAMPR14
350
        movgs   gr0,DAMPR15
351
 
352
        movgs   gr0,DAMLR1
353
        li      0x20000000,gr4
354
        movgs   gr4,DAMLR6
355
        li      0x10000000,gr4
356
        movgs   gr4,DAMLR7
357
 
358
70:
359
        LED 0x1004
360
        movsg   hsr0,gr4
361
        li      (1<<25),gr5             // Enable data MMU
362
        or      gr4,gr5,gr4
363
        movgs   gr4,hsr0
364
        LED 0x1005
365
        .endm
366
 
367
#endif // _CYGONCE_PLATFORM_INC_H_

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.