2 * Copyright 2008 Extreme Engineering Solutions, Inc.
3 * Copyright 2004, 2007 Freescale Semiconductor, Inc.
5 * SPDX-License-Identifier: GPL-2.0+
11 #include <asm/processor.h>
12 #include <asm/immap_85xx.h>
13 #include <asm/fsl_pci.h>
15 #include <asm/cache.h>
18 #include <fdt_support.h>
21 extern void ft_board_pci_setup(void *blob, bd_t *bd);
23 static void flash_cs_fixup(void)
28 * Print boot dev and swap flash flash chip selects if booted from 2nd
29 * flash. Swapping chip selects presents user with a common memory
30 * map regardless of which flash was booted from.
32 flash_sel = !((pca953x_get_val(CONFIG_SYS_I2C_PCA953X_ADDR0) &
33 CONFIG_SYS_PCA953X_FLASH_PASS_CS));
34 printf("Flash: Executed from flash%d\n", flash_sel ? 2 : 1);
37 set_lbc_br(0, CONFIG_SYS_BR1_PRELIM);
38 set_lbc_or(0, CONFIG_SYS_OR1_PRELIM);
40 set_lbc_br(1, CONFIG_SYS_BR0_PRELIM);
41 set_lbc_or(1, CONFIG_SYS_OR0_PRELIM);
45 int board_early_init_r(void)
47 /* Initialize PCA9557 devices */
48 pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR0, 0xff, 0);
49 pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR1, 0xff, 0);
52 * Remap NOR flash region to caching-inhibited
53 * so that flash can be erased/programmed properly.
56 /* Flush d-cache and invalidate i-cache of any FLASH data */
60 /* Invalidate existing TLB entry for NOR flash */
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);
72 #if defined(CONFIG_OF_BOARD_SETUP)
73 void ft_board_setup(void *blob, bd_t *bd)
76 ft_board_pci_setup(blob, bd);
78 ft_cpu_setup(blob, bd);