1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (C) 2016-2017
4 * Lukasz Majewski, DENX Software Engineering, lukma@denx.de
10 #include "mx6_common.h"
12 #define CONFIG_SPL_LIBCOMMON_SUPPORT
15 #define CONFIG_SYS_UBOOT_BASE (CONFIG_SYS_FLASH_BASE + 0x80000)
16 #define CONFIG_SYS_SPL_ARGS_ADDR 0x18000000
19 * Below defines are set but NOT really used since we by
20 * design force U-Boot run when we boot in development
21 * mode from SD card (SD2)
23 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR (0x800)
24 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (0x80)
25 #define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR (0x1000)
26 #define CONFIG_SPL_FS_LOAD_KERNEL_NAME "fitImage"
28 #define CONFIG_MXC_UART_BASE UART1_BASE
30 /* MMC Configuration */
31 #define CONFIG_SYS_FSL_USDHC_NUM 2
32 #define CONFIG_SYS_FSL_ESDHC_ADDR 0
35 #define CONFIG_SYS_FLASH_BASE WEIM_ARB_BASE_ADDR
36 #define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT
37 #define CONFIG_SYS_FLASH_EMPTY_INFO
38 #define CONFIG_FLASH_VERIFY
41 #define CONFIG_SYS_MAX_FLASH_BANKS_DETECT 1
42 #define CONFIG_SYS_FLASH_BANKS_LIST { (CONFIG_SYS_FLASH_BASE) }
43 #define CONFIG_SYS_FLASH_BANKS_SIZES { (32 * SZ_1M) }
45 /* Ethernet Configuration */
46 #define IMX_FEC_BASE ENET_BASE_ADDR
47 #define CONFIG_FEC_MXC_PHYADDR 1
49 #define CONFIG_EXTRA_ENV_SETTINGS \
50 "console=ttymxc0,115200 quiet\0" \
51 "fdt_high=0xffffffff\0" \
52 "initrd_high=0xffffffff\0" \
54 "kernelsize=0x300000\0" \
55 "disable_giga=yes\0" \
57 "tftpboot ${loadaddr} ${kernel_file};\0" \
59 "setenv boot_medium nor;" \
60 "setexpr.l _src_sbmr1 *0x020d8004;" \
61 "setexpr _b_medium ${_src_sbmr1} '&' 0x00000040;" \
62 "if test ${_b_medium} = 40; then " \
63 "setenv boot_medium sdcard;" \
65 "kernel_file=fitImage\0" \
67 "echo '#######################';" \
68 "echo '# Factory SDcard Boot #';" \
69 "echo '#######################';" \
71 "setenv mmcfactorydev 0;" \
72 "setenv mmcfactorypart 1;" \
73 "run factory_flash_img;\0" \
75 "setenv kernelnor 0x08180000;" \
76 "setenv bootargs console=${console} " \
77 CONFIG_MTDPARTS_DEFAULT " " \
78 "root=/dev/mmcblk1 rootfstype=ext4 rw rootwait noinitrd;" \
79 "cp.l ${kernelnor} ${loadaddr} ${kernelsize};" \
80 "bootm ${loadaddr};reset;\0" \
82 "echo '#######################';" \
83 "echo '# RECOVERY SWU Boot #';" \
84 "echo '#######################';" \
85 "setenv rootfsloadaddr 0x13000000;" \
86 "setenv swukernelnor 0x08980000;" \
87 "setenv swurootfsnor 0x09180000;" \
88 "setenv bootargs console=${console} " \
89 CONFIG_MTDPARTS_DEFAULT " " \
90 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
91 ":${hostname}::off root=/dev/ram rw;" \
92 "cp.l ${swurootfsnor} ${rootfsloadaddr} 0x200000;" \
93 "cp.l ${swukernelnor} ${loadaddr} ${kernelsize};" \
94 "bootm ${loadaddr} ${rootfsloadaddr};reset;\0" \
96 "echo '#######################';" \
97 "echo '# TFTP Boot #';" \
98 "echo '#######################';" \
99 "if run download_kernel; then " \
100 "setenv bootargs console=${console} " \
101 "root=/dev/mmcblk0p2 rootwait;" \
102 "bootm $loadaddr};reset;" \
105 "if test -n ${recovery_status}; then " \
106 "run boot_recovery;" \
108 "if test ! -n ${boot_medium}; then " \
109 "run get_boot_medium;" \
110 "if test ${boot_medium} = sdcard; then " \
116 "if test ${boot_medium} = tftp; then " \
121 "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
125 "load_addr=0x11000000\0" \
126 "uboot_file=u-boot.img\0" \
128 "load_uboot=tftp ${load_addr} ${uboot_file}\0" \
129 "nor_img_addr=0x11000000\0" \
130 "nor_img_file=core-image-lwn-mccmon6.nor\0" \
131 "emmc_img_file=core-image-lwn-mccmon6.ext4\0" \
132 "nor_bank_start=" __stringify(CONFIG_SYS_FLASH_BASE) "\0" \
133 "nor_img_size=0x02000000\0" \
134 "factory_script_file=factory.scr\0" \
135 "factory_load_script=" \
136 "if test -e mmc ${mmcdev}:${mmcfactorypart} " \
137 "${factory_script_file}; then " \
138 "load mmc ${mmcdev}:${mmcfactorypart} " \
139 "${loadaddr} ${factory_script_file};" \
141 "factory_script=echo Running factory script from mmc${mmcdev} ...; " \
142 "source ${loadaddr}\0" \
143 "factory_flash_img="\
144 "echo 'Flash mccmon6 with factory images'; " \
145 "if run factory_load_script; then " \
146 "run factory_script;" \
148 "echo No factory script: ${factory_script_file} found on " \
149 "device ${mmcdev};" \
150 "run factory_nor_img;" \
151 "run factory_eMMC_img;" \
152 "run factory_SPL_falcon_setup;" \
155 "echo 'Update mccmon6 eMMC image'; " \
156 "if load mmc ${mmcdev}:${mmcfactorypart} " \
157 "${loadaddr} ${emmc_img_file}; then " \
158 "setexpr fw_sz ${filesize} / 0x200;" \
159 "setexpr fw_sz ${fw_sz} + 1;" \
160 "mmc dev ${mmcfactorydev};" \
161 "mmc write ${loadaddr} 0x0 ${fw_sz};" \
164 "echo 'Update mccmon6 NOR image'; " \
165 "if load mmc ${mmcdev}:${mmcfactorypart} " \
166 "${nor_img_addr} ${nor_img_file}; then " \
170 "protect off ${nor_bank_start} +${nor_img_size};" \
171 "erase ${nor_bank_start} +${nor_img_size};" \
172 "setexpr nor_img_size ${nor_img_size} / 4; " \
173 "cp.l ${nor_img_addr} ${nor_bank_start} ${nor_img_size}\0" \
174 "factory_SPL_falcon_setup="\
175 "echo 'Write Falcon boot data'; " \
176 "setenv kernelnor 0x08180000;" \
177 "cp.l ${kernelnor} ${loadaddr} ${kernelsize};" \
178 "spl export fdt ${loadaddr};" \
179 "setenv nor_img_addr ${fdtargsaddr};" \
180 "setenv nor_img_size 0x20000;" \
181 "setenv nor_bank_start " \
182 __stringify(CONFIG_CMD_SPL_NOR_OFS)";" \
185 "echo 'Update mccmon6 NOR U-BOOT via TFTP'; " \
186 "setenv nor_img_file u-boot.img; " \
187 "setenv nor_img_size 0x80000; " \
188 "setenv nor_bank_start 0x08080000; " \
189 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
193 "echo 'Update mccmon6 NOR fitImage via TFTP'; " \
194 "setenv nor_img_file fitImage; " \
195 "setenv nor_img_size 0x500000; " \
196 "setenv nor_bank_start 0x08180000; " \
197 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
201 "echo 'Update mccmon6 NOR image via TFTP'; " \
202 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
206 "if tftp ${load_addr} SPL_padded; then " \
207 "erase 0x08000000 +0x20000;" \
208 "cp.b ${load_addr} 0x08000000 0x20000;" \
211 "if mmc dev 1; then " \
212 "if tftp ${load_addr} ${SPL_file}; then " \
213 "setexpr fw_sz ${filesize} / 0x200; " \
214 "setexpr fw_sz ${fw_sz} + 1; " \
215 "mmc write ${load_addr} 0x2 ${fw_sz};" \
219 "if mmc dev 1; then " \
220 "if run load_uboot; then " \
221 "setexpr fw_sz ${filesize} / 0x200; " \
222 "setexpr fw_sz ${fw_sz} + 1; " \
223 "mmc write ${load_addr} 0x8A ${fw_sz};" \
227 /* Physical Memory Map */
228 #define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
230 #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
231 #define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
232 #define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
234 #define CONFIG_SYS_INIT_SP_OFFSET \
235 (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
236 #define CONFIG_SYS_INIT_SP_ADDR \
237 (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
239 /* Environment organization */
241 /* Envs are stored in NOR flash */
243 #endif /* __CONFIG_H * */