1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright 2016 Freescale Semiconductor
4 * Copyright 2019-2021 NXP
7 #ifndef __LS1046A_COMMON_H
8 #define __LS1046A_COMMON_H
11 #ifdef CONFIG_SPL_BUILD
20 #if defined(CONFIG_SPL_BUILD) && \
21 (defined(CONFIG_NAND_BOOT) || defined(CONFIG_QSPI_BOOT))
24 #if defined(CONFIG_SPL_BUILD) && \
25 !defined(CONFIG_SPL_FSL_LS_PPA)
29 #include <asm/arch/config.h>
30 #include <asm/arch/stream_id_lsch2.h>
32 /* Link Definitions */
34 #define CONFIG_VERY_BIG_RAM
35 #define CONFIG_SYS_DDR_SDRAM_BASE 0x80000000
36 #define CFG_SYS_FSL_DDR_SDRAM_BASE_PHY 0
37 #define CONFIG_SYS_SDRAM_BASE CONFIG_SYS_DDR_SDRAM_BASE
38 #define CONFIG_SYS_DDR_BLOCK2_BASE 0x880000000ULL
40 #define CPU_RELEASE_ADDR secondary_boot_addr
43 #define CFG_SYS_NS16550_CLK (get_serial_clock())
47 #ifdef CONFIG_NXP_ESBC
48 #define CONFIG_U_BOOT_HDR_SIZE (16 << 10)
50 * HDR would be appended at end of image and copied to DDR along
51 * with U-Boot image. Here u-boot max. size is 512K. So if binary
52 * size increases then increase this size in case of secure boot as
53 * it uses raw u-boot image instead of fit image.
55 #endif /* ifdef CONFIG_NXP_ESBC */
59 #ifdef CONFIG_NAND_BOOT
60 #define CFG_SYS_NAND_U_BOOT_DST CONFIG_TEXT_BASE
61 #define CFG_SYS_NAND_U_BOOT_START CONFIG_TEXT_BASE
70 #ifdef CONFIG_SYS_DPAA_FMAN
71 #define CONFIG_SYS_FM_MURAM_SIZE 0x60000
75 /* Miscellaneous configurable options */
77 #define CONFIG_HWCONFIG
78 #define HWCONFIG_BUFFER_SIZE 128
80 #define BOOT_TARGET_DEVICES(func) \
85 #include <config_distro_bootcmd.h>
87 #if defined(CONFIG_TARGET_LS1046AFRWY)
88 #define LS1046A_BOOT_SRC_AND_HDR\
89 "boot_scripts=ls1046afrwy_boot.scr\0" \
90 "boot_script_hdr=hdr_ls1046afrwy_bs.out\0"
91 #elif defined(CONFIG_TARGET_LS1046AQDS)
92 #define LS1046A_BOOT_SRC_AND_HDR\
93 "boot_scripts=ls1046aqds_boot.scr\0" \
94 "boot_script_hdr=hdr_ls1046aqds_bs.out\0"
96 #define LS1046A_BOOT_SRC_AND_HDR\
97 "boot_scripts=ls1046ardb_boot.scr\0" \
98 "boot_script_hdr=hdr_ls1046ardb_bs.out\0"
101 /* Initial environment variables */
102 #define CONFIG_EXTRA_ENV_SETTINGS \
103 "hwconfig=fsl_ddr:bank_intlv=auto\0" \
104 "ramdisk_addr=0x800000\0" \
105 "ramdisk_size=0x2000000\0" \
106 "bootm_size=0x10000000\0" \
107 "kernel_addr=0x61000000\0" \
108 "scriptaddr=0x80000000\0" \
109 "scripthdraddr=0x80080000\0" \
110 "fdtheader_addr_r=0x80100000\0" \
111 "kernelheader_addr_r=0x80200000\0" \
112 "load_addr=0xa0000000\0" \
113 "kernel_addr_r=0x81000000\0" \
114 "fdt_addr_r=0x90000000\0" \
115 "ramdisk_addr_r=0xa0000000\0" \
116 "kernel_start=0x1000000\0" \
117 "kernelheader_start=0x600000\0" \
118 "kernel_load=0xa0000000\0" \
119 "kernel_size=0x2800000\0" \
120 "kernelheader_size=0x40000\0" \
121 "kernel_addr_sd=0x8000\0" \
122 "kernel_size_sd=0x14000\0" \
123 "kernelhdr_addr_sd=0x3000\0" \
124 "kernelhdr_size_sd=0x10\0" \
125 "console=ttyS0,115200\0" \
126 CONFIG_MTDPARTS_DEFAULT "\0" \
128 LS1046A_BOOT_SRC_AND_HDR \
129 "scan_dev_for_boot_part=" \
130 "part list ${devtype} ${devnum} devplist; " \
131 "env exists devplist || setenv devplist 1; " \
132 "for distro_bootpart in ${devplist}; do " \
133 "if fstype ${devtype} " \
134 "${devnum}:${distro_bootpart} " \
135 "bootfstype; then " \
136 "run scan_dev_for_boot; " \
140 "load ${devtype} ${devnum}:${distro_bootpart} " \
141 "${scriptaddr} ${prefix}${script}; " \
142 "env exists secureboot && load ${devtype} " \
143 "${devnum}:${distro_bootpart} " \
144 "${scripthdraddr} ${prefix}${boot_script_hdr}; " \
145 "env exists secureboot " \
146 "&& esbc_validate ${scripthdraddr};" \
147 "source ${scriptaddr}\0" \
148 "qspi_bootcmd=echo Trying load from qspi..;" \
149 "sf probe && sf read $load_addr " \
150 "$kernel_start $kernel_size; env exists secureboot " \
151 "&& sf read $kernelheader_addr_r $kernelheader_start " \
152 "$kernelheader_size && esbc_validate ${kernelheader_addr_r}; " \
153 "bootm $load_addr#$board\0" \
154 "nand_bootcmd=echo Trying load from nand..;" \
155 "nand info; nand read $load_addr " \
156 "$kernel_start $kernel_size; env exists secureboot " \
157 "&& nand read $kernelheader_addr_r $kernelheader_start " \
158 "$kernelheader_size && esbc_validate ${kernelheader_addr_r}; " \
159 "bootm $load_addr#$board\0" \
160 "nor_bootcmd=echo Trying load from nor..;" \
161 "cp.b $kernel_addr $load_addr " \
162 "$kernel_size; env exists secureboot " \
163 "&& cp.b $kernelheader_addr $kernelheader_addr_r " \
164 "$kernelheader_size && esbc_validate ${kernelheader_addr_r}; " \
165 "bootm $load_addr#$board\0" \
166 "sd_bootcmd=echo Trying load from SD ..;" \
167 "mmcinfo; mmc read $load_addr " \
168 "$kernel_addr_sd $kernel_size_sd && " \
169 "env exists secureboot && mmc read $kernelheader_addr_r " \
170 "$kernelhdr_addr_sd $kernelhdr_size_sd " \
171 " && esbc_validate ${kernelheader_addr_r};" \
172 "bootm $load_addr#$board\0"
176 #include <asm/arch/soc.h>
178 #endif /* __LS1046A_COMMON_H */