blob: a0803227c88f8acefc7939cf5410aa37e1014e3f [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Lukasz Majewskibe44b182017-01-27 23:16:29 +01002/*
3 * Copyright (C) 2016-2017
4 * Lukasz Majewski, DENX Software Engineering, lukma@denx.de
Lukasz Majewskibe44b182017-01-27 23:16:29 +01005 */
6
7#ifndef __CONFIG_H
8#define __CONFIG_H
9
Lukasz Majewskibe44b182017-01-27 23:16:29 +010010#include "mx6_common.h"
11
12#define CONFIG_SPL_LIBCOMMON_SUPPORT
13#include "imx6_spl.h"
14
Lukasz Majewskibe44b182017-01-27 23:16:29 +010015#define CONFIG_SYS_UBOOT_BASE (CONFIG_SYS_FLASH_BASE + 0x80000)
Lukasz Majewskibe44b182017-01-27 23:16:29 +010016#define CONFIG_SYS_SPL_ARGS_ADDR 0x18000000
17
18/*
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)
22 */
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)
Lukasz Majewski97c07802019-10-15 10:28:46 +020026#define CONFIG_SPL_FS_LOAD_KERNEL_NAME "fitImage"
Lukasz Majewskibe44b182017-01-27 23:16:29 +010027
Lukasz Majewskibe44b182017-01-27 23:16:29 +010028#define CONFIG_MXC_UART_BASE UART1_BASE
29
Lukasz Majewskibe44b182017-01-27 23:16:29 +010030/* MMC Configuration */
31#define CONFIG_SYS_FSL_USDHC_NUM 2
32#define CONFIG_SYS_FSL_ESDHC_ADDR 0
33
Lukasz Majewskibe44b182017-01-27 23:16:29 +010034/* NOR 16-bit mode */
35#define CONFIG_SYS_FLASH_BASE WEIM_ARB_BASE_ADDR
Lukasz Majewskibe44b182017-01-27 23:16:29 +010036#define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT
Lukasz Majewskibe44b182017-01-27 23:16:29 +010037#define CONFIG_SYS_FLASH_EMPTY_INFO
Lukasz Majewskibe44b182017-01-27 23:16:29 +010038#define CONFIG_FLASH_VERIFY
39
40/* NOR Flash MTD */
Lukasz Majewskibe44b182017-01-27 23:16:29 +010041#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) }
44
Lukasz Majewskibe44b182017-01-27 23:16:29 +010045/* Ethernet Configuration */
Lukasz Majewskibe44b182017-01-27 23:16:29 +010046#define IMX_FEC_BASE ENET_BASE_ADDR
Lukasz Majewskibe44b182017-01-27 23:16:29 +010047#define CONFIG_FEC_MXC_PHYADDR 1
Lukasz Majewskibe44b182017-01-27 23:16:29 +010048
Lukasz Majewskibe44b182017-01-27 23:16:29 +010049#define CONFIG_EXTRA_ENV_SETTINGS \
Lukasz Majewskid01bf662017-02-21 22:45:20 +010050 "console=ttymxc0,115200 quiet\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010051 "fdt_high=0xffffffff\0" \
52 "initrd_high=0xffffffff\0" \
53 "boot_os=yes\0" \
Lukasz Majewski97c07802019-10-15 10:28:46 +020054 "kernelsize=0x300000\0" \
Lukasz Majewski5da443f2019-05-16 09:41:44 +020055 "disable_giga=yes\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010056 "download_kernel=" \
Lukasz Majewski97c07802019-10-15 10:28:46 +020057 "tftpboot ${loadaddr} ${kernel_file};\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010058 "get_boot_medium=" \
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;" \
64 "fi\0" \
Lukasz Majewski97c07802019-10-15 10:28:46 +020065 "kernel_file=fitImage\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010066 "boot_sd=" \
67 "echo '#######################';" \
68 "echo '# Factory SDcard Boot #';" \
69 "echo '#######################';" \
70 "setenv mmcdev 1;" \
71 "setenv mmcfactorydev 0;" \
72 "setenv mmcfactorypart 1;" \
73 "run factory_flash_img;\0" \
74 "boot_nor=" \
75 "setenv kernelnor 0x08180000;" \
Lukasz Majewskid01bf662017-02-21 22:45:20 +010076 "setenv bootargs console=${console} " \
Tom Rini5ad8e112017-10-22 17:55:07 -040077 CONFIG_MTDPARTS_DEFAULT " " \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010078 "root=/dev/mmcblk1 rootfstype=ext4 rw rootwait noinitrd;" \
Lukasz Majewski97c07802019-10-15 10:28:46 +020079 "cp.l ${kernelnor} ${loadaddr} ${kernelsize};" \
80 "bootm ${loadaddr};reset;\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010081 "boot_recovery=" \
82 "echo '#######################';" \
83 "echo '# RECOVERY SWU Boot #';" \
84 "echo '#######################';" \
85 "setenv rootfsloadaddr 0x13000000;" \
86 "setenv swukernelnor 0x08980000;" \
87 "setenv swurootfsnor 0x09180000;" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010088 "setenv bootargs console=${console} " \
Tom Rini5ad8e112017-10-22 17:55:07 -040089 CONFIG_MTDPARTS_DEFAULT " " \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010090 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
91 ":${hostname}::off root=/dev/ram rw;" \
92 "cp.l ${swurootfsnor} ${rootfsloadaddr} 0x200000;" \
Lukasz Majewski97c07802019-10-15 10:28:46 +020093 "cp.l ${swukernelnor} ${loadaddr} ${kernelsize};" \
94 "bootm ${loadaddr} ${rootfsloadaddr};reset;\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010095 "boot_tftp=" \
96 "echo '#######################';" \
97 "echo '# TFTP Boot #';" \
98 "echo '#######################';" \
99 "if run download_kernel; then " \
100 "setenv bootargs console=${console} " \
101 "root=/dev/mmcblk0p2 rootwait;" \
Lukasz Majewski97c07802019-10-15 10:28:46 +0200102 "bootm $loadaddr};reset;" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100103 "fi\0" \
104 "bootcmd=" \
105 "if test -n ${recovery_status}; then " \
106 "run boot_recovery;" \
107 "else " \
108 "if test ! -n ${boot_medium}; then " \
109 "run get_boot_medium;" \
110 "if test ${boot_medium} = sdcard; then " \
111 "run boot_sd;" \
112 "else " \
113 "run boot_nor;" \
114 "fi;" \
115 "else " \
116 "if test ${boot_medium} = tftp; then " \
117 "run boot_tftp;" \
118 "fi;" \
119 "fi;" \
120 "fi\0" \
Tom Rini5ad8e112017-10-22 17:55:07 -0400121 "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100122 "bootdev=1\0" \
123 "bootpart=1\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100124 "netdev=eth0\0" \
125 "load_addr=0x11000000\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100126 "uboot_file=u-boot.img\0" \
127 "SPL_file=SPL\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};" \
140 "fi\0" \
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;" \
147 "else " \
148 "echo No factory script: ${factory_script_file} found on " \
149 "device ${mmcdev};" \
150 "run factory_nor_img;" \
151 "run factory_eMMC_img;" \
Lukasz Majewski97c07802019-10-15 10:28:46 +0200152 "run factory_SPL_falcon_setup;" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100153 "fi\0" \
154 "factory_eMMC_img="\
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};" \
162 "fi\0" \
163 "factory_nor_img="\
164 "echo 'Update mccmon6 NOR image'; " \
165 "if load mmc ${mmcdev}:${mmcfactorypart} " \
166 "${nor_img_addr} ${nor_img_file}; then " \
167 "run nor_update;" \
168 "fi\0" \
169 "nor_update=" \
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" \
Lukasz Majewski97c07802019-10-15 10:28:46 +0200174 "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)";" \
183 "run nor_update\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100184 "tftp_nor_uboot="\
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 " \
190 "run nor_update;" \
191 "fi\0" \
Lukasz Majewski97c07802019-10-15 10:28:46 +0200192 "tftp_nor_fitImg="\
193 "echo 'Update mccmon6 NOR fitImage via TFTP'; " \
194 "setenv nor_img_file fitImage; " \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100195 "setenv nor_img_size 0x500000; " \
196 "setenv nor_bank_start 0x08180000; " \
197 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
198 "run nor_update;" \
199 "fi\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100200 "tftp_nor_img="\
201 "echo 'Update mccmon6 NOR image via TFTP'; " \
202 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
203 "run nor_update;" \
204 "fi\0" \
205 "tftp_nor_SPL="\
206 "if tftp ${load_addr} SPL_padded; then " \
207 "erase 0x08000000 +0x20000;" \
208 "cp.b ${load_addr} 0x08000000 0x20000;" \
209 "fi;\0" \
210 "tftp_sd_SPL="\
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};" \
216 "fi;" \
217 "fi;\0" \
218 "tftp_sd_uboot="\
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};" \
224 "fi;" \
225 "fi;\0"
226
227/* Physical Memory Map */
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100228#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
229
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
233
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)
238
239/* Environment organization */
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100240
241/* Envs are stored in NOR flash */
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100242
243#endif /* __CONFIG_H * */