2 * Copyright (c) 2005 Cisco Systems. All rights reserved.
3 * Roland Dreier <rolandd@cisco.com>
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
15 #define DCRN_SDR0_CFGADDR 0x00e
16 #define DCRN_SDR0_CFGDATA 0x00f
18 #if defined(CONFIG_440SPE)
19 #define DCRN_PCIE0_BASE 0x100
20 #define DCRN_PCIE1_BASE 0x120
21 #define DCRN_PCIE2_BASE 0x140
24 #if defined(CONFIG_405EX)
25 #define DCRN_PCIE0_BASE 0x040
26 #define DCRN_PCIE1_BASE 0x060
29 #define PCIE0 DCRN_PCIE0_BASE
30 #define PCIE1 DCRN_PCIE1_BASE
31 #define PCIE2 DCRN_PCIE2_BASE
33 #define DCRN_PEGPL_CFGBAH(base) (base + 0x00)
34 #define DCRN_PEGPL_CFGBAL(base) (base + 0x01)
35 #define DCRN_PEGPL_CFGMSK(base) (base + 0x02)
36 #define DCRN_PEGPL_MSGBAH(base) (base + 0x03)
37 #define DCRN_PEGPL_MSGBAL(base) (base + 0x04)
38 #define DCRN_PEGPL_MSGMSK(base) (base + 0x05)
39 #define DCRN_PEGPL_OMR1BAH(base) (base + 0x06)
40 #define DCRN_PEGPL_OMR1BAL(base) (base + 0x07)
41 #define DCRN_PEGPL_OMR1MSKH(base) (base + 0x08)
42 #define DCRN_PEGPL_OMR1MSKL(base) (base + 0x09)
43 #define DCRN_PEGPL_REGBAH(base) (base + 0x12)
44 #define DCRN_PEGPL_REGBAL(base) (base + 0x13)
45 #define DCRN_PEGPL_REGMSK(base) (base + 0x14)
46 #define DCRN_PEGPL_SPECIAL(base) (base + 0x15)
47 #define DCRN_PEGPL_CFG(base) (base + 0x16)
52 #define PESDR0_PLLLCT1 0x03a0
53 #define PESDR0_PLLLCT2 0x03a1
54 #define PESDR0_PLLLCT3 0x03a2
56 #if defined(CONFIG_440SPE)
57 #define PCIE0_SDR 0x300
58 #define PCIE1_SDR 0x340
59 #define PCIE2_SDR 0x370
62 #if defined(CONFIG_405EX)
63 #define PCIE0_SDR 0x400
64 #define PCIE1_SDR 0x440
67 /* common regs, at least for 405EX and 440SPe */
68 #define SDRN_PESDR_UTLSET1(n) (sdr_base(n) + 0x00)
69 #define SDRN_PESDR_UTLSET2(n) (sdr_base(n) + 0x01)
70 #define SDRN_PESDR_DLPSET(n) (sdr_base(n) + 0x02)
71 #define SDRN_PESDR_LOOP(n) (sdr_base(n) + 0x03)
72 #define SDRN_PESDR_RCSSET(n) (sdr_base(n) + 0x04)
73 #define SDRN_PESDR_RCSSTS(n) (sdr_base(n) + 0x05)
75 #if defined(CONFIG_440SPE)
76 #define SDRN_PESDR_HSSL0SET1(n) (sdr_base(n) + 0x06)
77 #define SDRN_PESDR_HSSL0SET2(n) (sdr_base(n) + 0x07)
78 #define SDRN_PESDR_HSSL0STS(n) (sdr_base(n) + 0x08)
79 #define SDRN_PESDR_HSSL1SET1(n) (sdr_base(n) + 0x09)
80 #define SDRN_PESDR_HSSL1SET2(n) (sdr_base(n) + 0x0a)
81 #define SDRN_PESDR_HSSL1STS(n) (sdr_base(n) + 0x0b)
82 #define SDRN_PESDR_HSSL2SET1(n) (sdr_base(n) + 0x0c)
83 #define SDRN_PESDR_HSSL2SET2(n) (sdr_base(n) + 0x0d)
84 #define SDRN_PESDR_HSSL2STS(n) (sdr_base(n) + 0x0e)
85 #define SDRN_PESDR_HSSL3SET1(n) (sdr_base(n) + 0x0f)
86 #define SDRN_PESDR_HSSL3SET2(n) (sdr_base(n) + 0x10)
87 #define SDRN_PESDR_HSSL3STS(n) (sdr_base(n) + 0x11)
89 #define PESDR0_UTLSET1 0x0300
90 #define PESDR0_UTLSET2 0x0301
91 #define PESDR0_DLPSET 0x0302
92 #define PESDR0_LOOP 0x0303
93 #define PESDR0_RCSSET 0x0304
94 #define PESDR0_RCSSTS 0x0305
95 #define PESDR0_HSSL0SET1 0x0306
96 #define PESDR0_HSSL0SET2 0x0307
97 #define PESDR0_HSSL0STS 0x0308
98 #define PESDR0_HSSL1SET1 0x0309
99 #define PESDR0_HSSL1SET2 0x030a
100 #define PESDR0_HSSL1STS 0x030b
101 #define PESDR0_HSSL2SET1 0x030c
102 #define PESDR0_HSSL2SET2 0x030d
103 #define PESDR0_HSSL2STS 0x030e
104 #define PESDR0_HSSL3SET1 0x030f
105 #define PESDR0_HSSL3SET2 0x0310
106 #define PESDR0_HSSL3STS 0x0311
107 #define PESDR0_HSSL4SET1 0x0312
108 #define PESDR0_HSSL4SET2 0x0313
109 #define PESDR0_HSSL4STS 0x0314
110 #define PESDR0_HSSL5SET1 0x0315
111 #define PESDR0_HSSL5SET2 0x0316
112 #define PESDR0_HSSL5STS 0x0317
113 #define PESDR0_HSSL6SET1 0x0318
114 #define PESDR0_HSSL6SET2 0x0319
115 #define PESDR0_HSSL6STS 0x031a
116 #define PESDR0_HSSL7SET1 0x031b
117 #define PESDR0_HSSL7SET2 0x031c
118 #define PESDR0_HSSL7STS 0x031d
119 #define PESDR0_HSSCTLSET 0x031e
120 #define PESDR0_LANE_ABCD 0x031f
121 #define PESDR0_LANE_EFGH 0x0320
123 #define PESDR1_UTLSET1 0x0340
124 #define PESDR1_UTLSET2 0x0341
125 #define PESDR1_DLPSET 0x0342
126 #define PESDR1_LOOP 0x0343
127 #define PESDR1_RCSSET 0x0344
128 #define PESDR1_RCSSTS 0x0345
129 #define PESDR1_HSSL0SET1 0x0346
130 #define PESDR1_HSSL0SET2 0x0347
131 #define PESDR1_HSSL0STS 0x0348
132 #define PESDR1_HSSL1SET1 0x0349
133 #define PESDR1_HSSL1SET2 0x034a
134 #define PESDR1_HSSL1STS 0x034b
135 #define PESDR1_HSSL2SET1 0x034c
136 #define PESDR1_HSSL2SET2 0x034d
137 #define PESDR1_HSSL2STS 0x034e
138 #define PESDR1_HSSL3SET1 0x034f
139 #define PESDR1_HSSL3SET2 0x0350
140 #define PESDR1_HSSL3STS 0x0351
141 #define PESDR1_HSSCTLSET 0x0352
142 #define PESDR1_LANE_ABCD 0x0353
144 #define PESDR2_UTLSET1 0x0370
145 #define PESDR2_UTLSET2 0x0371
146 #define PESDR2_DLPSET 0x0372
147 #define PESDR2_LOOP 0x0373
148 #define PESDR2_RCSSET 0x0374
149 #define PESDR2_RCSSTS 0x0375
150 #define PESDR2_HSSL0SET1 0x0376
151 #define PESDR2_HSSL0SET2 0x0377
152 #define PESDR2_HSSL0STS 0x0378
153 #define PESDR2_HSSL1SET1 0x0379
154 #define PESDR2_HSSL1SET2 0x037a
155 #define PESDR2_HSSL1STS 0x037b
156 #define PESDR2_HSSL2SET1 0x037c
157 #define PESDR2_HSSL2SET2 0x037d
158 #define PESDR2_HSSL2STS 0x037e
159 #define PESDR2_HSSL3SET1 0x037f
160 #define PESDR2_HSSL3SET2 0x0380
161 #define PESDR2_HSSL3STS 0x0381
162 #define PESDR2_HSSCTLSET 0x0382
163 #define PESDR2_LANE_ABCD 0x0383
165 #elif defined(CONFIG_405EX)
167 #define SDRN_PESDR_PHYSET1(n) (sdr_base(n) + 0x06)
168 #define SDRN_PESDR_PHYSET2(n) (sdr_base(n) + 0x07)
169 #define SDRN_PESDR_BIST(n) (sdr_base(n) + 0x08)
170 #define SDRN_PESDR_LPB(n) (sdr_base(n) + 0x0b)
171 #define SDRN_PESDR_PHYSTA(n) (sdr_base(n) + 0x0c)
173 #define PESDR0_UTLSET1 0x0400
174 #define PESDR0_UTLSET2 0x0401
175 #define PESDR0_DLPSET 0x0402
176 #define PESDR0_LOOP 0x0403
177 #define PESDR0_RCSSET 0x0404
178 #define PESDR0_RCSSTS 0x0405
179 #define PESDR0_PHYSET1 0x0406
180 #define PESDR0_PHYSET2 0x0407
181 #define PESDR0_BIST 0x0408
182 #define PESDR0_LPB 0x040B
183 #define PESDR0_PHYSTA 0x040C
185 #define PESDR1_UTLSET1 0x0440
186 #define PESDR1_UTLSET2 0x0441
187 #define PESDR1_DLPSET 0x0442
188 #define PESDR1_LOOP 0x0443
189 #define PESDR1_RCSSET 0x0444
190 #define PESDR1_RCSSTS 0x0445
191 #define PESDR1_PHYSET1 0x0446
192 #define PESDR1_PHYSET2 0x0447
193 #define PESDR1_BIST 0x0448
194 #define PESDR1_LPB 0x044B
195 #define PESDR1_PHYSTA 0x044C
200 * UTL register offsets
202 #define PEUTL_PBBSZ 0x20
203 #define PEUTL_OPDBSZ 0x68
204 #define PEUTL_IPHBSZ 0x70
205 #define PEUTL_IPDBSZ 0x78
206 #define PEUTL_OUTTR 0x90
207 #define PEUTL_INTR 0x98
208 #define PEUTL_PCTL 0xa0
209 #define PEUTL_RCIRQEN 0xb8
212 * Config space register offsets
214 #define PECFG_BAR0LMPA 0x210
215 #define PECFG_BAR0HMPA 0x214
216 #define PECFG_BAR1MPA 0x218
217 #define PECFG_BAR2MPA 0x220
219 #define PECFG_PIMEN 0x33c
220 #define PECFG_PIM0LAL 0x340
221 #define PECFG_PIM0LAH 0x344
222 #define PECFG_PIM1LAL 0x348
223 #define PECFG_PIM1LAH 0x34c
224 #define PECFG_PIM01SAL 0x350
225 #define PECFG_PIM01SAH 0x354
227 #define PECFG_POM0LAL 0x380
228 #define PECFG_POM0LAH 0x384
230 #define SDR_READ(offset) ({\
231 mtdcr(DCRN_SDR0_CFGADDR, offset); \
232 mfdcr(DCRN_SDR0_CFGDATA);})
234 #define SDR_WRITE(offset, data) ({\
235 mtdcr(DCRN_SDR0_CFGADDR, offset); \
236 mtdcr(DCRN_SDR0_CFGDATA,data);})
238 #define GPL_DMER_MASK_DISA 0x02000000
240 int ppc4xx_init_pcie(void);
241 int ppc4xx_init_pcie_rootport(int port);
242 int ppc4xx_init_pcie_endport(int port);
243 void ppc4xx_setup_pcie_rootpoint(struct pci_controller *hose, int port);
244 int ppc4xx_setup_pcie_endpoint(struct pci_controller *hose, int port);
245 int pcie_hose_scan(struct pci_controller *hose, int bus);
247 static inline void mdelay(int n)
255 static inline u32 sdr_base(int port)
258 default: /* to satisfy compiler */
263 #if defined(PCIE2_SDR)
270 #endif /* __4XX_PCIE_H */