2 * Copyright (C) 2007 Freescale Semiconductor, Inc.
4 * Author: Scott Wood <scottwood@freescale.com>
5 * Dave Liu <daveliu@freescale.com>
7 * See file CREDITS for list of people who contributed to this
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS for A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 #include <fdt_support.h>
33 DECLARE_GLOBAL_DATA_PTR;
35 int board_early_init_f(void)
37 volatile immap_t *im = (immap_t *)CFG_IMMR;
39 if (im->pmc.pmccr1 & PMCCR1_POWER_OFF)
40 gd->flags |= GD_FLG_SILENT;
45 static u8 read_board_info(void)
50 if (i2c_read(CFG_I2C_PCF8574A_ADDR, 0, 0, &val8, 1) == 0)
58 static const char * const rev_str[] = {
68 info = read_board_info();
69 i = (!info) ? 4: info & 0x03;
71 printf("Board: Freescale MPC8315ERDB Rev %s\n", rev_str[i]);
76 static struct pci_region pci_regions[] = {
78 bus_start: CFG_PCI_MEM_BASE,
79 phys_start: CFG_PCI_MEM_PHYS,
80 size: CFG_PCI_MEM_SIZE,
81 flags: PCI_REGION_MEM | PCI_REGION_PREFETCH
84 bus_start: CFG_PCI_MMIO_BASE,
85 phys_start: CFG_PCI_MMIO_PHYS,
86 size: CFG_PCI_MMIO_SIZE,
90 bus_start: CFG_PCI_IO_BASE,
91 phys_start: CFG_PCI_IO_PHYS,
92 size: CFG_PCI_IO_SIZE,
97 void pci_init_board(void)
99 volatile immap_t *immr = (volatile immap_t *)CFG_IMMR;
100 volatile clk83xx_t *clk = (volatile clk83xx_t *)&immr->clk;
101 volatile law83xx_t *pci_law = immr->sysconf.pcilaw;
102 struct pci_region *reg[] = { pci_regions };
105 /* Enable all 3 PCI_CLK_OUTPUTs. */
106 clk->occr |= 0xe0000000;
109 * Configure PCI Local Access Windows
111 pci_law[0].bar = CFG_PCI_MEM_PHYS & LAWBAR_BAR;
112 pci_law[0].ar = LBLAWAR_EN | LBLAWAR_512MB;
114 pci_law[1].bar = CFG_PCI_IO_PHYS & LAWBAR_BAR;
115 pci_law[1].ar = LBLAWAR_EN | LBLAWAR_1MB;
117 warmboot = gd->bd->bi_bootflags & BOOTFLAG_WARM;
118 warmboot |= immr->pmc.pmccr1 & PMCCR1_POWER_OFF;
120 mpc83xx_pci_init(1, reg, warmboot);
123 #if defined(CONFIG_OF_BOARD_SETUP)
124 void fdt_tsec1_fixup(void *fdt, bd_t *bd)
126 char *mpc8315erdb = getenv("mpc8315erdb");
127 const char disabled[] = "disabled";
132 if (!strcmp(mpc8315erdb, "tsec1")) {
134 } else if (strcmp(mpc8315erdb, "ulpi")) {
135 printf("WARNING: wrong `mpc8315erdb' environment "
136 "variable specified: `%s'. Should be `ulpi' "
137 "or `tsec1'.\n", mpc8315erdb);
142 ret = fdt_path_offset(fdt, "/aliases");
144 printf("WARNING: can't find /aliases node\n");
148 path = fdt_getprop(fdt, ret, "ethernet0", NULL);
150 printf("WARNING: can't find ethernet0 alias\n");
154 do_fixup_by_path(fdt, path, "status", disabled, sizeof(disabled), 1);
157 void ft_board_setup(void *blob, bd_t *bd)
159 ft_cpu_setup(blob, bd);
161 ft_pci_setup(blob, bd);
163 fdt_fixup_dr_usb(blob, bd);
164 fdt_tsec1_fixup(blob, bd);