2 * Copyright (C) Freescale Semiconductor, Inc. 2006-2007
4 * Author: Scott Wood <scottwood@freescale.com>
6 * See file CREDITS for list of people who contributed to this
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS for A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
30 DECLARE_GLOBAL_DATA_PTR;
32 int board_early_init_f(void)
34 #ifndef CFG_8313ERDB_BROKEN_PMC
35 volatile immap_t *im = (immap_t *)CFG_IMMR;
37 if (im->pmc.pmccr1 & PMCCR1_POWER_OFF)
38 gd->flags |= GD_FLG_SILENT;
46 puts("Board: Freescale MPC8313ERDB\n");
50 static struct pci_region pci_regions[] = {
52 bus_start: CFG_PCI1_MEM_BASE,
53 phys_start: CFG_PCI1_MEM_PHYS,
54 size: CFG_PCI1_MEM_SIZE,
55 flags: PCI_REGION_MEM | PCI_REGION_PREFETCH
58 bus_start: CFG_PCI1_MMIO_BASE,
59 phys_start: CFG_PCI1_MMIO_PHYS,
60 size: CFG_PCI1_MMIO_SIZE,
64 bus_start: CFG_PCI1_IO_BASE,
65 phys_start: CFG_PCI1_IO_PHYS,
66 size: CFG_PCI1_IO_SIZE,
71 void pci_init_board(void)
73 volatile immap_t *immr = (volatile immap_t *)CFG_IMMR;
74 volatile clk83xx_t *clk = (volatile clk83xx_t *)&immr->clk;
75 volatile law83xx_t *pci_law = immr->sysconf.pcilaw;
76 struct pci_region *reg[] = { pci_regions };
79 /* Enable all 3 PCI_CLK_OUTPUTs. */
80 clk->occr |= 0xe0000000;
83 * Configure PCI Local Access Windows
85 pci_law[0].bar = CFG_PCI1_MEM_PHYS & LAWBAR_BAR;
86 pci_law[0].ar = LBLAWAR_EN | LBLAWAR_512MB;
88 pci_law[1].bar = CFG_PCI1_IO_PHYS & LAWBAR_BAR;
89 pci_law[1].ar = LBLAWAR_EN | LBLAWAR_1MB;
91 warmboot = gd->bd->bi_bootflags & BOOTFLAG_WARM;
92 #ifndef CFG_8313ERDB_BROKEN_PMC
93 warmboot |= immr->pmc.pmccr1 & PMCCR1_POWER_OFF;
96 mpc83xx_pci_init(1, reg, warmboot);
99 #if defined(CONFIG_OF_FLAT_TREE) && defined(CONFIG_OF_BOARD_SETUP)
100 void ft_board_setup(void *blob, bd_t *bd)
106 ft_pci_setup(blob, bd);
108 ft_cpu_setup(blob, bd);
110 p = ft_get_prop(blob, "/memory/reg", &len);
112 *p++ = cpu_to_be32(bd->bi_memstart);
113 *p = cpu_to_be32(bd->bi_memsize);