1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright 2016 Freescale Semiconductor, Inc.
9 #include <asm/arch/clock.h>
10 #include <asm/arch/fsl_serdes.h>
11 #ifdef CONFIG_FSL_LS_PPA
12 #include <asm/arch/ppa.h>
14 #include <asm/arch/mmu.h>
15 #include <asm/arch/soc.h>
20 #include <fsl_esdhc.h>
21 #include <environment.h>
26 DECLARE_GLOBAL_DATA_PTR;
30 #ifdef CONFIG_TARGET_LS1012ARDB
33 puts("Board: LS1012ARDB ");
35 /* Initialize i2c early for Serial flash bank information */
38 if (i2c_read(I2C_MUX_IO_ADDR, I2C_MUX_IO_1, 1, &in1, 1) < 0) {
39 printf("Error reading i2c boot information!\n");
40 return 0; /* Don't want to hang() on this error */
44 switch (in1 & SW_REV_MASK) {
71 printf(", boot from QSPI");
72 if ((in1 & SW_BOOT_MASK) == SW_BOOT_EMU)
74 else if ((in1 & SW_BOOT_MASK) == SW_BOOT_BANK1)
76 else if ((in1 & SW_BOOT_MASK) == SW_BOOT_BANK2)
82 puts("Board: LS1012A2G5RDB ");
89 static const struct fsl_mmdc_info mparam = {
90 0x05180000, /* mdctl */
91 0x00030035, /* mdpdc */
92 0x12554000, /* mdotc */
93 0xbabf7954, /* mdcfg0 */
94 0xdb328f64, /* mdcfg1 */
95 0x01ff00db, /* mdcfg2 */
96 0x00001680, /* mdmisc */
97 0x0f3c8000, /* mdref */
98 0x00002000, /* mdrwd */
99 0x00bf1023, /* mdor */
100 0x0000003f, /* mdasp */
101 0x0000022a, /* mpodtctrl */
102 0xa1390003, /* mpzqhwctrl */
107 gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
108 #if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
109 /* This will break-before-make MMU for DDR */
110 update_early_mmu_table();
117 int board_early_init_f(void)
119 fsl_lsch2_early_init_f();
126 struct ccsr_cci400 *cci = (struct ccsr_cci400 *)(CONFIG_SYS_IMMR +
127 CONFIG_SYS_CCI400_OFFSET);
129 * Set CCI-400 control override register to enable barrier
132 out_le32(&cci->ctrl_ord, CCI400_CTRLORD_EN_BARRIER);
134 #ifdef CONFIG_SYS_FSL_ERRATUM_A010315
138 #ifdef CONFIG_ENV_IS_NOWHERE
139 gd->env_addr = (ulong)&default_environment[0];
142 #ifdef CONFIG_FSL_CAAM
146 #ifdef CONFIG_FSL_LS_PPA
152 #ifdef CONFIG_TARGET_LS1012ARDB
153 int esdhc_status_fixup(void *blob, const char *compat)
155 char esdhc1_path[] = "/soc/esdhc@1580000";
156 bool sdhc2_en = false;
162 /* IO1[7:3] is the field of board revision info. */
163 if (i2c_read(I2C_MUX_IO_ADDR, I2C_MUX_IO_1, 1, &io, 1) < 0) {
164 printf("Error reading i2c boot information!\n");
168 /* hwconfig method is used for RevD and later versions. */
169 if ((io & SW_REV_MASK) <= SW_REV_D) {
170 #ifdef CONFIG_HWCONFIG
171 if (hwconfig("esdhc1"))
176 * The I2C IO-expander for mux select is used to control
177 * the muxing of various onboard interfaces.
179 * IO0[3:2] indicates SDHC2 interface demultiplexer
182 * 01 - GPIO (to Arduino)
186 if (i2c_read(I2C_MUX_IO_ADDR, I2C_MUX_IO_0, 1, &io, 1) < 0) {
187 printf("Error reading i2c boot information!\n");
191 mux_sdhc2 = (io & 0x0c) >> 2;
192 /* Enable SDHC2 only when use SDIO wifi and eMMC */
193 if (mux_sdhc2 == 2 || mux_sdhc2 == 0)
197 do_fixup_by_path(blob, esdhc1_path, "status", "okay",
200 do_fixup_by_path(blob, esdhc1_path, "status", "disabled",
201 sizeof("disabled"), 1);
206 int ft_board_setup(void *blob, bd_t *bd)
208 arch_fixup_fdt(blob);
210 ft_cpu_setup(blob, bd);