blob: dcce52eb7d37bc86748b93db6dcbc6a831d8145e [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
Lukasz Majewskibe44b182017-01-27 23:16:29 +010012#include "imx6_spl.h"
13
Lukasz Majewskibe44b182017-01-27 23:16:29 +010014#define CONFIG_SYS_UBOOT_BASE (CONFIG_SYS_FLASH_BASE + 0x80000)
Lukasz Majewskibe44b182017-01-27 23:16:29 +010015#define CONFIG_SYS_SPL_ARGS_ADDR 0x18000000
16
17/*
18 * Below defines are set but NOT really used since we by
19 * design force U-Boot run when we boot in development
20 * mode from SD card (SD2)
21 */
22#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR (0x800)
23#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (0x80)
Lukasz Majewski97c07802019-10-15 10:28:46 +020024#define CONFIG_SPL_FS_LOAD_KERNEL_NAME "fitImage"
Lukasz Majewskibe44b182017-01-27 23:16:29 +010025
Lukasz Majewskibe44b182017-01-27 23:16:29 +010026#define CONFIG_MXC_UART_BASE UART1_BASE
27
Lukasz Majewskibe44b182017-01-27 23:16:29 +010028/* MMC Configuration */
29#define CONFIG_SYS_FSL_USDHC_NUM 2
30#define CONFIG_SYS_FSL_ESDHC_ADDR 0
31
Lukasz Majewskibe44b182017-01-27 23:16:29 +010032/* NOR 16-bit mode */
33#define CONFIG_SYS_FLASH_BASE WEIM_ARB_BASE_ADDR
Lukasz Majewskibe44b182017-01-27 23:16:29 +010034#define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT
Lukasz Majewskibe44b182017-01-27 23:16:29 +010035#define CONFIG_SYS_FLASH_EMPTY_INFO
Lukasz Majewskibe44b182017-01-27 23:16:29 +010036#define CONFIG_FLASH_VERIFY
37
38/* NOR Flash MTD */
Lukasz Majewskibe44b182017-01-27 23:16:29 +010039#define CONFIG_SYS_FLASH_BANKS_LIST { (CONFIG_SYS_FLASH_BASE) }
40#define CONFIG_SYS_FLASH_BANKS_SIZES { (32 * SZ_1M) }
41
Lukasz Majewskibe44b182017-01-27 23:16:29 +010042/* Ethernet Configuration */
Lukasz Majewskibe44b182017-01-27 23:16:29 +010043#define CONFIG_FEC_MXC_PHYADDR 1
Lukasz Majewskibe44b182017-01-27 23:16:29 +010044
Lukasz Majewskibe44b182017-01-27 23:16:29 +010045#define CONFIG_EXTRA_ENV_SETTINGS \
Lukasz Majewskid01bf662017-02-21 22:45:20 +010046 "console=ttymxc0,115200 quiet\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010047 "fdt_high=0xffffffff\0" \
48 "initrd_high=0xffffffff\0" \
49 "boot_os=yes\0" \
Lukasz Majewski97c07802019-10-15 10:28:46 +020050 "kernelsize=0x300000\0" \
Lukasz Majewski5da443f2019-05-16 09:41:44 +020051 "disable_giga=yes\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010052 "download_kernel=" \
Lukasz Majewski97c07802019-10-15 10:28:46 +020053 "tftpboot ${loadaddr} ${kernel_file};\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010054 "get_boot_medium=" \
55 "setenv boot_medium nor;" \
56 "setexpr.l _src_sbmr1 *0x020d8004;" \
57 "setexpr _b_medium ${_src_sbmr1} '&' 0x00000040;" \
58 "if test ${_b_medium} = 40; then " \
59 "setenv boot_medium sdcard;" \
60 "fi\0" \
Lukasz Majewski97c07802019-10-15 10:28:46 +020061 "kernel_file=fitImage\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010062 "boot_sd=" \
63 "echo '#######################';" \
64 "echo '# Factory SDcard Boot #';" \
65 "echo '#######################';" \
66 "setenv mmcdev 1;" \
67 "setenv mmcfactorydev 0;" \
68 "setenv mmcfactorypart 1;" \
69 "run factory_flash_img;\0" \
70 "boot_nor=" \
71 "setenv kernelnor 0x08180000;" \
Lukasz Majewskid01bf662017-02-21 22:45:20 +010072 "setenv bootargs console=${console} " \
Tom Rini5ad8e112017-10-22 17:55:07 -040073 CONFIG_MTDPARTS_DEFAULT " " \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010074 "root=/dev/mmcblk1 rootfstype=ext4 rw rootwait noinitrd;" \
Lukasz Majewski97c07802019-10-15 10:28:46 +020075 "cp.l ${kernelnor} ${loadaddr} ${kernelsize};" \
76 "bootm ${loadaddr};reset;\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010077 "boot_recovery=" \
78 "echo '#######################';" \
79 "echo '# RECOVERY SWU Boot #';" \
80 "echo '#######################';" \
81 "setenv rootfsloadaddr 0x13000000;" \
82 "setenv swukernelnor 0x08980000;" \
83 "setenv swurootfsnor 0x09180000;" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010084 "setenv bootargs console=${console} " \
Tom Rini5ad8e112017-10-22 17:55:07 -040085 CONFIG_MTDPARTS_DEFAULT " " \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010086 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
87 ":${hostname}::off root=/dev/ram rw;" \
88 "cp.l ${swurootfsnor} ${rootfsloadaddr} 0x200000;" \
Lukasz Majewski97c07802019-10-15 10:28:46 +020089 "cp.l ${swukernelnor} ${loadaddr} ${kernelsize};" \
90 "bootm ${loadaddr} ${rootfsloadaddr};reset;\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010091 "boot_tftp=" \
92 "echo '#######################';" \
93 "echo '# TFTP Boot #';" \
94 "echo '#######################';" \
95 "if run download_kernel; then " \
96 "setenv bootargs console=${console} " \
97 "root=/dev/mmcblk0p2 rootwait;" \
Lukasz Majewski97c07802019-10-15 10:28:46 +020098 "bootm $loadaddr};reset;" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010099 "fi\0" \
100 "bootcmd=" \
101 "if test -n ${recovery_status}; then " \
102 "run boot_recovery;" \
103 "else " \
104 "if test ! -n ${boot_medium}; then " \
105 "run get_boot_medium;" \
106 "if test ${boot_medium} = sdcard; then " \
107 "run boot_sd;" \
108 "else " \
109 "run boot_nor;" \
110 "fi;" \
111 "else " \
112 "if test ${boot_medium} = tftp; then " \
113 "run boot_tftp;" \
114 "fi;" \
115 "fi;" \
116 "fi\0" \
Tom Rini5ad8e112017-10-22 17:55:07 -0400117 "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100118 "bootdev=1\0" \
119 "bootpart=1\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100120 "netdev=eth0\0" \
121 "load_addr=0x11000000\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100122 "uboot_file=u-boot.img\0" \
123 "SPL_file=SPL\0" \
124 "load_uboot=tftp ${load_addr} ${uboot_file}\0" \
125 "nor_img_addr=0x11000000\0" \
126 "nor_img_file=core-image-lwn-mccmon6.nor\0" \
127 "emmc_img_file=core-image-lwn-mccmon6.ext4\0" \
128 "nor_bank_start=" __stringify(CONFIG_SYS_FLASH_BASE) "\0" \
129 "nor_img_size=0x02000000\0" \
130 "factory_script_file=factory.scr\0" \
131 "factory_load_script=" \
132 "if test -e mmc ${mmcdev}:${mmcfactorypart} " \
133 "${factory_script_file}; then " \
134 "load mmc ${mmcdev}:${mmcfactorypart} " \
135 "${loadaddr} ${factory_script_file};" \
136 "fi\0" \
137 "factory_script=echo Running factory script from mmc${mmcdev} ...; " \
138 "source ${loadaddr}\0" \
139 "factory_flash_img="\
140 "echo 'Flash mccmon6 with factory images'; " \
141 "if run factory_load_script; then " \
142 "run factory_script;" \
143 "else " \
144 "echo No factory script: ${factory_script_file} found on " \
145 "device ${mmcdev};" \
146 "run factory_nor_img;" \
147 "run factory_eMMC_img;" \
Lukasz Majewski97c07802019-10-15 10:28:46 +0200148 "run factory_SPL_falcon_setup;" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100149 "fi\0" \
150 "factory_eMMC_img="\
151 "echo 'Update mccmon6 eMMC image'; " \
152 "if load mmc ${mmcdev}:${mmcfactorypart} " \
153 "${loadaddr} ${emmc_img_file}; then " \
154 "setexpr fw_sz ${filesize} / 0x200;" \
155 "setexpr fw_sz ${fw_sz} + 1;" \
156 "mmc dev ${mmcfactorydev};" \
157 "mmc write ${loadaddr} 0x0 ${fw_sz};" \
158 "fi\0" \
159 "factory_nor_img="\
160 "echo 'Update mccmon6 NOR image'; " \
161 "if load mmc ${mmcdev}:${mmcfactorypart} " \
162 "${nor_img_addr} ${nor_img_file}; then " \
163 "run nor_update;" \
164 "fi\0" \
165 "nor_update=" \
166 "protect off ${nor_bank_start} +${nor_img_size};" \
167 "erase ${nor_bank_start} +${nor_img_size};" \
168 "setexpr nor_img_size ${nor_img_size} / 4; " \
169 "cp.l ${nor_img_addr} ${nor_bank_start} ${nor_img_size}\0" \
Lukasz Majewski97c07802019-10-15 10:28:46 +0200170 "factory_SPL_falcon_setup="\
171 "echo 'Write Falcon boot data'; " \
172 "setenv kernelnor 0x08180000;" \
173 "cp.l ${kernelnor} ${loadaddr} ${kernelsize};" \
174 "spl export fdt ${loadaddr};" \
175 "setenv nor_img_addr ${fdtargsaddr};" \
176 "setenv nor_img_size 0x20000;" \
177 "setenv nor_bank_start " \
178 __stringify(CONFIG_CMD_SPL_NOR_OFS)";" \
179 "run nor_update\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100180 "tftp_nor_uboot="\
181 "echo 'Update mccmon6 NOR U-BOOT via TFTP'; " \
182 "setenv nor_img_file u-boot.img; " \
183 "setenv nor_img_size 0x80000; " \
184 "setenv nor_bank_start 0x08080000; " \
185 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
186 "run nor_update;" \
187 "fi\0" \
Lukasz Majewski97c07802019-10-15 10:28:46 +0200188 "tftp_nor_fitImg="\
189 "echo 'Update mccmon6 NOR fitImage via TFTP'; " \
190 "setenv nor_img_file fitImage; " \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100191 "setenv nor_img_size 0x500000; " \
192 "setenv nor_bank_start 0x08180000; " \
193 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
194 "run nor_update;" \
195 "fi\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100196 "tftp_nor_img="\
197 "echo 'Update mccmon6 NOR image via TFTP'; " \
198 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
199 "run nor_update;" \
200 "fi\0" \
201 "tftp_nor_SPL="\
202 "if tftp ${load_addr} SPL_padded; then " \
203 "erase 0x08000000 +0x20000;" \
204 "cp.b ${load_addr} 0x08000000 0x20000;" \
205 "fi;\0" \
206 "tftp_sd_SPL="\
207 "if mmc dev 1; then " \
208 "if tftp ${load_addr} ${SPL_file}; then " \
209 "setexpr fw_sz ${filesize} / 0x200; " \
210 "setexpr fw_sz ${fw_sz} + 1; " \
211 "mmc write ${load_addr} 0x2 ${fw_sz};" \
212 "fi;" \
213 "fi;\0" \
214 "tftp_sd_uboot="\
215 "if mmc dev 1; then " \
216 "if run load_uboot; then " \
217 "setexpr fw_sz ${filesize} / 0x200; " \
218 "setexpr fw_sz ${fw_sz} + 1; " \
219 "mmc write ${load_addr} 0x8A ${fw_sz};" \
220 "fi;" \
221 "fi;\0"
222
223/* Physical Memory Map */
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100224#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
225
226#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
227#define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
228#define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
229
230#define CONFIG_SYS_INIT_SP_OFFSET \
231 (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
232#define CONFIG_SYS_INIT_SP_ADDR \
233 (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
234
235/* Environment organization */
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100236
237/* Envs are stored in NOR flash */
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100238
239#endif /* __CONFIG_H * */