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 |
|
|
// Display a value in the system LEDs
|
56 |
|
|
.macro LED n
|
57 |
|
|
sethi #(_MB93093_FPGA_LEDS>>16),gr15
|
58 |
|
|
setlo #(_MB93093_FPGA_LEDS&0xFFFF),gr15
|
59 |
|
|
setlos #\n,gr14
|
60 |
|
|
stbi gr14,@(gr15,0)
|
61 |
|
|
.endm
|
62 |
|
|
|
63 |
|
|
// Platform initialization - only the necessary bits required to get the
|
64 |
|
|
// board started from a cold reset.
|
65 |
|
|
.macro platform_init
|
66 |
|
|
li 0x7FFF,gr4 // First, a good long spin
|
67 |
|
|
05: nop
|
68 |
|
|
subi gr4,1,gr4
|
69 |
|
|
cmp gr4,gr0,icc0
|
70 |
|
|
bne icc0,0,05b
|
71 |
|
|
|
72 |
|
|
|
73 |
|
|
call 10f // position independent way to get @_platform_tab
|
74 |
|
|
_platform_tab_fr4xx:
|
75 |
|
|
//
|
76 |
|
|
// SDRAM setups for FR4xx
|
77 |
|
|
//
|
78 |
|
|
.long _FRV400_SDRAM_BR0,0x00000000 // SDRAM 0x0XXXXXXX
|
79 |
|
|
.long _FRV400_SDRAM_AM0,0x03FFFFFF
|
80 |
|
|
|
81 |
|
|
//
|
82 |
|
|
// LOCAL bus setups for FR4xx
|
83 |
|
|
//
|
84 |
|
|
.long _FRV400_LBUS_GCR,0x0000007f
|
85 |
|
|
.long _FRV400_LBUS_CR0,0x00010701 // ROM/FLASH 0xFF000000..0xFFFFFFFF
|
86 |
|
|
|
87 |
|
|
.long _FRV400_LBUS_BR1,0x10000000 // Ethernet
|
88 |
|
|
.long _FRV400_LBUS_AM1,0x0FFFFFFF
|
89 |
|
|
.long _FRV400_LBUS_CR1,0x00010404
|
90 |
|
|
|
91 |
|
|
.long _FRV400_LBUS_BR2,0x20000000 // FPGA
|
92 |
|
|
.long _FRV400_LBUS_AM2,0x0FFFFFFF
|
93 |
|
|
.long _FRV400_LBUS_CR2,0x00000000
|
94 |
|
|
|
95 |
|
|
.long _FRV400_LBUS_BR3,0x30000000 // CSR / CSC (MB93493)
|
96 |
|
|
.long _FRV400_LBUS_AM3,0x07FFFFFF
|
97 |
|
|
.long _FRV400_LBUS_CR3,0xc8100000
|
98 |
|
|
|
99 |
|
|
.long _FRV400_LBUS_BR4,0xfd000000
|
100 |
|
|
.long _FRV400_LBUS_AM4,0x00FFFFFF
|
101 |
|
|
.long _FRV400_LBUS_CR4,0x00010701
|
102 |
|
|
|
103 |
|
|
.long _FRV400_LBUS_BR5,0x38000000
|
104 |
|
|
.long _FRV400_LBUS_AM5,0x07FFFFFF
|
105 |
|
|
.long _FRV400_LBUS_CR5,0x00010000
|
106 |
|
|
|
107 |
|
|
.long _FRV400_LBUS_EST,0x00000000
|
108 |
|
|
.long _FRV400_LBUS_EAD,0x00000000
|
109 |
|
|
|
110 |
|
|
.long _FRV400_GPIO_SIR,0x000c954f // Routing for Rx0, Rx1, CTS
|
111 |
|
|
.long _FRV400_GPIO_SOR,0x00036ab0 // Routing for Tx0, Tx1, RTS, TOUT0, TOUT1
|
112 |
|
|
.long 0x20000020,0x55555555
|
113 |
|
|
.long _FRV400_SDRAM_CTL,0x05011000 // SDRAM mode/control
|
114 |
|
|
.long _FRV400_SDRAM_AN0,0x00010201
|
115 |
|
|
.long _FRV400_SDRAM_ART,0x00000820
|
116 |
|
|
.long _FRV400_SDRAM_RCN,0x00000000
|
117 |
|
|
.long _FRV400_SDRAM_MS, 0x00010000
|
118 |
|
|
.long _FRV400_SDRAM_CFG,0x80000100
|
119 |
|
|
|
120 |
|
|
//? .long _FRV400_CLK_CTRL,0x00000001 // External clock divisor (/2)
|
121 |
|
|
.long 0
|
122 |
|
|
.long _FRV400_SDRAM_STS
|
123 |
|
|
|
124 |
|
|
|
125 |
|
|
|
126 |
|
|
|
127 |
|
|
10: movsg lr,gr4 // _platform_tab -> list of initializations
|
128 |
|
|
20: ldi @(gr4,0),gr5 // Register
|
129 |
|
|
ldi @(gr4,4),gr6 // Value
|
130 |
|
|
cmp gr5,gr0,icc0 // End of list?
|
131 |
|
|
beq icc0,0,30f
|
132 |
|
|
sti gr6,@(gr5,0)
|
133 |
|
|
addi gr4,2*4,gr4
|
134 |
|
|
bra 20b // Next item
|
135 |
|
|
30: ldi @(gr6,0),gr5 // gr6 == _FRVxxx_SDRAM_STS
|
136 |
|
|
cmp gr5,gr0,icc0
|
137 |
|
|
bne icc0,0,30b // Wait for SDRAM ready
|
138 |
|
|
//
|
139 |
|
|
// Note: it is unclear from the documentation if this works at all. There is no
|
140 |
|
|
// description of how these registers are searched and what would happen if they
|
141 |
|
|
// overlap. If it turns out that they are not allowed to overlap, then this setup
|
142 |
|
|
// will have to be restructured.
|
143 |
|
|
//
|
144 |
|
|
|
145 |
|
|
// Clear all AMPR registers. They must not overlap.
|
146 |
|
|
li 0x91, gr4
|
147 |
|
|
movgs gr4,IAMPR0
|
148 |
|
|
movgs gr0,IAMPR1
|
149 |
|
|
movgs gr0,IAMPR2
|
150 |
|
|
movgs gr0,IAMPR3
|
151 |
|
|
movgs gr0,IAMPR4
|
152 |
|
|
movgs gr0,IAMPR5
|
153 |
|
|
movgs gr0,IAMPR6
|
154 |
|
|
movgs gr0,IAMPR7
|
155 |
|
|
|
156 |
|
|
li 0x00000091,gr4
|
157 |
|
|
movgs gr4,DAMPR0
|
158 |
|
|
li 0x100000b5,gr4
|
159 |
|
|
movgs gr4,DAMPR1
|
160 |
|
|
li 0x200000b5,gr4
|
161 |
|
|
movgs gr4,DAMPR2
|
162 |
|
|
li 0x300000a5,gr4
|
163 |
|
|
movgs gr4,DAMPR3
|
164 |
|
|
li 0x380000a5,gr4
|
165 |
|
|
movgs gr4,DAMPR4
|
166 |
|
|
li 0xfd000075,gr4
|
167 |
|
|
movgs gr4,DAMPR5
|
168 |
|
|
li 0xff000075,gr4
|
169 |
|
|
movgs gr4,DAMPR6
|
170 |
|
|
movgs gr0,DAMPR7
|
171 |
|
|
|
172 |
|
|
#if 0
|
173 |
|
|
li 0x03F0003D,gr4 // Set 0x03FXXXXX supervisor only, no cache - PCI window (1MB)
|
174 |
|
|
movgs gr4,DAMPR0
|
175 |
|
|
|
176 |
|
|
li 0x000000C9,gr4 // Set 0x0XXXXXXX supervisor only, cache - SDRAM
|
177 |
|
|
movgs gr4,DAMPR1
|
178 |
|
|
|
179 |
|
|
li 0x200000BD,gr4 // Set 0x2XXXXXXX supervisor only, no cache - Motherboard resources
|
180 |
|
|
movgs gr4,DAMPR6
|
181 |
|
|
LED 0x1003
|
182 |
|
|
li 0x100000BD,gr4 // Set 0x1XXXXXXX supervisor only, no cache - PCI bridge
|
183 |
|
|
movgs gr4,DAMPR7
|
184 |
|
|
#endif
|
185 |
|
|
movsg hsr0,gr4
|
186 |
|
|
li (1<<25),gr5 // Enable data MMU
|
187 |
|
|
or gr4,gr5,gr4
|
188 |
|
|
movgs gr4,hsr0
|
189 |
|
|
|
190 |
|
|
.endm
|
191 |
|
|
|
192 |
|
|
#endif // _CYGONCE_PLATFORM_INC_H_
|