source: rtems/bsps/powerpc/mvme5500/pci/pci_interface.c @ 762fa62

5
Last change on this file since 762fa62 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: 2.9 KB
Line 
1/* pci_interface.c
2 *
3 * Copyright 2004, 2006, 2007 All rights reserved. (NDA items)
4 *      Brookhaven National Laboratory and Shuchen Kate Feng <feng1@bnl.gov>
5 *
6 * The license and distribution terms for this file may be
7 * found in the file LICENSE in this distribution.
8 *
9 * 8/17/2006 : S. Kate Feng
10 *             uses in_le32()/out_le32(), instead of inl()/outl() for compatibility.
11 *
12 * 11/2008 : Enable "PCI Read Agressive Prefetch",
13 *           "PCI Read Line Agressive Prefetch", and
14 *           "PCI Read Multiple Agressive Prefetch" to improve the
15 *           performance of the PCI based applications (e.g. 1GHz NIC).
16 */
17
18#include <libcpu/io.h>
19#include <rtems/bspIo.h>            /* printk */
20
21#include <bsp.h>
22#include <bsp/pci.h>
23#include <bsp/gtreg.h>
24#include <bsp/gtpcireg.h>
25
26#include <inttypes.h>
27
28#define PCI_DEBUG     0
29
30#if 0
31#define CPU2PCI_ORDER
32#define PCI2CPU_ORDER
33#endif
34
35/* PCI Read Agressive Prefetch Enable (1<<16 ),
36 * PCI Read Line Agressive Prefetch Enable( 1<<17),
37 * PCI Read Multiple Agressive Prefetch Enable (1<<18).
38 */
39#ifdef PCI2CPU_ORDER
40#define PCI_ACCCTLBASEL_VALUE          0x01079000
41#else
42#define PCI_ACCCTLBASEL_VALUE          0x01071000
43#endif
44
45
46#define ConfSBDis     0x10000000  /* 1: disable, 0: enable */
47#define IOSBDis       0x20000000  /* 1: disable, 0: enable */
48#define ConfIOSBDis   0x30000000
49#define CpuPipeline   0x00002000  /* optional, 1:enable, 0:disable */
50
51/* CPU to PCI ordering register */
52#define DLOCK_ORDER_REG    0x2D0  /* Deadlock and Ordering register */
53#define PCI0OrEn      0x00000001
54#define PCI1OrEn      0x00000020
55#define PCIOrEn       0x40000000
56#define PCIOrEnMASK   0x40000021
57
58#define CNT_SYNC_REG       0x2E0  /* Counters and Sync Barrier register */
59#define L0SyncBar     0x00001000
60#define L1SyncBar     0x00002000
61#define DSyncBar      0x00004000
62#define SyncBarMode   0x00008000
63#define SyncBarMASK   0x0000f000
64
65#define WRTBK_PRIO_BUFFER  0x2d8  /* writback priority and buffer depth */
66
67#define ADDR_PIPELINE 0x00020000
68
69void  pciAccessInit(void);
70
71void pci_interface(void)
72{
73
74#ifdef CPU2PCI_ORDER
75    /* MOTLOad deafult : 0x07ff8600 */
76    out_le32((volatile uint32_t *)(GT64x60_REG_BASE+CNT_SYNC_REG), 0x07fff600);
77#endif
78    /* asserts SERR upon various detection */
79    out_le32((volatile uint32_t *)(GT64x60_REG_BASE+0xc28), 0x3fffff);
80    pciAccessInit();
81}
82
83void pciAccessInit(void)
84{
85  unsigned int PciLocal, data;
86
87  for (PciLocal=0; PciLocal < 2; PciLocal++) {
88    data = in_le32((volatile uint32_t *)(GT64x60_REG_BASE+PCI0_ACCESS_CNTL_BASE0_LOW+(PciLocal * 0x80)));
89#if 0
90    printk("PCI%d_ACCESS_CNTL_BASE0_LOW was 0x%x\n",PciLocal,data);
91#endif
92    data |= PCI_ACCCTLBASEL_VALUE;
93    data &= ~0x300000;
94    out_le32((volatile uint32_t *)(GT64x60_REG_BASE+PCI0_ACCESS_CNTL_BASE0_LOW+(PciLocal * 0x80)), data);
95#if 0
96      printf("PCI%d_ACCESS_CNTL_BASE0_LOW now 0x%" PRIx32 "\n",PciLocal,in_le32((volatile uint32_t *)(GT64x60_REG_BASE+PCI0_ACCESS_CNTL_BASE0_LOW+(PciLocal * 0x80))));
97#endif
98  }
99}
100
Note: See TracBrowser for help on using the repository browser.