2 * Copyright 2008 Extreme Engineering Solutions, Inc.
3 * Copyright 2004, 2007 Freescale Semiconductor, Inc.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27 #include <asm/processor.h>
28 #include <asm/immap_85xx.h>
29 #include <asm/fsl_pci.h>
31 #include <asm/cache.h>
34 #include <fdt_support.h>
37 extern void ft_board_pci_setup(void *blob, bd_t *bd);
39 static void flash_cs_fixup(void)
44 * Print boot dev and swap flash flash chip selects if booted from 2nd
45 * flash. Swapping chip selects presents user with a common memory
46 * map regardless of which flash was booted from.
48 flash_sel = !((pca953x_get_val(CONFIG_SYS_I2C_PCA953X_ADDR0) &
49 CONFIG_SYS_PCA953X_FLASH_PASS_CS));
50 printf("Flash: Executed from flash%d\n", flash_sel ? 2 : 1);
53 set_lbc_br(0, CONFIG_SYS_BR1_PRELIM);
54 set_lbc_or(0, CONFIG_SYS_OR1_PRELIM);
56 set_lbc_br(1, CONFIG_SYS_BR0_PRELIM);
57 set_lbc_or(1, CONFIG_SYS_OR0_PRELIM);
61 int board_early_init_r(void)
63 /* Initialize PCA9557 devices */
64 pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR0, 0xff, 0);
65 pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR1, 0xff, 0);
68 * Remap NOR flash region to caching-inhibited
69 * so that flash can be erased/programmed properly.
72 /* Flush d-cache and invalidate i-cache of any FLASH data */
76 /* Invalidate existing TLB entry for NOR flash */
78 set_tlb(1, (CONFIG_SYS_FLASH_BASE2 & 0xf0000000),
79 (CONFIG_SYS_FLASH_BASE2 & 0xf0000000),
80 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
81 0, 0, BOOKE_PAGESZ_256M, 1);
88 #if defined(CONFIG_OF_BOARD_SETUP)
89 void ft_board_setup(void *blob, bd_t *bd)
92 ft_board_pci_setup(blob, bd);
94 ft_cpu_setup(blob, bd);