From b95aedf3b4c152a949c7ec5f99fb8efaa67ef4be Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 20 Feb 2003 21:43:02 +0000 Subject: 2003-02-20 Till Straumann 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. --- c/src/lib/libbsp/powerpc/shared/vme/vmeconfig.c | 109 ++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 c/src/lib/libbsp/powerpc/shared/vme/vmeconfig.c (limited to 'c/src/lib/libbsp/powerpc/shared/vme/vmeconfig.c') diff --git a/c/src/lib/libbsp/powerpc/shared/vme/vmeconfig.c b/c/src/lib/libbsp/powerpc/shared/vme/vmeconfig.c new file mode 100644 index 0000000000..9092680067 --- /dev/null +++ b/c/src/lib/libbsp/powerpc/shared/vme/vmeconfig.c @@ -0,0 +1,109 @@ +/* $Id$ */ + +/* Standard VME bridge configuration for VGM type boards */ + +/* Author: Till Straumann , 3/2002 */ + +#include +#include +#include +#include +#include +#include + +/* Use a weak alias for the VME configuration. + * This permits individual applications to override + * this routine. + * They may even create an 'empty' + * + * void BSP_vme_config(void) {} + * + * which will avoid linking in the Universe driver + * at all :-). + */ + +void BSP_vme_config(void) __attribute__ (( weak, alias("__BSP_default_vme_config") )); + +int _BSP_vme_bridge_irq = -1; + +SPR_RO(DBAT0U) + +void +__BSP_default_vme_config(void) +{ +union { + struct _BATU bat; + unsigned long batbits; +} dbat0u; + + if (currentBoard < MVME_2300 || currentBoard >= MVME_1600) { + printk("VME bridge for this board is unknown - if it's a Tundra Universe, add the board to 'shared/vme/vmeconfig.c'\n"); + printk("Skipping VME initialization...\n"); + return; + } + + vmeUniverseInit(); + vmeUniverseReset(); + + /* setup a PCI area to map the VME bus */ + + dbat0u.batbits = _read_DBAT0U(); + + /* if we have page tables, BAT0 is available */ + if (dbat0u.bat.vs || dbat0u.bat.vp) { + printk("WARNING: BAT0 is taken (no pagetables?); VME bridge must share PCI range for VME access\n"); + printk("Skipping VME initialization...\n"); + return; + } + + setdbat(0, + PCI_MEM_BASE + _VME_A32_WIN0_ON_PCI, + PCI_MEM_BASE + _VME_A32_WIN0_ON_PCI, + 0x10000000, + IO_PAGE); + + /* map VME address ranges */ + vmeUniverseMasterPortCfg( + 0, + VME_AM_EXT_SUP_DATA, + _VME_A32_WIN0_ON_VME, + _VME_A32_WIN0_ON_PCI, + 0x0F000000); + vmeUniverseMasterPortCfg( + 1, + VME_AM_STD_SUP_DATA, + 0x00000000, + _VME_A24_ON_PCI, + 0x00ff0000); + vmeUniverseMasterPortCfg( + 2, + VME_AM_SUP_SHORT_IO, + 0x00000000, + _VME_A16_ON_PCI, + 0x00010000); + +#ifdef _VME_DRAM_OFFSET + /* map our memory to VME */ + vmeUniverseSlavePortCfg( + 0, + VME_AM_EXT_SUP_DATA, + _VME_DRAM_OFFSET, + PCI_DRAM_OFFSET, + BSP_mem_size); + + /* make sure the host bridge PCI master is enabled */ + vmeUniverseWriteReg( + vmeUniverseReadReg(UNIV_REGOFF_PCI_CSR) | UNIV_PCI_CSR_BM, + UNIV_REGOFF_PCI_CSR); +#endif + + /* stdio is not yet initialized; the driver will revert to printk */ + vmeUniverseMasterPortsShow(0); + vmeUniverseSlavePortsShow(0); + + /* install the VME insterrupt manager */ + vmeUniverseInstallIrqMgr(0,5,1,6); + if (vmeUniverse0PciIrqLine<0) + BSP_panic("Unable to get interrupt line info from PCI config"); + _BSP_vme_bridge_irq=BSP_PCI_IRQ_LOWEST_OFFSET+vmeUniverse0PciIrqLine; +} -- cgit v1.2.3