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 | /* |
---|
6 | * Authorship |
---|
7 | * ---------- |
---|
8 | * This software was created by |
---|
9 | * Till Straumann <strauman@slac.stanford.edu>, 3/2002, |
---|
10 | * Stanford Linear Accelerator Center, Stanford University. |
---|
11 | * |
---|
12 | * Acknowledgement of sponsorship |
---|
13 | * ------------------------------ |
---|
14 | * This software was produced by |
---|
15 | * the Stanford Linear Accelerator Center, Stanford University, |
---|
16 | * under Contract DE-AC03-76SFO0515 with the Department of Energy. |
---|
17 | * |
---|
18 | * Government disclaimer of liability |
---|
19 | * ---------------------------------- |
---|
20 | * Neither the United States nor the United States Department of Energy, |
---|
21 | * nor any of their employees, makes any warranty, express or implied, or |
---|
22 | * assumes any legal liability or responsibility for the accuracy, |
---|
23 | * completeness, or usefulness of any data, apparatus, product, or process |
---|
24 | * disclosed, or represents that its use would not infringe privately owned |
---|
25 | * rights. |
---|
26 | * |
---|
27 | * Stanford disclaimer of liability |
---|
28 | * -------------------------------- |
---|
29 | * Stanford University makes no representations or warranties, express or |
---|
30 | * implied, nor assumes any liability for the use of this software. |
---|
31 | * |
---|
32 | * Stanford disclaimer of copyright |
---|
33 | * -------------------------------- |
---|
34 | * Stanford University, owner of the copyright, hereby disclaims its |
---|
35 | * copyright and all other rights in this software. Hence, anyone may |
---|
36 | * freely use it for any purpose without restriction. |
---|
37 | * |
---|
38 | * Maintenance of notices |
---|
39 | * ---------------------- |
---|
40 | * In the interest of clarity regarding the origin and status of this |
---|
41 | * SLAC software, this and all the preceding Stanford University notices |
---|
42 | * are to remain affixed to any copy or derivative of this software made |
---|
43 | * or distributed by the recipient and are to be affixed to any copy of |
---|
44 | * software made or distributed by the recipient that contains a copy or |
---|
45 | * derivative of this software. |
---|
46 | * |
---|
47 | * ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03 |
---|
48 | */ |
---|
49 | |
---|
50 | /* Copyright 2004, Brookhaven National Lab. and S. Kate Feng <feng1@bnl.gov> |
---|
51 | * Modified to support the MVME5500, 3/2004 |
---|
52 | */ |
---|
53 | |
---|
54 | #include <bsp.h> |
---|
55 | #include <bsp/VME.h> |
---|
56 | #include <bsp/irq.h> |
---|
57 | #include <libcpu/bat.h> |
---|
58 | |
---|
59 | /* Use a weak alias for the VME configuration. |
---|
60 | * This permits individual applications to override |
---|
61 | * this routine. |
---|
62 | * They may even create an 'empty' |
---|
63 | * |
---|
64 | * void BSP_vme_config(void) {} |
---|
65 | * |
---|
66 | * which will avoid linking in the Universe driver |
---|
67 | * at all :-). |
---|
68 | */ |
---|
69 | |
---|
70 | void BSP_vme_config(void) __attribute__ (( weak, alias("__BSP_default_vme_config") )); |
---|
71 | |
---|
72 | void |
---|
73 | __BSP_default_vme_config(void) |
---|
74 | { |
---|
75 | |
---|
76 | vmeUniverseInit(); |
---|
77 | vmeUniverseReset(); |
---|
78 | |
---|
79 | /* setup a PCI0 area to map the VME bus */ |
---|
80 | setdbat(0,_VME_A32_WIN0_ON_PCI, _VME_A32_WIN0_ON_PCI, 0x10000000, IO_PAGE); |
---|
81 | |
---|
82 | /* map VME address ranges */ |
---|
83 | vmeUniverseMasterPortCfg( |
---|
84 | 0, |
---|
85 | VME_AM_EXT_SUP_DATA, |
---|
86 | _VME_A32_WIN0_ON_VME, |
---|
87 | _VME_A32_WIN0_ON_PCI, |
---|
88 | 0x0F000000); |
---|
89 | vmeUniverseMasterPortCfg( |
---|
90 | 1, |
---|
91 | VME_AM_STD_SUP_DATA, |
---|
92 | 0x00000000, |
---|
93 | _VME_A24_ON_PCI, |
---|
94 | 0x00ff0000); |
---|
95 | vmeUniverseMasterPortCfg( |
---|
96 | 2, |
---|
97 | VME_AM_SUP_SHORT_IO, |
---|
98 | 0x00000000, |
---|
99 | _VME_A16_ON_PCI, |
---|
100 | 0x00010000); |
---|
101 | |
---|
102 | #ifdef _VME_DRAM_OFFSET |
---|
103 | /* map our memory to VME */ |
---|
104 | vmeUniverseSlavePortCfg( |
---|
105 | 0, |
---|
106 | VME_AM_EXT_SUP_DATA, |
---|
107 | _VME_DRAM_OFFSET, |
---|
108 | PCI_DRAM_OFFSET, |
---|
109 | BSP_mem_size); |
---|
110 | |
---|
111 | /* make sure the host bridge PCI master is enabled */ |
---|
112 | vmeUniverseWriteReg( |
---|
113 | vmeUniverseReadReg(UNIV_REGOFF_PCI_CSR) | UNIV_PCI_CSR_BM, |
---|
114 | UNIV_REGOFF_PCI_CSR); |
---|
115 | #endif |
---|
116 | |
---|
117 | /* stdio is not yet initialized; the driver will revert to printk */ |
---|
118 | vmeUniverseMasterPortsShow(0); |
---|
119 | vmeUniverseSlavePortsShow(0); |
---|
120 | |
---|
121 | /* install the VME insterrupt manager */ |
---|
122 | vmeUniverseInstallIrqMgr(0,64+12,1,64+13); |
---|
123 | if (vmeUniverse0PciIrqLine<0) |
---|
124 | BSP_panic("Unable to get interrupt line info from PCI config"); |
---|
125 | _BSP_vme_bridge_irq= BSP_GPP_IRQ_LOWEST_OFFSET+vmeUniverse0PciIrqLine; |
---|
126 | /* install alternate resetter TODO |
---|
127 | __BSP_alternate_reset = vmeUniverseResetBus;*/ |
---|
128 | } |
---|