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#include <common.h>
54#include <command.h>
55#include <asm/4xx_pci.h>
56#include <asm/processor.h>
57#include <asm/io.h>
58#include <pci.h>
59
60#ifdef CONFIG_PCI
61
62DECLARE_GLOBAL_DATA_PTR;
63
64#if defined(CONFIG_405GP) || defined(CONFIG_405EP)
65
66
67
68
69
70
71
72int __pci_pre_init(struct pci_controller *hose)
73{
74#if defined(CONFIG_405EP)
75
76
77
78
79
80
81
82
83
84
85 mtdcr(CPC0_PCI, mfdcr(CPC0_PCI) | CPC0_PCI_ARBIT_EN);
86#endif
87
88 return 1;
89}
90int pci_pre_init(struct pci_controller *hose)
91 __attribute__((weak, alias("__pci_pre_init")));
92
93int __is_pci_host(struct pci_controller *hose)
94{
95#if defined(CONFIG_405GP)
96 if (mfdcr(CPC0_PSR) & PSR_PCI_ARBIT_EN)
97 return 1;
98#elif defined (CONFIG_405EP)
99 if (mfdcr(CPC0_PCI) & CPC0_PCI_ARBIT_EN)
100 return 1;
101#endif
102 return 0;
103}
104int is_pci_host(struct pci_controller *hose) __attribute__((weak, alias("__is_pci_host")));
105
106
107
108
109void pci_405gp_init(struct pci_controller *hose)
110{
111 int i, reg_num = 0;
112 bd_t *bd = gd->bd;
113
114 unsigned short temp_short;
115 unsigned long ptmpcila[2] = {CONFIG_SYS_PCI_PTM1PCI, CONFIG_SYS_PCI_PTM2PCI};
116#if defined(CONFIG_PCI_4xx_PTM_OVERWRITE)
117 char *ptmla_str, *ptmms_str;
118#endif
119 unsigned long ptmla[2] = {CONFIG_SYS_PCI_PTM1LA, CONFIG_SYS_PCI_PTM2LA};
120 unsigned long ptmms[2] = {CONFIG_SYS_PCI_PTM1MS, CONFIG_SYS_PCI_PTM2MS};
121#if defined(CONFIG_PIP405) || defined(CONFIG_TARGET_MIP405) \
122 || defined(CONFIG_TARGET_MIP405T)
123 unsigned long pmmla[3] = {0x80000000, 0xA0000000, 0};
124 unsigned long pmmma[3] = {0xE0000001, 0xE0000001, 0};
125 unsigned long pmmpcila[3] = {0x80000000, 0x00000000, 0};
126 unsigned long pmmpciha[3] = {0x00000000, 0x00000000, 0};
127#else
128 unsigned long pmmla[3] = {0x80000000, 0,0};
129 unsigned long pmmma[3] = {0xC0000001, 0,0};
130 unsigned long pmmpcila[3] = {0x80000000, 0,0};
131 unsigned long pmmpciha[3] = {0x00000000, 0,0};
132#endif
133#ifdef CONFIG_PCI_PNP
134#if (CONFIG_PCI_HOST == PCI_HOST_AUTO)
135 char *s;
136#endif
137#endif
138
139#if defined(CONFIG_PCI_4xx_PTM_OVERWRITE)
140 ptmla_str = getenv("ptm1la");
141 ptmms_str = getenv("ptm1ms");
142 if(NULL != ptmla_str && NULL != ptmms_str ) {
143 ptmla[0] = simple_strtoul (ptmla_str, NULL, 16);
144 ptmms[0] = simple_strtoul (ptmms_str, NULL, 16);
145 }
146
147 ptmla_str = getenv("ptm2la");
148 ptmms_str = getenv("ptm2ms");
149 if(NULL != ptmla_str && NULL != ptmms_str ) {
150 ptmla[1] = simple_strtoul (ptmla_str, NULL, 16);
151 ptmms[1] = simple_strtoul (ptmms_str, NULL, 16);
152 }
153#endif
154
155
156
157
158 hose->first_busno = 0;
159 hose->last_busno = 0xff;
160
161
162 pci_set_region(hose->regions + reg_num++,
163 MIN_PCI_PCI_IOADDR,
164 MIN_PLB_PCI_IOADDR,
165 0x10000,
166 PCI_REGION_IO);
167
168
169 pci_set_region(hose->regions + reg_num++,
170 0x00800000,
171 0xe8800000,
172 0x03800000,
173 PCI_REGION_IO);
174
175 reg_num = 2;
176
177
178 for (i=0; i<2; i++)
179 if (ptmms[i] & 1)
180 {
181 if (!i) hose->pci_fb = hose->regions + reg_num;
182
183 pci_set_region(hose->regions + reg_num++,
184 ptmpcila[i], ptmla[i],
185 ~(ptmms[i] & 0xfffff000) + 1,
186 PCI_REGION_MEM |
187 PCI_REGION_SYS_MEMORY);
188 }
189
190
191 for (i=0; i<3; i++)
192 if (pmmma[i] & 1)
193 {
194 pci_set_region(hose->regions + reg_num++,
195 pmmpcila[i], pmmla[i],
196 ~(pmmma[i] & 0xfffff000) + 1,
197 PCI_REGION_MEM);
198 }
199
200 hose->region_count = reg_num;
201
202 pci_setup_indirect(hose,
203 PCICFGADR,
204 PCICFGDATA);
205
206 if (hose->pci_fb)
207 pciauto_region_init(hose->pci_fb);
208
209
210 if (pci_pre_init(hose) == 0) {
211 printf("PCI: Board-specific initialization failed.\n");
212 printf("PCI: Configuration aborted.\n");
213 return;
214 }
215
216 pci_register_hose(hose);
217
218
219
220
221
222
223
224 out32r(PMM0MA, (pmmma[0]&~0x1));
225 out32r(PMM0LA, pmmla[0]);
226 out32r(PMM0PCILA, pmmpcila[0]);
227 out32r(PMM0PCIHA, pmmpciha[0]);
228 out32r(PMM0MA, pmmma[0]);
229
230
231
232
233 out32r(PMM1MA, (pmmma[1]&~0x1));
234 out32r(PMM1LA, pmmla[1]);
235 out32r(PMM1PCILA, pmmpcila[1]);
236 out32r(PMM1PCIHA, pmmpciha[1]);
237 out32r(PMM1MA, pmmma[1]);
238
239
240
241
242 out32r(PMM2MA, (pmmma[2]&~0x1));
243 out32r(PMM2LA, pmmla[2]);
244 out32r(PMM2PCILA, pmmpcila[2]);
245 out32r(PMM2PCIHA, pmmpciha[2]);
246 out32r(PMM2MA, pmmma[2]);
247
248
249
250
251
252 out32r(PTM1LA, ptmla[0]);
253 out32r(PTM1MS, ptmms[0]);
254 pci_write_config_dword(PCIDEVID_405GP, PCI_BASE_ADDRESS_1, ptmpcila[0]);
255
256
257
258
259 out32r(PTM2LA, ptmla[1]);
260 pci_write_config_dword(PCIDEVID_405GP, PCI_BASE_ADDRESS_2, ptmpcila[1]);
261
262 if (ptmms[1] == 0)
263 {
264 out32r(PTM2MS, 0x00000001);
265 pci_write_config_dword(PCIDEVID_405GP, PCI_BASE_ADDRESS_2, 0x00000000);
266 out32r(PTM2MS, 0x00000000);
267 }
268 else
269 {
270 out32r(PTM2MS, ptmms[1]);
271 }
272
273
274
275
276 pci_write_config_word(PCIDEVID_405GP, PCI_SUBSYSTEM_VENDOR_ID, CONFIG_SYS_PCI_SUBSYS_VENDORID);
277#ifdef CONFIG_CPCI405
278 if (is_pci_host(hose))
279 pci_write_config_word(PCIDEVID_405GP, PCI_SUBSYSTEM_ID, CONFIG_SYS_PCI_SUBSYS_DEVICEID);
280 else
281 pci_write_config_word(PCIDEVID_405GP, PCI_SUBSYSTEM_ID, CONFIG_SYS_PCI_SUBSYS_DEVICEID2);
282#else
283 pci_write_config_word(PCIDEVID_405GP, PCI_SUBSYSTEM_ID, CONFIG_SYS_PCI_SUBSYS_DEVICEID);
284#endif
285
286
287
288
289#ifdef CONFIG_SYS_PCI_CLASSCODE
290 pci_write_config_word(PCIDEVID_405GP, PCI_CLASS_SUB_CODE, CONFIG_SYS_PCI_CLASSCODE);
291#endif
292
293
294
295
296 if (bd->bi_pci_busfreq >= 66000000) {
297 pci_read_config_word(PCIDEVID_405GP, PCI_STATUS, &temp_short);
298 pci_write_config_word(PCIDEVID_405GP,PCI_STATUS,(temp_short|PCI_STATUS_66MHZ));
299 }
300
301#if (CONFIG_PCI_HOST != PCI_HOST_ADAPTER)
302#if (CONFIG_PCI_HOST == PCI_HOST_AUTO)
303 if (is_pci_host(hose) ||
304 (((s = getenv("pciscan")) != NULL) && (strcmp(s, "yes") == 0)))
305#endif
306 {
307
308
309
310
311
312 pci_read_config_word(PCIDEVID_405GP, PCI_COMMAND, &temp_short);
313 pci_write_config_word(PCIDEVID_405GP, PCI_COMMAND, temp_short |
314 PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY);
315 }
316#endif
317
318#if defined(CONFIG_405EP)
319
320
321
322
323
324 pci_write_config_word(PCIDEVID_405GP, PCI_VENDOR_ID, PCI_VENDOR_ID_IBM);
325 pci_write_config_word(PCIDEVID_405GP,
326 PCI_DEVICE_ID, PCI_DEVICE_ID_IBM_405GP);
327#endif
328
329
330
331
332 pci_read_config_word(PCIDEVID_405GP, PCIBRDGOPT2, &temp_short);
333 pci_write_config_word(PCIDEVID_405GP, PCIBRDGOPT2, (temp_short | 0x0001));
334
335#ifdef CONFIG_PCI_PNP
336
337
338
339#if (CONFIG_PCI_HOST == PCI_HOST_AUTO)
340 if (is_pci_host(hose) ||
341 (((s = getenv("pciscan")) != NULL) && (strcmp(s, "yes") == 0)))
342#endif
343 {
344#ifdef CONFIG_PCI_SCAN_SHOW
345 printf("PCI: Bus Dev VenId DevId Class Int\n");
346#endif
347 hose->last_busno = pci_hose_scan(hose);
348 }
349#endif
350
351}
352
353
354
355
356
357
358
359
360
361void pci_405gp_setup_bridge(struct pci_controller *hose, pci_dev_t dev,
362 struct pci_config_table *entry)
363{
364#ifdef DEBUG
365 printf("405gp_setup_bridge\n");
366#endif
367}
368
369
370
371
372
373void pci_405gp_fixup_irq(struct pci_controller *hose, pci_dev_t dev)
374{
375 unsigned char int_line = 0xff;
376
377
378
379
380 switch (PCI_DEV(dev) & 0x03)
381 {
382 case 0:
383 int_line = 27 + 2;
384 break;
385 case 1:
386 int_line = 27 + 3;
387 break;
388 case 2:
389 int_line = 27 + 0;
390 break;
391 case 3:
392 int_line = 27 + 1;
393 break;
394 }
395
396 pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE, int_line);
397}
398
399void pci_405gp_setup_vga(struct pci_controller *hose, pci_dev_t dev,
400 struct pci_config_table *entry)
401{
402 unsigned int cmdstat = 0;
403
404 pciauto_setup_device(hose, dev, 6, hose->pci_mem, hose->pci_prefetch, hose->pci_io);
405
406
407 pci_hose_read_config_dword(hose, dev, PCI_COMMAND, &cmdstat);
408 cmdstat |= PCI_COMMAND_IO;
409 pci_hose_write_config_dword(hose, dev, PCI_COMMAND, cmdstat);
410}
411
412#if !(defined(CONFIG_PIP405) || defined(CONFIG_TARGET_MIP405) \
413 || defined(CONFIG_TARGET_MIP405T))
414
415
416
417
418
419static struct pci_config_table pci_405gp_config_table[] = {
420
421#ifdef CONFIG_SYS_PCI_SUBSYS_VENDORID
422 {CONFIG_SYS_PCI_SUBSYS_VENDORID, PCI_ANY_ID, PCI_CLASS_BRIDGE_HOST,
423 PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, pci_405gp_setup_bridge},
424#endif
425 {PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA,
426 PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, pci_405gp_setup_vga},
427
428 {PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_NOT_DEFINED_VGA,
429 PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, pci_405gp_setup_vga},
430
431 { }
432};
433
434static struct pci_controller hose = {
435 fixup_irq: pci_405gp_fixup_irq,
436 config_table: pci_405gp_config_table,
437};
438
439void pci_init_board(void)
440{
441
442 hose.fixup_irq = pci_405gp_fixup_irq;
443 hose.config_table = pci_405gp_config_table;
444 pci_405gp_init(&hose);
445}
446
447#endif
448
449#endif
450
451
452
453
454#if defined(CONFIG_440)
455
456#if defined(CONFIG_SYS_PCI_MASTER_INIT) || defined(CONFIG_SYS_PCI_TARGET_INIT)
457static struct pci_controller ppc440_hose = {0};
458#endif
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474int __is_pci_host(struct pci_controller *hose)
475{
476 return 1;
477}
478int is_pci_host(struct pci_controller *hose)
479 __attribute__((weak, alias("__is_pci_host")));
480
481#if defined(CONFIG_440EP) || defined(CONFIG_440EPX) || \
482 defined(CONFIG_440GR) || defined(CONFIG_440GRX)
483
484#if defined(CONFIG_SYS_PCI_TARGET_INIT)
485
486
487
488
489
490
491
492void __pci_target_init(struct pci_controller *hose)
493{
494
495
496
497
498
499
500
501
502
503
504
505
506 out_le32((void *)PCIL0_PMM0MA, 0x00000000);
507
508 out_le32((void *)PCIL0_PMM0LA, CONFIG_SYS_PCI_MEMBASE);
509
510 out_le32((void *)PCIL0_PMM0PCILA, CONFIG_SYS_PCI_MEMBASE);
511
512 out_le32((void *)PCIL0_PMM0PCIHA, 0x00000000);
513
514 out_le32((void *)PCIL0_PMM0MA, 0xE0000001);
515
516
517 out_le32((void *)PCIL0_PMM1MA, 0x00000000);
518
519 out_le32((void *)PCIL0_PMM1LA, CONFIG_SYS_PCI_MEMBASE2);
520
521 out_le32((void *)PCIL0_PMM1PCILA, CONFIG_SYS_PCI_MEMBASE2);
522
523 out_le32((void *)PCIL0_PMM1PCIHA, 0x00000000);
524
525 out_le32((void *)PCIL0_PMM1MA, 0xE0000001);
526
527 out_le32((void *)PCIL0_PTM1MS, 0x00000001);
528 out_le32((void *)PCIL0_PTM1LA, 0);
529 out_le32((void *)PCIL0_PTM2MS, 0);
530 out_le32((void *)PCIL0_PTM2LA, 0);
531
532
533
534
535
536
537 pci_write_config_word(0, PCI_SUBSYSTEM_VENDOR_ID,
538 CONFIG_SYS_PCI_SUBSYS_VENDORID);
539 pci_write_config_word(0, PCI_SUBSYSTEM_ID, CONFIG_SYS_PCI_SUBSYS_ID);
540
541
542 pci_write_config_word(0, PCI_COMMAND, PCI_COMMAND_MASTER);
543
544
545 pci_write_config_word(0, PCI_LATENCY_TIMER, 1);
546
547
548 pci_write_config_word(0, PCI_ERREN, 0);
549
550 pci_write_config_dword(0, PCI_BRDGOPT2, 0x00000101);
551}
552#endif
553
554
555
556
557
558
559
560
561
562
563
564
565
566int __pci_pre_init(struct pci_controller *hose)
567{
568 u32 reg;
569
570
571
572
573
574 mfsdr(SDR0_AMP1, reg);
575 mtsdr(SDR0_AMP1, (reg & 0x000000FF) | 0x0000FF00);
576 reg = mfdcr(PLB3A0_ACR);
577 mtdcr(PLB3A0_ACR, reg | 0x80000000);
578
579
580
581
582 mfsdr(SDR0_AMP0, reg);
583 mtsdr(SDR0_AMP0, (reg & 0x000000FF) | 0x0000FF00);
584 reg = mfdcr(PLB4A0_ACR) | 0xa0000000;
585 mtdcr(PLB4A0_ACR, reg);
586
587
588
589
590
591 reg = (mfdcr(PLB4A0_ACR) & ~PLB4Ax_ACR_PPM_MASK) | PLB4Ax_ACR_PPM_FAIR;
592 reg = (reg & ~PLB4Ax_ACR_HBU_MASK) | PLB4Ax_ACR_HBU_ENABLED;
593 reg = (reg & ~PLB4Ax_ACR_RDP_MASK) | PLB4Ax_ACR_RDP_4DEEP;
594 reg = (reg & ~PLB4Ax_ACR_WRP_MASK) | PLB4Ax_ACR_WRP_2DEEP;
595 mtdcr(PLB4A0_ACR, reg);
596
597
598 reg = (mfdcr(PLB4A1_ACR) & ~PLB4Ax_ACR_PPM_MASK) | PLB4Ax_ACR_PPM_FAIR;
599 reg = (reg & ~PLB4Ax_ACR_HBU_MASK) | PLB4Ax_ACR_HBU_ENABLED;
600 reg = (reg & ~PLB4Ax_ACR_RDP_MASK) | PLB4Ax_ACR_RDP_4DEEP;
601 reg = (reg & ~PLB4Ax_ACR_WRP_MASK) | PLB4Ax_ACR_WRP_2DEEP;
602 mtdcr(PLB4A1_ACR, reg);
603
604#if defined(CONFIG_SYS_PCI_BOARD_FIXUP_IRQ)
605 hose->fixup_irq = board_pci_fixup_irq;
606#endif
607
608 return 1;
609}
610
611#else
612
613#if defined(CONFIG_SYS_PCI_TARGET_INIT)
614void __pci_target_init(struct pci_controller * hose)
615{
616
617
618
619 out_le32((void *)PCIL0_PIM0SA, 0);
620 out_le32((void *)PCIL0_PIM1SA, 0);
621 out_le32((void *)PCIL0_PIM2SA, 0);
622 out_le32((void *)PCIL0_EROMBA, 0);
623
624
625
626
627
628 out_le32((void *)PCIL0_PIM0LAL, CONFIG_SYS_SDRAM_BASE);
629 out_le32((void *)PCIL0_PIM0LAH, 0);
630 out_le32((void *)PCIL0_PIM0SA, ~(gd->ram_size - 1) | 1);
631 out_le32((void *)PCIL0_BAR0, 0);
632
633
634
635
636 out_le16((void *)PCIL0_SBSYSVID, CONFIG_SYS_PCI_SUBSYS_VENDORID);
637 out_le16((void *)PCIL0_SBSYSID, CONFIG_SYS_PCI_SUBSYS_DEVICEID);
638
639 out_le16((void *)PCIL0_CMD, in_le16((void *)PCIL0_CMD) |
640 PCI_COMMAND_MEMORY);
641}
642#endif
643
644int __pci_pre_init(struct pci_controller *hose)
645{
646
647
648
649
650 if (!pci_arbiter_enabled()) {
651 printf("PCI: PCI Arbiter disabled!\n");
652 return 0;
653 }
654
655 return 1;
656}
657
658#endif
659
660#if defined(CONFIG_SYS_PCI_TARGET_INIT)
661void pci_target_init(struct pci_controller * hose)
662 __attribute__((weak, alias("__pci_target_init")));
663#endif
664
665int pci_pre_init(struct pci_controller *hose)
666 __attribute__((weak, alias("__pci_pre_init")));
667
668#if defined(CONFIG_SYS_PCI_MASTER_INIT)
669void __pci_master_init(struct pci_controller *hose)
670{
671 u16 reg;
672
673
674
675
676
677
678 pci_read_config_word(0, PCI_COMMAND, ®);
679 pci_write_config_word(0, PCI_COMMAND, reg |
680 PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY);
681}
682void pci_master_init(struct pci_controller *hose)
683 __attribute__((weak, alias("__pci_master_init")));
684#endif
685
686#if defined(CONFIG_SYS_PCI_MASTER_INIT) || defined(CONFIG_SYS_PCI_TARGET_INIT)
687static int pci_440_init (struct pci_controller *hose)
688{
689 int reg_num = 0;
690
691#ifndef CONFIG_DISABLE_PISE_TEST
692
693
694
695
696#if defined(CONFIG_440GX) || defined(CONFIG_440SP) || defined(CONFIG_440SPE)
697 unsigned long strap;
698
699 mfsdr(SDR0_SDSTP1,strap);
700 if ((strap & SDR0_SDSTP1_PISE_MASK) == 0) {
701 printf("PCI: SDR0_STRP1[PISE] not set.\n");
702 printf("PCI: Configuration aborted.\n");
703 return -1;
704 }
705#elif defined(CONFIG_440GP)
706 unsigned long strap;
707
708 strap = mfdcr(CPC0_STRP1);
709 if ((strap & CPC0_STRP1_PISE_MASK) == 0) {
710 printf("PCI: CPC0_STRP1[PISE] not set.\n");
711 printf("PCI: Configuration aborted.\n");
712 return -1;
713 }
714#endif
715#endif
716
717
718
719
720 hose->first_busno = 0;
721 hose->last_busno = 0;
722
723
724 pci_set_region(hose->regions + reg_num++,
725 0x00000000,
726 PCIL0_IOBASE,
727 0x10000,
728 PCI_REGION_IO);
729
730
731 pci_set_region(hose->regions + reg_num++,
732 CONFIG_SYS_PCI_TARGBASE,
733 CONFIG_SYS_PCI_MEMBASE,
734#ifdef CONFIG_SYS_PCI_MEMSIZE
735 CONFIG_SYS_PCI_MEMSIZE,
736#else
737 0x10000000,
738#endif
739 PCI_REGION_MEM );
740
741#if defined(CONFIG_PCI_SYS_MEM_BUS) && defined(CONFIG_PCI_SYS_MEM_PHYS) && \
742 defined(CONFIG_PCI_SYS_MEM_SIZE)
743
744 pci_set_region(hose->regions + reg_num++,
745 CONFIG_PCI_SYS_MEM_BUS,
746 CONFIG_PCI_SYS_MEM_PHYS,
747 CONFIG_PCI_SYS_MEM_SIZE,
748 PCI_REGION_MEM | PCI_REGION_SYS_MEMORY );
749#endif
750
751 hose->region_count = reg_num;
752
753 pci_setup_indirect(hose, PCIL0_CFGADR, PCIL0_CFGDATA);
754
755
756 if (pci_pre_init(hose) == 0) {
757 printf("PCI: Board-specific initialization failed.\n");
758 printf("PCI: Configuration aborted.\n");
759 return -1;
760 }
761
762 pci_register_hose( hose );
763
764
765
766
767#if defined(CONFIG_SYS_PCI_TARGET_INIT)
768 pci_target_init(hose);
769#else
770 out16r( PCIL0_SBSYSVID, CONFIG_SYS_PCI_SUBSYS_VENDORID );
771 out16r( PCIL0_SBSYSID, CONFIG_SYS_PCI_SUBSYS_ID );
772 out16r( PCIL0_CLS, 0x00060000 );
773#endif
774
775#if defined(CONFIG_440GX) || defined(CONFIG_440SPE) || \
776 defined(CONFIG_460EX) || defined(CONFIG_460GT)
777 out32r( PCIL0_BRDGOPT1, 0x04000060 );
778 out32r( PCIL0_BRDGOPT2, in32(PCIL0_BRDGOPT2) | 0x83 );
779#elif defined(PCIL0_BRDGOPT1)
780 out32r( PCIL0_BRDGOPT1, 0x10000060 );
781 out32r( PCIL0_BRDGOPT2, in32(PCIL0_BRDGOPT2) | 1 );
782#endif
783
784
785
786
787
788#if defined(CONFIG_SYS_PCI_MASTER_INIT)
789 pci_master_init(hose);
790#else
791 out32r( PCIL0_POM0SA, 0 );
792 out32r( PCIL0_POM1SA, 0 );
793 out32r( PCIL0_POM2SA, 0 );
794#if defined(CONFIG_440SPE)
795 out32r( PCIL0_POM0LAL, 0x10000000 );
796 out32r( PCIL0_POM0LAH, 0x0000000c );
797#elif defined(CONFIG_460EX) || defined(CONFIG_460GT)
798 out32r( PCIL0_POM0LAL, 0x20000000 );
799 out32r( PCIL0_POM0LAH, 0x0000000c );
800#else
801 out32r( PCIL0_POM0LAL, 0x00000000 );
802 out32r( PCIL0_POM0LAH, 0x00000003 );
803#endif
804 out32r( PCIL0_POM0PCIAL, CONFIG_SYS_PCI_MEMBASE );
805 out32r( PCIL0_POM0PCIAH, 0x00000000 );
806 out32r( PCIL0_POM0SA, 0xf0000001 );
807 out32r( PCIL0_STS, in32r( PCIL0_STS ) & ~0x0000fff8 );
808#endif
809
810
811
812
813
814
815
816 if (is_pci_host(hose)) {
817#ifdef CONFIG_PCI_SCAN_SHOW
818 printf("PCI: Bus Dev VenId DevId Class Int\n");
819#endif
820#if !defined(CONFIG_440EP) && !defined(CONFIG_440GR) && \
821 !defined(CONFIG_440EPX) && !defined(CONFIG_440GRX)
822 out16r( PCIL0_CMD, in16r( PCIL0_CMD ) | PCI_COMMAND_MASTER);
823#endif
824 hose->last_busno = pci_hose_scan(hose);
825 }
826 return hose->last_busno;
827}
828#endif
829
830void pci_init_board(void)
831{
832 int busno = 0;
833
834
835
836
837
838#if defined(CONFIG_SYS_PCI_MASTER_INIT) || defined(CONFIG_SYS_PCI_TARGET_INIT)
839 busno = pci_440_init(&ppc440_hose);
840 if (busno < 0)
841 return;
842#endif
843#if (defined(CONFIG_440SPE) || \
844 defined(CONFIG_460EX) || defined(CONFIG_460GT)) && \
845 !defined(CONFIG_PCI_DISABLE_PCIE)
846 pcie_setup_hoses(busno + 1);
847#endif
848}
849
850#endif
851
852#if defined(CONFIG_405EX)
853void pci_init_board(void)
854{
855#ifdef CONFIG_PCI_SCAN_SHOW
856 printf("PCI: Bus Dev VenId DevId Class Int\n");
857#endif
858 pcie_setup_hoses(0);
859}
860#endif
861
862#endif
863