1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
#include <stdint.h>
#include <arch/io.h>
#include "cpc710.h"
#include "cpc710_pci.h"
extern void setCPC710(uint32_t, uint32_t);
void
setCPC710_PCI32(uint32_t addr, uint32_t data)
{
out_be32((unsigned *)(CPC710_PCI32_CONFIG + addr), data);
}
#if 0
void
setCPC710_PCI64(uint32_t addr, uint32_t data)
{
out_be32((unsigned *)(CPC710_PCI64_CONFIG + addr), data);
}
#endif
void
cpc710_pci_init(void)
{
/* Enable PCI32 */
setCPC710(CPC710_CPC0_PCICNFR, 0x80000002); /* activate PCI32 config */
setCPC710(CPC710_CPC0_PCIBAR, CPC710_PCI32_CONFIG); /* PCI32 base address */
setCPC710(CPC710_CPC0_PCIENB, 0x80000000); /* enable addr space */
setCPC710(CPC710_CPC0_PCICNFR, 0x00000000); /* config done */
/* Reset PCI Status register */
pci_ppc_write_config16(0, 0, 0x06, 0xffff);
/* Configure bus number */
pci_ppc_write_config16(0, 0, 0x40, 0);
/* Set PCI configuration registers */
setCPC710_PCI32(CPC710_PCIL0_PCIDG, 0x40000000);
setCPC710_PCI32(CPC710_PCIL0_PIBAR, 0x00000000);
setCPC710_PCI32(CPC710_PCIL0_PMBAR, 0x00000000);
setCPC710_PCI32(CPC710_PCIL0_PR, 0xa000c000);
setCPC710_PCI32(CPC710_PCIL0_ACR, 0xfc000000);
setCPC710_PCI32(CPC710_PCIL0_MSIZE, CPC710_PCI32_MEM_SIZE);
setCPC710_PCI32(CPC710_PCIL0_IOSIZE, CPC710_PCI32_IO_SIZE);
setCPC710_PCI32(CPC710_PCIL0_SMBAR, CPC710_PCI32_MEM_BASE);
setCPC710_PCI32(CPC710_PCIL0_SIBAR, CPC710_PCI32_IO_BASE);
setCPC710_PCI32(CPC710_PCIL0_CTLRW, 0x00000000);
setCPC710_PCI32(CPC710_PCIL0_PSSIZE, 0x00000080);
setCPC710_PCI32(CPC710_PCIL0_BARPS, 0x00000000);
setCPC710_PCI32(CPC710_PCIL0_PSBAR, 0x00000080);
setCPC710_PCI32(CPC710_PCIL0_BPMDLK, 0x00000000);
setCPC710_PCI32(CPC710_PCIL0_TPMDLK, 0x00000000);
setCPC710_PCI32(CPC710_PCIL0_BIODLK, 0x00000000);
setCPC710_PCI32(CPC710_PCIL0_TIODLK, 0x00000000);
/* Enable address space */
pci_ppc_write_config16(0, 0, 0x04, 0xfda7);
setCPC710_PCI32(CPC710_PCIL0_CRR, 0xfc000000);
/*
* wait for PCI to reset
*/
udelay(250);
#if 0
/* Enable PCI64 */
setCPC710(CPC710_CPC0_PCICNFR, 0x80000003); /* activate PCI64 config */
setCPC710(CPC710_CPC0_PCIBAR, CPC710_PCI64_CONFIG); /* PCI64 base address */
setCPC710(CPC710_CPC0_PCIENB, 0x80000000); /* enable addr space */
setCPC710(CPC710_CPC0_PCICNFR, 0x00000000); /* config done */
/* Reset PCI Status register */
setCPC710_PCI64(CPC710_PCIL0_CFGADDR, 0x06000080);
setCPC710_PCI64_16(CPC710_PCIL0_CFGDATA, 0xffff);
/* Reset G_INT[A-D] bits in INT_RESET */
setCPC710_PCI64(CPC710_PCIL0_CFGADDR, 0x68000080);
setCPC710_PCI64(CPC710_PCIL0_CFGDATA, 0x0f000000);
/* Configure bus number BUSNO=1, SUBNO=1 */
setCPC710_PCI64(CPC710_PCIL0_CFGADDR, 0x40000080);
setCPC710_PCI64_16(CPC710_PCIL0_CFGDATA, 0x0101);
/* Set PCI configuration registers */
setCPC710_PCI64(CPC710_PCIL0_PSEA, 0x00000000);
setCPC710_PCI64(CPC710_PCIL0_PCIDG, 0xc0000000);
setCPC710_PCI64(CPC710_PCIL0_PIBAR, 0x00000000);
setCPC710_PCI64(CPC710_PCIL0_PMBAR, 0x00000000);
setCPC710_PCI64(CPC710_PCIL0_PR, 0x80008000);
setCPC710_PCI64(CPC710_PCIL0_ACR, 0xff000000);
setCPC710_PCI64(CPC710_PCIL0_MSIZE, CPC710_PCI64_MEM_SIZE);
setCPC710_PCI64(CPC710_PCIL0_IOSIZE, CPC710_PCI64_IO_SIZE);
setCPC710_PCI64(CPC710_PCIL0_SMBAR, CPC710_PCI64_MEM_BASE);
setCPC710_PCI64(CPC710_PCIL0_SIBAR, CPC710_PCI64_IO_BASE);
setCPC710_PCI64(CPC710_PCIL0_CTLRW, 0x02000000);
setCPC710_PCI64(CPC710_PCIL0_PSSIZE, 0x00000080);
/* Config PSBAR for PCI64 */
setCPC710_PCI64(CPC710_PCIL0_CFGADDR, 0x10000080);
setCPC710_PCI64(CPC710_PCIL0_CFGDATA, 0x00000080);
setCPC710_PCI64(CPC710_PCIL0_BARPS, 0x00000000);
setCPC710_PCI64(CPC710_PCIL0_INTSET, 0x00000000);
/* Enable address space */
setCPC710_PCI64(CPC710_PCIL0_CFGADDR, 0x04000180);
setCPC710_PCI64_16(CPC710_PCIL0_CFGDATA, 0xfda7);
setCPC710_PCI64(CPC710_PCIL0_CRR, 0xfc000000);
/*
* wait for PCI to reset
*/
udelay(250);
#endif
}
|