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#ifndef _MSP_PCI_H_
27#define _MSP_PCI_H_
28
29#define MSP_HAS_PCI(ID) (((u32)(ID) <= 0x4236) && ((u32)(ID) >= 0x4220))
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#define MSP_PCI_OATRAN 0xB8000000UL
59
60#define MSP_PCI_SPACE_BASE (MSP_PCI_OATRAN + 0x1002000UL)
61#define MSP_PCI_SPACE_SIZE (0x3000000UL - 0x2000)
62#define MSP_PCI_SPACE_END \
63 (MSP_PCI_SPACE_BASE + MSP_PCI_SPACE_SIZE - 1)
64#define MSP_PCI_IOSPACE_BASE (MSP_PCI_OATRAN + 0x1001000UL)
65#define MSP_PCI_IOSPACE_SIZE 0x1000
66#define MSP_PCI_IOSPACE_END \
67 (MSP_PCI_IOSPACE_BASE + MSP_PCI_IOSPACE_SIZE - 1)
68
69
70#define PCI_STAT_IRQ 20
71
72#define QFLUSH_REG_1 0xB7F40000
73
74typedef volatile unsigned int pcireg;
75typedef void * volatile ppcireg;
76
77struct pci_block_copy
78{
79 pcireg unused1;
80 pcireg unused2;
81 ppcireg unused3;
82 ppcireg unused4;
83 pcireg unused5;
84 pcireg unused6;
85 pcireg unused7;
86 ppcireg unused8;
87 ppcireg unused9;
88 pcireg unusedA;
89 ppcireg unusedB;
90 ppcireg unusedC;
91};
92
93enum
94{
95 config_device_vendor,
96 config_status_command,
97 config_class_revision,
98 config_BIST_header_latency_cache,
99 config_BAR0,
100 config_BAR1,
101 config_BAR2,
102 config_not_used7,
103 config_not_used8,
104 config_not_used9,
105 config_CIS,
106 config_subsystem,
107 config_not_used12,
108 config_capabilities,
109 config_not_used14,
110 config_lat_grant_irq,
111 config_message_control,
112 config_message_addr,
113 config_message_data,
114 config_VPD_addr,
115 config_VPD_data,
116 config_maxregs
117};
118
119struct msp_pci_regs
120{
121 pcireg hop_unused_00;
122 pcireg hop_unused_04;
123 pcireg hop_unused_08;
124 pcireg hop_unused_0C;
125 pcireg hop_unused_10;
126 pcireg hop_unused_14;
127 pcireg hop_unused_18;
128 pcireg hop_unused_1C;
129 pcireg hop_unused_20;
130 pcireg hop_unused_24;
131 pcireg hop_unused_28;
132 pcireg hop_unused_2C;
133 pcireg hop_unused_30;
134 pcireg hop_unused_34;
135 pcireg if_control;
136 pcireg oatran;
137 pcireg reset_ctl;
138 pcireg config_addr;
139 pcireg hop_unused_48;
140 pcireg msg_signaled_int_status;
141 pcireg msg_signaled_int_mask;
142 pcireg if_status;
143 pcireg if_mask;
144 pcireg hop_unused_5C;
145 pcireg hop_unused_60;
146 pcireg hop_unused_64;
147 pcireg hop_unused_68;
148 pcireg hop_unused_6C;
149 pcireg hop_unused_70;
150
151 struct pci_block_copy pci_bc[2] __attribute__((aligned(64)));
152
153 pcireg error_hdr1;
154 pcireg error_hdr2;
155
156 pcireg config[config_maxregs] __attribute__((aligned(256)));
157
158};
159
160#define BPCI_CFGADDR_BUSNUM_SHF 16
161#define BPCI_CFGADDR_FUNCTNUM_SHF 8
162#define BPCI_CFGADDR_REGNUM_SHF 2
163#define BPCI_CFGADDR_ENABLE (1<<31)
164
165#define BPCI_IFCONTROL_RTO (1<<20)
166#define BPCI_IFCONTROL_HCE (1<<16)
167#define BPCI_IFCONTROL_CTO_SHF 12
168#define BPCI_IFCONTROL_SE (1<<5)
169#define BPCI_IFCONTROL_BIST (1<<4)
170#define BPCI_IFCONTROL_CAP (1<<3)
171#define BPCI_IFCONTROL_MMC_SHF 0
172
173#define BPCI_IFSTATUS_MGT (1<<8)
174#define BPCI_IFSTATUS_MTT (1<<9)
175#define BPCI_IFSTATUS_MRT (1<<10)
176#define BPCI_IFSTATUS_BC0F (1<<13)
177#define BPCI_IFSTATUS_BC1F (1<<14)
178#define BPCI_IFSTATUS_PCIU (1<<15)
179#define BPCI_IFSTATUS_BSIZ (1<<16)
180#define BPCI_IFSTATUS_BADD (1<<17)
181#define BPCI_IFSTATUS_RTO (1<<18)
182#define BPCI_IFSTATUS_SER (1<<19)
183#define BPCI_IFSTATUS_PER (1<<20)
184#define BPCI_IFSTATUS_LCA (1<<21)
185#define BPCI_IFSTATUS_MEM (1<<22)
186#define BPCI_IFSTATUS_ARB (1<<23)
187#define BPCI_IFSTATUS_STA (1<<27)
188#define BPCI_IFSTATUS_TA (1<<28)
189#define BPCI_IFSTATUS_MA (1<<29)
190#define BPCI_IFSTATUS_PEI (1<<30)
191#define BPCI_IFSTATUS_PET (1<<31)
192
193#define BPCI_RESETCTL_PR (1<<0)
194#define BPCI_RESETCTL_RT (1<<4)
195#define BPCI_RESETCTL_CT (1<<8)
196#define BPCI_RESETCTL_PE (1<<12)
197#define BPCI_RESETCTL_HM (1<<13)
198#define BPCI_RESETCTL_RI (1<<14)
199
200extern struct msp_pci_regs msp_pci_regs
201 __attribute__((section(".register")));
202extern unsigned long msp_pci_config_space
203 __attribute__((section(".register")));
204
205#endif
206