1 /* *********************************************************************
2 * SB1250 Board Support Package
4 * Board-specific initialization File: BCM91125C_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 "sb1250_mc.h"
55 #include "sb1250_mac.h"
56 #include "bsp_config.h"
57 #include "bcm91125c.h"
58 #include "mipsmacros.h"
59 #include "sb1250_draminit.h"
63 #if defined(_BCM91125C_DIAG_CFG_)
64 #define _SERIAL_PORT_LEDS_
67 /* *********************************************************************
69 ********************************************************************* */
71 #ifdef _SERIAL_PORT_LEDS_
72 #define BOARD_PROMICE_BASE (0x1FDFFC00)
73 #define BOARD_PROMICE_ZERO (0)
74 #define BOARD_PROMICE_ONE (1)
75 #define BOARD_PROMICE_DATA (2)
76 #define BOARD_PROMICE_STATUS (3)
78 #define TDA 0x01 /* Target data available */
79 #define HDA 0x02 /* Host data available */
80 #define OVR 0x04 /* Host data overflow */
84 /* *********************************************************************
87 * Initialize board registers. This is the earliest
88 * time the BSP gets control. This routine cannot assume that
89 * memory is operational, and therefore all code in this routine
90 * must run from registers only. The $ra register must not
91 * be modified, as it contains the return address.
93 * This routine will be called from uncached space, before
94 * the caches are initialized. If you want to make
95 * subroutine calls from here, you must use the CALLKSEG1 macro.
97 * Among other things, this is where the GPIO registers get
98 * programmed to make on-board LEDs function, or other startup
99 * that has to be done before anything will work.
106 ********************************************************************* */
108 LEAF(board_earlyinit)
111 # Configure the GPIOs
114 li t0,PHYS_TO_K1(A_GPIO_DIRECTION)
115 li t1,GPIO_OUTPUT_MASK
118 li t0,PHYS_TO_K1(A_GPIO_INT_TYPE)
119 li t1,GPIO_INTERRUPT_MASK
123 # Set both loopback pins to "disable"
125 li t0,PHYS_TO_K1(A_GPIO_PIN_CLR)
126 li t1,M_GPIO_SERIAL0_LOOPBACK | M_GPIO_SERIAL1_LOOPBACK
134 li t0,PHYS_TO_K1(A_IO_EXT_CS_BASE(LEDS_CS))
135 li t1,LEDS_PHYS >> S_IO_ADDRBASE
136 sd t1,R_IO_EXT_START_ADDR(t0)
138 li t1,LEDS_SIZE-1 /* Needs to be 1 smaller, se UM for details */
139 sd t1,R_IO_EXT_MULT_SIZE(t0)
142 sd t1,R_IO_EXT_TIME_CFG0(t0)
145 sd t1,R_IO_EXT_TIME_CFG1(t0)
148 sd t1,R_IO_EXT_CFG(t0)
153 # Configure the alternate boot ROM
156 li t0,PHYS_TO_K1(A_IO_EXT_CS_BASE(ALT_BOOTROM_CS))
158 li t1,ALT_BOOTROM_PHYS >> S_IO_ADDRBASE
159 sd t1,R_IO_EXT_START_ADDR(t0)
161 li t1,ALT_BOOTROM_SIZE-1
162 sd t1,R_IO_EXT_MULT_SIZE(t0)
164 li t1,ALT_BOOTROM_TIMING0
165 sd t1,R_IO_EXT_TIME_CFG0(t0)
167 li t1,ALT_BOOTROM_TIMING1
168 sd t1,R_IO_EXT_TIME_CFG1(t0)
170 li t1,ALT_BOOTROM_CONFIG
171 sd t1,R_IO_EXT_CFG(t0)
177 # Configure the Big Flash
180 li t0,PHYS_TO_K1(A_IO_EXT_CS_BASE(BIG_FLASH_CS))
182 li t1,BIG_FLASH_PHYS >> S_IO_ADDRBASE
183 sd t1,R_IO_EXT_START_ADDR(t0)
185 li t1,BIG_FLASH_SIZE-1
186 sd t1,R_IO_EXT_MULT_SIZE(t0)
188 li t1,BIG_FLASH_TIMING0
189 sd t1,R_IO_EXT_TIME_CFG0(t0)
191 li t1,BIG_FLASH_TIMING1
192 sd t1,R_IO_EXT_TIME_CFG1(t0)
194 li t1,BIG_FLASH_CONFIG
195 sd t1,R_IO_EXT_CFG(t0)
198 * If the CPU is a 1250 or hybrid, certain initialization has
199 * to be done so that the chip can be used like an 112x.
202 /* First, figure out what type of SOC we're on. */
203 ld t1, PHYS_TO_K1(A_SCD_SYSTEM_REVISION)
205 bne t3, K_SYS_SOC_TYPE_BCM1250, is_bcm112x
208 * We have a 1250 or hybrid. Initialize registers as appropriate.
212 * If we're not already running as a uniprocessor, get us there.
214 dsrl t1, t1, S_SYS_PART # part number now in t1
216 dsrl t3, t3, 8 # t3 = numcpus
218 ld t4, PHYS_TO_K1(A_SCD_SYSTEM_CFG)
219 or t4, t4, M_SYS_SB_SOFTRES
220 xor t4, t4, M_SYS_SB_SOFTRES
221 sd t4, PHYS_TO_K1(A_SCD_SYSTEM_CFG) /* clear soft reset */
225 or t4, t4, M_SYS_SB_SOFTRES | M_SYS_UNICPU0
226 sd t4, PHYS_TO_K1(A_SCD_SYSTEM_CFG) /* go unicpu */
236 li t0, PHYS_TO_K1(A_MC_BASE_0)
237 dli t1, V_MC_CONFIG_DEFAULT | M_MC_ECC_DISABLE | \
239 sd t1, R_MC_CONFIG(t0)
240 sd zero, R_MC_CS_START(t0)
241 sd zero, R_MC_CS_END(t0)
242 sd zero, R_MC_CS_INTERLEAVE(t0)
243 sd zero, R_MC_CS_ATTR(t0)
244 sd zero, R_MC_TEST_DATA(t0)
245 sd zero, R_MC_TEST_ECC(t0)
248 * Zero out MAC 2's address register. (This has
249 * undefined value after reset, but OSes may check
250 * it on some parts to see if they should init
251 * the interface. This is a convenient place
255 li t0, PHYS_TO_K1(A_MAC_BASE_2)
256 sd zero, R_MAC_ETHERNET_ADDR(t0)
265 /* *********************************************************************
268 * Return the address of the DRAM information table
274 * v0 - DRAM info table, return 0 to use default table
275 ********************************************************************* */
287 * Globals: Only one memory controller, no port interleaving
291 DRAM_CHAN_CFG(MC_CHAN1, DRT10(8,0), JEDEC, CASCHECK, BLKSIZE32, CFG_DRAM_CSINTERLEAVE, CFG_DRAM_ECC, 0)
293 DRAM_CS_SPD(MC_CS0, 0, 0, 0x54)
294 DRAM_CS_SPD(MC_CS2, 0, 0, 0x55)
301 /* *********************************************************************
304 * Transmit a single character via UART A
307 * a0 - character to transmit (low-order 8 bits)
314 ********************************************************************* */
316 #ifdef _SERIAL_PORT_LEDS_
318 LEAF(board_piai2_txchar)
320 # Wait until there is space in the transmit buffer
322 li t0,PHYS_TO_K1(BOARD_PROMICE_BASE)
324 1: lb t1,BOARD_PROMICE_STATUS(t0)
328 # Okay, now send the character.
330 sb a0,BOARD_PROMICE_ZERO(t0)
336 END(board_piai2_txchar)
339 /* *********************************************************************
342 * Set LEDs for boot-time progress indication. Not used if
343 * the board does not have progress LEDs. This routine
344 * must not call any other routines, since it may be invoked
345 * either from KSEG0 or KSEG1 and it may be invoked
346 * whether or not the icache is operational.
349 * a0 - LED value (8 bits per character, 4 characters)
356 ********************************************************************* */
358 #define LED_CHAR0 (32+8*3)
359 #define LED_CHAR1 (32+8*2)
360 #define LED_CHAR2 (32+8*1)
361 #define LED_CHAR3 (32+8*0)
365 #ifdef _SERIAL_PORT_LEDS_
370 bal board_piai2_txchar
374 li t0,PHYS_TO_K1(LEDS_PHYS)
376 bal board_piai2_txchar
379 li t0,PHYS_TO_K1(LEDS_PHYS)
381 bal board_piai2_txchar
384 li t0,PHYS_TO_K1(LEDS_PHYS)
386 bal board_piai2_txchar
389 li t0,PHYS_TO_K1(LEDS_PHYS)
391 bal board_piai2_txchar
394 bal board_piai2_txchar
396 bal board_piai2_txchar
398 bal board_piai2_txchar
406 li t0,PHYS_TO_K1(LEDS_PHYS)