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>
23 DECLARE_GLOBAL_DATA_PTR;
25 static inline int get_board_version(void)
27 struct ccsr_gpio *pgpio = (void *)(GPIO1_BASE_ADDR);
30 val = in_be32(&pgpio->gpdat);
37 #ifdef CONFIG_TARGET_LS1012AFRDM
38 puts("Board: LS1012AFRDM ");
42 rev = get_board_version();
44 puts("Board: FRWY-LS1012A ");
64 #ifdef CONFIG_TARGET_LS1012AFRWY
65 int esdhc_status_fixup(void *blob, const char *compat)
67 char esdhc0_path[] = "/soc/esdhc@1560000";
68 char esdhc1_path[] = "/soc/esdhc@1580000";
70 do_fixup_by_path(blob, esdhc0_path, "status", "okay",
73 do_fixup_by_path(blob, esdhc1_path, "status", "disabled",
74 sizeof("disabled"), 1);
81 #ifdef CONFIG_TARGET_LS1012AFRWY
84 struct fsl_mmdc_info mparam = {
85 0x04180000, /* mdctl */
86 0x00030035, /* mdpdc */
87 0x12554000, /* mdotc */
88 0xbabf7954, /* mdcfg0 */
89 0xdb328f64, /* mdcfg1 */
90 0x01ff00db, /* mdcfg2 */
91 0x00001680, /* mdmisc */
92 0x0f3c8000, /* mdref */
93 0x00002000, /* mdrwd */
94 0x00bf1023, /* mdor */
95 0x0000003f, /* mdasp */
96 0x0000022a, /* mpodtctrl */
97 0xa1390003, /* mpzqhwctrl */
100 #ifdef CONFIG_TARGET_LS1012AFRWY
101 board_rev = get_board_version();
103 if (board_rev & BOARD_REV_B) {
104 mparam.mdctl = 0x05180000;
105 gd->ram_size = SYS_SDRAM_SIZE_1024;
107 gd->ram_size = SYS_SDRAM_SIZE_512;
110 gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
114 #if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
115 /* This will break-before-make MMU for DDR */
116 update_early_mmu_table();
122 int board_early_init_f(void)
124 fsl_lsch2_early_init_f();
131 struct ccsr_cci400 *cci = (struct ccsr_cci400 *)(CONFIG_SYS_IMMR +
132 CONFIG_SYS_CCI400_OFFSET);
135 * Set CCI-400 control override register to enable barrier
138 out_le32(&cci->ctrl_ord, CCI400_CTRLORD_EN_BARRIER);
140 #ifdef CONFIG_ENV_IS_NOWHERE
141 gd->env_addr = (ulong)&default_environment[0];
144 #ifdef CONFIG_FSL_CAAM
148 #ifdef CONFIG_FSL_LS_PPA
154 int ft_board_setup(void *blob, bd_t *bd)
156 arch_fixup_fdt(blob);
158 ft_cpu_setup(blob, bd);