1 /*------------------------------------------------------------------------------+
3 * This source code has been made available to you by IBM on an AS-IS
4 * basis. Anyone receiving this source is licensed under IBM
5 * copyrights to use it in any way he or she deems fit, including
6 * copying it, modifying it, compiling it, and redistributing it either
7 * with or without modifications. No license under IBM patents or
8 * patent applications is to be implied by the copyright license.
10 * Any user of this software should understand that IBM cannot provide
11 * technical support for this software and will not be responsible for
12 * any consequences resulting from the use of this software.
14 * Any person who transfers this source code or any derivative work
15 * must include the IBM copyright notice, this paragraph, and the
16 * preceding two paragraphs in the transferred software.
18 * COPYRIGHT I B M CORPORATION 1995
19 * LICENSED MATERIAL - PROGRAM PROPERTY OF I B M
20 *-------------------------------------------------------------------------------*/
22 /*-----------------------------------------------------------------------------
23 * Function: ext_bus_cntlr_init
24 * Description: Initializes the External Bus Controller for the external
25 * peripherals. IMPORTANT: For pass1 this code must run from
26 * cache since you can not reliably change a peripheral banks
27 * timing register (pbxap) while running code from that bank.
28 * For ex., since we are running from ROM on bank 0, we can NOT
29 * execute the code that modifies bank 0 timings from ROM, so
30 * we run it from cache.
31 * Bank 0 - Flash or Multi Purpose Socket
32 * Bank 1 - Multi Purpose Socket or Flash
37 * Bank 6 - used to switch on the 12V for the Multipurpose socket
38 * Bank 7 - Config Register
39 *-----------------------------------------------------------------------------*/
42 #define _LINUX_CONFIG_H 1 /* avoid reading Linux autoconf.h file */
44 #include "configs/PIP405.h"
45 #include <ppc_asm.tmpl>
48 #include <asm/cache.h>
52 .globl ext_bus_cntlr_init
54 mflr r4 /* save link register */
57 mflr r3 /* get address of ..getAddr */
58 mtlr r4 /* restore link register */
59 addi r4,0,14 /* set ctr to 14; used to prefetch */
60 mtctr r4 /* 14 cache lines to fit this function */
61 /* in cache (gives us 8x14=112 instrctns) */
63 icbt r0,r3 /* prefetch cache line for addr in r3 */
64 addi r3,r3,32 /* move to next cache line */
65 bdnz ..ebcloop /* continue for 14 cache lines */
67 /*-------------------------------------------------------------------
68 * Delay to ensure all accesses to ROM are complete before changing
70 *------------------------------------------------------------------- */
75 bdnz ..spinlp /* spin loop */
77 /*-----------------------------------------------------------------------
79 *----------------------------------------------------------------------- */
84 andi. r0, r4, 0x2000 /* mask out irrelevant bits */
85 beq 0f /* jump if 8 bit bus width */
87 /* setup 16 bit things
88 *-----------------------------------------------------------------------
89 * Memory Bank 0 (16 Bit Flash) initialization
90 *---------------------------------------------------------------------- */
100 /* BS=0x011(8MB),BU=0x3(R/W), */
101 addis r4,0,((FLASH_BASE0_PRELIM & 0xFFF00000) | 0x00050000)@h
102 ori r4,r4,0xA000 /* BW=0x01(16 bits) */
105 /*-----------------------------------------------------------------------
106 * Memory Bank 1 (Multi Purpose Socket) initialization
107 *----------------------------------------------------------------------*/
116 /* BS=0x011(8MB),BU=0x3(R/W), */
117 addis r4,0,((MULTI_PURPOSE_SOCKET_ADDR & 0xFFF00000) | 0x00050000)@h
118 ori r4,r4,0x8000 /* BW=0x0( 8 bits) */
123 /* 8Bit boot mode: */
124 /*-----------------------------------------------------------------------
125 * Memory Bank 0 Multi Purpose Socket initialization
126 *----------------------------------------------------------------------- */
136 /* BS=0x011(4MB),BU=0x3(R/W), */
137 addis r4,0,((FLASH_BASE0_PRELIM & 0xFFF00000) | 0x00050000)@h
138 ori r4,r4,0x8000 /* BW=0x0( 8 bits) */
141 /*-----------------------------------------------------------------------
142 * Memory Bank 1 (Flash) initialization
143 *-----------------------------------------------------------------------*/
152 /* BS=0x011(8MB),BU=0x3(R/W), */
153 addis r4,0,((MULTI_PURPOSE_SOCKET_ADDR & 0xFFF00000) | 0x00050000)@h
154 ori r4,r4,0xA000 /* BW=0x0( 8 bits) */
158 /*-----------------------------------------------------------------------
159 * Memory Bank 2-3-4-5-6 (not used) initialization
160 *-----------------------------------------------------------------------*/
191 /*-----------------------------------------------------------------------
192 * Memory Bank 7 (Config Register) initialization
193 *----------------------------------------------------------------------- */
196 addis r4,0,0x0181 /* Doc says TWT=3 and Openios TWT=3!! */
197 ori r4,r4,0x5280 /* disable Ready, BEM=0 */
202 /* BS=0x0(1MB),BU=0x3(R/W), */
203 addis r4,0,((CONFIG_PORT_ADDR & 0xFFF00000) | 0x00010000)@h
204 ori r4,r4,0x8000 /* BW=0x0(8 bits) */
206 nop /* pass2 DCR errata #8 */
209 /*-----------------------------------------------------------------------------
210 * Function: sdram_init
211 * Description: Configures the internal SRAM memory. and setup the
212 * Stackpointer in it.
213 *----------------------------------------------------------------------------- */