source: rtems/bsps/powerpc/mvme5500/pci/detect_host_bridge.c @ 5a4e3dc0

5
Last change on this file since 5a4e3dc0 was 5a4e3dc0, checked in by Sebastian Huber <sebastian.huber@…>, on 04/23/18 at 10:50:58

bsps: Move PCI drivers to bsps

This patch is a part of the BSP source reorganization.

Update #3285.

  • Property mode set to 100644
File size: 1.9 KB
Line 
1/*
2 * detect_host_bridge.c
3 *
4 * This code is inspired by detect_grackle_bridge.c of SVGM BSP
5 * written by Till Straumann
6 * Copyright (C) 2001, 2003 Till Straumann <strauman@slac.stanford.edu>
7 *
8 * Copyright (C) 2004 S. Kate Feng, <feng1@bnl.gov>
9 * wrote it to support the MVME5500 board.
10 *
11 */
12#include <libcpu/io.h>
13#include <rtems/bspIo.h>            /* printk */
14
15#include <bsp/pci.h>
16#include <bsp/gtreg.h>
17#include <bsp/gtpcireg.h>
18
19#include <stdio.h>
20#include <string.h>
21#include <inttypes.h>
22
23#define PCI_DEBUG 0
24
25#define HOSTBRIDGET_ERROR               0xf0000000
26
27unsigned long _BSP_clear_hostbridge_errors(int enableMCP, int quiet)
28{
29  uint32_t pcidata, pcidata1;
30  int PciLocal, busNumber=0;
31
32  /* On the mvme5500 board, the GT64260B system controller had the MCP
33   * signal pulled up high.  Thus, the MCP signal is not used as it is
34   * on other boards such as mvme2307.
35   */
36  if (enableMCP) return(-1);
37  for (PciLocal=0; PciLocal<1; PciLocal++ ) {
38     pci_read_config_dword(busNumber,
39                        0,
40                        0,
41                        PCI_COMMAND,
42                        &pcidata);
43
44    if (!quiet)
45    printk("Before _BSP_clear_hostbridge_errors(): 0x%" PRIx32 ", cause 0x%lx\n",
46           pcidata, inl(0x1d58));
47
48    outl(0,0x1d58);
49
50    /* Clear the error on the host bridge */
51    pcidata1= pcidata;
52    pcidata1 |= PCI_STATUS_CLRERR_MASK;
53    pcidata1 |= 0x140;
54    pci_write_config_dword(busNumber,
55                               0,
56                               0,
57                          PCI_COMMAND,
58                          pcidata1);
59
60    pci_read_config_dword(busNumber,
61                               0,
62                               0,
63                          PCI_COMMAND,
64                          &pcidata1);
65
66    if (!quiet) printk("After _BSP_clear_hostbridge_errors(): sts 0x%" PRIx32 "\n",
67                        pcidata1);
68    if (pcidata1 & HOSTBRIDGET_ERROR) printk("BSP_clear_hostbridge_errors(): unable to clear pending hostbridge errors\n");
69    busNumber += BSP_MAX_PCI_BUS_ON_PCI0;
70  }
71  return(pcidata &  HOSTBRIDGET_ERROR);
72}
Note: See TracBrowser for help on using the repository browser.