1 /* *********************************************************************
2 * SB1250 Board Support Package
4 * Board-specific initialization File: TINY_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"
59 /* *********************************************************************
61 ********************************************************************* */
65 /* *********************************************************************
68 * Initialize board registers. This is the earliest
69 * time the BSP gets control. This routine cannot assume that
70 * memory is operational, and therefore all code in this routine
71 * must run from registers only. The $ra register must not
72 * be modified, as it contains the return address.
74 * This routine will be called from uncached space, before
75 * the caches are initialized. If you want to make
76 * subroutine calls from here, you must use the CALLKSEG1 macro.
78 * Among other things, this is where the GPIO registers get
79 * programmed to make on-board LEDs function, or other startup
80 * that has to be done before anything will work.
87 ********************************************************************* */
92 # Reprogram the SCD to make sure UART0 is enabled.
93 # Some CSWARM boards have the SER0 enable bit when
94 # they're not supposed to, which switches the UART
95 # into synchronous mode. Kill off the SCD bit.
96 # XXX this should be investigated in hardware, as
97 # XXX it is a strap option on the CPU.
100 li t0,PHYS_TO_K1(A_SCD_SYSTEM_CFG)
102 dli t2,~M_SYS_SER0_ENABLE
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
119 # Turn on the diagnostic LED and turn off the sturgeon NMI
121 li t0,PHYS_TO_K1(A_GPIO_PIN_SET)
122 li t1,M_GPIO_DEBUG_LED
125 li t0,PHYS_TO_K1(A_GPIO_PIN_CLR)
126 li t1,M_GPIO_STURGEON_NMI
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)
156 /* *********************************************************************
159 * Return the address of the DRAM information table. Note that
160 * the address must be obtained in a position-independent way,
161 * so avoid the use of the "la" instruction.
167 * v0 - DRAM info table, return 0 to use default table
168 ********************************************************************* */
179 /* *********************************************************************
182 * Set LEDs for boot-time progress indication. Not used if
183 * the board does not have progress LEDs. This routine
184 * must not call any other routines, since it may be invoked
185 * either from KSEG0 or KSEG1 and it may be invoked
186 * whether or not the icache is operational.
189 * a0 - LED value (8 bits per character, 4 characters)
196 ********************************************************************* */
199 #define LED_CHAR0 (32+8*3)
200 #define LED_CHAR1 (32+8*2)
201 #define LED_CHAR2 (32+8*1)
202 #define LED_CHAR3 (32+8*0)
206 li t0,PHYS_TO_K1(LEDS_PHYS)