blob: 2c862e9ddcc253f9b465514b87f0a0e2fc9523f4 [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
16/*
17 * Below defines are set but NOT really used since we by
18 * design force U-Boot run when we boot in development
19 * mode from SD card (SD2)
20 */
Lukasz Majewskibe44b182017-01-27 23:16:29 +010021
Lukasz Majewskibe44b182017-01-27 23:16:29 +010022#define CONFIG_MXC_UART_BASE UART1_BASE
23
Lukasz Majewskibe44b182017-01-27 23:16:29 +010024/* MMC Configuration */
25#define CONFIG_SYS_FSL_USDHC_NUM 2
26#define CONFIG_SYS_FSL_ESDHC_ADDR 0
27
Lukasz Majewskibe44b182017-01-27 23:16:29 +010028/* NOR 16-bit mode */
29#define CONFIG_SYS_FLASH_BASE WEIM_ARB_BASE_ADDR
Lukasz Majewskibe44b182017-01-27 23:16:29 +010030#define CONFIG_SYS_FLASH_EMPTY_INFO
Lukasz Majewskibe44b182017-01-27 23:16:29 +010031#define CONFIG_FLASH_VERIFY
32
33/* NOR Flash MTD */
Lukasz Majewskibe44b182017-01-27 23:16:29 +010034#define CONFIG_SYS_FLASH_BANKS_LIST { (CONFIG_SYS_FLASH_BASE) }
35#define CONFIG_SYS_FLASH_BANKS_SIZES { (32 * SZ_1M) }
36
Lukasz Majewskibe44b182017-01-27 23:16:29 +010037/* Ethernet Configuration */
Lukasz Majewskibe44b182017-01-27 23:16:29 +010038#define CONFIG_FEC_MXC_PHYADDR 1
Lukasz Majewskibe44b182017-01-27 23:16:29 +010039
Lukasz Majewskibe44b182017-01-27 23:16:29 +010040#define CONFIG_EXTRA_ENV_SETTINGS \
Lukasz Majewskid01bf662017-02-21 22:45:20 +010041 "console=ttymxc0,115200 quiet\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010042 "fdt_high=0xffffffff\0" \
43 "initrd_high=0xffffffff\0" \
44 "boot_os=yes\0" \
Lukasz Majewski97c07802019-10-15 10:28:46 +020045 "kernelsize=0x300000\0" \
Lukasz Majewski5da443f2019-05-16 09:41:44 +020046 "disable_giga=yes\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010047 "download_kernel=" \
Lukasz Majewski97c07802019-10-15 10:28:46 +020048 "tftpboot ${loadaddr} ${kernel_file};\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010049 "get_boot_medium=" \
50 "setenv boot_medium nor;" \
51 "setexpr.l _src_sbmr1 *0x020d8004;" \
52 "setexpr _b_medium ${_src_sbmr1} '&' 0x00000040;" \
53 "if test ${_b_medium} = 40; then " \
54 "setenv boot_medium sdcard;" \
55 "fi\0" \
Lukasz Majewski97c07802019-10-15 10:28:46 +020056 "kernel_file=fitImage\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010057 "boot_sd=" \
58 "echo '#######################';" \
59 "echo '# Factory SDcard Boot #';" \
60 "echo '#######################';" \
61 "setenv mmcdev 1;" \
62 "setenv mmcfactorydev 0;" \
63 "setenv mmcfactorypart 1;" \
64 "run factory_flash_img;\0" \
65 "boot_nor=" \
66 "setenv kernelnor 0x08180000;" \
Lukasz Majewskid01bf662017-02-21 22:45:20 +010067 "setenv bootargs console=${console} " \
Tom Rini5ad8e112017-10-22 17:55:07 -040068 CONFIG_MTDPARTS_DEFAULT " " \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010069 "root=/dev/mmcblk1 rootfstype=ext4 rw rootwait noinitrd;" \
Lukasz Majewski97c07802019-10-15 10:28:46 +020070 "cp.l ${kernelnor} ${loadaddr} ${kernelsize};" \
71 "bootm ${loadaddr};reset;\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010072 "boot_recovery=" \
73 "echo '#######################';" \
74 "echo '# RECOVERY SWU Boot #';" \
75 "echo '#######################';" \
76 "setenv rootfsloadaddr 0x13000000;" \
77 "setenv swukernelnor 0x08980000;" \
78 "setenv swurootfsnor 0x09180000;" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010079 "setenv bootargs console=${console} " \
Tom Rini5ad8e112017-10-22 17:55:07 -040080 CONFIG_MTDPARTS_DEFAULT " " \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010081 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
82 ":${hostname}::off root=/dev/ram rw;" \
83 "cp.l ${swurootfsnor} ${rootfsloadaddr} 0x200000;" \
Lukasz Majewski97c07802019-10-15 10:28:46 +020084 "cp.l ${swukernelnor} ${loadaddr} ${kernelsize};" \
85 "bootm ${loadaddr} ${rootfsloadaddr};reset;\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010086 "boot_tftp=" \
87 "echo '#######################';" \
88 "echo '# TFTP Boot #';" \
89 "echo '#######################';" \
90 "if run download_kernel; then " \
91 "setenv bootargs console=${console} " \
92 "root=/dev/mmcblk0p2 rootwait;" \
Lukasz Majewski97c07802019-10-15 10:28:46 +020093 "bootm $loadaddr};reset;" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010094 "fi\0" \
95 "bootcmd=" \
96 "if test -n ${recovery_status}; then " \
97 "run boot_recovery;" \
98 "else " \
99 "if test ! -n ${boot_medium}; then " \
100 "run get_boot_medium;" \
101 "if test ${boot_medium} = sdcard; then " \
102 "run boot_sd;" \
103 "else " \
104 "run boot_nor;" \
105 "fi;" \
106 "else " \
107 "if test ${boot_medium} = tftp; then " \
108 "run boot_tftp;" \
109 "fi;" \
110 "fi;" \
111 "fi\0" \
Tom Rini5ad8e112017-10-22 17:55:07 -0400112 "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100113 "bootdev=1\0" \
114 "bootpart=1\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100115 "netdev=eth0\0" \
116 "load_addr=0x11000000\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100117 "uboot_file=u-boot.img\0" \
118 "SPL_file=SPL\0" \
119 "load_uboot=tftp ${load_addr} ${uboot_file}\0" \
120 "nor_img_addr=0x11000000\0" \
121 "nor_img_file=core-image-lwn-mccmon6.nor\0" \
122 "emmc_img_file=core-image-lwn-mccmon6.ext4\0" \
123 "nor_bank_start=" __stringify(CONFIG_SYS_FLASH_BASE) "\0" \
124 "nor_img_size=0x02000000\0" \
125 "factory_script_file=factory.scr\0" \
126 "factory_load_script=" \
127 "if test -e mmc ${mmcdev}:${mmcfactorypart} " \
128 "${factory_script_file}; then " \
129 "load mmc ${mmcdev}:${mmcfactorypart} " \
130 "${loadaddr} ${factory_script_file};" \
131 "fi\0" \
132 "factory_script=echo Running factory script from mmc${mmcdev} ...; " \
133 "source ${loadaddr}\0" \
134 "factory_flash_img="\
135 "echo 'Flash mccmon6 with factory images'; " \
136 "if run factory_load_script; then " \
137 "run factory_script;" \
138 "else " \
139 "echo No factory script: ${factory_script_file} found on " \
140 "device ${mmcdev};" \
141 "run factory_nor_img;" \
142 "run factory_eMMC_img;" \
Lukasz Majewski97c07802019-10-15 10:28:46 +0200143 "run factory_SPL_falcon_setup;" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100144 "fi\0" \
145 "factory_eMMC_img="\
146 "echo 'Update mccmon6 eMMC image'; " \
147 "if load mmc ${mmcdev}:${mmcfactorypart} " \
148 "${loadaddr} ${emmc_img_file}; then " \
149 "setexpr fw_sz ${filesize} / 0x200;" \
150 "setexpr fw_sz ${fw_sz} + 1;" \
151 "mmc dev ${mmcfactorydev};" \
152 "mmc write ${loadaddr} 0x0 ${fw_sz};" \
153 "fi\0" \
154 "factory_nor_img="\
155 "echo 'Update mccmon6 NOR image'; " \
156 "if load mmc ${mmcdev}:${mmcfactorypart} " \
157 "${nor_img_addr} ${nor_img_file}; then " \
158 "run nor_update;" \
159 "fi\0" \
160 "nor_update=" \
161 "protect off ${nor_bank_start} +${nor_img_size};" \
162 "erase ${nor_bank_start} +${nor_img_size};" \
163 "setexpr nor_img_size ${nor_img_size} / 4; " \
164 "cp.l ${nor_img_addr} ${nor_bank_start} ${nor_img_size}\0" \
Lukasz Majewski97c07802019-10-15 10:28:46 +0200165 "factory_SPL_falcon_setup="\
166 "echo 'Write Falcon boot data'; " \
167 "setenv kernelnor 0x08180000;" \
168 "cp.l ${kernelnor} ${loadaddr} ${kernelsize};" \
169 "spl export fdt ${loadaddr};" \
170 "setenv nor_img_addr ${fdtargsaddr};" \
171 "setenv nor_img_size 0x20000;" \
172 "setenv nor_bank_start " \
173 __stringify(CONFIG_CMD_SPL_NOR_OFS)";" \
174 "run nor_update\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100175 "tftp_nor_uboot="\
176 "echo 'Update mccmon6 NOR U-BOOT via TFTP'; " \
177 "setenv nor_img_file u-boot.img; " \
178 "setenv nor_img_size 0x80000; " \
179 "setenv nor_bank_start 0x08080000; " \
180 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
181 "run nor_update;" \
182 "fi\0" \
Lukasz Majewski97c07802019-10-15 10:28:46 +0200183 "tftp_nor_fitImg="\
184 "echo 'Update mccmon6 NOR fitImage via TFTP'; " \
185 "setenv nor_img_file fitImage; " \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100186 "setenv nor_img_size 0x500000; " \
187 "setenv nor_bank_start 0x08180000; " \
188 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
189 "run nor_update;" \
190 "fi\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100191 "tftp_nor_img="\
192 "echo 'Update mccmon6 NOR image via TFTP'; " \
193 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
194 "run nor_update;" \
195 "fi\0" \
196 "tftp_nor_SPL="\
197 "if tftp ${load_addr} SPL_padded; then " \
198 "erase 0x08000000 +0x20000;" \
199 "cp.b ${load_addr} 0x08000000 0x20000;" \
200 "fi;\0" \
201 "tftp_sd_SPL="\
202 "if mmc dev 1; then " \
203 "if tftp ${load_addr} ${SPL_file}; then " \
204 "setexpr fw_sz ${filesize} / 0x200; " \
205 "setexpr fw_sz ${fw_sz} + 1; " \
206 "mmc write ${load_addr} 0x2 ${fw_sz};" \
207 "fi;" \
208 "fi;\0" \
209 "tftp_sd_uboot="\
210 "if mmc dev 1; then " \
211 "if run load_uboot; then " \
212 "setexpr fw_sz ${filesize} / 0x200; " \
213 "setexpr fw_sz ${fw_sz} + 1; " \
214 "mmc write ${load_addr} 0x8A ${fw_sz};" \
215 "fi;" \
216 "fi;\0"
217
218/* Physical Memory Map */
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100219#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
220
221#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
222#define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
223#define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
224
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100225/* Environment organization */
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100226
227/* Envs are stored in NOR flash */
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100228
229#endif /* __CONFIG_H * */