annotate packages/hal/powerpc/moab/current/src/moab.S @ 1223:dbcfe4e0dbd2

New platform - TAMS MOAB - and generic changes to support it
author gthomas
date Fri, 19 Sep 2003 17:11:18 +0000
parents
children 0c4f43524d06
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1223
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
1 ##=============================================================================
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
2 ##
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
3 ## moab.S
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
4 ##
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
5 ## MOAB board hardware setup
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
6 ##
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
7 ##=============================================================================
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
8 #####ECOSGPLCOPYRIGHTBEGIN####
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
9 ## -------------------------------------------
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
10 ## This file is part of eCos, the Embedded Configurable Operating System.
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
11 ## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
12 ## Copyright (C) 2002, 2003 Gary Thomas
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
13 ##
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
14 ## eCos is free software; you can redistribute it and/or modify it under
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
15 ## the terms of the GNU General Public License as published by the Free
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
16 ## Software Foundation; either version 2 or (at your option) any later version.
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
17 ##
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
18 ## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
19 ## WARRANTY; without even the implied warranty of MERCHANTABILITY or
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
20 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
21 ## for more details.
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
22 ##
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
23 ## You should have received a copy of the GNU General Public License along
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
24 ## with eCos; if not, write to the Free Software Foundation, Inc.,
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
25 ## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
26 ##
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
27 ## As a special exception, if other files instantiate templates or use macros
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
28 ## or inline functions from this file, or you compile this file and link it
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
29 ## with other works to produce a work based on this file, this file does not
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
30 ## by itself cause the resulting work to be covered by the GNU General Public
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
31 ## License. However the source code for this file must still be made available
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
32 ## in accordance with section (3) of the GNU General Public License.
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
33 ##
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
34 ## This exception does not invalidate any other reasons why a work based on
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
35 ## this file might be covered by the GNU General Public License.
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
36 ##
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
37 ## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
38 ## at http://sources.redhat.com/ecos/ecos-license/
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
39 ## -------------------------------------------
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
40 #####ECOSGPLCOPYRIGHTEND####
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
41 ##=============================================================================
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
42 #######DESCRIPTIONBEGIN####
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
43 ##
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
44 ## Author(s): gthomas
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
45 ## Contributors:hmt
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
46 ## Date: 2002-07-22
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
47 ## Purpose: MOAB board hardware setup
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
48 ## Description: This file contains any code needed to initialize the
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
49 ## hardware on a TAMS MOAB (PowerPC 405GPr) board.
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
50 ##
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
51 ######DESCRIPTIONEND####
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
52 ##
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
53 ##=============================================================================
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
54
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
55 #include <pkgconf/hal.h>
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
56 #include <cyg/hal/arch.inc> /* register symbols et al */
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
57 #define CYGARC_HAL_COMMON_EXPORT_CPU_MACROS
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
58 #include <cyg/hal/ppc_regs.h> /* on-chip resource layout, special */
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
59
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
60 #------------------------------------------------------------------------------
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
61
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
62 // No useable LEDs
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
63 #define LED(x)
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
64
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
65 #------------------------------------------------------------------------------
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
66
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
67 FUNC_START( hal_hardware_init )
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
68 mflr r30 // Save return address
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
69
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
70 #ifndef CYG_HAL_STARTUP_RAM
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
71
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
72 li r3,0x00000000 // Make sure nothing is cacheable
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
73 mticcr r3
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
74 mtdccr r3
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
75
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
76 // Force data caches to be totally clean
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
77 lwi r3,0
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
78 lwi r4,0x8000
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
79 10: dcbf 0,r3
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
80 dccci 0,r3
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
81 addi r3,r3,16
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
82 cmpw r3,r4
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
83 bne 10b
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
84
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
85 // Basic chip configuration
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
86 #if CYGHWR_HAL_POWERPC_CPU_SPEED == 250
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
87 lwi r3,0x09f8102a
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
88 lwi r3,0x09f8502a
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
89 #elif CYGHWR_HAL_POWERPC_CPU_SPEED == 333
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
90 lwi r3,0x09f8503a
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
91 #else
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
92 #error "Unsupported board/CPU speed"
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
93 #endif
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
94 mtdcr DCR_CPC0_CR0,r3
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
95 li r3,0x00000000
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
96 mtdcr DCR_CPC0_CR1,r3
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
97
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
98 lwi r3,0x60606000 // Edge conditioning register
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
99 mtdcr DCR_CPC0_ECR,r3
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
100
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
101 // GPIO
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
102 // GPIO 13 - I - media present
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
103 // GPIO 14 - O - main flash ALE
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
104 // GPIO 15 - O - main flash CLE
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
105 // GPIO 16 - I - watchdog ?
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
106 // GPIO 17 - O - NAND CE
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
107 // GPIO 24 - O - heartbeat LED
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
108 lwi r4,GPIO_OR // Leave NAND not-selected, heartbeat off
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
109 lwi r3,0x00004080
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
110 stw r3,0(r4)
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
111 lwi r4,GPIO_TCR // Tri-state control - enables outputs
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
112 lwi r3,0x0003C080
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
113 stw r3,0(r4)
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
114
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
115 li r3,DCR_SDRAM0_CFG // See if SDRAM already configured
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
116 mtdcr DCR_SDRAM0_CFGADDR,r3
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
117 mfdcr r4,DCR_SDRAM0_CFGDATA
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
118 lwi r3,0x80800000
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
119 and r4,r4,r3
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
120 cmpw r3,r4
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
121 beq sdram_ok
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
122
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
123 // DRAM controller
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
124 li r3,DCR_SDRAM0_CFG // Turn off controller to allow changes
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
125 lwi r4,0x00000000
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
126 mtdcr DCR_SDRAM0_CFGADDR,r3
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
127 mtdcr DCR_SDRAM0_CFGDATA,r4
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
128 li r3,DCR_SDRAM0_TR
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
129 lwi r4,0x010A800E
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
130 mtdcr DCR_SDRAM0_CFGADDR,r3
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
131 mtdcr DCR_SDRAM0_CFGDATA,r4
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
132 li r3,DCR_SDRAM0_RTR
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
133 lwi r4,0x05F00000
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
134 mtdcr DCR_SDRAM0_CFGADDR,r3
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
135 mtdcr DCR_SDRAM0_CFGDATA,r4
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
136 li r3,DCR_SDRAM0_B1CR // Note: non-ascending addresses because
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
137 lwi r4,0x00062001 // the low 1/2 of memory fails on some boards
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
138 mtdcr DCR_SDRAM0_CFGADDR,r3
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
139 mtdcr DCR_SDRAM0_CFGDATA,r4
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
140 li r3,DCR_SDRAM0_B0CR
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
141 lwi r4,0x02062001
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
142 mtdcr DCR_SDRAM0_CFGADDR,r3
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
143 mtdcr DCR_SDRAM0_CFGDATA,r4
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
144
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
145 lwi r4,GPIO_OR // Turn heartbeat LED on
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
146 lwi r3,0x00004000
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
147 stw r3,0(r4)
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
148
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
149 lwi r3,0xA000 // Pause for at least 200us
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
150 mtctr r3
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
151 13: nop
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
152 bdnz 13b
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
153
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
154 li r3,DCR_SDRAM0_CFG // Enable controller
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
155 lwi r4,0x80800000
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
156 mtdcr DCR_SDRAM0_CFGADDR,r3
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
157 mtdcr DCR_SDRAM0_CFGDATA,r4
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
158
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
159 sdram_ok:
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
160 // Bus controller
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
161 li r3,DCR_EBC0_B0AP // BOOT FLASH at 0xFFExxxxx, R/W
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
162 lwi r4,0x7F8FFE80
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
163 mtdcr DCR_EBC0_CFGADDR,r3
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
164 mtdcr DCR_EBC0_CFGDATA,r4
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
165 li r3,DCR_EBC0_B0CR
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
166 lwi r4,0xFFE38000
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
167 mtdcr DCR_EBC0_CFGADDR,r3
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
168 mtdcr DCR_EBC0_CFGDATA,r4
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
169 li r3,DCR_EBC0_B1AP // MAIN FLASH at 0xCxxxxxxx, R/W
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
170 lwi r4,0x7F8FFE00
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
171 mtdcr DCR_EBC0_CFGADDR,r3
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
172 mtdcr DCR_EBC0_CFGDATA,r4
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
173 li r3,DCR_EBC0_B1CR
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
174 lwi r4,0xC0018000 // 1MB, 8bits [actually only 1 byte!]
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
175 mtdcr DCR_EBC0_CFGADDR,r3
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
176 mtdcr DCR_EBC0_CFGDATA,r4
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
177
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
178 // On-chip memory
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
179 lwi r4,0xD0000000 // Instruction/Data at 0xD0XXXXXX..0xD7XXXXXX
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
180 lwi r3,0x80000000
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
181 mtdcr DCR_OCM0_ISARC,r4
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
182 mtdcr DCR_OCM0_DSARC,r4
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
183 mtdcr DCR_OCM0_ISCNTL,r3
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
184 mtdcr DCR_OCM0_DSCNTL,r3
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
185
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
186 lwi r4,GPIO_OR // Turn heartbeat LED off
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
187 lwi r3,0x00004080
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
188 stw r3,0(r4)
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
189
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
190 #endif // ROM or ROMRAM startup
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
191
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
192 lwi r3,0x80000001 // DRAM can be cached - instructions only
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
193 iccci 0,r3
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
194 mticcr r3
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
195 li r3,0x00000000
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
196 mtdccr r3
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
197
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
198 #ifdef CYG_HAL_STARTUP_ROMRAM
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
199 // Copy image from ROM to RAM
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
200 mr r6,r30
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
201 lwi r7,0xFFF80000
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
202 and r6,r6,r7
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
203 subi r6,r6,4
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
204 lwi r7,0-4 // where to copy to
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
205 lwi r8,__ram_data_end
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
206 10: lwzu r5,4(r6)
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
207 stwu r5,4(r7)
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
208 cmplw r7,r8
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
209 bne 10b
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
210 lwi r30,_hal_hardware_init_done
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
211 #endif
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
212
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
213 lwi r4,GPIO_OR // Turn heartbeat LED on
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
214 lwi r3,0x00004000
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
215 stw r3,0(r4)
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
216
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
217 mtlr r30 // Restore return address
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
218 blr
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
219 FUNC_END( hal_hardware_init )
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
220
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
221 .globl _hang
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
222 _hang: nop
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
223 b _hang
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
224 blr
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
225
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
226 #if 0
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
227 .text
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
228 .globl _get_cache_contents
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
229 _get_cache_contents:
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
230 subi r3,r3,4
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
231 li r4,256
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
232 mtctr r4
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
233 li r4,0 // Address
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
234 lwi r7,0xFFFFFFE0
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
235 mfspr r5,SPR_CCR0
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
236 10: and r5,r5,r7 // CIS=0,CWS=0 => DATA, WAY A
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
237 mtspr SPR_CCR0,r5
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
238 sync
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
239 isync
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
240 dcread r6,0,r4
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
241 stwu r6,4(r3)
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
242 and r5,r5,r7 // CIS=0,CWS=1 => DATA, WAY B
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
243 ori r5,r5,0x01
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
244 mtspr SPR_CCR0,r5
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
245 sync
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
246 isync
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
247 mfspr r5,SPR_CCR0
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
248 dcread r6,0,r4
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
249 stwu r6,4(r3)
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
250 and r5,r5,r7 // CIS=1,CWS=0 => TAG, WAY A
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
251 ori r5,r5,0x10
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
252 mtspr SPR_CCR0,r5
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
253 sync
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
254 isync
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
255 dcread r6,0,r4
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
256 stwu r6,4(r3)
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
257 and r5,r5,r7 // CIS=1,CWS=1 => TAG, WAY B
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
258 ori r5,r5,0x11
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
259 mtspr SPR_CCR0,r5
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
260 sync
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
261 isync
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
262 dcread r6,0,r4
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
263 stwu r6,4(r3)
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
264 addi r4,r4,32
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
265 bdnz 10b
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
266 blr
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
267 #endif
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
268
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
269 #ifndef CYG_HAL_STARTUP_RAM
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
270 .section ".reset_vector","ax"
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
271 ba 0xFFF80100
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
272 .previous
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
273 #endif
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
274
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
275 #------------------------------------------------------------------------------
dbcfe4e0dbd2 New platform - TAMS MOAB - and generic changes to support it
gthomas
parents:
diff changeset
276 # end of moab.S