Migrate CUSTOM_SYS_INIT_SP_ADDR to Kconfig using system-constants.h
[platform/kernel/u-boot.git] / include / configs / ls1043a_common.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2015 Freescale Semiconductor
4  * Copyright 2019-2021 NXP
5  */
6
7 #ifndef __LS1043A_COMMON_H
8 #define __LS1043A_COMMON_H
9
10 /* SPL build */
11 #ifdef CONFIG_SPL_BUILD
12 #define SPL_NO_FMAN
13 #define SPL_NO_DSPI
14 #define SPL_NO_PCIE
15 #define SPL_NO_ENV
16 #define SPL_NO_MISC
17 #define SPL_NO_USB
18 #define SPL_NO_SATA
19 #define SPL_NO_QE
20 #define SPL_NO_EEPROM
21 #endif
22 #if (defined(CONFIG_SPL_BUILD) && defined(CONFIG_NAND_BOOT))
23 #define SPL_NO_MMC
24 #endif
25 #if (defined(CONFIG_SPL_BUILD) && defined(CONFIG_SD_BOOT_QSPI))
26 #define SPL_NO_IFC
27 #endif
28
29 #include <asm/arch/stream_id_lsch2.h>
30 #include <asm/arch/config.h>
31
32 /* Link Definitions */
33
34 #define CONFIG_VERY_BIG_RAM
35 #define CONFIG_SYS_DDR_SDRAM_BASE       0x80000000
36 #define CONFIG_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
39
40 #define CPU_RELEASE_ADDR               secondary_boot_addr
41
42 /* Serial Port */
43 #define CONFIG_SYS_NS16550_SERIAL
44 #define CONFIG_SYS_NS16550_REG_SIZE     1
45 #define CONFIG_SYS_NS16550_CLK          (get_serial_clock())
46
47 /* SD boot SPL */
48 #ifdef CONFIG_SD_BOOT
49
50 #define CONFIG_SPL_STACK                0x1001e000
51
52 #define CONFIG_SYS_SPL_MALLOC_START     (CONFIG_SPL_BSS_START_ADDR + \
53                                         CONFIG_SPL_BSS_MAX_SIZE)
54 #define CONFIG_SYS_SPL_MALLOC_SIZE      0x100000
55 #define CONFIG_SPL_BSS_START_ADDR       0x8f000000
56
57 #ifdef CONFIG_NXP_ESBC
58 #define CONFIG_U_BOOT_HDR_SIZE                          (16 << 10)
59 /*
60  * HDR would be appended at end of image and copied to DDR along
61  * with U-Boot image. Here u-boot max. size is 512K. So if binary
62  * size increases then increase this size in case of secure boot as
63  * it uses raw u-boot image instead of fit image.
64  */
65 #define CONFIG_SYS_MONITOR_LEN          (0x100000 + CONFIG_U_BOOT_HDR_SIZE)
66 #else
67 #define CONFIG_SYS_MONITOR_LEN          0x100000
68 #endif /* ifdef CONFIG_NXP_ESBC */
69 #endif
70
71 /* NAND SPL */
72 #ifdef CONFIG_NAND_BOOT
73 #define CONFIG_SPL_STACK                0x1001d000
74 #define CONFIG_SYS_NAND_U_BOOT_DST      CONFIG_SYS_TEXT_BASE
75 #define CONFIG_SYS_NAND_U_BOOT_START    CONFIG_SYS_TEXT_BASE
76 #define CONFIG_SYS_SPL_MALLOC_START     0x80200000
77 #define CONFIG_SPL_BSS_START_ADDR       0x80100000
78 #define CONFIG_SYS_SPL_MALLOC_SIZE      0x100000
79
80 #ifdef CONFIG_NXP_ESBC
81 #define CONFIG_U_BOOT_HDR_SIZE                          (16 << 10)
82 #endif /* ifdef CONFIG_NXP_ESBC */
83
84 #ifdef CONFIG_U_BOOT_HDR_SIZE
85 /*
86  * HDR would be appended at end of image and copied to DDR along
87  * with U-Boot image. Here u-boot max. size is 512K. So if binary
88  * size increases then increase this size in case of secure boot as
89  * it uses raw u-boot image instead of fit image.
90  */
91 #define CONFIG_SYS_MONITOR_LEN          (0x100000 + CONFIG_U_BOOT_HDR_SIZE)
92 #else
93 #define CONFIG_SYS_MONITOR_LEN          0x100000
94 #endif /* ifdef CONFIG_U_BOOT_HDR_SIZE */
95
96 #endif
97
98 /* GPIO */
99
100 /* IFC */
101 #ifndef SPL_NO_IFC
102 #if defined(CONFIG_TFABOOT) || \
103         (!defined(CONFIG_QSPI_BOOT) && !defined(CONFIG_SD_BOOT_QSPI))
104 /*
105  * CONFIG_SYS_FLASH_BASE has the final address (core view)
106  * CONFIG_SYS_FLASH_BASE_PHYS has the final address (IFC view)
107  * CONFIG_SYS_FLASH_BASE_PHYS_EARLY has the temporary IFC address
108  * CONFIG_SYS_TEXT_BASE is linked to 0x60000000 for booting
109  */
110 #define CONFIG_SYS_FLASH_BASE                   0x60000000
111 #define CONFIG_SYS_FLASH_BASE_PHYS              CONFIG_SYS_FLASH_BASE
112 #define CONFIG_SYS_FLASH_BASE_PHYS_EARLY        0x00000000
113
114 #ifdef CONFIG_MTD_NOR_FLASH
115 #define CONFIG_SYS_FLASH_QUIET_TEST
116 #define CONFIG_FLASH_SHOW_PROGRESS      45      /* count down from 45/5: 9..1 */
117 #endif
118 #endif
119 #endif
120
121 /* I2C */
122
123 /* PCIe */
124 #ifndef SPL_NO_PCIE
125 #define CONFIG_PCIE1            /* PCIE controller 1 */
126 #define CONFIG_PCIE2            /* PCIE controller 2 */
127 #define CONFIG_PCIE3            /* PCIE controller 3 */
128
129 #ifdef CONFIG_PCI
130 #define CONFIG_PCI_SCAN_SHOW
131 #endif
132 #endif
133
134 /*  DSPI  */
135
136 /* FMan ucode */
137 #ifndef SPL_NO_FMAN
138 #define CONFIG_SYS_DPAA_FMAN
139 #ifdef CONFIG_SYS_DPAA_FMAN
140 #define CONFIG_SYS_FM_MURAM_SIZE        0x60000
141
142 #define CONFIG_SYS_FDT_PAD              (0x3000 + CONFIG_SYS_QE_FMAN_FW_LENGTH)
143 #endif
144 #endif
145
146 /* Miscellaneous configurable options */
147
148 #define CONFIG_HWCONFIG
149 #define HWCONFIG_BUFFER_SIZE            128
150
151 #ifndef SPL_NO_MISC
152 #ifndef CONFIG_SPL_BUILD
153 #define BOOT_TARGET_DEVICES(func) \
154         func(MMC, mmc, 0) \
155         func(USB, usb, 0) \
156         func(DHCP, dhcp, na)
157 #include <config_distro_bootcmd.h>
158 #endif
159
160 /* Initial environment variables */
161 #define CONFIG_EXTRA_ENV_SETTINGS               \
162         "hwconfig=fsl_ddr:bank_intlv=auto\0"    \
163         "fdt_high=0xffffffffffffffff\0"         \
164         "initrd_high=0xffffffffffffffff\0"      \
165         "kernel_addr=0x61000000\0"              \
166         "scriptaddr=0x80000000\0"               \
167         "scripthdraddr=0x80080000\0"            \
168         "fdtheader_addr_r=0x80100000\0"         \
169         "kernelheader_addr_r=0x80200000\0"      \
170         "kernel_addr_r=0x81000000\0"            \
171         "kernel_start=0x1000000\0"              \
172         "kernelheader_start=0x800000\0"         \
173         "fdt_addr_r=0x90000000\0"               \
174         "load_addr=0xa0000000\0"                \
175         "kernelheader_addr=0x60600000\0"        \
176         "kernel_size=0x2800000\0"               \
177         "kernelheader_size=0x40000\0"           \
178         "kernel_addr_sd=0x8000\0"               \
179         "kernel_size_sd=0x14000\0"              \
180         "kernelhdr_addr_sd=0x3000\0"            \
181         "kernelhdr_size_sd=0x10\0"              \
182         "console=ttyS0,115200\0"                \
183         "boot_os=y\0"                           \
184         "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0"        \
185         BOOTENV                                 \
186         "boot_scripts=ls1043ardb_boot.scr\0"    \
187         "boot_script_hdr=hdr_ls1043ardb_bs.out\0"       \
188         "scan_dev_for_boot_part="               \
189                 "part list ${devtype} ${devnum} devplist; "     \
190                 "env exists devplist || setenv devplist 1; "    \
191                 "for distro_bootpart in ${devplist}; do "       \
192                         "if fstype ${devtype} "                 \
193                                 "${devnum}:${distro_bootpart} " \
194                                 "bootfstype; then "             \
195                                 "run scan_dev_for_boot; "       \
196                         "fi; "                                  \
197                 "done\0"                        \
198         "boot_a_script="                                        \
199                 "load ${devtype} ${devnum}:${distro_bootpart} " \
200                         "${scriptaddr} ${prefix}${script}; "    \
201                 "env exists secureboot && load ${devtype} "     \
202                         "${devnum}:${distro_bootpart} "         \
203                         "${scripthdraddr} ${prefix}${boot_script_hdr}; " \
204                         "env exists secureboot "        \
205                         "&& esbc_validate ${scripthdraddr};"    \
206                 "source ${scriptaddr}\0"                        \
207         "qspi_bootcmd=echo Trying load from qspi..;"    \
208                 "sf probe && sf read $load_addr "       \
209                 "$kernel_start $kernel_size; env exists secureboot "    \
210                 "&& sf read $kernelheader_addr_r $kernelheader_start "  \
211                 "$kernelheader_size && esbc_validate ${kernelheader_addr_r}; " \
212                 "bootm $load_addr#$board\0"     \
213         "nor_bootcmd=echo Trying load from nor..;"      \
214                 "cp.b $kernel_addr $load_addr " \
215                 "$kernel_size; env exists secureboot "  \
216                 "&& cp.b $kernelheader_addr $kernelheader_addr_r "      \
217                 "$kernelheader_size && esbc_validate ${kernelheader_addr_r}; " \
218                 "bootm $load_addr#$board\0"         \
219         "nand_bootcmd=echo Trying load from NAND..;"    \
220                 "nand info; nand read $load_addr "      \
221                 "$kernel_start $kernel_size; env exists secureboot "    \
222                 "&& nand read $kernelheader_addr_r $kernelheader_start "        \
223                 "$kernelheader_size && esbc_validate ${kernelheader_addr_r}; " \
224                 "bootm $load_addr#$board\0"     \
225         "sd_bootcmd=echo Trying load from SD ..;"       \
226                 "mmcinfo; mmc read $load_addr "         \
227                 "$kernel_addr_sd $kernel_size_sd && "     \
228                 "env exists secureboot && mmc read $kernelheader_addr_r "               \
229                 "$kernelhdr_addr_sd $kernelhdr_size_sd "                \
230                 " && esbc_validate ${kernelheader_addr_r};"     \
231                 "bootm $load_addr#$board\0"
232
233
234 #ifdef CONFIG_TFABOOT
235 #define QSPI_NOR_BOOTCOMMAND "run distro_bootcmd; run qspi_bootcmd; "   \
236                            "env exists secureboot && esbc_halt;"
237 #define SD_BOOTCOMMAND "run distro_bootcmd; run sd_bootcmd; "  \
238                            "env exists secureboot && esbc_halt;"
239 #define IFC_NOR_BOOTCOMMAND "run distro_bootcmd; run nor_bootcmd; "     \
240                            "env exists secureboot && esbc_halt;"
241 #define IFC_NAND_BOOTCOMMAND "run distro_bootcmd; run nand_bootcmd; "   \
242                            "env exists secureboot && esbc_halt;"
243 #endif
244 #endif
245
246 #define CONFIG_SYS_BOOTM_LEN   (64 << 20)      /* Increase max gunzip size */
247
248 #include <asm/arch/soc.h>
249
250 #endif /* __LS1043A_COMMON_H */