1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23#include <common.h>
24#include <malloc.h>
25#include <net.h>
26#include <asm/io.h>
27#include <pci.h>
28
29
30
31
32
33#define PLX9030_VENDOR_ID 0x10B5
34#define PLX9030_DEVICE_ID 0x9030
35
36#undef PLX_DEBUG
37
38
39#define P9030_LAS0RR 0x00
40#define P9030_LAS1RR 0x04
41#define P9030_LAS2RR 0x08
42#define P9030_LAS3RR 0x0c
43#define P9030_EROMRR 0x10
44#define P9030_LAS0BA 0x14
45#define P9030_LAS1BA 0x18
46#define P9030_LAS2BA 0x1c
47#define P9030_LAS3BA 0x20
48#define P9030_EROMBA 0x24
49#define P9030_LAS0BRD 0x28
50#define P9030_LAS1BRD 0x2c
51#define P9030_LAS2BRD 0x30
52#define P9030_LAS3BRD 0x34
53#define P9030_EROMBRD 0x38
54#define P9030_CS0BASE 0x3C
55#define P9030_CS1BASE 0x40
56#define P9030_CS2BASE 0x44
57#define P9030_CS3BASE 0x48
58#define P9030_INTCSR 0x4c
59#define P9030_CNTRL 0x50
60#define P9030_GPIOC 0x54
61
62
63
64
65
66
67static struct pci_device_id supported[] = {
68 { PLX9030_VENDOR_ID, PLX9030_DEVICE_ID },
69 { }
70};
71
72
73void sysOutLong(ulong address, ulong value);
74
75
76
77
78
79
80
81
82
83
84void Plx9030Init (void)
85{
86 pci_dev_t devno;
87 ulong membaseCsr;
88 int idx = 0;
89
90
91
92
93 if ((devno = pci_find_devices(supported, idx++)) < 0)
94 {
95 printf("No PLX9030 device found !!\n");
96 return;
97 }
98
99
100#ifdef PLX_DEBUG
101 printf("PLX 9030 device found ! devno = 0x%x\n",devno);
102#endif
103
104 membaseCsr = PCI_PLX9030_MEMADDR;
105
106
107 pci_write_config_dword(devno, PCI_BASE_ADDRESS_0, membaseCsr);
108
109
110 pci_write_config_dword(devno,
111 PCI_COMMAND,
112 PCI_COMMAND_MEMORY |
113 PCI_COMMAND_MASTER);
114
115
116
117 sysOutLong((membaseCsr + P9030_GPIOC), 0x00000FC0);
118
119
120 sysOutLong((membaseCsr + P9030_LAS0BA), 0x00000001);
121 sysOutLong((membaseCsr + P9030_LAS0RR), 0x0FE00000);
122 sysOutLong((membaseCsr + P9030_LAS0BRD), 0x51928900);
123 sysOutLong((membaseCsr + P9030_CS0BASE), 0x00100001);
124
125 pci_write_config_dword(devno, PCI_BASE_ADDRESS_2, SRAM_BASE);
126
127
128 sysOutLong((membaseCsr + P9030_LAS1BA), 0x00400001);
129 sysOutLong((membaseCsr + P9030_LAS1RR), 0x0FFFFF00);
130 sysOutLong((membaseCsr + P9030_LAS1BRD), 0x55122900);
131 sysOutLong((membaseCsr + P9030_CS1BASE), 0x00400081);
132
133
134 pci_write_config_dword(devno, PCI_BASE_ADDRESS_3, ST16552_A_BASE);
135
136
137 sysOutLong((membaseCsr + P9030_LAS2BA), 0x00800001);
138 sysOutLong((membaseCsr + P9030_LAS2RR), 0x0FFFFF00);
139 sysOutLong((membaseCsr + P9030_LAS2BRD), 0x55122900);
140 sysOutLong((membaseCsr + P9030_CS2BASE), 0x00800081);
141
142 pci_write_config_dword(devno, PCI_BASE_ADDRESS_4, ST16552_B_BASE);
143
144
145 sysOutLong((membaseCsr + P9030_LAS3BA), 0x00C00001);
146 sysOutLong((membaseCsr + P9030_LAS3RR), 0x0FFFFF00);
147 sysOutLong((membaseCsr + P9030_LAS3BRD), 0x55357A80);
148 sysOutLong((membaseCsr + P9030_CS3BASE), 0x00C00081);
149
150 pci_write_config_dword(devno, PCI_BASE_ADDRESS_5, BCSR_BASE);
151}
152
153void sysOutLong(ulong address, ulong value)
154{
155 *(ulong*)address = cpu_to_le32(value);
156}
157