1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright 2017-2018, 2021 NXP
7 #include <fdt_support.h>
11 #include <asm/global_data.h>
13 #include <asm/arch/clock.h>
14 #include <asm/arch/fsl_serdes.h>
15 #ifdef CONFIG_FSL_LS_PPA
16 #include <asm/arch/ppa.h>
18 #include <asm/arch/mmu.h>
19 #include <asm/arch/soc.h>
20 #include <fsl_esdhc.h>
22 #include <env_internal.h>
25 #include <net/pfe_eth/pfe/pfe_hw.h>
27 DECLARE_GLOBAL_DATA_PTR;
29 static inline int get_board_version(void)
32 #ifdef CONFIG_TARGET_LS1012AFRDM
35 struct ccsr_gpio *pgpio = (void *)(GPIO2_BASE_ADDR);
37 val = in_be32(&pgpio->gpdat) & BOARD_REV_MASK;/*Get GPIO2 11,12,14*/
45 #ifdef CONFIG_TARGET_LS1012AFRDM
46 puts("Board: LS1012AFRDM ");
50 rev = get_board_version();
52 puts("Board: FRWY-LS1012A ");
72 #ifdef CONFIG_TARGET_LS1012AFRWY
73 int esdhc_status_fixup(void *blob, const char *compat)
75 char esdhc0_path[] = "/soc/esdhc@1560000";
76 char esdhc1_path[] = "/soc/esdhc@1580000";
78 do_fixup_by_path(blob, esdhc0_path, "status", "okay",
81 do_fixup_by_path(blob, esdhc1_path, "status", "disabled",
82 sizeof("disabled"), 1);
90 #ifdef CONFIG_TARGET_LS1012AFRWY
94 gd->ram_size = tfa_get_dram_size();
97 #ifdef CONFIG_TARGET_LS1012AFRWY
98 board_rev = get_board_version();
100 if (board_rev & BOARD_REV_C)
101 gd->ram_size = SYS_SDRAM_SIZE_1024;
103 gd->ram_size = SYS_SDRAM_SIZE_512;
105 gd->ram_size = CFG_SYS_SDRAM_SIZE;
113 #ifdef CONFIG_TARGET_LS1012AFRWY
116 struct fsl_mmdc_info mparam = {
117 0x04180000, /* mdctl */
118 0x00030035, /* mdpdc */
119 0x12554000, /* mdotc */
120 0xbabf7954, /* mdcfg0 */
121 0xdb328f64, /* mdcfg1 */
122 0x01ff00db, /* mdcfg2 */
123 0x00001680, /* mdmisc */
124 0x0f3c8000, /* mdref */
125 0x00002000, /* mdrwd */
126 0x00bf1023, /* mdor */
127 0x0000003f, /* mdasp */
128 0x0000022a, /* mpodtctrl */
129 0xa1390003, /* mpzqhwctrl */
132 #ifdef CONFIG_TARGET_LS1012AFRWY
133 board_rev = get_board_version();
135 if (board_rev == BOARD_REV_C) {
136 mparam.mdctl = 0x05180000;
137 gd->ram_size = SYS_SDRAM_SIZE_1024;
139 gd->ram_size = SYS_SDRAM_SIZE_512;
142 gd->ram_size = CFG_SYS_SDRAM_SIZE;
146 #if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
147 /* This will break-before-make MMU for DDR */
148 update_early_mmu_table();
155 int board_early_init_f(void)
157 fsl_lsch2_early_init_f();
164 struct ccsr_cci400 *cci = (struct ccsr_cci400 *)(CONFIG_SYS_IMMR +
165 CONFIG_SYS_CCI400_OFFSET);
168 * Set CCI-400 control override register to enable barrier
171 if (current_el() == 3)
172 out_le32(&cci->ctrl_ord, CCI400_CTRLORD_EN_BARRIER);
174 #ifdef CONFIG_FSL_LS_PPA
180 #ifdef CONFIG_FSL_PFE
181 void board_quiesce_devices(void)
183 pfe_command_stop(0, NULL);
187 int ft_board_setup(void *blob, struct bd_info *bd)
189 arch_fixup_fdt(blob);
191 ft_cpu_setup(blob, bd);