2 * Copyright 2016 Freescale Semiconductor, Inc.
4 * SPDX-License-Identifier: GPL-2.0+
10 #include <asm/arch/clock.h>
11 #include <asm/arch/fsl_serdes.h>
12 #ifdef CONFIG_FSL_LS_PPA
13 #include <asm/arch/ppa.h>
15 #include <asm/arch/mmu.h>
16 #include <asm/arch/soc.h>
21 #include <fsl_esdhc.h>
22 #include <environment.h>
27 DECLARE_GLOBAL_DATA_PTR;
31 #ifdef CONFIG_TARGET_LS1012ARDB
34 puts("Board: LS1012ARDB ");
36 /* Initialize i2c early for Serial flash bank information */
39 if (i2c_read(I2C_MUX_IO_ADDR, I2C_MUX_IO_1, 1, &in1, 1) < 0) {
40 printf("Error reading i2c boot information!\n");
41 return 0; /* Don't want to hang() on this error */
45 switch (in1 & SW_REV_MASK) {
72 printf(", boot from QSPI");
73 if ((in1 & SW_BOOT_MASK) == SW_BOOT_EMU)
75 else if ((in1 & SW_BOOT_MASK) == SW_BOOT_BANK1)
77 else if ((in1 & SW_BOOT_MASK) == SW_BOOT_BANK2)
83 puts("Board: LS1012A2G5RDB ");
90 static const struct fsl_mmdc_info mparam = {
91 0x05180000, /* mdctl */
92 0x00030035, /* mdpdc */
93 0x12554000, /* mdotc */
94 0xbabf7954, /* mdcfg0 */
95 0xdb328f64, /* mdcfg1 */
96 0x01ff00db, /* mdcfg2 */
97 0x00001680, /* mdmisc */
98 0x0f3c8000, /* mdref */
99 0x00002000, /* mdrwd */
100 0x00bf1023, /* mdor */
101 0x0000003f, /* mdasp */
102 0x0000022a, /* mpodtctrl */
103 0xa1390003, /* mpzqhwctrl */
108 gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
109 #if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
110 /* This will break-before-make MMU for DDR */
111 update_early_mmu_table();
117 int board_eth_init(bd_t *bis)
119 return pci_eth_init(bis);
122 int board_early_init_f(void)
124 fsl_lsch2_early_init_f();
131 struct ccsr_cci400 *cci = (struct ccsr_cci400 *)(CONFIG_SYS_IMMR +
132 CONFIG_SYS_CCI400_OFFSET);
134 * Set CCI-400 control override register to enable barrier
137 out_le32(&cci->ctrl_ord, CCI400_CTRLORD_EN_BARRIER);
139 #ifdef CONFIG_SYS_FSL_ERRATUM_A010315
143 #ifdef CONFIG_ENV_IS_NOWHERE
144 gd->env_addr = (ulong)&default_environment[0];
147 #ifdef CONFIG_FSL_CAAM
151 #ifdef CONFIG_FSL_LS_PPA
157 #ifdef CONFIG_TARGET_LS1012ARDB
158 int esdhc_status_fixup(void *blob, const char *compat)
160 char esdhc1_path[] = "/soc/esdhc@1580000";
161 bool sdhc2_en = false;
167 /* IO1[7:3] is the field of board revision info. */
168 if (i2c_read(I2C_MUX_IO_ADDR, I2C_MUX_IO_1, 1, &io, 1) < 0) {
169 printf("Error reading i2c boot information!\n");
173 /* hwconfig method is used for RevD and later versions. */
174 if ((io & SW_REV_MASK) <= SW_REV_D) {
175 #ifdef CONFIG_HWCONFIG
176 if (hwconfig("esdhc1"))
181 * The I2C IO-expander for mux select is used to control
182 * the muxing of various onboard interfaces.
184 * IO0[3:2] indicates SDHC2 interface demultiplexer
187 * 01 - GPIO (to Arduino)
191 if (i2c_read(I2C_MUX_IO_ADDR, I2C_MUX_IO_0, 1, &io, 1) < 0) {
192 printf("Error reading i2c boot information!\n");
196 mux_sdhc2 = (io & 0x0c) >> 2;
197 /* Enable SDHC2 only when use SDIO wifi and eMMC */
198 if (mux_sdhc2 == 2 || mux_sdhc2 == 0)
202 do_fixup_by_path(blob, esdhc1_path, "status", "okay",
205 do_fixup_by_path(blob, esdhc1_path, "status", "disabled",
206 sizeof("disabled"), 1);
211 int ft_board_setup(void *blob, bd_t *bd)
213 arch_fixup_fdt(blob);
215 ft_cpu_setup(blob, bd);