1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23#include <common.h>
24#include <asm/processor.h>
25#include <asm/fsl_ddr_sdram.h>
26#include <asm/mmu.h>
27#include <asm/io.h>
28#include <fdt_support.h>
29#include <pca953x.h>
30#include "../common/fsl_8xxx_misc.h"
31
32#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_PCI)
33extern void ft_board_pci_setup(void *blob, bd_t *bd);
34#endif
35
36
37
38
39
40static void flash_cs_fixup(void)
41{
42 int flash_sel;
43
44
45
46
47
48
49 flash_sel = !((pca953x_get_val(CONFIG_SYS_I2C_PCA953X_ADDR0) &
50 CONFIG_SYS_PCA953X_C0_FLASH_PASS_CS));
51 printf("Flash: Executed from flash%d\n", flash_sel ? 2 : 1);
52
53 if (flash_sel) {
54 set_lbc_br(0, CONFIG_SYS_BR1_PRELIM);
55 set_lbc_or(0, CONFIG_SYS_OR1_PRELIM);
56
57 set_lbc_br(1, CONFIG_SYS_BR0_PRELIM);
58 set_lbc_or(1, CONFIG_SYS_OR0_PRELIM);
59 }
60}
61
62int board_early_init_r(void)
63{
64
65 pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR0, 0xff, 0);
66 pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR1, 0xff, 0);
67 pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR2, 0xff, 0);
68 pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR3, 0xff, 0);
69
70 flash_cs_fixup();
71
72 return 0;
73}
74
75phys_size_t initdram(int board_type)
76{
77 phys_size_t dram_size = fsl_ddr_sdram();
78
79#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
80
81 ddr_enable_ecc(dram_size);
82#endif
83
84 return dram_size;
85}
86
87#if defined(CONFIG_OF_BOARD_SETUP)
88void ft_board_setup(void *blob, bd_t *bd)
89{
90#ifdef CONFIG_PCI
91 ft_board_pci_setup(blob, bd);
92#endif
93 ft_cpu_setup(blob, bd);
94}
95#endif
96
97#ifdef CONFIG_MP
98extern void cpu_mp_lmb_reserve(struct lmb *lmb);
99
100void board_lmb_reserve(struct lmb *lmb)
101{
102 cpu_mp_lmb_reserve(lmb);
103}
104#endif
105