2 * pci.c -- esd VME8349 PCI board support.
3 * Copyright (c) 2006 Wind River Systems, Inc.
4 * Copyright (C) 2006-2009 Freescale Semiconductor, Inc.
6 * Based on MPC8349 PCI support but w/o PIB related code.
8 * See file CREDITS for list of people who contributed to this
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; either version 2 of
14 * the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
34 #include <asm/fsl_i2c.h>
36 DECLARE_GLOBAL_DATA_PTR;
38 static struct pci_region pci1_regions[] = {
40 bus_start: CONFIG_SYS_PCI1_MEM_BASE,
41 phys_start: CONFIG_SYS_PCI1_MEM_PHYS,
42 size: CONFIG_SYS_PCI1_MEM_SIZE,
43 flags: PCI_REGION_MEM | PCI_REGION_PREFETCH
46 bus_start: CONFIG_SYS_PCI1_IO_BASE,
47 phys_start: CONFIG_SYS_PCI1_IO_PHYS,
48 size: CONFIG_SYS_PCI1_IO_SIZE,
52 bus_start: CONFIG_SYS_PCI1_MMIO_BASE,
53 phys_start: CONFIG_SYS_PCI1_MMIO_PHYS,
54 size: CONFIG_SYS_PCI1_MMIO_SIZE,
62 * NOTICE: PCI2 is not supported. There is only one
63 * physical PCI slot on the board.
69 volatile immap_t *immr = (volatile immap_t *)CONFIG_SYS_IMMR;
70 volatile clk83xx_t *clk = (volatile clk83xx_t *)&immr->clk;
71 volatile law83xx_t *pci_law = immr->sysconf.pcilaw;
72 struct pci_region *reg[] = { pci1_regions };
77 /* Read the PCI_M66EN jumper setting */
78 if ((i2c_read(CONFIG_SYS_I2C_8574_ADDR2, 0, 0, ®8, 1) == 0) ||
79 (i2c_read(0x38 , 0, 0, ®8, 1) == 0)) {
81 clk->occr = 0xff000000; /* 66 MHz PCI */
82 printf("PCI: 66MHz\n");
84 clk->occr = 0xffff0003; /* 33 MHz PCI */
85 printf("PCI: 33MHz\n");
87 if (((reg8 & 0x01) == 0) || ((reg8 & 0x02) == 0))
90 clk->occr = 0xffff0003; /* 33 MHz PCI */
91 printf("PCI: 33MHz (I2C read failed)\n");
96 * Assert/deassert PCI reset
98 setbits_be32(&immr->gpio[0].dat, 0x00800000);
99 setbits_be32(&immr->gpio[0].dir, 0x00800000);
100 setbits_be32(&immr->gpio[1].dir, 0x08800000);
102 setbits_be32(&immr->gpio[1].dat, 0x08000000);
104 setbits_be32(&immr->gpio[1].dat, 0x08800000);
106 clrbits_be32(&immr->gpio[1].dat, 0x00100000);
108 /* Configure PCI Local Access Windows */
109 pci_law[0].bar = CONFIG_SYS_PCI1_MEM_PHYS & LAWBAR_BAR;
110 pci_law[0].ar = LAWAR_EN | LAWAR_SIZE_1G;
112 pci_law[1].bar = CONFIG_SYS_PCI1_IO_PHYS & LAWBAR_BAR;
113 pci_law[1].ar = LAWAR_EN | LAWAR_SIZE_4M;
118 mpc83xx_pci_init(1, reg, 0);