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/soc.h>
20 #include <fsl_esdhc.h>
21 #include <environment.h>
25 DECLARE_GLOBAL_DATA_PTR
;
31 puts("Board: LS1012ARDB ");
33 /* Initialize i2c early for Serial flash bank information */
36 if (i2c_read(I2C_MUX_IO1_ADDR
, 1, 1, &in1
, 1) < 0) {
37 printf("Error reading i2c boot information!\n");
38 return 0; /* Don't want to hang() on this error */
42 if ((in1
& (~__SW_REV_MASK
)) == __SW_REV_A
)
44 else if ((in1
& (~__SW_REV_MASK
)) == __SW_REV_B
)
49 printf(", boot from QSPI");
50 if ((in1
& (~__SW_BOOT_MASK
)) == __SW_BOOT_EMU
)
52 else if ((in1
& (~__SW_BOOT_MASK
)) == __SW_BOOT_BANK1
)
54 else if ((in1
& (~__SW_BOOT_MASK
)) == __SW_BOOT_BANK2
)
64 static const struct fsl_mmdc_info mparam
= {
65 0x05180000, /* mdctl */
66 0x00030035, /* mdpdc */
67 0x12554000, /* mdotc */
68 0xbabf7954, /* mdcfg0 */
69 0xdb328f64, /* mdcfg1 */
70 0x01ff00db, /* mdcfg2 */
71 0x00001680, /* mdmisc */
72 0x0f3c8000, /* mdref */
73 0x00002000, /* mdrwd */
74 0x00bf1023, /* mdor */
75 0x0000003f, /* mdasp */
76 0x0000022a, /* mpodtctrl */
77 0xa1390003, /* mpzqhwctrl */
82 gd
->ram_size
= CONFIG_SYS_SDRAM_SIZE
;
87 int board_eth_init(bd_t
*bis
)
89 return pci_eth_init(bis
);
92 int board_early_init_f(void)
94 fsl_lsch2_early_init_f();
101 struct ccsr_cci400
*cci
= (struct ccsr_cci400
*)CONFIG_SYS_CCI400_ADDR
;
103 * Set CCI-400 control override register to enable barrier
106 out_le32(&cci
->ctrl_ord
, CCI400_CTRLORD_EN_BARRIER
);
108 #ifdef CONFIG_SYS_FSL_ERRATUM_A010315
112 #ifdef CONFIG_ENV_IS_NOWHERE
113 gd
->env_addr
= (ulong
)&default_environment
[0];
116 #ifdef CONFIG_FSL_LS_PPA
122 int esdhc_status_fixup(void *blob
, const char *compat
)
124 char esdhc0_path
[] = "/soc/esdhc@1560000";
125 char esdhc1_path
[] = "/soc/esdhc@1580000";
129 do_fixup_by_path(blob
, esdhc0_path
, "status", "okay",
135 * The I2C IO-expander for mux select is used to control the muxing
136 * of various onboard interfaces.
138 * IO1[3:2] indicates SDHC2 interface demultiplexer select lines.
140 * 01 - GPIO (to Arduino)
144 if (i2c_read(I2C_MUX_IO1_ADDR
, 0, 1, &io
, 1) < 0) {
145 printf("Error reading i2c boot information!\n");
146 return 0; /* Don't want to hang() on this error */
149 mux_sdhc2
= (io
& 0x0c) >> 2;
150 /* Enable SDHC2 only when use SDIO wifi and eMMC */
151 if (mux_sdhc2
== 2 || mux_sdhc2
== 0)
152 do_fixup_by_path(blob
, esdhc1_path
, "status", "okay",
155 do_fixup_by_path(blob
, esdhc1_path
, "status", "disabled",
156 sizeof("disabled"), 1);
160 int ft_board_setup(void *blob
, bd_t
*bd
)
162 arch_fixup_fdt(blob
);
164 ft_cpu_setup(blob
, bd
);
169 void dram_init_banksize(void)
172 * gd->secure_ram tracks the location of secure memory.
173 * It was set as if the memory starts from 0.
174 * The address needs to add the offset of its bank.
176 gd
->bd
->bi_dram
[0].start
= CONFIG_SYS_SDRAM_BASE
;
177 if (gd
->ram_size
> CONFIG_SYS_DDR_BLOCK1_SIZE
) {
178 gd
->bd
->bi_dram
[0].size
= CONFIG_SYS_DDR_BLOCK1_SIZE
;
179 gd
->bd
->bi_dram
[1].start
= CONFIG_SYS_DDR_BLOCK2_BASE
;
180 gd
->bd
->bi_dram
[1].size
= gd
->ram_size
-
181 CONFIG_SYS_DDR_BLOCK1_SIZE
;
182 #ifdef CONFIG_SYS_MEM_RESERVE_SECURE
183 gd
->arch
.secure_ram
= gd
->bd
->bi_dram
[1].start
+
184 gd
->arch
.secure_ram
-
185 CONFIG_SYS_DDR_BLOCK1_SIZE
;
186 gd
->arch
.secure_ram
|= MEM_RESERVE_SECURE_MAINTAINED
;
189 gd
->bd
->bi_dram
[0].size
= gd
->ram_size
;
190 #ifdef CONFIG_SYS_MEM_RESERVE_SECURE
191 gd
->arch
.secure_ram
= gd
->bd
->bi_dram
[0].start
+
193 gd
->arch
.secure_ram
|= MEM_RESERVE_SECURE_MAINTAINED
;