2 * Copyright (C) 2006-2009 Freescale Semiconductor, Inc.
4 * SPDX-License-Identifier: GPL-2.0+
14 #include <asm/fsl_i2c.h>
16 DECLARE_GLOBAL_DATA_PTR;
18 static struct pci_region pci1_regions[] = {
20 bus_start: CONFIG_SYS_PCI1_MEM_BASE,
21 phys_start: CONFIG_SYS_PCI1_MEM_PHYS,
22 size: CONFIG_SYS_PCI1_MEM_SIZE,
23 flags: PCI_REGION_MEM | PCI_REGION_PREFETCH
26 bus_start: CONFIG_SYS_PCI1_IO_BASE,
27 phys_start: CONFIG_SYS_PCI1_IO_PHYS,
28 size: CONFIG_SYS_PCI1_IO_SIZE,
32 bus_start: CONFIG_SYS_PCI1_MMIO_BASE,
33 phys_start: CONFIG_SYS_PCI1_MMIO_PHYS,
34 size: CONFIG_SYS_PCI1_MMIO_SIZE,
39 #ifdef CONFIG_MPC83XX_PCI2
40 static struct pci_region pci2_regions[] = {
42 bus_start: CONFIG_SYS_PCI2_MEM_BASE,
43 phys_start: CONFIG_SYS_PCI2_MEM_PHYS,
44 size: CONFIG_SYS_PCI2_MEM_SIZE,
45 flags: PCI_REGION_MEM | PCI_REGION_PREFETCH
48 bus_start: CONFIG_SYS_PCI2_IO_BASE,
49 phys_start: CONFIG_SYS_PCI2_IO_PHYS,
50 size: CONFIG_SYS_PCI2_IO_SIZE,
54 bus_start: CONFIG_SYS_PCI2_MMIO_BASE,
55 phys_start: CONFIG_SYS_PCI2_MMIO_PHYS,
56 size: CONFIG_SYS_PCI2_MMIO_SIZE,
62 void pci_init_board(void)
64 volatile immap_t *immr = (volatile immap_t *)CONFIG_SYS_IMMR;
65 volatile clk83xx_t *clk = (volatile clk83xx_t *)&immr->clk;
66 volatile law83xx_t *pci_law = immr->sysconf.pcilaw;
67 #ifndef CONFIG_MPC83XX_PCI2
68 struct pci_region *reg[] = { pci1_regions };
70 struct pci_region *reg[] = { pci1_regions, pci2_regions };
74 #if defined(CONFIG_SYS_I2C)
76 /* Read the PCI_M66EN jumper setting */
77 if ((i2c_read(CONFIG_SYS_I2C_8574_ADDR2, 0, 0, ®8, sizeof(reg8)) == 0) ||
78 (i2c_read(CONFIG_SYS_I2C_8574A_ADDR2, 0, 0, ®8, sizeof(reg8)) == 0)) {
79 if (reg8 & I2C_8574_PCI66)
80 clk->occr = 0xff000000; /* 66 MHz PCI */
82 clk->occr = 0xff600001; /* 33 MHz PCI */
84 clk->occr = 0xff600001; /* 33 MHz PCI */
87 clk->occr = 0xff000000; /* 66 MHz PCI */
91 /* Configure PCI Local Access Windows */
92 pci_law[0].bar = CONFIG_SYS_PCI1_MEM_PHYS & LAWBAR_BAR;
93 pci_law[0].ar = LAWAR_EN | LAWAR_SIZE_1G;
95 pci_law[1].bar = CONFIG_SYS_PCI1_IO_PHYS & LAWBAR_BAR;
96 pci_law[1].ar = LAWAR_EN | LAWAR_SIZE_32M;
100 #ifndef CONFIG_MPC83XX_PCI2
101 mpc83xx_pci_init(1, reg);
103 mpc83xx_pci_init(2, reg);