1 /* *********************************************************************
2 * SB1250 Board Support Package
4 * Board-specific initialization File: BIGSUR_INIT.S
6 * This module contains the assembly-language part of the init
7 * code for this board support package. The routine
8 * "board_earlyinit" lives here.
10 * Author: Mitch Lichtenberg (mpl@broadcom.com)
12 *********************************************************************
14 * Copyright 2000,2001,2002,2003
15 * Broadcom Corporation. All rights reserved.
17 * This software is furnished under license and may be used and
18 * copied only in accordance with the following terms and
19 * conditions. Subject to these conditions, you may download,
20 * copy, install, use, modify and distribute modified or unmodified
21 * copies of this software in source and/or binary form. No title
22 * or ownership is transferred hereby.
24 * 1) Any source code used, modified or distributed must reproduce
25 * and retain this copyright notice and list of conditions
26 * as they appear in the source file.
28 * 2) No right is granted to use any trade name, trademark, or
29 * logo of Broadcom Corporation. The "Broadcom Corporation"
30 * name may not be used to endorse or promote products derived
31 * from this software without the prior written permission of
32 * Broadcom Corporation.
34 * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR
35 * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED
36 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
37 * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT
38 * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN
39 * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT,
40 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
41 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
42 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
43 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
44 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
45 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF
46 * THE POSSIBILITY OF SUCH DAMAGE.
47 ********************************************************************* */
51 #include "bcm1400_genbus.h"
52 #include "bcm1400_regs.h"
53 #include "bcm1400_scd.h"
54 #include "bsp_config.h"
55 #include "mipsmacros.h"
57 #include "bcm1400_draminit.h"
63 /* *********************************************************************
65 ********************************************************************* */
67 /* #define _SERIAL_PORT_LEDS_ */
69 #ifdef _SERIAL_PORT_LEDS_
70 #include "bcm1400_uart.h"
73 /* *********************************************************************
76 * Initialize board registers. This is the earliest
77 * time the BSP gets control. This routine cannot assume that
78 * memory is operational, and therefore all code in this routine
79 * must run from registers only. The $ra register must not
80 * be modified, as it contains the return address.
82 * This routine will be called from uncached space, before
83 * the caches are initialized. If you want to make
84 * subroutine calls from here, you must use the CALLKSEG1 macro.
86 * Among other things, this is where the GPIO registers get
87 * programmed to make on-board LEDs function, or other startup
88 * that has to be done before anything will work.
95 ********************************************************************* */
101 # Configure the GPIOs
104 li t0,PHYS_TO_K1(A_GPIO_DIRECTION)
105 li t1,GPIO_OUTPUT_MASK
108 li t0,PHYS_TO_K1(A_GPIO_INT_TYPE)
109 li t1,GPIO_INTERRUPT_MASK
113 # Turn off the diagnostic LED.
115 li t0,PHYS_TO_K1(A_GPIO_PIN_CLR)
116 li t1,M_GPIO_DEBUG_LED
121 # Configure the alternate boot ROM
124 li t0,PHYS_TO_K1(A_IO_EXT_CS_BASE(ALT_BOOTROM_CS))
126 li t1,ALT_BOOTROM_PHYS >> S_IO_ADDRBASE
127 sd t1,R_IO_EXT_START_ADDR(t0)
129 li t1,ALT_BOOTROM_SIZE-1
130 sd t1,R_IO_EXT_MULT_SIZE(t0)
132 li t1,ALT_BOOTROM_TIMING0
133 sd t1,R_IO_EXT_TIME_CFG0(t0)
135 li t1,ALT_BOOTROM_TIMING1
136 sd t1,R_IO_EXT_TIME_CFG1(t0)
138 li t1,ALT_BOOTROM_CONFIG
139 sd t1,R_IO_EXT_CFG(t0)
142 # Make sure that the mailbox register is cleared
145 li t0,PHYS_TO_K1(A_IMR_REGISTER(0,R_IMR_MAILBOX_CLR_CPU))
149 #ifdef _SERIAL_PORT_LEDS_
151 # Program the mode register for 8 bits/char, no parity
153 li t0,PHYS_TO_K1(A_DUART_MODE_REG_1_A)
154 li t1,V_DUART_BITS_PER_CHAR_8 | V_DUART_PARITY_MODE_NONE
157 # Program the mode register for 1 stop bit, ignore CTS
159 li t0,PHYS_TO_K1(A_DUART_MODE_REG_2_A)
160 li t1,M_DUART_STOP_BIT_LEN_1
163 # Program the baud rate to 115200
165 li t0,PHYS_TO_K1(A_DUART_CLK_SEL_A)
166 li t1,V_DUART_BAUD_RATE(CFG_SERIAL_BAUD_RATE)
169 # Dont use any interrupts
171 li t0,PHYS_TO_K1(A_DUART_IMR)
173 and t1,~M_DUART_IMR_ALL_A
176 # Enable sending and receiving
178 li t0,PHYS_TO_K1(A_DUART_CMD_A)
179 li t1,M_DUART_RX_EN | M_DUART_TX_EN
190 /* *********************************************************************
193 * Return the address of the DRAM information table
199 * v0 - DRAM info table, return 0 to use default table
200 ********************************************************************* */
206 # This board has soldered-down memory. (?)
218 * Regular DRAM for regular Bigsurs
224 * DRAM globals: interleave OK
227 DRAM_GLOBALS(CFG_DRAM_INTERLEAVE)
231 * 128MB on MC 0 (JEDEC SDRAM)
232 * Samsung K4H561638B - 16Mx16 chips
234 * Minimum tMEMCLK: 8.0ns (125Mhz max freq)
236 * CS0 Geometry: 13 rows, 9 columns, 2 bankbits
238 * 64khz refresh, CAS Latency 2.5
239 * Timing (ns): tCK=7.50 tRAS=45 tRP=20.00 tRRD=15.0 tRCD=20.0 tRFC=auto tRC=auto
241 * Clock Config: Default
244 DRAM_CHAN_CFG(MC_CHAN0, DRT10(8,0), JEDEC, CASCHECK, BLKSIZE32, CFG_DRAM_CSINTERLEAVE, CFG_DRAM_ECC, 0)
245 DRAM_CS_GEOM(MC_CS0, 13, 9, 2)
246 DRAM_CS_TIMING(DRT10(7,5), JEDEC_RFSH_64khz, JEDEC_CASLAT_25, 0, 45, DRT4(20,0), DRT4(15,0), DRT4(20,0), 0, 0)
250 * 128MB on MC 1 (JEDEC SDRAM)
251 * Samsung K4H561638B - 16Mx16 chips
253 * Minimum tMEMCLK: 8.0ns (125Mhz max freq)
255 * CS0 Geometry: 13 rows, 9 columns, 2 bankbits
257 * 64khz refresh, CAS Latency 2.5
258 * Timing (ns): tCK=7.50 tRAS=45 tRP=20.00 tRRD=15.0 tRCD=20.0 tRFC=auto tRC=auto
260 * Clock Config: Default
263 DRAM_CHAN_CFG(MC_CHAN1, DRT10(8,0), JEDEC, CASCHECK, BLKSIZE32, CFG_DRAM_CSINTERLEAVE, CFG_DRAM_ECC, 0)
264 DRAM_CS_GEOM(MC_CS0, 13, 9, 2)
265 DRAM_CS_TIMING(DRT10(7,5), JEDEC_RFSH_64khz, JEDEC_CASLAT_25, 0, 45, DRT4(20,0), DRT4(15,0), DRT4(20,0), 0, 0)
273 /* *********************************************************************
276 * Transmit a single character via UART A
279 * a0 - character to transmit (low-order 8 bits)
286 ********************************************************************* */
288 #ifdef _SERIAL_PORT_LEDS_
289 LEAF(board_uarta_txchar)
291 # Wait until there is space in the transmit buffer
293 1: li t0,PHYS_TO_K1(A_DUART_STATUS_A)
294 ld t1,(t0) # Get status bits
295 and t1,M_DUART_TX_RDY # test for ready
296 beq t1,0,1b # keep going till ready
298 # Okay, now send the character.
300 li t0,PHYS_TO_K1(A_DUART_TX_HOLD_A)
307 END(board_uarta_txchar)
310 /* *********************************************************************
313 * Set LEDs for boot-time progress indication. Not used if
314 * the board does not have progress LEDs. This routine
315 * must not call any other routines, since it may be invoked
316 * either from KSEG0 or KSEG1 and it may be invoked
317 * whether or not the icache is operational.
320 * a0 - LED value (8 bits per character, 4 characters)
327 ********************************************************************* */
332 #ifdef _SERIAL_PORT_LEDS_
337 bal board_uarta_txchar
341 bal board_uarta_txchar
343 bal board_uarta_txchar
345 bal board_uarta_txchar
347 bal board_uarta_txchar
350 bal board_uarta_txchar