1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2006-2009 Freescale Semiconductor, Inc.
8 #include <linux/delay.h>
15 #include <asm/fsl_i2c.h>
17 static struct pci_region pci1_regions[] = {
19 bus_start: CONFIG_SYS_PCI1_MEM_BASE,
20 phys_start: CONFIG_SYS_PCI1_MEM_PHYS,
21 size: CONFIG_SYS_PCI1_MEM_SIZE,
22 flags: PCI_REGION_MEM | PCI_REGION_PREFETCH
25 bus_start: CONFIG_SYS_PCI1_IO_BASE,
26 phys_start: CONFIG_SYS_PCI1_IO_PHYS,
27 size: CONFIG_SYS_PCI1_IO_SIZE,
31 bus_start: CONFIG_SYS_PCI1_MMIO_BASE,
32 phys_start: CONFIG_SYS_PCI1_MMIO_PHYS,
33 size: CONFIG_SYS_PCI1_MMIO_SIZE,
38 #ifdef CONFIG_MPC83XX_PCI2
39 static struct pci_region pci2_regions[] = {
41 bus_start: CONFIG_SYS_PCI2_MEM_BASE,
42 phys_start: CONFIG_SYS_PCI2_MEM_PHYS,
43 size: CONFIG_SYS_PCI2_MEM_SIZE,
44 flags: PCI_REGION_MEM | PCI_REGION_PREFETCH
47 bus_start: CONFIG_SYS_PCI2_IO_BASE,
48 phys_start: CONFIG_SYS_PCI2_IO_PHYS,
49 size: CONFIG_SYS_PCI2_IO_SIZE,
53 bus_start: CONFIG_SYS_PCI2_MMIO_BASE,
54 phys_start: CONFIG_SYS_PCI2_MMIO_PHYS,
55 size: CONFIG_SYS_PCI2_MMIO_SIZE,
61 void pci_init_board(void)
63 volatile immap_t *immr = (volatile immap_t *)CONFIG_SYS_IMMR;
64 volatile clk83xx_t *clk = (volatile clk83xx_t *)&immr->clk;
65 volatile law83xx_t *pci_law = immr->sysconf.pcilaw;
66 #ifndef CONFIG_MPC83XX_PCI2
67 struct pci_region *reg[] = { pci1_regions };
69 struct pci_region *reg[] = { pci1_regions, pci2_regions };
73 #if defined(CONFIG_SYS_I2C)
75 /* Read the PCI_M66EN jumper setting */
76 if ((i2c_read(CONFIG_SYS_I2C_8574_ADDR2, 0, 0, ®8, sizeof(reg8)) == 0) ||
77 (i2c_read(CONFIG_SYS_I2C_8574A_ADDR2, 0, 0, ®8, sizeof(reg8)) == 0)) {
78 if (reg8 & I2C_8574_PCI66)
79 clk->occr = 0xff000000; /* 66 MHz PCI */
81 clk->occr = 0xff600001; /* 33 MHz PCI */
83 clk->occr = 0xff600001; /* 33 MHz PCI */
86 clk->occr = 0xff000000; /* 66 MHz PCI */
90 /* Configure PCI Local Access Windows */
91 pci_law[0].bar = CONFIG_SYS_PCI1_MEM_PHYS & LAWBAR_BAR;
92 pci_law[0].ar = LAWAR_EN | LAWAR_SIZE_1G;
94 pci_law[1].bar = CONFIG_SYS_PCI1_IO_PHYS & LAWBAR_BAR;
95 pci_law[1].ar = LAWAR_EN | LAWAR_SIZE_32M;
99 #ifndef CONFIG_MPC83XX_PCI2
100 mpc83xx_pci_init(1, reg);
102 mpc83xx_pci_init(2, reg);