2 #include "bsp_config.h"
6 #include "bcm97115_uart.h"
10 /* *********************************************************************
13 * Initialize board registers. This is the earliest
14 * time the BSP gets control. This routine cannot assume that
15 * memory is operational, and therefore all code in this routine
16 * must run from registers only. The $ra register must not
17 * be modified, as it contains the return address.
19 * This routine will be called from uncached space, before
20 * the caches are initialized. If you want to make
21 * subroutine calls from here, you must use the CALLKSEG1 macro.
23 * Among other things, this is where the GPIO registers get
24 * programmed to make on-board LEDs function, or other startup
25 * that has to be done before anything will work.
32 ********************************************************************* */
41 li t2,PHYS_ROM_BASE|EBI_SIZE_2M
42 sw t2,CS0BASE(t1) //# CS[0] Base
45 li t2,PHYS_FLASH_BASE|EBI_SIZE_16M
46 sw t2,CS1BASE(t1) //# CS[1] Base
47 li t2,SEVENWT|EBI_WORD_WIDE|EBI_ENABLE
48 sw t2,CS1CNTL(t1) //# CS[1] Control
51 li t2,PHYS_FLASH2_BASE|EBI_SIZE_4M
52 sw t2,CS2BASE(t1) //# CS[2] Base
53 li t2,SEVENWT|EBI_WORD_WIDE|EBI_ENABLE
54 sw t2,CS2CNTL(t1) //# CS[2] Control
57 li t2,PHYS_BCM44XX_BASE|EBI_SIZE_8K
58 sw t2,CS8BASE(t1) //# CS[8] Base
60 li t2,EBI_WORD_WIDE|EBI_ENABLE|EBI_TS_TA_MODE|0x800
62 li t2,EBI_WORD_WIDE|EBI_ENABLE|EBI_TS_TA_MODE|EBI_REV_END|0x800
64 sw t2,CS8CNTL(t1) //# CS[8] Control
71 # Turn off all timers.
75 sb zero,TIMER_MASK(t0)
79 sw zero,TIMER_0_CTL(t0)
80 sw zero,TIMER_1_CTL(t0)
81 sw zero,TIMER_2_CTL(t0)
82 sw zero,TIMER_3_CTL(t0)
87 li t3, XTALFREQ / 115200 / 16
89 /* Ugh! Debugging hack! */
92 sb t3, BAUDLO_OFFSET(t1)
95 sb t3, BAUDHI_OFFSET(t1)
97 sb zero, RXSTAT_OFFSET(t1)
98 sb zero, TXSTAT_OFFSET(t1)
100 li t2, TXEN | RXEN | BITM8
101 sb t2, CTRL_OFFSET(t1)
113 /* *********************************************************************
116 * Return the address of the DRAM information table
122 * v0 - DRAM info table, return 0 to use default table
123 ********************************************************************* */
128 move v0,zero # auto configure
134 /* *********************************************************************
137 * This routine should activate memory.
140 * a0 - points to configuration table returned by board_draminfo
141 * or 0 to use an automatic table
144 * v0 - total memory installed
147 * can use all registers.
148 ********************************************************************* */
152 #ifndef DEBUG_ENV_ICE
155 * BCM711x Mips bootcode
158 * BCM97115 DDRAM Configuration
159 * DDRAM configured for 2 chips of 16Mbits x 16 (total 64 Mbytes):
160 * - CS0: 1 chip of 256 Mbits, 16 bit wide, a total of 32 Mbytes
161 * - CS1: 1 chip of 256 Mbits, 16 bit wide, a total of 32 Mbytes
162 * - 16 bit mode of operation for the DDR interface
163 * BCM97110 DDRAM Configuration
164 * DDRAM configured for 2 chips of 16Mbits x 16 (total 64 Mbytes):
165 * - CS0: 2 chips of 256 Mbits, 16-bit wide, a total of 64 Mbytes
166 * - CS1: No DDR device mounted on this chip select
167 * - 32 bit mode of operation for the DDR interface
171 * Setup for 2 chips 16Mbits x 16 Samsung K4H561638B.
173 li v0,DDR_BASE_ADR_REG /* v0 contains DDR control reg. base. */
179 * Program RB_MMC_DRAM_TIMING_REG (0x00)
181 #if defined(BCM97115)
182 li v1,0x0000BA2C /* Set RB_MMC_DRAM_TIMING_REG = 0x0000BA2C */
184 li v1,0x00001A2C /* Set RB_MMC_DRAM_TIMING_REG = 0x00001A2C */
186 sw v1,0x00(v0) /* Set RB_MMC_DRAM_TIMING_REG */
189 * Program RB_MMC_MEC_DRAM_MODE_REG (0x01)
190 * BCM97115 (default 64 Mbytes)
191 * - ExtBusWidth 16-bit external DDR interface
192 * - M256_CS1 256 Mbits device mounted on chip select 1
193 * - M256_CS0 256 Mbits device mounted on chip select 0
195 * BCM97110 (default 64 Mbytes)
196 * - ExtBusWidth 32-bit external DDR interface
197 * - M256_CS0 256 Mbits device mounted on chip select 0
199 * - Burst Length 8 for 16bit mode & 4 for 32bit mode
201 #if defined(BCM97115)
202 li v1,0x00007823 /* Setting for BCM7115 */
203 /* RB_MMC_MEC_DRAM_MODE_REG = 0x00007863 */
205 li v1,0x00001023 /* Setting for BCM7110 */
206 /* RB_MMC_MEC_DRAM_MODE_REG = 0x00001022 */
209 sw v1,0x04(v0) /* Set RB_MMC_MEMC_DRAM_MODE_REG */
212 * Program RB_MMC_MEMC_DRAM_MODE2_REG (0x2A)
214 * - MEMSIZE 32 Mbytes mounted on CS0
215 * - CS1_NM there is DDR device mounted on the second chip select
217 * - MEMSIZE 64 Mbytes mounted on CS0
218 * - CS1_NM there is no DDR device mounted on the second chip select
220 #if defined(BCM97115)
226 sw v1,0xA8(v0) /* Set RB_MMC_MEMC_DRAM_MODE2_REG */
229 * Program RB_MMC_MMU_REG0 (0x06)
230 * RB_MMC_MMU_REG1 (0x07)
231 * RB_MMC_MMU_REG2 (0x08)
232 * RB_MMC_MMU_REG3 (0x09)
234 * - CS0 32 Mbytes mounted on CS0 (4M x 16 x 4) * 1 chip
235 * - CS1 32 Mbytes mounted on CS1 (4M x 16 x 4) * 1 chip
237 * - CS0 64 Mbytes mounted on CS0 (4M x 16 x 4) * 2 chips
238 * - CS1 there is no DDR device mounted on the second chip select
240 #if defined(BCM97115)
242 sw v1,0x18(v0) /* Set RB_MMC_MMU_REG0 = 0x00003210 */
244 sw v1,0x1C(v0) /* Set RB_MMC_MMU_REG1 = 0x0000BA98 */
246 sw v1,0x20(v0) /* Set RB_MMC_MMU_REG2 = 0x0000ffff */
247 sw v1,0x24(v0) /* Set RB_MMC_MMU_REG3 = 0x0000ffff */
250 sw v1,0x18(v0) /* Set RB_MMC_MMU_REG0 = 0x00003210 */
252 sw v1,0x1C(v0) /* Set RB_MMC_MMU_REG1 = 0x00007654 */
254 sw v1,0x20(v0) /* Set RB_MMC_MMU_REG2 = 0x0000ffff */
255 sw v1,0x24(v0) /* Set RB_MMC_MMU_REG3 = 0x0000ffff */
259 * Program RB_MMC_NMBX_TIMING_REG (0x02)
262 sw v1,0x08(v0) /* Set RB_MMC_NMBX_TIMING_REG = 0x0000172E */
265 * Program RB_MMC_READ01_NCDL_CORR_REG (0x0D)
266 * RB_MMC_READ23_NCDL_CORR_REG (0x2B)
269 sw v1,0x34(v0) /* Set RB_MMC_READ01_NCDL_CORR_REG = 0x00007E7E */
270 sw v1,0xAC(v0) /* Set RB_MMC_READ23_NCDL_CORR_REG = 0x00007E7E */
273 * Program RB_MMC_RDWR_NCDL_CORR_REG (0x0C)
275 #if defined(BCM97115)
276 li v1,0x00009D05 /* Set RB_MMC_RDWR_NCDL_CORR_REG = 0x00009D05 */
278 li v1,0x00000101 /* Set RB_MMC_RDWR_NCDL_CORR_REG = 0x00000101 */
281 sw v1,0x30(v0) /* Set RB_MMC_RDWR_NCDL_CORR_REG */
284 * Program RB_MMC_MSA_MODE_REG (0x1B)
286 sw $0,0x6C(v0) /* Set RB_MMC_MSA_MODE_REG: Normal mode */
289 * Program the client priority, timer value and
290 * round robin membership etc.
292 sw $0,0x0C(v0) /* Set RB_MMC_CLIENT_INDEX_REG */
294 sw v1,0x10(v0) /* Set RB_MMC_INDX_DATA_WR_REG */
455 * Program RB_SOFT_RESET1_WITHDRAW_REG (0x69)
470 /* *********************************************************************
473 * Set LEDs for boot-time progress indication. Not used if
474 * the board does not have progress LEDs. This routine
475 * must not call any other routines, since it may be invoked
476 * either from KSEG0 or KSEG1 and it may be invoked
477 * whether or not the icache is operational.
480 * a0 - LED value (8 bits per character, 4 characters)
487 ********************************************************************* */
498 1: lb t1, TXSTAT_OFFSET(t0)
502 sb a0, TXDATA_OFFSET(t0)
512 1: lb t1, TXSTAT_OFFSET(t0)
516 sb t3, TXDATA_OFFSET(t0)
519 1: lb t1, TXSTAT_OFFSET(t0)
523 sb t3, TXDATA_OFFSET(t0)