1 |
27 |
unneback |
##=============================================================================
|
2 |
|
|
##
|
3 |
|
|
## cogent.S
|
4 |
|
|
##
|
5 |
|
|
## Cogent 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): nickg
|
44 |
|
|
## Contributors: nickg
|
45 |
|
|
## Date: 1997-11-11
|
46 |
|
|
## Purpose: Cogent board hardware setup
|
47 |
|
|
## Description: This file contains any code needed to initialize the
|
48 |
|
|
## hardware on a Cogent PowerPC 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_COGENT) && defined(CYGPKG_HAL_POWERPC_MPC8xx)
|
65 |
|
|
|
66 |
|
|
# Set up MPC8xx mapping registers for cogent
|
67 |
|
|
|
68 |
|
|
lwi r3,CYGARC_REG_IMM_BASE # base address of control registers
|
69 |
|
|
mtspr CYGARC_REG_IMMR,r3
|
70 |
|
|
|
71 |
|
|
# Set timebase divisor to busclock/16, pitrtc divisor to 512.
|
72 |
|
|
lwz r4,(CYGARC_REG_IMM_SCCR - CYGARC_REG_IMM_BASE)(r3)
|
73 |
|
|
lwi r5,(CYGARC_REG_IMM_SCCR_RTDIV | CYGARC_REG_IMM_SCCR_RTSEL | CYGARC_REG_IMM_SCCR_TBS)
|
74 |
|
|
or r4,r4,r5
|
75 |
|
|
stw r4,(CYGARC_REG_IMM_SCCR - CYGARC_REG_IMM_BASE)(r3)
|
76 |
|
|
|
77 |
|
|
# Enable TimeBase
|
78 |
|
|
li r4,CYGARC_REG_IMM_TBSCR_TBE
|
79 |
|
|
sth r4,(CYGARC_REG_IMM_TBSCR - CYGARC_REG_IMM_BASE)(r3)
|
80 |
|
|
|
81 |
|
|
# Note: I do not know if the timeout is correct/optimal.
|
82 |
|
|
# Works with the above memory mappings/wait states and
|
83 |
|
|
# the PromICE.
|
84 |
|
|
# Disable watchdog, enable bus monitor, timeout after 255*8 cycles
|
85 |
|
|
lwi r4,(CYGARC_REG_IMM_SYPCR_BMT_MASK | CYGARC_REG_IMM_SYPCR_BME)
|
86 |
|
|
stw r4,(CYGARC_REG_IMM_SYPCR - CYGARC_REG_IMM_BASE)(r3)
|
87 |
|
|
|
88 |
|
|
# Set CS0 to
|
89 |
|
|
# base addr 0xfff00000
|
90 |
|
|
# wait states 4
|
91 |
|
|
# size 1M
|
92 |
|
|
# Covers ROM
|
93 |
|
|
# Note: After a reset code is currently executing via the default
|
94 |
|
|
# mapping defined in bank 0. This bank must remain valid while
|
95 |
|
|
# it is being configured.
|
96 |
|
|
lwi r4,(0xfff00000 | CYGARC_REG_IMM_BR_PS_16 | CYGARC_REG_IMM_BR_V)
|
97 |
|
|
stw r4,(CYGARC_REG_IMM_BR0 - CYGARC_REG_IMM_BASE)(r3)
|
98 |
|
|
lwi r4,(0xfff00000 | CYGARC_REG_IMM_OR_BI | 4 << CYGARC_REG_IMM_OR_SCY_SHIFT)
|
99 |
|
|
stw r4,(CYGARC_REG_IMM_OR0 - CYGARC_REG_IMM_BASE)(r3)
|
100 |
|
|
|
101 |
|
|
# Set CS1 to
|
102 |
|
|
# base addr 0x00000000
|
103 |
|
|
# external ACK
|
104 |
|
|
# size 64M
|
105 |
|
|
# Covers DRAM and slot0
|
106 |
|
|
lwi r4,(0xfc000000 | CYGARC_REG_IMM_OR_SETA)
|
107 |
|
|
stw r4,(CYGARC_REG_IMM_OR1 - CYGARC_REG_IMM_BASE)(r3)
|
108 |
|
|
lwi r4,(0x00000000 | CYGARC_REG_IMM_BR_PS_32 | CYGARC_REG_IMM_BR_V)
|
109 |
|
|
stw r4,(CYGARC_REG_IMM_BR1 - CYGARC_REG_IMM_BASE)(r3)
|
110 |
|
|
|
111 |
|
|
# Set CS2 to
|
112 |
|
|
# base addr 0x04000000
|
113 |
|
|
# external ACK
|
114 |
|
|
# size 64M
|
115 |
|
|
# slot1 and slot2
|
116 |
|
|
lwi r4,(0xfc000000 | CYGARC_REG_IMM_OR_SETA)
|
117 |
|
|
stw r4,(CYGARC_REG_IMM_OR2 - CYGARC_REG_IMM_BASE)(r3)
|
118 |
|
|
lwi r4,(0x04000000 | CYGARC_REG_IMM_BR_PS_32 | CYGARC_REG_IMM_BR_V)
|
119 |
|
|
stw r4,(CYGARC_REG_IMM_BR2 - CYGARC_REG_IMM_BASE)(r3)
|
120 |
|
|
|
121 |
|
|
# Set CS3 to
|
122 |
|
|
# base addr 0x0e000000
|
123 |
|
|
# exernal ack
|
124 |
|
|
# size 32M
|
125 |
|
|
# covers IO registers
|
126 |
|
|
lwi r4,(0xfe000000 | CYGARC_REG_IMM_OR_BI | CYGARC_REG_IMM_OR_SETA)
|
127 |
|
|
stw r4,(CYGARC_REG_IMM_OR3 - CYGARC_REG_IMM_BASE)(r3)
|
128 |
|
|
lwi r4,(0x0e000000 | CYGARC_REG_IMM_BR_PS_32 | CYGARC_REG_IMM_BR_V)
|
129 |
|
|
stw r4,(CYGARC_REG_IMM_BR3 - CYGARC_REG_IMM_BASE)(r3)
|
130 |
|
|
|
131 |
|
|
#endif
|
132 |
|
|
|
133 |
|
|
sync
|
134 |
|
|
blr
|
135 |
|
|
|
136 |
|
|
#------------------------------------------------------------------------------
|
137 |
|
|
# end of cogent.S
|