1
2
3
4
5
6#include <common.h>
7#include <command.h>
8#include <init.h>
9#include <asm/processor.h>
10#include <asm/mmu.h>
11#include <asm/immap_85xx.h>
12#include <asm/fsl_pci.h>
13#include <asm/io.h>
14#include <asm/cache.h>
15#include <linux/libfdt.h>
16#include <fdt_support.h>
17#include <pca953x.h>
18
19extern void ft_board_pci_setup(void *blob, struct bd_info *bd);
20
21static void flash_cs_fixup(void)
22{
23 int flash_sel;
24
25
26
27
28
29
30 flash_sel = !((pca953x_get_val(CONFIG_SYS_I2C_PCA953X_ADDR0) &
31 CONFIG_SYS_PCA953X_C0_FLASH_PASS_CS));
32 printf("Flash: Executed from flash%d\n", flash_sel ? 2 : 1);
33
34 if (flash_sel) {
35 set_lbc_br(0, CONFIG_SYS_BR1_PRELIM);
36 set_lbc_or(0, CONFIG_SYS_OR1_PRELIM);
37
38 set_lbc_br(1, CONFIG_SYS_BR0_PRELIM);
39 set_lbc_or(1, CONFIG_SYS_OR0_PRELIM);
40 }
41}
42
43int board_early_init_r(void)
44{
45
46 pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR0, 0xff, 0);
47 pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR1, 0xff, 0);
48 pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR2, 0xff, 0);
49 pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR3, 0xff, 0);
50
51
52
53
54
55
56
57 flush_dcache();
58 invalidate_icache();
59
60
61 disable_tlb(0);
62 set_tlb(1, (CONFIG_SYS_FLASH_BASE2 & 0xf0000000),
63 (CONFIG_SYS_FLASH_BASE2 & 0xf0000000),
64 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
65 0, 0, BOOKE_PAGESZ_256M, 1);
66
67 flash_cs_fixup();
68
69 return 0;
70}
71
72#if defined(CONFIG_OF_BOARD_SETUP)
73int ft_board_setup(void *blob, struct bd_info *bd)
74{
75#ifdef CONFIG_PCI
76 ft_board_pci_setup(blob, bd);
77#endif
78 ft_cpu_setup(blob, bd);
79
80 return 0;
81}
82#endif
83