1 |
27 |
unneback |
##=============================================================================
|
2 |
|
|
##
|
3 |
|
|
## ec555.S
|
4 |
|
|
##
|
5 |
|
|
## ec555 board hardware setup
|
6 |
|
|
##
|
7 |
|
|
##=============================================================================
|
8 |
|
|
#####ECOSGPLCOPYRIGHTBEGIN####
|
9 |
|
|
## -------------------------------------------
|
10 |
|
|
## This file is part of eCos, the Embedded Configurable Operating System.
|
11 |
|
|
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
|
12 |
|
|
##
|
13 |
|
|
## eCos is free software; you can redistribute it and/or modify it under
|
14 |
|
|
## the terms of the GNU General Public License as published by the Free
|
15 |
|
|
## Software Foundation; either version 2 or (at your option) any later version.
|
16 |
|
|
##
|
17 |
|
|
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
|
18 |
|
|
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
19 |
|
|
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
20 |
|
|
## for more details.
|
21 |
|
|
##
|
22 |
|
|
## You should have received a copy of the GNU General Public License along
|
23 |
|
|
## with eCos; if not, write to the Free Software Foundation, Inc.,
|
24 |
|
|
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
25 |
|
|
##
|
26 |
|
|
## As a special exception, if other files instantiate templates or use macros
|
27 |
|
|
## or inline functions from this file, or you compile this file and link it
|
28 |
|
|
## with other works to produce a work based on this file, this file does not
|
29 |
|
|
## by itself cause the resulting work to be covered by the GNU General Public
|
30 |
|
|
## License. However the source code for this file must still be made available
|
31 |
|
|
## in accordance with section (3) of the GNU General Public License.
|
32 |
|
|
##
|
33 |
|
|
## This exception does not invalidate any other reasons why a work based on
|
34 |
|
|
## this file might be covered by the GNU General Public License.
|
35 |
|
|
##
|
36 |
|
|
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
|
37 |
|
|
## at http://sources.redhat.com/ecos/ecos-license/
|
38 |
|
|
## -------------------------------------------
|
39 |
|
|
#####ECOSGPLCOPYRIGHTEND####
|
40 |
|
|
##=============================================================================
|
41 |
|
|
#######DESCRIPTIONBEGIN####
|
42 |
|
|
##
|
43 |
|
|
## Author(s): Bob Koninckx
|
44 |
|
|
## Contributors:Bob Koninckx
|
45 |
|
|
## Date: 2002-01-01
|
46 |
|
|
## Purpose: ec555 board hardware setup
|
47 |
|
|
## Description: This file contains any code needed to initialize the
|
48 |
|
|
## hardware on a ec555 mpc555 board.
|
49 |
|
|
##
|
50 |
|
|
######DESCRIPTIONEND####
|
51 |
|
|
##
|
52 |
|
|
##=============================================================================
|
53 |
|
|
|
54 |
|
|
#include
|
55 |
|
|
|
56 |
|
|
#include
|
57 |
|
|
#include
|
58 |
|
|
|
59 |
|
|
#------------------------------------------------------------------------------
|
60 |
|
|
|
61 |
|
|
.globl hal_hardware_init
|
62 |
|
|
hal_hardware_init:
|
63 |
|
|
#if defined(CYGPKG_HAL_POWERPC_EC555) && defined(CYGPKG_HAL_POWERPC_MPC5xx)
|
64 |
|
|
lwi r3, CYGARC_REG_IMM_BASE # Base address of control registers
|
65 |
|
|
|
66 |
|
|
// Burst enable
|
67 |
|
|
lwi r0, 0x00002000
|
68 |
|
|
mtspr 560, r0
|
69 |
|
|
|
70 |
|
|
// Disable the Watchdog (for now)
|
71 |
|
|
lwi r4, 0xffffff88
|
72 |
|
|
stw r4, (CYGARC_REG_IMM_SYPCR-CYGARC_REG_IMM_BASE)(r3)
|
73 |
|
|
lwi r4, 0x00000000
|
74 |
|
|
stw r4, (CYGARC_REG_IMM_SIUMCR-CYGARC_REG_IMM_BASE)(r3)
|
75 |
|
|
|
76 |
|
|
// Unlock locked registers
|
77 |
|
|
lwi r4, 0x55ccaa33
|
78 |
|
|
stw r4, (CYGARC_REG_IMM_TBSCRK-CYGARC_REG_IMM_BASE)(r3)
|
79 |
|
|
stw r4, (CYGARC_REG_IMM_TBREF0K-CYGARC_REG_IMM_BASE)(r3)
|
80 |
|
|
stw r4, (CYGARC_REG_IMM_TBREF1K-CYGARC_REG_IMM_BASE)(r3)
|
81 |
|
|
stw r4, (CYGARC_REG_IMM_TBK-CYGARC_REG_IMM_BASE)(r3)
|
82 |
|
|
stw r4, (CYGARC_REG_IMM_RTCSCK-CYGARC_REG_IMM_BASE)(r3)
|
83 |
|
|
stw r4, (CYGARC_REG_IMM_RTCK-CYGARC_REG_IMM_BASE)(r3)
|
84 |
|
|
stw r4, (CYGARC_REG_IMM_RTSECK-CYGARC_REG_IMM_BASE)(r3)
|
85 |
|
|
stw r4, (CYGARC_REG_IMM_RTCALK-CYGARC_REG_IMM_BASE)(r3)
|
86 |
|
|
stw r4, (CYGARC_REG_IMM_PISCRK-CYGARC_REG_IMM_BASE)(r3)
|
87 |
|
|
stw r4, (CYGARC_REG_IMM_PITCK-CYGARC_REG_IMM_BASE)(r3)
|
88 |
|
|
stw r4, (CYGARC_REG_IMM_SCCRK-CYGARC_REG_IMM_BASE)(r3)
|
89 |
|
|
stw r4, (CYGARC_REG_IMM_PLPRCRK-CYGARC_REG_IMM_BASE)(r3)
|
90 |
|
|
stw r4, (CYGARC_REG_IMM_RSRK-CYGARC_REG_IMM_BASE)(r3)
|
91 |
|
|
|
92 |
|
|
// Boost the clock to 40MHz
|
93 |
|
|
lwi r4, 0x03000000
|
94 |
|
|
stw r4, (CYGARC_REG_IMM_SCCR-CYGARC_REG_IMM_BASE)(r3)
|
95 |
|
|
lwi r4, 0x009150c0
|
96 |
|
|
stw r4, (CYGARC_REG_IMM_PLPRCR-CYGARC_REG_IMM_BASE)(r3)
|
97 |
|
|
lwi r4, 0x0080
|
98 |
|
|
sth r4, (CYGARC_REG_IMM_COLIR-CYGARC_REG_IMM_BASE)(r3)
|
99 |
|
|
|
100 |
|
|
// Set up the memory map
|
101 |
|
|
// Do NOT write protect the flash memory, flash drivers won't work
|
102 |
|
|
// if we do
|
103 |
|
|
lwi r4, 0x00800003
|
104 |
|
|
stw r4, (CYGARC_REG_IMM_BR0-CYGARC_REG_IMM_BASE)(r3)
|
105 |
|
|
lwi r4, 0xffc00530
|
106 |
|
|
stw r4, (CYGARC_REG_IMM_OR0-CYGARC_REG_IMM_BASE)(r3)
|
107 |
|
|
lwi r4, 0x00400011
|
108 |
|
|
stw r4, (CYGARC_REG_IMM_BR1-CYGARC_REG_IMM_BASE)(r3)
|
109 |
|
|
lwi r4, 0xfff00000
|
110 |
|
|
stw r4, (CYGARC_REG_IMM_OR1-CYGARC_REG_IMM_BASE)(r3)
|
111 |
|
|
lwi r4, 0x00c00000
|
112 |
|
|
stw r4, (CYGARC_REG_IMM_BR2-CYGARC_REG_IMM_BASE)(r3)
|
113 |
|
|
lwi r4, 0xffff8000
|
114 |
|
|
stw r4, (CYGARC_REG_IMM_OR2-CYGARC_REG_IMM_BASE)(r3)
|
115 |
|
|
lwi r4, 0x00e00000
|
116 |
|
|
stw r4, (CYGARC_REG_IMM_BR3-CYGARC_REG_IMM_BASE)(r3)
|
117 |
|
|
lwi r4, 0xffff8000
|
118 |
|
|
stw r4, (CYGARC_REG_IMM_OR3-CYGARC_REG_IMM_BASE)(r3)
|
119 |
|
|
|
120 |
|
|
#if defined(CYGSEM_HAL_POWERPC_MPC5XX_IFLASH_DUAL_MAP)
|
121 |
|
|
lwi r4, 1
|
122 |
|
|
#else
|
123 |
|
|
lwi r4, 0
|
124 |
|
|
#endif
|
125 |
|
|
stw r4, (CYGARC_REG_IMM_DMBR-CYGARC_REG_IMM_BASE)(r3)
|
126 |
|
|
lwi r4, 0
|
127 |
|
|
stw r4, (CYGARC_REG_IMM_DMOR-CYGARC_REG_IMM_BASE)(r3)
|
128 |
|
|
|
129 |
|
|
// Enable the time base and set the freeze flag
|
130 |
|
|
lwi r4, 0xc3
|
131 |
|
|
sth r4, (CYGARC_REG_IMM_TBSCR-CYGARC_REG_IMM_BASE)(r3)
|
132 |
|
|
|
133 |
|
|
// RTC is clocked by 4MHz crystal, set the freeze flag
|
134 |
|
|
lwi r4, 0xd2
|
135 |
|
|
sth r4, (CYGARC_REG_IMM_RTCSC-CYGARC_REG_IMM_BASE)(r3)
|
136 |
|
|
|
137 |
|
|
// Set the freeze flag for the Periodic interrupt timer
|
138 |
|
|
lwi r4, 0x82
|
139 |
|
|
sth r4, (CYGARC_REG_IMM_PISCR-CYGARC_REG_IMM_BASE)(r3)
|
140 |
|
|
|
141 |
|
|
// USIU rest.
|
142 |
|
|
lwi r4, 0x00000000
|
143 |
|
|
lwi r5, (CYGARC_REG_IMM_SGPIODT1-CYGARC_REG_IMM_BASE)
|
144 |
|
|
stwx r4, r3, r5
|
145 |
|
|
lwi r5, (CYGARC_REG_IMM_SGPIODT2-CYGARC_REG_IMM_BASE)
|
146 |
|
|
stwx r4, r3, r5
|
147 |
|
|
lwi r5, (CYGARC_REG_IMM_SGPIOCR-CYGARC_REG_IMM_BASE)
|
148 |
|
|
stwx r4, r3, r5
|
149 |
|
|
lwi r4, 0x00000ac6
|
150 |
|
|
lwi r5, (CYGARC_REG_IMM_EMCR-CYGARC_REG_IMM_BASE)
|
151 |
|
|
stwx r4, r3, r5
|
152 |
|
|
|
153 |
|
|
// Dual ported TPU RAM
|
154 |
|
|
lwi r4, 0x0000
|
155 |
|
|
lwi r5, (CYGARC_REG_IMM_DPTMCR-CYGARC_REG_IMM_BASE)
|
156 |
|
|
sthx r4, r3, r5
|
157 |
|
|
|
158 |
|
|
lwi r4, 0xffa0
|
159 |
|
|
lwi r5, (CYGARC_REG_IMM_RAMBAR-CYGARC_REG_IMM_BASE)
|
160 |
|
|
sthx r4, r3, r5
|
161 |
|
|
|
162 |
|
|
lwi r4, 0x00
|
163 |
|
|
lwi r5, (CYGARC_REG_IMM_PORTQS-CYGARC_REG_IMM_BASE)
|
164 |
|
|
sthx r4, r3, r5
|
165 |
|
|
|
166 |
|
|
lwi r4, 0x00
|
167 |
|
|
lwi r5, (CYGARC_REG_IMM_PQSPAR_DDRQST-CYGARC_REG_IMM_BASE)
|
168 |
|
|
sthx r4, r3, r5
|
169 |
|
|
lwi r5, (CYGARC_REG_IMM_MPIOSMDR-CYGARC_REG_IMM_BASE)
|
170 |
|
|
sthx r4, r3, r5
|
171 |
|
|
lwi r5, (CYGARC_REG_IMM_MPIOSMDDR-CYGARC_REG_IMM_BASE)
|
172 |
|
|
sthx r4, r3, r5
|
173 |
|
|
lwi r5, (CYGARC_REG_IMM_SRAMMCR_A-CYGARC_REG_IMM_BASE)
|
174 |
|
|
sthx r4, r3, r5
|
175 |
|
|
|
176 |
|
|
// They are assigned OCD functionality on this board
|
177 |
|
|
// Change the following to anything else and BDM will not work anymore
|
178 |
|
|
// on the ec555. This is not true for all MPC555 based boards, eg. cme555
|
179 |
|
|
// does not have this requirement
|
180 |
|
|
lwi r4, 0x3
|
181 |
|
|
lwi r5, (CYGARC_REG_IMM_MIOS1TPCR-CYGARC_REG_IMM_BASE)
|
182 |
|
|
sthx r4, r3, r5
|
183 |
|
|
|
184 |
|
|
// Enable 32 interrupt priorities on the IMB3 unit
|
185 |
|
|
lwi r4, 0x60000000
|
186 |
|
|
lwi r5, (CYGARC_REG_IMM_UMCR-CYGARC_REG_IMM_BASE)
|
187 |
|
|
stwx r4, r3, r5
|
188 |
|
|
|
189 |
|
|
// Finally, disable serialization
|
190 |
|
|
// Motorola claims that failing to do so results in a performance
|
191 |
|
|
// penalty of a facor three !!
|
192 |
|
|
lwi r0, 0x00000007
|
193 |
|
|
mtspr 158, r0
|
194 |
|
|
#endif
|
195 |
|
|
sync
|
196 |
|
|
blr
|
197 |
|
|
|
198 |
|
|
#------------------------------------------------------------------------------
|
199 |
|
|
# end of ec555.S
|