1
2
3
4
5
6
7
8
9#include <asm/mmu.h>
10#include <asm/io.h>
11#include <common.h>
12#include <mpc83xx.h>
13#include <pci.h>
14#include <i2c.h>
15#include <asm/fsl_i2c.h>
16
17DECLARE_GLOBAL_DATA_PTR;
18
19static struct pci_region pci1_regions[] = {
20 {
21 bus_start: CONFIG_SYS_PCI1_MEM_BASE,
22 phys_start: CONFIG_SYS_PCI1_MEM_PHYS,
23 size: CONFIG_SYS_PCI1_MEM_SIZE,
24 flags: PCI_REGION_MEM | PCI_REGION_PREFETCH
25 },
26 {
27 bus_start: CONFIG_SYS_PCI1_IO_BASE,
28 phys_start: CONFIG_SYS_PCI1_IO_PHYS,
29 size: CONFIG_SYS_PCI1_IO_SIZE,
30 flags: PCI_REGION_IO
31 },
32 {
33 bus_start: CONFIG_SYS_PCI1_MMIO_BASE,
34 phys_start: CONFIG_SYS_PCI1_MMIO_PHYS,
35 size: CONFIG_SYS_PCI1_MMIO_SIZE,
36 flags: PCI_REGION_MEM
37 },
38};
39
40
41
42
43
44
45
46
47
48
49
50
51
52void
53pci_init_board(void)
54{
55 volatile immap_t *immr = (volatile immap_t *)CONFIG_SYS_IMMR;
56 volatile clk83xx_t *clk = (volatile clk83xx_t *)&immr->clk;
57 volatile law83xx_t *pci_law = immr->sysconf.pcilaw;
58 struct pci_region *reg[] = { pci1_regions };
59 u32 reg32;
60
61
62
63
64
65
66
67
68
69
70
71 reg32 = OCCR_PCICOE1;
72#if 0
73
74 reg32 = 0xff000000;
75#endif
76 if (clk->spmr & SPMR_CKID) {
77
78
79 reg32 |= (OCCR_PCI1CR | OCCR_PCI2CR);
80
81 reg32 |= (OCCR_PCICD0 | OCCR_PCICD1 | OCCR_PCICD2 \
82 | OCCR_PCICD3 | OCCR_PCICD4 | OCCR_PCICD5 \
83 | OCCR_PCICD6 | OCCR_PCICD7);
84 }
85
86 clk->occr = reg32;
87 udelay(2000);
88
89
90 pci_law[0].bar = CONFIG_SYS_PCI1_MEM_PHYS & LAWBAR_BAR;
91 pci_law[0].ar = LAWAR_EN | LAWAR_SIZE_512M;
92
93 pci_law[1].bar = CONFIG_SYS_PCI1_IO_PHYS & LAWBAR_BAR;
94 pci_law[1].ar = LAWAR_EN | LAWAR_SIZE_16M;
95
96 udelay(2000);
97
98 mpc83xx_pci_init(1, reg);
99}
100