2 #include "bsp_config.h"
5 #include "6345_common.h"
9 #************************************************************************
10 #* InitEbi: Initializes the EBI for proper chip-select operation *
12 #* SYNTAX: void InitEbi(void); *
16 #* CS[0] - Flash @ 1fc0_0000 BASE_ADDR must already be set *
17 #* because we have boot from flash *
19 #* CS[2] - ITeX ADSL @ PHYS_ITEX_BASE *
21 #* CS[4] - BCM42xx @ PHYS_BCM42xx_BASE *
26 #************************************************************************
29 /* *********************************************************************
32 * Initialize board registers. This is the earliest
33 * time the BSP gets control. This routine cannot assume that
34 * memory is operational, and therefore all code in this routine
35 * must run from registers only. The $ra register must not
36 * be modified, as it contains the return address.
38 * This routine will be called from uncached space, before
39 * the caches are initialized. If you want to make
40 * subroutine calls from here, you must use the CALLKSEG1 macro.
42 * Among other things, this is where the GPIO registers get
43 * programmed to make on-board LEDs function, or other startup
44 * that has to be done before anything will work.
51 ********************************************************************* */
57 li v0,1<<22 # seanl: Why? SR_BEV
58 mtc0 v0,C0_SR # state unknown on reset
59 mtc0 zero,C0_CAUSE # clear software interrupts
63 /**--------------------------------------------------------------**/
64 /** platform specific code **/
65 /**--------------------------------------------------------------**/
68 /**----- Disable Caches -----------------------------------------**/
69 mfc0 t1, BCM6345_CONFIG
71 and t1, t1, ~(CP0_CFG_ICSHEN|CP0_CFG_DCSHEN)
72 mtc0 t1, BCM6345_CONFIG # disable I&D Caches
75 /**----- Initialize EBI -----------------------------------------**/
77 li t2,PHYS_FLASH_BASE|EBI_SIZE_8M
78 sw t2,CS0BASE(t1) # CS[0] Base
79 li t2,THREEWT|EBI_WORD_WIDE|EBI_ENABLE
80 sw t2,CS0CNTL(t1) # CS[0] Control
83 # Supposedly, this enables the master WR_POST for the EBI, as well as
84 # setting something else. However, with A3 silicon, it seems that we
85 # need to set the individual WR_POST bits for each CS#CNTL in order for
86 # it to work. It isn't clear whether or not the master enable is needed
89 # We believe that this used to work for the A2, but perhaps that change
90 # didn't get rolled in to A3?
96 /**--- End of InitEbi -------------------------------------------**/
98 /**----- Initialize MIPS Clock ----------------------------------**/
99 li t0, INTC_BASE # The address of the PLL register
102 sw t1, FMSEL(t0) # Set Mips Clock
108 /* *********************************************************************
111 * Return the address of the DRAM information table
117 * v0 - DRAM info table, return 0 to use default table
118 ********************************************************************* */
128 /* *********************************************************************
131 * This routine should activate memory.
134 * a0 - points to configuration table returned by board_draminfo
135 * or 0 to use an automatic table
138 * v0 - total memory installed
141 * can use all registers.
142 ********************************************************************* */
147 #************************************************************************
149 #* InitSdram: Initializes the Sdram for proper operation *
151 #* SYNTAX: void InitSdram(void); *
153 #* Note: We must be running UnCached before executing this routine *
154 #* for delay purposes *
155 #************************************************************************
160 /* check memory config type 64MB, 32MB, 16MB and default to 8MB */
162 li t0,BOARD_SDRAM_TYPE_ADDRESS
165 /* setting for 64MB, 2 chip */
166 li t3,SDR_ENABLE|SDR_MRS_CMD|SDR_64MEG |SDR_128MEG /* 0x0000003C */
167 li t2,PHYS_DRAM_BASE|DRAM64MBSPC /* 64mg */
169 li t4,MEMORY_64MB_2_CHIP
173 /* setting for 32MB, 1 chip */
174 li t3,SDR_ENABLE|SDR_MRS_CMD|SDR_128MEG /* 0x0000002C */
175 li t2,PHYS_DRAM_BASE|DRAM32MBSPC /* 32mg */
177 li t4,MEMORY_32MB_1_CHIP
181 /* setting for 16MB, 1 chip */
182 li t3,SDR_ENABLE|SDR_MRS_CMD|SDR_128MEG|SDR_9BIT_COL /* 0x0000082C */
183 li t2,PHYS_DRAM_BASE|DRAM16MBSPC /* 16mg */
185 li t4,MEMORY_16MB_1_CHIP
189 /* Default SDRAM settings for BCM6345 board (8MB, 1 chip) */
190 li t3,SDR_ENABLE|SDR_MRS_CMD|SDR_64MEG /* 0x0000001c */
191 li t2,PHYS_DRAM_BASE|DRAM8MBSPC /* 8mg */
195 sw t2,SDR_MEM_BASE(t1) # Set Memory Base address and size
196 li t2,SDR_FULL_PG|SDR_FAST_MEM
197 sw t2,SDR_CFG_REG(t1) # Full page burst, slow memory
198 li t2,SDR_ENABLE|SDR_PRE_CMD
199 sw t2,SDR_INIT_CTL(t1) # Pre-charge powerup sequence
200 li t2,SDR_ENABLE|SDR_CBR_CMD
201 sw t2,SDR_INIT_CTL(t1) # 8 or more auto-refresh cmds
202 sw t2,SDR_INIT_CTL(t1)
203 sw t2,SDR_INIT_CTL(t1)
204 sw t2,SDR_INIT_CTL(t1)
205 sw t2,SDR_INIT_CTL(t1)
206 sw t2,SDR_INIT_CTL(t1)
207 sw t2,SDR_INIT_CTL(t1)
208 sw t2,SDR_INIT_CTL(t1)
209 sw t3,SDR_INIT_CTL(t1) # Mode Register set,
210 li t2,SDR_REF_EN|0x40
211 sw t2,SDR_REF_CTL(t1) # Refresh period 0x40, Enable
219 /* *********************************************************************
222 * Set LEDs for boot-time progress indication. Not used if
223 * the board does not have progress LEDs. This routine
224 * must not call any other routines, since it may be invoked
225 * either from KSEG0 or KSEG1 and it may be invoked
226 * whether or not the icache is operational.
229 * a0 - LED value (8 bits per character, 4 characters)
236 ********************************************************************* */