1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) Freescale Semiconductor, Inc. 2006-2007
5 * Author: Scott Wood <scottwood@freescale.com>
9 #include <clock_legacy.h>
10 #include <fdt_support.h>
12 #if defined(CONFIG_OF_LIBFDT)
13 #include <linux/libfdt.h>
20 #if defined(CONFIG_MPC83XX_GPIO) && !defined(CONFIG_SPL_BUILD)
24 DECLARE_GLOBAL_DATA_PTR;
26 int board_early_init_f(void)
28 #ifndef CONFIG_SYS_8313ERDB_BROKEN_PMC
29 volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
31 if (im->pmc.pmccr1 & PMCCR1_POWER_OFF)
32 gd->flags |= GD_FLG_SILENT;
34 #if defined(CONFIG_MPC83XX_GPIO) && !defined(CONFIG_SPL_BUILD)
35 mpc83xx_gpio_init_f();
41 int board_early_init_r(void)
43 #if defined(CONFIG_MPC83XX_GPIO) && !defined(CONFIG_SPL_BUILD)
44 mpc83xx_gpio_init_r();
52 puts("Board: Freescale MPC8313ERDB\n");
56 #ifndef CONFIG_SPL_BUILD
57 static struct pci_region pci_regions[] = {
59 .bus_start = CONFIG_SYS_PCI1_MEM_BASE,
60 .phys_start = CONFIG_SYS_PCI1_MEM_PHYS,
61 .size = CONFIG_SYS_PCI1_MEM_SIZE,
62 .flags = PCI_REGION_MEM | PCI_REGION_PREFETCH
65 .bus_start = CONFIG_SYS_PCI1_MMIO_BASE,
66 .phys_start = CONFIG_SYS_PCI1_MMIO_PHYS,
67 .size = CONFIG_SYS_PCI1_MMIO_SIZE,
68 .flags = PCI_REGION_MEM
71 .bus_start = CONFIG_SYS_PCI1_IO_BASE,
72 .phys_start = CONFIG_SYS_PCI1_IO_PHYS,
73 .size = CONFIG_SYS_PCI1_IO_SIZE,
74 .flags = PCI_REGION_IO
78 void pci_init_board(void)
80 volatile immap_t *immr = (volatile immap_t *)CONFIG_SYS_IMMR;
81 volatile clk83xx_t *clk = (volatile clk83xx_t *)&immr->clk;
82 volatile law83xx_t *pci_law = immr->sysconf.pcilaw;
83 struct pci_region *reg[] = { pci_regions };
85 /* Enable all 3 PCI_CLK_OUTPUTs. */
86 clk->occr |= 0xe0000000;
89 * Configure PCI Local Access Windows
91 pci_law[0].bar = CONFIG_SYS_PCI1_MEM_PHYS & LAWBAR_BAR;
92 pci_law[0].ar = LBLAWAR_EN | LBLAWAR_512MB;
94 pci_law[1].bar = CONFIG_SYS_PCI1_IO_PHYS & LAWBAR_BAR;
95 pci_law[1].ar = LBLAWAR_EN | LBLAWAR_1MB;
97 mpc83xx_pci_init(1, reg);
101 * Miscellaneous late-boot configurations
103 * If a VSC7385 microcode image is present, then upload it.
105 int misc_init_r(void)
109 #ifdef CONFIG_VSC7385_IMAGE
110 if (vsc7385_upload_firmware((void *) CONFIG_VSC7385_IMAGE,
111 CONFIG_VSC7385_IMAGE_SIZE)) {
112 puts("Failure uploading VSC7385 microcode.\n");
120 #if defined(CONFIG_OF_BOARD_SETUP)
121 int ft_board_setup(void *blob, bd_t *bd)
123 ft_cpu_setup(blob, bd);
125 ft_pci_setup(blob, bd);
131 #else /* CONFIG_SPL_BUILD */
132 void board_init_f(ulong bootflag)
134 board_early_init_f();
135 NS16550_init((NS16550_t)(CONFIG_SYS_IMMR + 0x4500),
136 CONFIG_SYS_NS16550_CLK / 16 / CONFIG_BAUDRATE);
137 puts("NAND boot... ");
140 relocate_code(CONFIG_SYS_NAND_U_BOOT_RELOC_SP, (gd_t *)gd,
141 CONFIG_SYS_NAND_U_BOOT_RELOC);
144 void board_init_r(gd_t *gd, ulong dest_addr)
151 if (gd->flags & GD_FLG_SILENT)
155 NS16550_putc((NS16550_t)(CONFIG_SYS_IMMR + 0x4500), '\r');
157 NS16550_putc((NS16550_t)(CONFIG_SYS_IMMR + 0x4500), c);