1 /* *********************************************************************
2 * SB1250 Board Support Package
4 * Board-specific initialization File: BCM1250CPCI_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 "sb1250_genbus.h"
52 #include "sb1250_regs.h"
53 #include "sb1250_scd.h"
54 #include "bsp_config.h"
55 #include "mipsmacros.h"
56 #include "bcm1250cpci.h"
57 #include "sb1250_draminit.h"
63 /* *********************************************************************
65 ********************************************************************* */
68 * Define this to send the LED messages to the serial port instead
72 /* #define _SERIAL_PORT_LEDS_ */
74 #ifdef _SERIAL_PORT_LEDS_
75 #include "sb1250_uart.h" /* need this for serial defs */
79 /* *********************************************************************
82 * Initialize board registers. This is the earliest
83 * time the BSP gets control. This routine cannot assume that
84 * memory is operational, and therefore all code in this routine
85 * must run from registers only. The $ra register must not
86 * be modified, as it contains the return address.
88 * This routine will be called from uncached space, before
89 * the caches are initialized. If you want to make
90 * subroutine calls from here, you must use the CALLKSEG1 macro.
92 * Among other things, this is where the GPIO registers get
93 * programmed to make on-board LEDs function, or other startup
94 * that has to be done before anything will work.
101 ********************************************************************* */
103 LEAF(board_earlyinit)
107 # Configure the GPIOs
110 li t0,PHYS_TO_K1(A_GPIO_DIRECTION)
111 li t1,GPIO_OUTPUT_MASK
114 li t0,PHYS_TO_K1(A_GPIO_INT_TYPE)
115 li t1,GPIO_INTERRUPT_MASK
120 # Configure the alternate boot ROM
123 li t0,PHYS_TO_K1(A_IO_EXT_CS_BASE(ALT_BOOTROM_CS))
125 li t1,ALT_BOOTROM_PHYS >> S_IO_ADDRBASE
126 sd t1,R_IO_EXT_START_ADDR(t0)
128 li t1,ALT_BOOTROM_SIZE-1
129 sd t1,R_IO_EXT_MULT_SIZE(t0)
131 li t1,ALT_BOOTROM_TIMING0
132 sd t1,R_IO_EXT_TIME_CFG0(t0)
134 li t1,ALT_BOOTROM_TIMING1
135 sd t1,R_IO_EXT_TIME_CFG1(t0)
137 li t1,ALT_BOOTROM_CONFIG
138 sd t1,R_IO_EXT_CFG(t0)
144 li t0,PHYS_TO_K1(A_IO_EXT_CS_BASE(LEDS_CS))
145 li t1,LEDS_PHYS >> S_IO_ADDRBASE
146 sd t1,R_IO_EXT_START_ADDR(t0)
148 li t1,LEDS_SIZE-1 /* Needs to be 1 smaller, se UM for details */
149 sd t1,R_IO_EXT_MULT_SIZE(t0)
152 sd t1,R_IO_EXT_TIME_CFG0(t0)
155 sd t1,R_IO_EXT_TIME_CFG1(t0)
158 sd t1,R_IO_EXT_CFG(t0)
163 # Configure the IDE interface
166 li t0,PHYS_TO_K1(A_IO_EXT_CS_BASE(IDE_CS))
168 li t1,IDE_PHYS >> S_IO_ADDRBASE
169 sd t1,R_IO_EXT_START_ADDR(t0)
172 sd t1,R_IO_EXT_MULT_SIZE(t0)
175 sd t1,R_IO_EXT_TIME_CFG0(t0)
178 sd t1,R_IO_EXT_TIME_CFG1(t0)
181 sd t1,R_IO_EXT_CFG(t0)
185 # Configure the USB controllers
188 li t0,PHYS_TO_K1(A_IO_EXT_CS_BASE(USBCTL_CS))
189 li t1,USBCTL_PHYS >> S_IO_ADDRBASE
190 sd t1,R_IO_EXT_START_ADDR(t0)
192 li t1,USBCTL_SIZE-1 /* Needs to be 1 smaller, se UM for details */
193 sd t1,R_IO_EXT_MULT_SIZE(t0)
196 sd t1,R_IO_EXT_TIME_CFG0(t0)
199 sd t1,R_IO_EXT_TIME_CFG1(t0)
202 sd t1,R_IO_EXT_CFG(t0)
206 # Configure the PCMCIA
209 li t0,PHYS_TO_K1(A_IO_EXT_CS_BASE(PCMCIA_CS))
211 li t1,PCMCIA_PHYS >> S_IO_ADDRBASE
212 sd t1,R_IO_EXT_START_ADDR(t0)
215 sd t1,R_IO_EXT_MULT_SIZE(t0)
218 sd t1,R_IO_EXT_TIME_CFG0(t0)
221 sd t1,R_IO_EXT_TIME_CFG1(t0)
224 sd t1,R_IO_EXT_CFG(t0)
228 # Configure the CompactPCI CPLD
231 li t0,PHYS_TO_K1(A_IO_EXT_CS_BASE(CPCICPLD_CS))
232 li t1,CPCICPLD_PHYS >> S_IO_ADDRBASE
233 sd t1,R_IO_EXT_START_ADDR(t0)
235 li t1,CPCICPLD_SIZE-1 /* Needs to be 1 smaller, se UM for details */
236 sd t1,R_IO_EXT_MULT_SIZE(t0)
238 li t1,CPCICPLD_TIMING0
239 sd t1,R_IO_EXT_TIME_CFG0(t0)
241 li t1,CPCICPLD_TIMING1
242 sd t1,R_IO_EXT_TIME_CFG1(t0)
244 li t1,CPCICPLD_CONFIG
245 sd t1,R_IO_EXT_CFG(t0)
253 /* *********************************************************************
256 * Return the address of the DRAM information table
262 * v0 - DRAM info table, return 0 to use default table
263 ********************************************************************* */
269 # This board has soldered-down memory.
284 * Channel interleaving is allowed.
287 DRAM_GLOBALS(CFG_DRAM_INTERLEAVE)
290 * 128MB on MC 0 (JEDEC SDRAM)
291 * Samsung K4H561638B - 16Mx16 chips
293 * Minimum tMEMCLK: 8.0ns (125Mhz max freq)
295 * CS0 Geometry: 13 rows, 9 columns, 2 bankbits
297 * 64khz refresh, CAS Latency 2.5
298 * Timing (ns): tCK=7.50 tRAS=45 tRP=20.00 tRRD=15.0 tRCD=20.0 tRFC=auto tRC=auto
300 * Clock Config: Default
304 DRAM_CHAN_CFG(MC_CHAN0, DRT10(8,0), JEDEC, CASCHECK, BLKSIZE32, CFG_DRAM_CSINTERLEAVE, CFG_DRAM_ECC, 0)
305 DRAM_CS_GEOM(MC_CS0, 13, 9, 2)
306 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)
309 * 128MB on MC 1 (JEDEC SDRAM)
310 * Samsung K4H561638B - 16Mx16 chips
312 * Minimum tMEMCLK: 8.0ns (125Mhz max freq)
314 * CS0 Geometry: 13 rows, 9 columns, 2 bankbits
316 * 64khz refresh, CAS Latency 2.5
317 * Timing (ns): tCK=7.50 tRAS=45 tRP=20.00 tRRD=15.0 tRCD=20.0 tRFC=auto tRC=auto
319 * Clock Config: Default
322 DRAM_CHAN_CFG(MC_CHAN1, DRT10(8,0), JEDEC, CASCHECK, BLKSIZE32, CFG_DRAM_CSINTERLEAVE, CFG_DRAM_ECC, 0)
323 DRAM_CS_GEOM(MC_CS0, 13, 9, 2)
324 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)
331 /* *********************************************************************
334 * Transmit a single character via UART A
337 * a0 - character to transmit (low-order 8 bits)
344 ********************************************************************* */
345 #ifdef _SERIAL_PORT_LEDS_
346 LEAF(board_uarta_txchar)
348 # Wait until there is space in the transmit buffer
350 1: li t0,PHYS_TO_K1(A_DUART_STATUS_A)
351 ld t1,(t0) # Get status bits
352 and t1,M_DUART_TX_RDY # test for ready
353 beq t1,0,1b # keep going till ready
355 # Okay, now send the character.
357 li t0,PHYS_TO_K1(A_DUART_TX_HOLD_A)
364 END(board_uarta_txchar)
367 /* *********************************************************************
370 * Set LEDs for boot-time progress indication. Not used if
371 * the board does not have progress LEDs. This routine
372 * must not call any other routines, since it may be invoked
373 * either from KSEG0 or KSEG1 and it may be invoked
374 * whether or not the icache is operational.
377 * a0 - LED value (8 bits per character, 4 characters)
384 ********************************************************************* */
387 #define LED_CHAR0 (32+8*3)
388 #define LED_CHAR1 (32+8*2)
389 #define LED_CHAR2 (32+8*1)
390 #define LED_CHAR3 (32+8*0)
394 #ifdef _SERIAL_PORT_LEDS_
397 * Sending to serial port
403 bal board_uarta_txchar
407 bal board_uarta_txchar
409 bal board_uarta_txchar
411 bal board_uarta_txchar
413 bal board_uarta_txchar
416 bal board_uarta_txchar
426 li t0,PHYS_TO_K1(LEDS_PHYS)