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 #include <asm/arch/soc.h>
17 #include <fsl_esdhc.h>
18 #include <environment.h>
22 DECLARE_GLOBAL_DATA_PTR
;
28 puts("Board: LS1012ARDB ");
30 /* Initialize i2c early for Serial flash bank information */
33 if (i2c_read(I2C_MUX_IO1_ADDR
, 1, 1, &in1
, 1) < 0) {
34 printf("Error reading i2c boot information!\n");
35 return 0; /* Don't want to hang() on this error */
39 if ((in1
& (~__SW_REV_MASK
)) == __SW_REV_A
)
41 else if ((in1
& (~__SW_REV_MASK
)) == __SW_REV_B
)
46 printf(", boot from QSPI");
47 if ((in1
& (~__SW_BOOT_MASK
)) == __SW_BOOT_EMU
)
49 else if ((in1
& (~__SW_BOOT_MASK
)) == __SW_BOOT_BANK1
)
51 else if ((in1
& (~__SW_BOOT_MASK
)) == __SW_BOOT_BANK2
)
61 static const struct fsl_mmdc_info mparam
= {
62 0x05180000, /* mdctl */
63 0x00030035, /* mdpdc */
64 0x12554000, /* mdotc */
65 0xbabf7954, /* mdcfg0 */
66 0xdb328f64, /* mdcfg1 */
67 0x01ff00db, /* mdcfg2 */
68 0x00001680, /* mdmisc */
69 0x0f3c8000, /* mdref */
70 0x00002000, /* mdrwd */
71 0x00bf1023, /* mdor */
72 0x0000003f, /* mdasp */
73 0x0000022a, /* mpodtctrl */
74 0xa1390003, /* mpzqhwctrl */
79 gd
->ram_size
= CONFIG_SYS_SDRAM_SIZE
;
84 int board_eth_init(bd_t
*bis
)
86 return pci_eth_init(bis
);
89 int board_early_init_f(void)
91 fsl_lsch2_early_init_f();
98 struct ccsr_cci400
*cci
= (struct ccsr_cci400
*)CONFIG_SYS_CCI400_ADDR
;
100 * Set CCI-400 control override register to enable barrier
103 out_le32(&cci
->ctrl_ord
, CCI400_CTRLORD_EN_BARRIER
);
105 #ifdef CONFIG_SYS_FSL_ERRATUM_A010315
109 #ifdef CONFIG_ENV_IS_NOWHERE
110 gd
->env_addr
= (ulong
)&default_environment
[0];
116 int esdhc_status_fixup(void *blob
, const char *compat
)
118 char esdhc0_path
[] = "/soc/esdhc@1560000";
119 char esdhc1_path
[] = "/soc/esdhc@1580000";
123 do_fixup_by_path(blob
, esdhc0_path
, "status", "okay",
129 * The I2C IO-expander for mux select is used to control the muxing
130 * of various onboard interfaces.
132 * IO1[3:2] indicates SDHC2 interface demultiplexer select lines.
134 * 01 - GPIO (to Arduino)
138 if (i2c_read(I2C_MUX_IO1_ADDR
, 0, 1, &io
, 1) < 0) {
139 printf("Error reading i2c boot information!\n");
140 return 0; /* Don't want to hang() on this error */
143 mux_sdhc2
= (io
& 0x0c) >> 2;
144 /* Enable SDHC2 only when use SDIO wifi and eMMC */
145 if (mux_sdhc2
== 2 || mux_sdhc2
== 0)
146 do_fixup_by_path(blob
, esdhc1_path
, "status", "okay",
149 do_fixup_by_path(blob
, esdhc1_path
, "status", "disabled",
150 sizeof("disabled"), 1);
154 int ft_board_setup(void *blob
, bd_t
*bd
)
156 arch_fixup_fdt(blob
);
158 ft_cpu_setup(blob
, bd
);
163 void dram_init_banksize(void)
166 * gd->secure_ram tracks the location of secure memory.
167 * It was set as if the memory starts from 0.
168 * The address needs to add the offset of its bank.
170 gd
->bd
->bi_dram
[0].start
= CONFIG_SYS_SDRAM_BASE
;
171 if (gd
->ram_size
> CONFIG_SYS_DDR_BLOCK1_SIZE
) {
172 gd
->bd
->bi_dram
[0].size
= CONFIG_SYS_DDR_BLOCK1_SIZE
;
173 gd
->bd
->bi_dram
[1].start
= CONFIG_SYS_DDR_BLOCK2_BASE
;
174 gd
->bd
->bi_dram
[1].size
= gd
->ram_size
-
175 CONFIG_SYS_DDR_BLOCK1_SIZE
;
176 #ifdef CONFIG_SYS_MEM_RESERVE_SECURE
177 gd
->arch
.secure_ram
= gd
->bd
->bi_dram
[1].start
+
178 gd
->arch
.secure_ram
-
179 CONFIG_SYS_DDR_BLOCK1_SIZE
;
180 gd
->arch
.secure_ram
|= MEM_RESERVE_SECURE_MAINTAINED
;
183 gd
->bd
->bi_dram
[0].size
= gd
->ram_size
;
184 #ifdef CONFIG_SYS_MEM_RESERVE_SECURE
185 gd
->arch
.secure_ram
= gd
->bd
->bi_dram
[0].start
+
187 gd
->arch
.secure_ram
|= MEM_RESERVE_SECURE_MAINTAINED
;