]>
git.ipfire.org Git - people/ms/u-boot.git/blob - board/prodrive/alpr/alpr.c
3 * Stefan Roese, DENX Software Engineering, sr@denx.de.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26 #include <asm/processor.h>
27 #include <spd_sdram.h>
28 #include <ppc4xx_enet.h>
30 DECLARE_GLOBAL_DATA_PTR
;
32 extern int alpr_fpga_init(void);
34 int board_early_init_f (void)
38 /*-------------------------------------------------------------------------+
39 | Initialize EBC CONFIG
40 +-------------------------------------------------------------------------*/
42 mtebc(xbcfg
, EBC_CFG_LE_UNLOCK
|
43 EBC_CFG_PTD_ENABLE
| EBC_CFG_RTC_64PERCLK
|
44 EBC_CFG_ATC_PREVIOUS
| EBC_CFG_DTC_PREVIOUS
|
45 EBC_CFG_CTC_PREVIOUS
| EBC_CFG_EMC_NONDEFAULT
|
46 EBC_CFG_PME_DISABLE
| EBC_CFG_PR_32
);
48 mtebc(xbcfg
, EBC_CFG_LE_UNLOCK
|
49 EBC_CFG_PTD_DISABLE
| EBC_CFG_RTC_64PERCLK
|
50 EBC_CFG_ATC_PREVIOUS
| EBC_CFG_DTC_PREVIOUS
|
51 EBC_CFG_CTC_PREVIOUS
| EBC_CFG_EMC_NONDEFAULT
|
52 EBC_CFG_PME_DISABLE
| EBC_CFG_PR_32
);
55 /*--------------------------------------------------------------------
56 * Setup the interrupt controller polarities, triggers, etc.
57 *-------------------------------------------------------------------*/
58 mtdcr (uic0sr
, 0xffffffff); /* clear all */
59 mtdcr (uic0er
, 0x00000000); /* disable all */
60 mtdcr (uic0cr
, 0x00000009); /* SMI & UIC1 crit are critical */
61 mtdcr (uic0pr
, 0xfffffe13); /* per ref-board manual */
62 mtdcr (uic0tr
, 0x01c00008); /* per ref-board manual */
63 mtdcr (uic0vr
, 0x00000001); /* int31 highest, base=0x000 */
64 mtdcr (uic0sr
, 0xffffffff); /* clear all */
66 mtdcr (uic1sr
, 0xffffffff); /* clear all */
67 mtdcr (uic1er
, 0x00000000); /* disable all */
68 mtdcr (uic1cr
, 0x00000000); /* all non-critical */
69 mtdcr (uic1pr
, 0xffffe0ff); /* per ref-board manual */
70 mtdcr (uic1tr
, 0x00ffc000); /* per ref-board manual */
71 mtdcr (uic1vr
, 0x00000001); /* int31 highest, base=0x000 */
72 mtdcr (uic1sr
, 0xffffffff); /* clear all */
74 mtdcr (uic2sr
, 0xffffffff); /* clear all */
75 mtdcr (uic2er
, 0x00000000); /* disable all */
76 mtdcr (uic2cr
, 0x00000000); /* all non-critical */
77 mtdcr (uic2pr
, 0xffffffff); /* per ref-board manual */
78 mtdcr (uic2tr
, 0x00ff8c0f); /* per ref-board manual */
79 mtdcr (uic2vr
, 0x00000001); /* int31 highest, base=0x000 */
80 mtdcr (uic2sr
, 0xffffffff); /* clear all */
82 mtdcr (uicb0sr
, 0xfc000000); /* clear all */
83 mtdcr (uicb0er
, 0x00000000); /* disable all */
84 mtdcr (uicb0cr
, 0x00000000); /* all non-critical */
85 mtdcr (uicb0pr
, 0xfc000000); /* */
86 mtdcr (uicb0tr
, 0x00000000); /* */
87 mtdcr (uicb0vr
, 0x00000001); /* */
89 mfr
&= ~SDR0_MFR_ECS_MASK
;
96 char *s
= getenv ("serial#");
98 printf ("Board: ALPR");
108 #if defined(CFG_DRAM_TEST)
111 uint
*pstart
= (uint
*) 0x00000000;
112 uint
*pend
= (uint
*) 0x08000000;
115 for (p
= pstart
; p
< pend
; p
++)
118 for (p
= pstart
; p
< pend
; p
++) {
119 if (*p
!= 0xaaaaaaaa) {
120 printf ("SDRAM test fails at: %08x\n", (uint
) p
);
125 for (p
= pstart
; p
< pend
; p
++)
128 for (p
= pstart
; p
< pend
; p
++) {
129 if (*p
!= 0x55555555) {
130 printf ("SDRAM test fails at: %08x\n", (uint
) p
);
138 /*************************************************************************
141 * This routine is called just prior to registering the hose and gives
142 * the board the opportunity to check things. Returning a value of zero
143 * indicates that things are bad & PCI initialization should be aborted.
145 * Different boards may wish to customize the pci controller structure
146 * (add regions, override default access routines, etc) or perform
147 * certain pre-initialization actions.
149 ************************************************************************/
150 #if defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT)
151 int pci_pre_init(struct pci_controller
* hose
)
155 /*--------------------------------------------------------------------------+
156 * The ocotea board is always configured as the host & requires the
157 * PCI arbiter to be enabled.
158 *--------------------------------------------------------------------------*/
159 mfsdr(sdr_sdstp1
, strap
);
160 if( (strap
& SDR0_SDSTP1_PAE_MASK
) == 0 ){
161 printf("PCI: SDR0_STRP1[%08lX] - PCI Arbiter disabled.\n",strap
);
170 #endif /* defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT) */
172 /*************************************************************************
175 * The bootstrap configuration provides default settings for the pci
176 * inbound map (PIM). But the bootstrap config choices are limited and
177 * may not be sufficient for a given board.
179 ************************************************************************/
180 #if defined(CONFIG_PCI) && defined(CFG_PCI_TARGET_INIT)
181 void pci_target_init(struct pci_controller
* hose
)
183 /*--------------------------------------------------------------------------+
185 *--------------------------------------------------------------------------*/
186 out32r( PCIX0_PIM0SA
, 0 ); /* disable */
187 out32r( PCIX0_PIM1SA
, 0 ); /* disable */
188 out32r( PCIX0_PIM2SA
, 0 ); /* disable */
189 out32r( PCIX0_EROMBA
, 0 ); /* disable expansion rom */
191 /*--------------------------------------------------------------------------+
192 * Map all of SDRAM to PCI address 0x0000_0000. Note that the 440 strapping
193 * options to not support sizes such as 128/256 MB.
194 *--------------------------------------------------------------------------*/
195 out32r( PCIX0_PIM0LAL
, CFG_SDRAM_BASE
);
196 out32r( PCIX0_PIM0LAH
, 0 );
197 out32r( PCIX0_PIM0SA
, ~(gd
->ram_size
- 1) | 1 );
199 out32r( PCIX0_BAR0
, 0 );
201 /*--------------------------------------------------------------------------+
202 * Program the board's subsystem id/vendor id
203 *--------------------------------------------------------------------------*/
204 out16r( PCIX0_SBSYSVID
, CFG_PCI_SUBSYS_VENDORID
);
205 out16r( PCIX0_SBSYSID
, CFG_PCI_SUBSYS_DEVICEID
);
207 out16r( PCIX0_CMD
, in16r(PCIX0_CMD
) | PCI_COMMAND_MEMORY
| PCI_COMMAND_MASTER
);
209 #endif /* defined(CONFIG_PCI) && defined(CFG_PCI_TARGET_INIT) */
211 /*************************************************************************
214 * This routine is called to determine if a pci scan should be
215 * performed. With various hardware environments (especially cPCI and
216 * PPMC) it's insufficient to depend on the state of the arbiter enable
217 * bit in the strap register, or generic host/adapter assumptions.
219 * Rather than hard-code a bad assumption in the general 440 code, the
220 * 440 pci code requires the board to decide at runtime.
222 * Return 0 for adapter mode, non-zero for host (monarch) mode.
225 ************************************************************************/
226 #if defined(CONFIG_PCI)
227 int is_pci_host(struct pci_controller
*hose
)
229 /* The ocotea board is always configured as host. */
232 #endif /* defined(CONFIG_PCI) */
234 /*************************************************************************
237 ************************************************************************/
238 #if defined(CONFIG_PCI) && defined(CFG_PCI_MASTER_INIT)
239 void pci_master_init(struct pci_controller
*hose
)
241 /*--------------------------------------------------------------------------+
242 | PowerPC440 PCI Master configuration.
243 | Map PLB/processor addresses to PCI memory space.
244 | PLB address 0xA0000000-0xCFFFFFFF ==> PCI address 0x80000000-0xCFFFFFFF
245 | Use byte reversed out routines to handle endianess.
246 | Make this region non-prefetchable.
247 +--------------------------------------------------------------------------*/
248 out32r( PCIX0_POM0SA
, 0 ); /* disable */
249 out32r( PCIX0_POM1SA
, 0 ); /* disable */
250 out32r( PCIX0_POM2SA
, 0 ); /* disable */
252 out32r(PCIX0_POM0LAL
, CFG_PCI_MEMBASE
); /* PMM0 Local Address */
253 out32r(PCIX0_POM0LAH
, 0x00000003); /* PMM0 Local Address */
254 out32r(PCIX0_POM0PCIAL
, CFG_PCI_MEMBASE
); /* PMM0 PCI Low Address */
255 out32r(PCIX0_POM0PCIAH
, 0x00000000); /* PMM0 PCI High Address */
256 out32r(PCIX0_POM0SA
, ~(0x10000000 - 1) | 1); /* 256MB + enable region */
258 out32r(PCIX0_POM1LAL
, CFG_PCI_MEMBASE2
); /* PMM0 Local Address */
259 out32r(PCIX0_POM1LAH
, 0x00000003); /* PMM0 Local Address */
260 out32r(PCIX0_POM1PCIAL
, CFG_PCI_MEMBASE2
); /* PMM0 PCI Low Address */
261 out32r(PCIX0_POM1PCIAH
, 0x00000000); /* PMM0 PCI High Address */
262 out32r(PCIX0_POM1SA
, ~(0x10000000 - 1) | 1); /* 256MB + enable region */
264 #endif /* defined(CONFIG_PCI) && defined(CFG_PCI_MASTER_INIT) */
268 * Returns 1 if keys pressed to start the power-on long-running tests
269 * Called from board_init_f().
271 int post_hotkeys_pressed(void)
278 void board_reset(void)
281 * Initiate chip reset in debug control register DBCR
283 mtspr(dbcr0
, 0x20000000);