]> git.sur5r.net Git - u-boot/blob - board/freescale/mpc8313erdb/mpc8313erdb.c
83xx: Add Vitesse VSC7385 firmware uploading
[u-boot] / board / freescale / mpc8313erdb / mpc8313erdb.c
1 /*
2  * Copyright (C) Freescale Semiconductor, Inc. 2006-2007
3  *
4  * Author: Scott Wood <scottwood@freescale.com>
5  *
6  * See file CREDITS for list of people who contributed to this
7  * project.
8  *
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.
13  *
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.
18  *
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,
22  * MA 02111-1307 USA
23  */
24
25 #include <common.h>
26 #if defined(CONFIG_OF_LIBFDT)
27 #include <libfdt.h>
28 #endif
29 #include <pci.h>
30 #include <mpc83xx.h>
31 #include <vsc7385.h>
32
33 DECLARE_GLOBAL_DATA_PTR;
34
35 int board_early_init_f(void)
36 {
37 #ifndef CFG_8313ERDB_BROKEN_PMC
38         volatile immap_t *im = (immap_t *)CFG_IMMR;
39
40         if (im->pmc.pmccr1 & PMCCR1_POWER_OFF)
41                 gd->flags |= GD_FLG_SILENT;
42 #endif
43
44         return 0;
45 }
46
47 int checkboard(void)
48 {
49         puts("Board: Freescale MPC8313ERDB\n");
50         return 0;
51 }
52
53 static struct pci_region pci_regions[] = {
54         {
55                 bus_start: CFG_PCI1_MEM_BASE,
56                 phys_start: CFG_PCI1_MEM_PHYS,
57                 size: CFG_PCI1_MEM_SIZE,
58                 flags: PCI_REGION_MEM | PCI_REGION_PREFETCH
59         },
60         {
61                 bus_start: CFG_PCI1_MMIO_BASE,
62                 phys_start: CFG_PCI1_MMIO_PHYS,
63                 size: CFG_PCI1_MMIO_SIZE,
64                 flags: PCI_REGION_MEM
65         },
66         {
67                 bus_start: CFG_PCI1_IO_BASE,
68                 phys_start: CFG_PCI1_IO_PHYS,
69                 size: CFG_PCI1_IO_SIZE,
70                 flags: PCI_REGION_IO
71         }
72 };
73
74 void pci_init_board(void)
75 {
76         volatile immap_t *immr = (volatile immap_t *)CFG_IMMR;
77         volatile clk83xx_t *clk = (volatile clk83xx_t *)&immr->clk;
78         volatile law83xx_t *pci_law = immr->sysconf.pcilaw;
79         struct pci_region *reg[] = { pci_regions };
80         int warmboot;
81
82         /* Enable all 3 PCI_CLK_OUTPUTs. */
83         clk->occr |= 0xe0000000;
84
85         /*
86          * Configure PCI Local Access Windows
87          */
88         pci_law[0].bar = CFG_PCI1_MEM_PHYS & LAWBAR_BAR;
89         pci_law[0].ar = LBLAWAR_EN | LBLAWAR_512MB;
90
91         pci_law[1].bar = CFG_PCI1_IO_PHYS & LAWBAR_BAR;
92         pci_law[1].ar = LBLAWAR_EN | LBLAWAR_1MB;
93
94         warmboot = gd->bd->bi_bootflags & BOOTFLAG_WARM;
95 #ifndef CFG_8313ERDB_BROKEN_PMC
96         warmboot |= immr->pmc.pmccr1 & PMCCR1_POWER_OFF;
97 #endif
98
99         mpc83xx_pci_init(1, reg, warmboot);
100 }
101
102 /*
103  * Miscellaneous late-boot configurations
104  *
105  * If a VSC7385 microcode image is present, then upload it.
106 */
107 int misc_init_r(void)
108 {
109         int rc = 0;
110
111 #ifdef CONFIG_VSC7385_IMAGE
112         if (vsc7385_upload_firmware((void *) CONFIG_VSC7385_IMAGE,
113                 CONFIG_VSC7385_IMAGE_SIZE)) {
114                 puts("Failure uploading VSC7385 microcode.\n");
115                 rc = 1;
116         }
117 #endif
118
119         return rc;
120 }
121
122 #if defined(CONFIG_OF_BOARD_SETUP)
123 void ft_board_setup(void *blob, bd_t *bd)
124 {
125         ft_cpu_setup(blob, bd);
126 #ifdef CONFIG_PCI
127         ft_pci_setup(blob, bd);
128 #endif
129 }
130 #endif