1 |
27 |
unneback |
##=============================================================================
|
2 |
|
|
##
|
3 |
|
|
## cme555.S
|
4 |
|
|
##
|
5 |
|
|
## CME555 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: 2001-12-15
|
46 |
|
|
## Purpose: cme555 board hardware setup
|
47 |
|
|
## Description: This file contains any code needed to initialize the
|
48 |
|
|
## hardware on a cme555 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 |
|
|
|
64 |
|
|
#if defined(CYGPKG_HAL_POWERPC_CME555) && defined(CYGPKG_HAL_POWERPC_MPC5xx)
|
65 |
|
|
lwi r3, CYGARC_REG_IMM_BASE # Base address of control registers
|
66 |
|
|
|
67 |
|
|
// Configure external interrupt pins as General purpose I/O. They do not
|
68 |
|
|
// have pull-up resistors on the CME555. Add to that that IRQ0 triggers
|
69 |
|
|
// a non-maskable reset of the board ... This one gave me nightmares ...
|
70 |
|
|
lwi r4, 0x00000800
|
71 |
|
|
stw r4, (CYGARC_REG_IMM_SIUMCR-CYGARC_REG_IMM_BASE)(r3)
|
72 |
|
|
lwi r4, 0xff88
|
73 |
|
|
stw r4, (CYGARC_REG_IMM_SYPCR-CYGARC_REG_IMM_BASE)(r3)
|
74 |
|
|
|
75 |
|
|
// Memory map
|
76 |
|
|
// CS0 configuration
|
77 |
|
|
// Base address 0x400000, no burst support, 32 bit wide data port
|
78 |
|
|
// Valid addresses till 0x43FFFF, no wait states
|
79 |
|
|
lwi r4, 0x00400003
|
80 |
|
|
stw r4, (CYGARC_REG_IMM_BR0-CYGARC_REG_IMM_BASE)(r3)
|
81 |
|
|
lwi r4, 0xfff80002
|
82 |
|
|
stw r4, (CYGARC_REG_IMM_OR0-CYGARC_REG_IMM_BASE)(r3)
|
83 |
|
|
|
84 |
|
|
// CS1 configuration
|
85 |
|
|
// Base address 0x800000, no burst support, 32 bit wide data port
|
86 |
|
|
// Valid adresses till 0x87FFFF, three wait states for access time 70ns
|
87 |
|
|
lwi r4, 0x00800003
|
88 |
|
|
stw r4, (CYGARC_REG_IMM_BR1-CYGARC_REG_IMM_BASE)(r3)
|
89 |
|
|
lwi r4, 0xfff80032
|
90 |
|
|
stw r4, (CYGARC_REG_IMM_OR1-CYGARC_REG_IMM_BASE)(r3)
|
91 |
|
|
|
92 |
|
|
// CS2 configuration
|
93 |
|
|
// Base address 0xc00000, no burst support, 32 bit wide data port
|
94 |
|
|
// Valid adresses till 0xc7FFFF, maximum wait states
|
95 |
|
|
lwi r4, 0x00c00003
|
96 |
|
|
stw r4, (CYGARC_REG_IMM_BR2-CYGARC_REG_IMM_BASE)(r3)
|
97 |
|
|
lwi r4, 0xfff800f2
|
98 |
|
|
stw r4, (CYGARC_REG_IMM_OR2-CYGARC_REG_IMM_BASE)(r3)
|
99 |
|
|
|
100 |
|
|
// CS3 configuration
|
101 |
|
|
// works for keypad/LCD
|
102 |
|
|
// maximum wait states
|
103 |
|
|
lwi r4, 0x01000403
|
104 |
|
|
stw r4, (CYGARC_REG_IMM_BR3-CYGARC_REG_IMM_BASE)(r3)
|
105 |
|
|
lwi r4, 0xfffe0ff1
|
106 |
|
|
stw r4, (CYGARC_REG_IMM_OR3-CYGARC_REG_IMM_BASE)(r3)
|
107 |
|
|
|
108 |
|
|
// And some other configuration registers
|
109 |
|
|
#if defined(CYGSEM_HAL_POWERPC_MPC5XX_IFLASH_DUAL_MAP)
|
110 |
|
|
lwi r4, 1
|
111 |
|
|
#else
|
112 |
|
|
lwi r4, 0
|
113 |
|
|
#endif
|
114 |
|
|
stw r4, (CYGARC_REG_IMM_DMBR-CYGARC_REG_IMM_BASE)(r3)
|
115 |
|
|
lwi r4, 0
|
116 |
|
|
stw r4, (CYGARC_REG_IMM_DMOR-CYGARC_REG_IMM_BASE)(r3)
|
117 |
|
|
|
118 |
|
|
// Limb mode enable, TMBCLK = BUS/16, RTCCLK = Crystal / 16
|
119 |
|
|
// generate 40 MHz bus clock
|
120 |
|
|
lwi r4, 0x3010000
|
121 |
|
|
stw r4, (CYGARC_REG_IMM_SCCR-CYGARC_REG_IMM_BASE)(r3)
|
122 |
|
|
lwi r4, 0x900000
|
123 |
|
|
stw r4, (CYGARC_REG_IMM_PLPRCR-CYGARC_REG_IMM_BASE)(r3)
|
124 |
|
|
|
125 |
|
|
// Enable the time base and set the freeze flag
|
126 |
|
|
lwi r4, 0x03
|
127 |
|
|
sth r4, (CYGARC_REG_IMM_TBSCR-CYGARC_REG_IMM_BASE)(r3)
|
128 |
|
|
|
129 |
|
|
// Unlock the RTC register set
|
130 |
|
|
lwi r4, 0x55ccaa33
|
131 |
|
|
stw r4, (CYGARC_REG_IMM_RTCSCK-CYGARC_REG_IMM_BASE)(r3)
|
132 |
|
|
// RTC is clocked by 4MHz crystal, set the freeze flag
|
133 |
|
|
lwi r4, 0x12
|
134 |
|
|
sth r4, (CYGARC_REG_IMM_RTCSC-CYGARC_REG_IMM_BASE)(r3)
|
135 |
|
|
// Set the freeze flag for the Periodic interrupt timer
|
136 |
|
|
lwi r4, 0x02
|
137 |
|
|
sth r4, (CYGARC_REG_IMM_PISCR-CYGARC_REG_IMM_BASE)(r3)
|
138 |
|
|
|
139 |
|
|
lwi r4, 0x00
|
140 |
|
|
lwi r5, (CYGARC_REG_IMM_DPTMCR-CYGARC_REG_IMM_BASE)
|
141 |
|
|
sthx r4, r3, r5
|
142 |
|
|
|
143 |
|
|
lwi r4, 0xffa0
|
144 |
|
|
lwi r5, (CYGARC_REG_IMM_RAMBAR-CYGARC_REG_IMM_BASE)
|
145 |
|
|
sthx r4, r3, r5
|
146 |
|
|
|
147 |
|
|
lwi r4, 0x00
|
148 |
|
|
lwi r5, (CYGARC_REG_IMM_PORTQS-CYGARC_REG_IMM_BASE)
|
149 |
|
|
sthx r4, r3, r5
|
150 |
|
|
|
151 |
|
|
lwi r4, 0x00
|
152 |
|
|
lwi r5, (CYGARC_REG_IMM_PQSPAR_DDRQST-CYGARC_REG_IMM_BASE)
|
153 |
|
|
sthx r4, r3, r5
|
154 |
|
|
lwi r5, (CYGARC_REG_IMM_MPIOSMDR-CYGARC_REG_IMM_BASE)
|
155 |
|
|
sthx r4, r3, r5
|
156 |
|
|
lwi r5, (CYGARC_REG_IMM_MPIOSMDDR-CYGARC_REG_IMM_BASE)
|
157 |
|
|
sthx r4, r3, r5
|
158 |
|
|
lwi r5, (CYGARC_REG_IMM_MIOS1TPCR-CYGARC_REG_IMM_BASE)
|
159 |
|
|
sthx r4, r3, r5
|
160 |
|
|
lwi r5, (CYGARC_REG_IMM_SRAMMCR_A-CYGARC_REG_IMM_BASE)
|
161 |
|
|
sthx r4, r3, r5
|
162 |
|
|
|
163 |
|
|
lwi r4, 0x00000000
|
164 |
|
|
lwi r5, (CYGARC_REG_IMM_SGPIODT1-CYGARC_REG_IMM_BASE)
|
165 |
|
|
stwx r4, r3, r5
|
166 |
|
|
lwi r5, (CYGARC_REG_IMM_SGPIODT2-CYGARC_REG_IMM_BASE)
|
167 |
|
|
stwx r4, r3, r5
|
168 |
|
|
lwi r5, (CYGARC_REG_IMM_SGPIOCR-CYGARC_REG_IMM_BASE)
|
169 |
|
|
stwx r4, r3, r5
|
170 |
|
|
lwi r5, (CYGARC_REG_IMM_EMCR-CYGARC_REG_IMM_BASE)
|
171 |
|
|
stwx r4, r3, r5
|
172 |
|
|
|
173 |
|
|
// Enable 32 interrupt priorities on the IMB3 unit
|
174 |
|
|
lwi r4, 0x60000000
|
175 |
|
|
lwi r5, (CYGARC_REG_IMM_UMCR-CYGARC_REG_IMM_BASE)
|
176 |
|
|
stwx r4, r3, r5
|
177 |
|
|
#endif
|
178 |
|
|
|
179 |
|
|
sync
|
180 |
|
|
blr
|
181 |
|
|
|
182 |
|
|
#------------------------------------------------------------------------------
|
183 |
|
|
# end of cme555.S
|