1 |
27 |
unneback |
##=============================================================================
|
2 |
|
|
##
|
3 |
|
|
## variant.S
|
4 |
|
|
##
|
5 |
|
|
## MIPS uPD9875xx device code
|
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): hmt, nickg
|
44 |
|
|
## Contributors:nickg
|
45 |
|
|
## Date: 2001-05-25
|
46 |
|
|
## Purpose: NEC MIPS uPD985xx device code
|
47 |
|
|
## Description: Device specific code
|
48 |
|
|
##
|
49 |
|
|
##
|
50 |
|
|
##
|
51 |
|
|
##
|
52 |
|
|
######DESCRIPTIONEND####
|
53 |
|
|
##
|
54 |
|
|
##=============================================================================
|
55 |
|
|
|
56 |
|
|
#include
|
57 |
|
|
#include
|
58 |
|
|
|
59 |
|
|
#ifdef CYGPKG_KERNEL
|
60 |
|
|
# include
|
61 |
|
|
#endif
|
62 |
|
|
|
63 |
|
|
#include
|
64 |
|
|
|
65 |
|
|
#include
|
66 |
|
|
|
67 |
|
|
##-----------------------------------------------------------------------------
|
68 |
|
|
## MMU setup.
|
69 |
|
|
## Some of this code is taken from the PMON sources, hence it does not fully
|
70 |
|
|
## conform to our normal coding conventions.
|
71 |
|
|
|
72 |
|
|
#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM)
|
73 |
|
|
|
74 |
|
|
// There is none. We can access all areas via kseg[01] so we are happy
|
75 |
|
|
// with no MMU setup.
|
76 |
|
|
|
77 |
|
|
#endif
|
78 |
|
|
|
79 |
|
|
##-----------------------------------------------------------------------------
|
80 |
|
|
## MEMC initialization.
|
81 |
|
|
## This also initializes the PCI bus and ISA bus bridge, so at the end of this
|
82 |
|
|
## we should have full access to all the memory and devices we need.
|
83 |
|
|
## This code is table driven, which is somewhat more compact that coding it all.
|
84 |
|
|
## Table entries consist of an address and a value to store in that address.
|
85 |
|
|
## A zero address terminates the table. Two special address values modify the
|
86 |
|
|
## behaviour:
|
87 |
|
|
## DELAY_LOOP loops for the number of iterations in the value field.
|
88 |
|
|
## WRITE16 treats the next 2 words as an address and value to be written
|
89 |
|
|
## with a 16 bit write cycle.
|
90 |
|
|
|
91 |
|
|
#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM)
|
92 |
|
|
|
93 |
|
|
#define DELAY_LOOP 1
|
94 |
|
|
#define WRITE16 2
|
95 |
|
|
|
96 |
|
|
|
97 |
|
|
FUNC_START(hal_memc_setup)
|
98 |
|
|
|
99 |
|
|
lar t0,hal_memc_setup_table
|
100 |
|
|
la t1,0xbfc00000
|
101 |
|
|
la t2,DELAY_LOOP
|
102 |
|
|
la t3,WRITE16
|
103 |
|
|
1:
|
104 |
|
|
lw a0,0(t0) # next table entry
|
105 |
|
|
lw a1,4(t0) # value to write
|
106 |
|
|
addiu t0,8 # go to next entry
|
107 |
|
|
beq a0,t2,2f # Check for delay
|
108 |
|
|
nop
|
109 |
|
|
beq a0,t3,3f # Check for 16 bit write
|
110 |
|
|
nop
|
111 |
|
|
beqz a0,9f # zero terminates loop
|
112 |
|
|
nop
|
113 |
|
|
sw a1,0(a0) # write it
|
114 |
|
|
lw zero,0(t1) # uncached read to flush write buffer
|
115 |
|
|
b 1b
|
116 |
|
|
nop
|
117 |
|
|
2:
|
118 |
|
|
lw zero,0(t1) # uncached read to flush write buffer
|
119 |
|
|
bnez a1,2b # count down by value in a1
|
120 |
|
|
addiu a1,-1 # decrement in delay slot
|
121 |
|
|
b 1b # go back to loop
|
122 |
|
|
nop
|
123 |
|
|
3:
|
124 |
|
|
lw a3,0(t0) # get next word
|
125 |
|
|
addiu t0,4 # skip it
|
126 |
|
|
sh a3,0(a1) # store halfword
|
127 |
|
|
lw zero,0(t1) # uncached read to flush write buffer
|
128 |
|
|
b 1b
|
129 |
|
|
nop
|
130 |
|
|
9:
|
131 |
|
|
jr ra
|
132 |
|
|
nop
|
133 |
|
|
|
134 |
|
|
FUNC_END(hal_memc_setup)
|
135 |
|
|
|
136 |
|
|
##-----------------------------------------------------------------------------
|
137 |
|
|
##-----------------------------------------------------------------------------
|
138 |
|
|
## The initialization table
|
139 |
|
|
|
140 |
|
|
hal_memc_setup_table:
|
141 |
|
|
.long DELAY_LOOP, 0x00010000 # Wait for HW to settle
|
142 |
|
|
|
143 |
|
|
.long RMMDR_ADR, RMMDR_28F640
|
144 |
|
|
.long RMATR_ADR, RMATR_28F640
|
145 |
|
|
|
146 |
|
|
.long DELAY_LOOP, 0x00010000 # Wait for HW to settle
|
147 |
|
|
|
148 |
|
|
.long SDMDR_ADR, SDMDR_INIT
|
149 |
|
|
.long SDTSR_ADR, SDTSR_INIT
|
150 |
|
|
.long SDPTR_ADR, SDPTR_INIT
|
151 |
|
|
.long SDRMR_ADR, SDRMR_INIT
|
152 |
|
|
|
153 |
|
|
.long DELAY_LOOP, 0x00010000 # Wait for HW to settle
|
154 |
|
|
|
155 |
|
|
.long 0, 0
|
156 |
|
|
|
157 |
|
|
|
158 |
|
|
#endif
|
159 |
|
|
|
160 |
|
|
##-----------------------------------------------------------------------------
|
161 |
|
|
## end of platform.S
|
162 |
|
|
|