]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - board/mpl/mip405/init.S
f0a500ae13324c71a18606418c03796c2180e7b3
[karo-tx-uboot.git] / board / mpl / mip405 / init.S
1 /*------------------------------------------------------------------------------+
2  *
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.
9  *
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.
13  *
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.
17  *
18  *      COPYRIGHT   I B M   CORPORATION 1995
19  *      LICENSED MATERIAL  -  PROGRAM PROPERTY OF I B M
20  *-------------------------------------------------------------------------------*/
21
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 (set in C-Code)
33  *      Bank 2 - UART 1 (set in C-Code)
34  *      Bank 3 - UART 2 (set in C-Code)
35  *      Bank 4 - not used
36  *      Bank 5 - not used
37  *      Bank 6 - not used
38  *      Bank 7 - PLD Register
39  *-----------------------------------------------------------------------------*/
40 #include <ppc4xx.h>
41
42 #define _LINUX_CONFIG_H 1       /* avoid reading Linux autoconf.h file  */
43
44 #include <configs/MIP405.h>
45 #include <ppc_asm.tmpl>
46 #include <ppc_defs.h>
47
48 #include <asm/cache.h>
49 #include <asm/mmu.h>
50 #include "mip405.h"
51
52
53         .globl  ext_bus_cntlr_init
54 ext_bus_cntlr_init:
55   mflr    r4                      /* save link register */
56   bl      ..getAddr
57 ..getAddr:
58   mflr    r3                      /* get address of ..getAddr */
59   mtlr    r4                      /* restore link register */
60   addi    r4,0,14                 /* set ctr to 14; used to prefetch */
61   mtctr   r4                      /* 14 cache lines to fit this function */
62                                    /* in cache (gives us 8x14=112 instrctns) */
63 ..ebcloop:
64   icbt    r0,r3                   /* prefetch cache line for addr in r3 */
65   addi    r3,r3,32                                                              /* move to next cache line */
66   bdnz    ..ebcloop               /* continue for 14 cache lines */
67
68    /*-------------------------------------------------------------------
69     * Delay to ensure all accesses to ROM are complete before changing
70     * bank 0 timings.
71     *------------------------------------------------------------------- */
72         addis   r3,0,0x0
73   ori     r3,r3,0xA000
74   mtctr   r3
75 ..spinlp:
76   bdnz    ..spinlp                /* spin loop */
77
78         /*-----------------------------------------------------------------------
79          * decide boot up mode
80          *----------------------------------------------------------------------- */
81         addi            r4,0,pb0cr
82         mtdcr           ebccfga,r4
83         mfdcr           r4,ebccfgd
84
85         andi.           r0, r4, 0x2000                  /* mask out irrelevant bits */
86         beq                     0f                                              /* jump if 8 bit bus width */
87
88         /* setup 16 bit things (Flash Boot)
89    *-----------------------------------------------------------------------
90    * Memory Bank 0 (16 Bit Flash) initialization
91    *---------------------------------------------------------------------- */
92
93         addi    r4,0,pb0ap
94         mtdcr   ebccfga,r4
95 /*      addis   r4,0,0xFF8F */
96 /*      ori     r4,r4,0xFE80 */
97 /*      addis   r4,0,0x9B01 */
98 /*      ori     r4,r4,0x5480 */
99         addis   r4,0,(FLASH_AP_B)@h
100         ori     r4,r4,(FLASH_AP_B)@l
101         mtdcr   ebccfgd,r4
102
103         addi    r4,0,pb0cr
104         mtdcr   ebccfga,r4
105         /* BS=0x010(4MB),BU=0x3(R/W), */
106 /*      addis   r4,0,((FLASH_BASE0_PRELIM & 0xFFF00000) | 0x00050000)@h */
107 /*      ori     r4,r4,0xA000          / * BW=0x01(16 bits) */
108         addis   r4,0,(FLASH_CR_B)@h
109         ori     r4,r4,(FLASH_CR_B)@l
110         mtdcr   ebccfgd,r4
111         b                               1f
112
113 0:
114
115         /* 8Bit boot mode: */
116         /*-----------------------------------------------------------------------
117         * Memory Bank 0 Multi Purpose Socket initialization
118         *----------------------------------------------------------------------- */
119         /* 0x7F8FFE80 slowest boot */
120         addi    r4,0,pb0ap
121         mtdcr   ebccfga,r4
122 #if 0
123         addis   r4,0,0x9B01
124         ori     r4,r4,0x5480
125 #else
126         addis   r4,0,(MPS_AP_B)@h
127         ori     r4,r4,(MPS_AP_B)@l
128 #endif
129         mtdcr   ebccfgd,r4
130
131         addi    r4,0,pb0cr
132         mtdcr   ebccfga,r4
133         /* BS=0x010(4MB),BU=0x3(R/W), */
134 /*      addis   r4,0,((FLASH_BASE0_PRELIM & 0xFFF00000) | 0x00050000)@h */
135 /*      ori     r4,r4,0x8000          / * BW=0x0( 8 bits) */
136
137         addis   r4,0,(MPS_CR_B)@h
138         ori     r4,r4,(MPS_CR_B)@l
139
140         mtdcr   ebccfgd,r4
141
142
143 1:
144   /*-----------------------------------------------------------------------
145    * Memory Bank 2-3-4-5-6 (not used) initialization
146    *-----------------------------------------------------------------------*/
147   addi    r4,0,pb1cr
148   mtdcr   ebccfga,r4
149   addis   r4,0,0x0000
150   ori     r4,r4,0x0000
151   mtdcr   ebccfgd,r4
152
153   addi    r4,0,pb2cr
154   mtdcr   ebccfga,r4
155   addis   r4,0,0x0000
156   ori     r4,r4,0x0000
157   mtdcr   ebccfgd,r4
158
159   addi    r4,0,pb3cr
160   mtdcr   ebccfga,r4
161   addis   r4,0,0x0000
162   ori     r4,r4,0x0000
163   mtdcr   ebccfgd,r4
164
165   addi    r4,0,pb4cr
166   mtdcr   ebccfga,r4
167   addis   r4,0,0x0000
168   ori     r4,r4,0x0000
169   mtdcr   ebccfgd,r4
170
171   addi    r4,0,pb5cr
172   mtdcr   ebccfga,r4
173   addis   r4,0,0x0000
174   ori     r4,r4,0x0000
175   mtdcr   ebccfgd,r4
176
177         addi    r4,0,pb6cr
178   mtdcr   ebccfga,r4
179   addis   r4,0,0x0000
180   ori     r4,r4,0x0000
181   mtdcr   ebccfgd,r4
182
183         addi    r4,0,pb7cr
184   mtdcr   ebccfga,r4
185   addis   r4,0,0x0000
186   ori     r4,r4,0x0000
187   mtdcr   ebccfgd,r4
188         nop                             /* pass2 DCR errata #8 */
189   blr
190
191 /*-----------------------------------------------------------------------------
192  * Function:     sdram_init
193  * Description:  Configures the internal SRAM memory. and setup the
194  *               Stackpointer in it.
195  *----------------------------------------------------------------------------- */
196         .globl  sdram_init
197
198 sdram_init:
199
200
201   blr
202