summaryrefslogtreecommitdiff
path: root/c/src/lib/libbsp/powerpc/mvme5500/pci/detect_host_bridge.c
diff options
context:
space:
mode:
Diffstat (limited to 'c/src/lib/libbsp/powerpc/mvme5500/pci/detect_host_bridge.c')
-rw-r--r--c/src/lib/libbsp/powerpc/mvme5500/pci/detect_host_bridge.c67
1 files changed, 35 insertions, 32 deletions
diff --git a/c/src/lib/libbsp/powerpc/mvme5500/pci/detect_host_bridge.c b/c/src/lib/libbsp/powerpc/mvme5500/pci/detect_host_bridge.c
index 4615464491..712250f545 100644
--- a/c/src/lib/libbsp/powerpc/mvme5500/pci/detect_host_bridge.c
+++ b/c/src/lib/libbsp/powerpc/mvme5500/pci/detect_host_bridge.c
@@ -6,7 +6,8 @@
* Copyright (C) 2001, 2003 Till Straumann <strauman@slac.stanford.edu>
*
* Copyright (C) 2004 S. Kate Feng, <feng1@bnl.gov>
- * wrote it to support the MVME5500 board.
+ * wrote it to support the MVME5500 board,
+ * under the Deaprtment of Energy contract DE-AC02-98CH10886.
*
*/
#include <libcpu/io.h>
@@ -23,51 +24,53 @@
#define PCI_INVALID_VENDORDEVICEID 0xffffffff
#define PCI_MULTI_FUNCTION 0x80
-#define HOSTBRIDGET_ERROR 0xf0000000
unsigned long _BSP_clear_hostbridge_errors(int enableMCP, int quiet)
{
- unsigned int pcidata, pcidata1;
- int PciLocal, busNumber=0;
+ unsigned long pcidata=0;
+ unsigned short val;
+ int PciLocal, busNumber=0, loop;
/* On the mvme5500 board, the GT64260B system controller had the MCP
* signal pulled up high. Thus, the MCP signal is not used as it is
* on other boards such as mvme2307.
*/
if (enableMCP) return(-1);
- for (PciLocal=0; PciLocal<1; PciLocal++ ) {
- pci_read_config_dword(busNumber,
- 0,
- 0,
- PCI_COMMAND,
- &pcidata);
-
- if (!quiet)
- printk("Before _BSP_clear_hostbridge_errors(): 0x%x, cause 0x%x\n",
- pcidata, inl(0x1d58));
-
- outl(0,0x1d58);
+ for (PciLocal=0; PciLocal<2; PciLocal++ ) {
+ pci_read_config_word(busNumber,
+ 0,
+ 0,
+ PCI_STATUS,
+ &val);
+ if ( (val & PCI_STATUS_CLRERR_MASK) && (!quiet))
+ printk("Before _BSP_clear_hostbridge_errors(): PCI %d sts was 0x%x\n",
+ PciLocal, val);
+ if (!busNumber)
+ pcidata |= val;
+ else
+ pcidata |= (val <<16);
- /* Clear the error on the host bridge */
- pcidata1= pcidata;
- pcidata1 |= PCI_STATUS_CLRERR_MASK;
- pcidata1 |= 0x140;
- pci_write_config_dword(busNumber,
+ for ( loop=0; loop < 10; loop++) {
+ /* Clear the error on the host bridge */
+ pci_write_config_word(busNumber,
0,
0,
- PCI_COMMAND,
- pcidata1);
+ PCI_STATUS,
+ PCI_STATUS_CLRERR_MASK);
- pci_read_config_dword(busNumber,
+ pci_read_config_word(busNumber,
0,
0,
- PCI_COMMAND,
- &pcidata1);
-
- if (!quiet) printk("After _BSP_clear_hostbridge_errors(): sts 0x%x\n",
- pcidata1);
- if (pcidata1 & HOSTBRIDGET_ERROR) printk("BSP_clear_hostbridge_errors(): unable to clear pending hostbridge errors\n");
- busNumber += BSP_MAX_PCI_BUS_ON_PCI0;
+ PCI_STATUS,
+ &val);
+ if ( !(val & PCI_STATUS_CLRERR_MASK))
+ break;
+ else {
+ if (loop==9)
+ printk("BSP_clear_hostbridge_errors(): unable to clear pending hostbridge errors\n");
+ }
+ }
+ busNumber += BSP_MAX_PCI_BUS_ON_PCI0;
}
- return(pcidata & HOSTBRIDGET_ERROR);
+ return(pcidata);
}