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
;
33 puts("Board: LS1012ARDB ");
35 /* Initialize i2c early for Serial flash bank information */
38 if (i2c_read(I2C_MUX_IO1_ADDR
, 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 if ((in1
& (~__SW_REV_MASK
)) == __SW_REV_A
)
46 else if ((in1
& (~__SW_REV_MASK
)) == __SW_REV_B
)
51 printf(", boot from QSPI");
52 if ((in1
& (~__SW_BOOT_MASK
)) == __SW_BOOT_EMU
)
54 else if ((in1
& (~__SW_BOOT_MASK
)) == __SW_BOOT_BANK1
)
56 else if ((in1
& (~__SW_BOOT_MASK
)) == __SW_BOOT_BANK2
)
66 static const struct fsl_mmdc_info mparam
= {
67 0x05180000, /* mdctl */
68 0x00030035, /* mdpdc */
69 0x12554000, /* mdotc */
70 0xbabf7954, /* mdcfg0 */
71 0xdb328f64, /* mdcfg1 */
72 0x01ff00db, /* mdcfg2 */
73 0x00001680, /* mdmisc */
74 0x0f3c8000, /* mdref */
75 0x00002000, /* mdrwd */
76 0x00bf1023, /* mdor */
77 0x0000003f, /* mdasp */
78 0x0000022a, /* mpodtctrl */
79 0xa1390003, /* mpzqhwctrl */
84 gd
->ram_size
= CONFIG_SYS_SDRAM_SIZE
;
85 #if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
86 /* This will break-before-make MMU for DDR */
87 update_early_mmu_table();
93 int board_eth_init(bd_t
*bis
)
95 return pci_eth_init(bis
);
98 int board_early_init_f(void)
100 fsl_lsch2_early_init_f();
107 struct ccsr_cci400
*cci
= (struct ccsr_cci400
*)(CONFIG_SYS_IMMR
+
108 CONFIG_SYS_CCI400_OFFSET
);
110 * Set CCI-400 control override register to enable barrier
113 out_le32(&cci
->ctrl_ord
, CCI400_CTRLORD_EN_BARRIER
);
115 #ifdef CONFIG_SYS_FSL_ERRATUM_A010315
119 #ifdef CONFIG_ENV_IS_NOWHERE
120 gd
->env_addr
= (ulong
)&default_environment
[0];
123 #ifdef CONFIG_FSL_CAAM
127 #ifdef CONFIG_FSL_LS_PPA
133 int esdhc_status_fixup(void *blob
, const char *compat
)
135 char esdhc0_path
[] = "/soc/esdhc@1560000";
136 char esdhc1_path
[] = "/soc/esdhc@1580000";
140 do_fixup_by_path(blob
, esdhc0_path
, "status", "okay",
146 * The I2C IO-expander for mux select is used to control the muxing
147 * of various onboard interfaces.
149 * IO1[3:2] indicates SDHC2 interface demultiplexer select lines.
151 * 01 - GPIO (to Arduino)
155 if (i2c_read(I2C_MUX_IO1_ADDR
, 0, 1, &io
, 1) < 0) {
156 printf("Error reading i2c boot information!\n");
157 return 0; /* Don't want to hang() on this error */
160 mux_sdhc2
= (io
& 0x0c) >> 2;
161 /* Enable SDHC2 only when use SDIO wifi and eMMC */
162 if (mux_sdhc2
== 2 || mux_sdhc2
== 0)
163 do_fixup_by_path(blob
, esdhc1_path
, "status", "okay",
166 do_fixup_by_path(blob
, esdhc1_path
, "status", "disabled",
167 sizeof("disabled"), 1);
171 int ft_board_setup(void *blob
, bd_t
*bd
)
173 arch_fixup_fdt(blob
);
175 ft_cpu_setup(blob
, bd
);