2 * Copyright 2009 Extreme Engineering Solutions, Inc.
4 * SPDX-License-Identifier: GPL-2.0+
8 #include <asm/processor.h>
9 #include <fsl_ddr_sdram.h>
12 #include <fdt_support.h>
14 #include "../common/fsl_8xxx_misc.h"
16 DECLARE_GLOBAL_DATA_PTR;
18 #if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_PCI)
19 extern void ft_board_pci_setup(void *blob, bd_t *bd);
23 * Print out which flash was booted from and if booting from the 2nd flash,
24 * swap flash chip selects to maintain consistent flash numbering/addresses.
26 static void flash_cs_fixup(void)
31 * Print boot dev and swap flash flash chip selects if booted from 2nd
32 * flash. Swapping chip selects presents user with a common memory
33 * map regardless of which flash was booted from.
35 flash_sel = !((pca953x_get_val(CONFIG_SYS_I2C_PCA953X_ADDR0) &
36 CONFIG_SYS_PCA953X_C0_FLASH_PASS_CS));
37 printf("Flash: Executed from flash%d\n", flash_sel ? 2 : 1);
40 set_lbc_br(0, CONFIG_SYS_BR1_PRELIM);
41 set_lbc_or(0, CONFIG_SYS_OR1_PRELIM);
43 set_lbc_br(1, CONFIG_SYS_BR0_PRELIM);
44 set_lbc_or(1, CONFIG_SYS_OR0_PRELIM);
48 int board_early_init_r(void)
50 /* Initialize PCA9557 devices */
51 pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR0, 0xff, 0);
52 pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR1, 0xff, 0);
53 pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR2, 0xff, 0);
54 pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR3, 0xff, 0);
63 phys_size_t dram_size = fsl_ddr_sdram();
65 #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
66 /* Initialize and enable DDR ECC */
67 ddr_enable_ecc(dram_size);
70 gd->ram_size = dram_size;
75 #if defined(CONFIG_OF_BOARD_SETUP)
76 int ft_board_setup(void *blob, bd_t *bd)
79 ft_board_pci_setup(blob, bd);
81 ft_cpu_setup(blob, bd);