blob: ee942a48fc8817010f41d9f111b435228dde259d [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Lukasz Majewski11bd5e72017-01-27 23:16:29 +01002/*
3 * Copyright (C) 2016-2017
4 * Lukasz Majewski, DENX Software Engineering, lukma@denx.de
Lukasz Majewski11bd5e72017-01-27 23:16:29 +01005 */
6
7#ifndef __CONFIG_H
8#define __CONFIG_H
9
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010010#include "mx6_common.h"
11
12#define CONFIG_SPL_LIBCOMMON_SUPPORT
13#include "imx6_spl.h"
14
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010015#define CONFIG_SYS_UBOOT_BASE (CONFIG_SYS_FLASH_BASE + 0x80000)
Lukasz Majewski11bd5e72017-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 Majewskie4417ed2019-10-15 10:28:46 +020026#define CONFIG_SPL_FS_LOAD_KERNEL_NAME "fitImage"
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010027
28/* Size of malloc() pool */
29#define CONFIG_SYS_MALLOC_LEN (10 * SZ_1M)
30
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010031#define CONFIG_BOARD_LATE_INIT
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010032#define CONFIG_MXC_UART_BASE UART1_BASE
33
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010034/* MMC Configuration */
35#define CONFIG_SYS_FSL_USDHC_NUM 2
36#define CONFIG_SYS_FSL_ESDHC_ADDR 0
37
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010038/* NOR 16-bit mode */
39#define CONFIG_SYS_FLASH_BASE WEIM_ARB_BASE_ADDR
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010040#define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010041#define CONFIG_SYS_FLASH_EMPTY_INFO
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010042#define CONFIG_FLASH_VERIFY
43
44/* NOR Flash MTD */
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010045#define CONFIG_SYS_MAX_FLASH_BANKS_DETECT 1
46#define CONFIG_SYS_FLASH_BANKS_LIST { (CONFIG_SYS_FLASH_BASE) }
47#define CONFIG_SYS_FLASH_BANKS_SIZES { (32 * SZ_1M) }
48
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010049/* Ethernet Configuration */
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010050#define IMX_FEC_BASE ENET_BASE_ADDR
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010051#define CONFIG_FEC_MXC_PHYADDR 1
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010052
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010053#define CONFIG_EXTRA_ENV_SETTINGS \
Lukasz Majewskicb11a282017-02-21 22:45:20 +010054 "console=ttymxc0,115200 quiet\0" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010055 "fdt_high=0xffffffff\0" \
56 "initrd_high=0xffffffff\0" \
57 "boot_os=yes\0" \
Lukasz Majewskie4417ed2019-10-15 10:28:46 +020058 "kernelsize=0x300000\0" \
Lukasz Majewski917964c2019-05-16 09:41:44 +020059 "disable_giga=yes\0" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010060 "download_kernel=" \
Lukasz Majewskie4417ed2019-10-15 10:28:46 +020061 "tftpboot ${loadaddr} ${kernel_file};\0" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010062 "get_boot_medium=" \
63 "setenv boot_medium nor;" \
64 "setexpr.l _src_sbmr1 *0x020d8004;" \
65 "setexpr _b_medium ${_src_sbmr1} '&' 0x00000040;" \
66 "if test ${_b_medium} = 40; then " \
67 "setenv boot_medium sdcard;" \
68 "fi\0" \
Lukasz Majewskie4417ed2019-10-15 10:28:46 +020069 "kernel_file=fitImage\0" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010070 "boot_sd=" \
71 "echo '#######################';" \
72 "echo '# Factory SDcard Boot #';" \
73 "echo '#######################';" \
74 "setenv mmcdev 1;" \
75 "setenv mmcfactorydev 0;" \
76 "setenv mmcfactorypart 1;" \
77 "run factory_flash_img;\0" \
78 "boot_nor=" \
79 "setenv kernelnor 0x08180000;" \
Lukasz Majewskicb11a282017-02-21 22:45:20 +010080 "setenv bootargs console=${console} " \
Tom Rini43ede0b2017-10-22 17:55:07 -040081 CONFIG_MTDPARTS_DEFAULT " " \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010082 "root=/dev/mmcblk1 rootfstype=ext4 rw rootwait noinitrd;" \
Lukasz Majewskie4417ed2019-10-15 10:28:46 +020083 "cp.l ${kernelnor} ${loadaddr} ${kernelsize};" \
84 "bootm ${loadaddr};reset;\0" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010085 "boot_recovery=" \
86 "echo '#######################';" \
87 "echo '# RECOVERY SWU Boot #';" \
88 "echo '#######################';" \
89 "setenv rootfsloadaddr 0x13000000;" \
90 "setenv swukernelnor 0x08980000;" \
91 "setenv swurootfsnor 0x09180000;" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010092 "setenv bootargs console=${console} " \
Tom Rini43ede0b2017-10-22 17:55:07 -040093 CONFIG_MTDPARTS_DEFAULT " " \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010094 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
95 ":${hostname}::off root=/dev/ram rw;" \
96 "cp.l ${swurootfsnor} ${rootfsloadaddr} 0x200000;" \
Lukasz Majewskie4417ed2019-10-15 10:28:46 +020097 "cp.l ${swukernelnor} ${loadaddr} ${kernelsize};" \
98 "bootm ${loadaddr} ${rootfsloadaddr};reset;\0" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010099 "boot_tftp=" \
100 "echo '#######################';" \
101 "echo '# TFTP Boot #';" \
102 "echo '#######################';" \
103 "if run download_kernel; then " \
104 "setenv bootargs console=${console} " \
105 "root=/dev/mmcblk0p2 rootwait;" \
Lukasz Majewskie4417ed2019-10-15 10:28:46 +0200106 "bootm $loadaddr};reset;" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100107 "fi\0" \
108 "bootcmd=" \
109 "if test -n ${recovery_status}; then " \
110 "run boot_recovery;" \
111 "else " \
112 "if test ! -n ${boot_medium}; then " \
113 "run get_boot_medium;" \
114 "if test ${boot_medium} = sdcard; then " \
115 "run boot_sd;" \
116 "else " \
117 "run boot_nor;" \
118 "fi;" \
119 "else " \
120 "if test ${boot_medium} = tftp; then " \
121 "run boot_tftp;" \
122 "fi;" \
123 "fi;" \
124 "fi\0" \
Tom Rini43ede0b2017-10-22 17:55:07 -0400125 "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100126 "bootdev=1\0" \
127 "bootpart=1\0" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100128 "netdev=eth0\0" \
129 "load_addr=0x11000000\0" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100130 "uboot_file=u-boot.img\0" \
131 "SPL_file=SPL\0" \
132 "load_uboot=tftp ${load_addr} ${uboot_file}\0" \
133 "nor_img_addr=0x11000000\0" \
134 "nor_img_file=core-image-lwn-mccmon6.nor\0" \
135 "emmc_img_file=core-image-lwn-mccmon6.ext4\0" \
136 "nor_bank_start=" __stringify(CONFIG_SYS_FLASH_BASE) "\0" \
137 "nor_img_size=0x02000000\0" \
138 "factory_script_file=factory.scr\0" \
139 "factory_load_script=" \
140 "if test -e mmc ${mmcdev}:${mmcfactorypart} " \
141 "${factory_script_file}; then " \
142 "load mmc ${mmcdev}:${mmcfactorypart} " \
143 "${loadaddr} ${factory_script_file};" \
144 "fi\0" \
145 "factory_script=echo Running factory script from mmc${mmcdev} ...; " \
146 "source ${loadaddr}\0" \
147 "factory_flash_img="\
148 "echo 'Flash mccmon6 with factory images'; " \
149 "if run factory_load_script; then " \
150 "run factory_script;" \
151 "else " \
152 "echo No factory script: ${factory_script_file} found on " \
153 "device ${mmcdev};" \
154 "run factory_nor_img;" \
155 "run factory_eMMC_img;" \
Lukasz Majewskie4417ed2019-10-15 10:28:46 +0200156 "run factory_SPL_falcon_setup;" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100157 "fi\0" \
158 "factory_eMMC_img="\
159 "echo 'Update mccmon6 eMMC image'; " \
160 "if load mmc ${mmcdev}:${mmcfactorypart} " \
161 "${loadaddr} ${emmc_img_file}; then " \
162 "setexpr fw_sz ${filesize} / 0x200;" \
163 "setexpr fw_sz ${fw_sz} + 1;" \
164 "mmc dev ${mmcfactorydev};" \
165 "mmc write ${loadaddr} 0x0 ${fw_sz};" \
166 "fi\0" \
167 "factory_nor_img="\
168 "echo 'Update mccmon6 NOR image'; " \
169 "if load mmc ${mmcdev}:${mmcfactorypart} " \
170 "${nor_img_addr} ${nor_img_file}; then " \
171 "run nor_update;" \
172 "fi\0" \
173 "nor_update=" \
174 "protect off ${nor_bank_start} +${nor_img_size};" \
175 "erase ${nor_bank_start} +${nor_img_size};" \
176 "setexpr nor_img_size ${nor_img_size} / 4; " \
177 "cp.l ${nor_img_addr} ${nor_bank_start} ${nor_img_size}\0" \
Lukasz Majewskie4417ed2019-10-15 10:28:46 +0200178 "factory_SPL_falcon_setup="\
179 "echo 'Write Falcon boot data'; " \
180 "setenv kernelnor 0x08180000;" \
181 "cp.l ${kernelnor} ${loadaddr} ${kernelsize};" \
182 "spl export fdt ${loadaddr};" \
183 "setenv nor_img_addr ${fdtargsaddr};" \
184 "setenv nor_img_size 0x20000;" \
185 "setenv nor_bank_start " \
186 __stringify(CONFIG_CMD_SPL_NOR_OFS)";" \
187 "run nor_update\0" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100188 "tftp_nor_uboot="\
189 "echo 'Update mccmon6 NOR U-BOOT via TFTP'; " \
190 "setenv nor_img_file u-boot.img; " \
191 "setenv nor_img_size 0x80000; " \
192 "setenv nor_bank_start 0x08080000; " \
193 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
194 "run nor_update;" \
195 "fi\0" \
Lukasz Majewskie4417ed2019-10-15 10:28:46 +0200196 "tftp_nor_fitImg="\
197 "echo 'Update mccmon6 NOR fitImage via TFTP'; " \
198 "setenv nor_img_file fitImage; " \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100199 "setenv nor_img_size 0x500000; " \
200 "setenv nor_bank_start 0x08180000; " \
201 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
202 "run nor_update;" \
203 "fi\0" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100204 "tftp_nor_img="\
205 "echo 'Update mccmon6 NOR image via TFTP'; " \
206 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
207 "run nor_update;" \
208 "fi\0" \
209 "tftp_nor_SPL="\
210 "if tftp ${load_addr} SPL_padded; then " \
211 "erase 0x08000000 +0x20000;" \
212 "cp.b ${load_addr} 0x08000000 0x20000;" \
213 "fi;\0" \
214 "tftp_sd_SPL="\
215 "if mmc dev 1; then " \
216 "if tftp ${load_addr} ${SPL_file}; then " \
217 "setexpr fw_sz ${filesize} / 0x200; " \
218 "setexpr fw_sz ${fw_sz} + 1; " \
219 "mmc write ${load_addr} 0x2 ${fw_sz};" \
220 "fi;" \
221 "fi;\0" \
222 "tftp_sd_uboot="\
223 "if mmc dev 1; then " \
224 "if run load_uboot; then " \
225 "setexpr fw_sz ${filesize} / 0x200; " \
226 "setexpr fw_sz ${fw_sz} + 1; " \
227 "mmc write ${load_addr} 0x8A ${fw_sz};" \
228 "fi;" \
229 "fi;\0"
230
231/* Physical Memory Map */
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100232#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
233
234#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
235#define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
236#define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
237
238#define CONFIG_SYS_INIT_SP_OFFSET \
239 (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
240#define CONFIG_SYS_INIT_SP_ADDR \
241 (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
242
243/* Environment organization */
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100244
245/* Envs are stored in NOR flash */
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100246
247#endif /* __CONFIG_H * */