1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright 2017-2018 NXP
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>
16 #include <fsl_esdhc.h>
18 #include <environment.h>
22 DECLARE_GLOBAL_DATA_PTR;
24 static inline int get_board_version(void)
26 struct ccsr_gpio *pgpio = (void *)(GPIO1_BASE_ADDR);
29 val = in_be32(&pgpio->gpdat);
36 #ifdef CONFIG_TARGET_LS1012AFRDM
37 puts("Board: LS1012AFRDM ");
41 rev = get_board_version();
43 puts("Board: FRWY-LS1012A ");
63 #ifdef CONFIG_TARGET_LS1012AFRWY
64 int esdhc_status_fixup(void *blob, const char *compat)
66 char esdhc0_path[] = "/soc/esdhc@1560000";
67 char esdhc1_path[] = "/soc/esdhc@1580000";
69 do_fixup_by_path(blob, esdhc0_path, "status", "okay",
72 do_fixup_by_path(blob, esdhc1_path, "status", "disabled",
73 sizeof("disabled"), 1);
80 #ifdef CONFIG_TARGET_LS1012AFRWY
83 struct fsl_mmdc_info mparam = {
84 0x04180000, /* mdctl */
85 0x00030035, /* mdpdc */
86 0x12554000, /* mdotc */
87 0xbabf7954, /* mdcfg0 */
88 0xdb328f64, /* mdcfg1 */
89 0x01ff00db, /* mdcfg2 */
90 0x00001680, /* mdmisc */
91 0x0f3c8000, /* mdref */
92 0x00002000, /* mdrwd */
93 0x00bf1023, /* mdor */
94 0x0000003f, /* mdasp */
95 0x0000022a, /* mpodtctrl */
96 0xa1390003, /* mpzqhwctrl */
99 #ifdef CONFIG_TARGET_LS1012AFRWY
100 board_rev = get_board_version();
102 if (board_rev & BOARD_REV_B) {
103 mparam.mdctl = 0x05180000;
104 gd->ram_size = SYS_SDRAM_SIZE_1024;
106 gd->ram_size = SYS_SDRAM_SIZE_512;
109 gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
113 #if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
114 /* This will break-before-make MMU for DDR */
115 update_early_mmu_table();
121 int board_early_init_f(void)
123 fsl_lsch2_early_init_f();
130 struct ccsr_cci400 *cci = (struct ccsr_cci400 *)(CONFIG_SYS_IMMR +
131 CONFIG_SYS_CCI400_OFFSET);
134 * Set CCI-400 control override register to enable barrier
137 out_le32(&cci->ctrl_ord, CCI400_CTRLORD_EN_BARRIER);
139 #ifdef CONFIG_ENV_IS_NOWHERE
140 gd->env_addr = (ulong)&default_environment[0];
143 #ifdef CONFIG_FSL_LS_PPA
149 int ft_board_setup(void *blob, bd_t *bd)
151 arch_fixup_fdt(blob);
153 ft_cpu_setup(blob, bd);