blob: 58229418f36a5a4348c5f5b1f7ddcc5034c6897e [file] [log] [blame]
Peter Tyser5da6f802009-06-30 17:26:01 -05001/*
2 * Copyright 2009 Extreme Engineering Solutions, Inc.
3 *
4 * See file CREDITS for list of people who contributed to this
5 * project.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20 * MA 02111-1307 USA
21 */
22
23#include <common.h>
24#include <asm/processor.h>
25#include <asm/mmu.h>
26#include <asm/io.h>
27#include <fdt_support.h>
28#include <pca953x.h>
29
30#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_PCI)
31extern void ft_board_pci_setup(void *blob, bd_t *bd);
32#endif
33
34int checkboard(void)
35{
36 char *s;
37
38 printf("Board: X-ES %s 3U VPX SBC\n", CONFIG_SYS_BOARD_NAME);
39 printf(" ");
40 s = getenv("board_rev");
41 if (s)
42 printf("Rev %s, ", s);
43 s = getenv("serial#");
44 if (s)
45 printf("Serial# %s, ", s);
46 s = getenv("board_cfg");
47 if (s)
48 printf("Cfg %s", s);
49 printf("\n");
50
51 return 0;
52}
53/*
54 * Print out which flash was booted from and if booting from the 2nd flash,
55 * swap flash chip selects to maintain consistent flash numbering/addresses.
56 */
57static void flash_cs_fixup(void)
58{
Peter Tyser5da6f802009-06-30 17:26:01 -050059 int flash_sel;
60
61 /*
62 * Print boot dev and swap flash flash chip selects if booted from 2nd
63 * flash. Swapping chip selects presents user with a common memory
64 * map regardless of which flash was booted from.
65 */
66 flash_sel = !((pca953x_get_val(CONFIG_SYS_I2C_PCA953X_ADDR0) &
67 CONFIG_SYS_PCA953X_C0_FLASH_PASS_CS));
68 printf("FLASH: Executed from FLASH%d\n", flash_sel ? 2 : 1);
69
70 if (flash_sel) {
Becky Brucef51cdaf2010-06-17 11:37:20 -050071 set_lbc_br(0, CONFIG_SYS_BR1_PRELIM);
72 set_lbc_or(0, CONFIG_SYS_OR1_PRELIM);
Peter Tyser5da6f802009-06-30 17:26:01 -050073
Becky Brucef51cdaf2010-06-17 11:37:20 -050074 set_lbc_br(1, CONFIG_SYS_BR0_PRELIM);
75 set_lbc_or(1, CONFIG_SYS_OR0_PRELIM);
Peter Tyser5da6f802009-06-30 17:26:01 -050076 }
77}
78
79int board_early_init_r(void)
80{
81 /* Initialize PCA9557 devices */
82 pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR0, 0xff, 0);
83 pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR1, 0xff, 0);
84 pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR2, 0xff, 0);
85 pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR3, 0xff, 0);
86
87 flash_cs_fixup();
88
89 return 0;
90}
91
92#if defined(CONFIG_OF_BOARD_SETUP)
93void ft_board_setup(void *blob, bd_t *bd)
94{
95#ifdef CONFIG_PCI
96 ft_board_pci_setup(blob, bd);
97#endif
98 ft_cpu_setup(blob, bd);
99}
100#endif
101
102#ifdef CONFIG_MP
103extern void cpu_mp_lmb_reserve(struct lmb *lmb);
104
105void board_lmb_reserve(struct lmb *lmb)
106{
107 cpu_mp_lmb_reserve(lmb);
108}
109#endif