source: rtems/c/src/lib/libbsp/powerpc/shared/vme/vmeconfig.c @ b95aedf

4.104.114.84.95
Last change on this file since b95aedf was b95aedf, checked in by Joel Sherrill <joel.sherrill@…>, on 02/20/03 at 21:43:02

2003-02-20 Till Straumann <strauman@…>

PR 349/bsps

  • vme/.cvsignore, vme/Makefile.am, vme/VME.h, vme/VMEConfig.h, vme/vmeconfig.c: Add glue to the powerpc/shared BSP to use the vmeUniverse VME-PCI bridge driver.
  • Property mode set to 100644
File size: 2.5 KB
Line 
1/* $Id$ */
2
3/* Standard VME bridge configuration for VGM type boards */
4
5/* Author: Till Straumann <strauman@slac.stanford.edu>, 3/2002 */
6
7#include <bsp.h>
8#include <bsp/VME.h>
9#include <bsp/irq.h>
10#include <libcpu/bat.h>
11#include <libcpu/spr.h>
12#include <bsp/motorola.h>
13
14/* Use a weak alias for the VME configuration.
15 * This permits individual applications to override
16 * this routine.
17 * They may even create an 'empty'
18 *
19 *    void BSP_vme_config(void) {}
20 *
21 * which will avoid linking in the Universe driver
22 * at all :-).
23 */
24
25void BSP_vme_config(void) __attribute__ (( weak, alias("__BSP_default_vme_config") ));
26
27int _BSP_vme_bridge_irq = -1;
28
29SPR_RO(DBAT0U)
30
31void
32__BSP_default_vme_config(void)
33{
34union {
35        struct _BATU    bat;
36        unsigned long   batbits;
37} dbat0u;
38
39  if (currentBoard < MVME_2300 || currentBoard >= MVME_1600) {
40                printk("VME bridge for this board is unknown - if it's a Tundra Universe, add the board to 'shared/vme/vmeconfig.c'\n");
41                printk("Skipping VME initialization...\n");
42                return;
43  }
44
45  vmeUniverseInit();
46  vmeUniverseReset();
47
48  /* setup a PCI area to map the VME bus */
49
50  dbat0u.batbits = _read_DBAT0U();
51
52  /* if we have page tables, BAT0 is available */
53  if (dbat0u.bat.vs || dbat0u.bat.vp) {
54        printk("WARNING: BAT0 is taken (no pagetables?); VME bridge must share PCI range for VME access\n");
55        printk("Skipping VME initialization...\n");
56        return;
57  }
58
59  setdbat(0,
60                  PCI_MEM_BASE + _VME_A32_WIN0_ON_PCI,
61                  PCI_MEM_BASE + _VME_A32_WIN0_ON_PCI,
62                  0x10000000,
63                  IO_PAGE);
64
65  /* map VME address ranges */
66  vmeUniverseMasterPortCfg(
67        0,
68        VME_AM_EXT_SUP_DATA,
69        _VME_A32_WIN0_ON_VME,
70        _VME_A32_WIN0_ON_PCI,
71        0x0F000000);
72  vmeUniverseMasterPortCfg(
73        1,
74        VME_AM_STD_SUP_DATA,
75        0x00000000,
76        _VME_A24_ON_PCI,
77        0x00ff0000);
78  vmeUniverseMasterPortCfg(
79        2,
80        VME_AM_SUP_SHORT_IO,
81        0x00000000,
82        _VME_A16_ON_PCI,
83        0x00010000);
84
85#ifdef _VME_DRAM_OFFSET
86  /* map our memory to VME */
87  vmeUniverseSlavePortCfg(
88        0,
89        VME_AM_EXT_SUP_DATA,
90        _VME_DRAM_OFFSET,
91        PCI_DRAM_OFFSET,
92        BSP_mem_size);
93
94  /* make sure the host bridge PCI master is enabled */
95  vmeUniverseWriteReg(
96        vmeUniverseReadReg(UNIV_REGOFF_PCI_CSR) | UNIV_PCI_CSR_BM,
97        UNIV_REGOFF_PCI_CSR);
98#endif
99
100  /* stdio is not yet initialized; the driver will revert to printk */
101  vmeUniverseMasterPortsShow(0);
102  vmeUniverseSlavePortsShow(0);
103
104  /* install the VME insterrupt manager */
105  vmeUniverseInstallIrqMgr(0,5,1,6);
106  if (vmeUniverse0PciIrqLine<0)
107        BSP_panic("Unable to get interrupt line info from PCI config");
108  _BSP_vme_bridge_irq=BSP_PCI_IRQ_LOWEST_OFFSET+vmeUniverse0PciIrqLine;
109}
Note: See TracBrowser for help on using the repository browser.