1 | /* vmeconfig.c,v 1.1.2.2 2003/03/25 16:46:01 joel Exp */ |
---|
2 | |
---|
3 | /* Standard VME bridge configuration for PPC boards */ |
---|
4 | |
---|
5 | /* Copyright Author: Till Straumann <strauman@slac.stanford.edu>, 3/2002 */ |
---|
6 | |
---|
7 | /* Copyright 2004, Brookhaven National Lab. and S. Kate Feng <feng1@bnl.gov> |
---|
8 | * Modified to support the MVME5500, 3/2004 |
---|
9 | */ |
---|
10 | |
---|
11 | #include <bsp.h> |
---|
12 | #include <bsp/VME.h> |
---|
13 | #include <bsp/irq.h> |
---|
14 | #include <libcpu/bat.h> |
---|
15 | |
---|
16 | /* Use a weak alias for the VME configuration. |
---|
17 | * This permits individual applications to override |
---|
18 | * this routine. |
---|
19 | * They may even create an 'empty' |
---|
20 | * |
---|
21 | * void BSP_vme_config(void) {} |
---|
22 | * |
---|
23 | * which will avoid linking in the Universe driver |
---|
24 | * at all :-). |
---|
25 | */ |
---|
26 | |
---|
27 | void BSP_vme_config(void) __attribute__ (( weak, alias("__BSP_default_vme_config") )); |
---|
28 | |
---|
29 | void |
---|
30 | __BSP_default_vme_config(void) |
---|
31 | { |
---|
32 | |
---|
33 | vmeUniverseInit(); |
---|
34 | vmeUniverseReset(); |
---|
35 | |
---|
36 | /* setup a PCI0 area to map the VME bus */ |
---|
37 | setdbat(0,_VME_A32_WIN0_ON_PCI, _VME_A32_WIN0_ON_PCI, 0x10000000, IO_PAGE); |
---|
38 | |
---|
39 | /* map VME address ranges */ |
---|
40 | vmeUniverseMasterPortCfg( |
---|
41 | 0, |
---|
42 | VME_AM_EXT_SUP_DATA, |
---|
43 | _VME_A32_WIN0_ON_VME, |
---|
44 | _VME_A32_WIN0_ON_PCI, |
---|
45 | 0x0F000000); |
---|
46 | vmeUniverseMasterPortCfg( |
---|
47 | 1, |
---|
48 | VME_AM_STD_SUP_DATA, |
---|
49 | 0x00000000, |
---|
50 | _VME_A24_ON_PCI, |
---|
51 | 0x00ff0000); |
---|
52 | vmeUniverseMasterPortCfg( |
---|
53 | 2, |
---|
54 | VME_AM_SUP_SHORT_IO, |
---|
55 | 0x00000000, |
---|
56 | _VME_A16_ON_PCI, |
---|
57 | 0x00010000); |
---|
58 | |
---|
59 | #ifdef _VME_DRAM_OFFSET |
---|
60 | /* map our memory to VME */ |
---|
61 | vmeUniverseSlavePortCfg( |
---|
62 | 0, |
---|
63 | VME_AM_EXT_SUP_DATA, |
---|
64 | _VME_DRAM_OFFSET, |
---|
65 | PCI_DRAM_OFFSET, |
---|
66 | BSP_mem_size); |
---|
67 | |
---|
68 | /* make sure the host bridge PCI master is enabled */ |
---|
69 | vmeUniverseWriteReg( |
---|
70 | vmeUniverseReadReg(UNIV_REGOFF_PCI_CSR) | UNIV_PCI_CSR_BM, |
---|
71 | UNIV_REGOFF_PCI_CSR); |
---|
72 | #endif |
---|
73 | |
---|
74 | /* stdio is not yet initialized; the driver will revert to printk */ |
---|
75 | vmeUniverseMasterPortsShow(0); |
---|
76 | vmeUniverseSlavePortsShow(0); |
---|
77 | |
---|
78 | /* install the VME insterrupt manager */ |
---|
79 | vmeUniverseInstallIrqMgr(0,12,1,13); |
---|
80 | if (vmeUniverse0PciIrqLine<0) |
---|
81 | BSP_panic("Unable to get interrupt line info from PCI config"); |
---|
82 | _BSP_vme_bridge_irq= BSP_GPP_IRQ_LOWEST_OFFSET+vmeUniverse0PciIrqLine; |
---|
83 | /* install alternate resetter TODO |
---|
84 | __BSP_alternate_reset = vmeUniverseResetBus;*/ |
---|
85 | } |
---|