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