blob: 7c401a2cfd6cfe91a47cf839466dd5ed9819e47c [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
Tom Rini6a5dccc2022-11-16 13:10:41 -050012#define CFG_SYS_UBOOT_BASE (CFG_SYS_FLASH_BASE + 0x80000)
Lukasz Majewskibe44b182017-01-27 23:16:29 +010013
14/*
15 * Below defines are set but NOT really used since we by
16 * design force U-Boot run when we boot in development
17 * mode from SD card (SD2)
18 */
Lukasz Majewskibe44b182017-01-27 23:16:29 +010019
Lukasz Majewskibe44b182017-01-27 23:16:29 +010020#define CONFIG_MXC_UART_BASE UART1_BASE
21
Lukasz Majewskibe44b182017-01-27 23:16:29 +010022/* MMC Configuration */
Tom Rini376b88a2022-10-28 20:27:13 -040023#define CFG_SYS_FSL_USDHC_NUM 2
24#define CFG_SYS_FSL_ESDHC_ADDR 0
Lukasz Majewskibe44b182017-01-27 23:16:29 +010025
Lukasz Majewskibe44b182017-01-27 23:16:29 +010026/* NOR 16-bit mode */
Tom Rini6a5dccc2022-11-16 13:10:41 -050027#define CFG_SYS_FLASH_BASE WEIM_ARB_BASE_ADDR
Lukasz Majewskibe44b182017-01-27 23:16:29 +010028#define CONFIG_FLASH_VERIFY
29
30/* NOR Flash MTD */
Tom Rini6a5dccc2022-11-16 13:10:41 -050031#define CFG_SYS_FLASH_BANKS_LIST { (CFG_SYS_FLASH_BASE) }
32#define CFG_SYS_FLASH_BANKS_SIZES { (32 * SZ_1M) }
Lukasz Majewskibe44b182017-01-27 23:16:29 +010033
Lukasz Majewskibe44b182017-01-27 23:16:29 +010034/* Ethernet Configuration */
Lukasz Majewskibe44b182017-01-27 23:16:29 +010035#define CONFIG_FEC_MXC_PHYADDR 1
Lukasz Majewskibe44b182017-01-27 23:16:29 +010036
Lukasz Majewskibe44b182017-01-27 23:16:29 +010037#define CONFIG_EXTRA_ENV_SETTINGS \
Lukasz Majewskid01bf662017-02-21 22:45:20 +010038 "console=ttymxc0,115200 quiet\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010039 "fdt_high=0xffffffff\0" \
40 "initrd_high=0xffffffff\0" \
41 "boot_os=yes\0" \
Lukasz Majewski97c07802019-10-15 10:28:46 +020042 "kernelsize=0x300000\0" \
Lukasz Majewski5da443f2019-05-16 09:41:44 +020043 "disable_giga=yes\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010044 "download_kernel=" \
Lukasz Majewski97c07802019-10-15 10:28:46 +020045 "tftpboot ${loadaddr} ${kernel_file};\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010046 "get_boot_medium=" \
47 "setenv boot_medium nor;" \
48 "setexpr.l _src_sbmr1 *0x020d8004;" \
49 "setexpr _b_medium ${_src_sbmr1} '&' 0x00000040;" \
50 "if test ${_b_medium} = 40; then " \
51 "setenv boot_medium sdcard;" \
52 "fi\0" \
Lukasz Majewski97c07802019-10-15 10:28:46 +020053 "kernel_file=fitImage\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010054 "boot_sd=" \
55 "echo '#######################';" \
56 "echo '# Factory SDcard Boot #';" \
57 "echo '#######################';" \
58 "setenv mmcdev 1;" \
59 "setenv mmcfactorydev 0;" \
60 "setenv mmcfactorypart 1;" \
61 "run factory_flash_img;\0" \
62 "boot_nor=" \
63 "setenv kernelnor 0x08180000;" \
Lukasz Majewskid01bf662017-02-21 22:45:20 +010064 "setenv bootargs console=${console} " \
Tom Rini5ad8e112017-10-22 17:55:07 -040065 CONFIG_MTDPARTS_DEFAULT " " \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010066 "root=/dev/mmcblk1 rootfstype=ext4 rw rootwait noinitrd;" \
Lukasz Majewski97c07802019-10-15 10:28:46 +020067 "cp.l ${kernelnor} ${loadaddr} ${kernelsize};" \
68 "bootm ${loadaddr};reset;\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010069 "boot_recovery=" \
70 "echo '#######################';" \
71 "echo '# RECOVERY SWU Boot #';" \
72 "echo '#######################';" \
73 "setenv rootfsloadaddr 0x13000000;" \
74 "setenv swukernelnor 0x08980000;" \
75 "setenv swurootfsnor 0x09180000;" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010076 "setenv bootargs console=${console} " \
Tom Rini5ad8e112017-10-22 17:55:07 -040077 CONFIG_MTDPARTS_DEFAULT " " \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010078 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
79 ":${hostname}::off root=/dev/ram rw;" \
80 "cp.l ${swurootfsnor} ${rootfsloadaddr} 0x200000;" \
Lukasz Majewski97c07802019-10-15 10:28:46 +020081 "cp.l ${swukernelnor} ${loadaddr} ${kernelsize};" \
82 "bootm ${loadaddr} ${rootfsloadaddr};reset;\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010083 "boot_tftp=" \
84 "echo '#######################';" \
85 "echo '# TFTP Boot #';" \
86 "echo '#######################';" \
87 "if run download_kernel; then " \
88 "setenv bootargs console=${console} " \
89 "root=/dev/mmcblk0p2 rootwait;" \
Lukasz Majewski97c07802019-10-15 10:28:46 +020090 "bootm $loadaddr};reset;" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +010091 "fi\0" \
92 "bootcmd=" \
93 "if test -n ${recovery_status}; then " \
94 "run boot_recovery;" \
95 "else " \
96 "if test ! -n ${boot_medium}; then " \
97 "run get_boot_medium;" \
98 "if test ${boot_medium} = sdcard; then " \
99 "run boot_sd;" \
100 "else " \
101 "run boot_nor;" \
102 "fi;" \
103 "else " \
104 "if test ${boot_medium} = tftp; then " \
105 "run boot_tftp;" \
106 "fi;" \
107 "fi;" \
108 "fi\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100109 "bootdev=1\0" \
110 "bootpart=1\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100111 "netdev=eth0\0" \
112 "load_addr=0x11000000\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100113 "uboot_file=u-boot.img\0" \
114 "SPL_file=SPL\0" \
115 "load_uboot=tftp ${load_addr} ${uboot_file}\0" \
116 "nor_img_addr=0x11000000\0" \
117 "nor_img_file=core-image-lwn-mccmon6.nor\0" \
118 "emmc_img_file=core-image-lwn-mccmon6.ext4\0" \
Tom Rini6a5dccc2022-11-16 13:10:41 -0500119 "nor_bank_start=" __stringify(CFG_SYS_FLASH_BASE) "\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100120 "nor_img_size=0x02000000\0" \
121 "factory_script_file=factory.scr\0" \
122 "factory_load_script=" \
123 "if test -e mmc ${mmcdev}:${mmcfactorypart} " \
124 "${factory_script_file}; then " \
125 "load mmc ${mmcdev}:${mmcfactorypart} " \
126 "${loadaddr} ${factory_script_file};" \
127 "fi\0" \
128 "factory_script=echo Running factory script from mmc${mmcdev} ...; " \
129 "source ${loadaddr}\0" \
130 "factory_flash_img="\
131 "echo 'Flash mccmon6 with factory images'; " \
132 "if run factory_load_script; then " \
133 "run factory_script;" \
134 "else " \
135 "echo No factory script: ${factory_script_file} found on " \
136 "device ${mmcdev};" \
137 "run factory_nor_img;" \
138 "run factory_eMMC_img;" \
Lukasz Majewski97c07802019-10-15 10:28:46 +0200139 "run factory_SPL_falcon_setup;" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100140 "fi\0" \
141 "factory_eMMC_img="\
142 "echo 'Update mccmon6 eMMC image'; " \
143 "if load mmc ${mmcdev}:${mmcfactorypart} " \
144 "${loadaddr} ${emmc_img_file}; then " \
145 "setexpr fw_sz ${filesize} / 0x200;" \
146 "setexpr fw_sz ${fw_sz} + 1;" \
147 "mmc dev ${mmcfactorydev};" \
148 "mmc write ${loadaddr} 0x0 ${fw_sz};" \
149 "fi\0" \
150 "factory_nor_img="\
151 "echo 'Update mccmon6 NOR image'; " \
152 "if load mmc ${mmcdev}:${mmcfactorypart} " \
153 "${nor_img_addr} ${nor_img_file}; then " \
154 "run nor_update;" \
155 "fi\0" \
156 "nor_update=" \
157 "protect off ${nor_bank_start} +${nor_img_size};" \
158 "erase ${nor_bank_start} +${nor_img_size};" \
159 "setexpr nor_img_size ${nor_img_size} / 4; " \
160 "cp.l ${nor_img_addr} ${nor_bank_start} ${nor_img_size}\0" \
Lukasz Majewski97c07802019-10-15 10:28:46 +0200161 "factory_SPL_falcon_setup="\
162 "echo 'Write Falcon boot data'; " \
163 "setenv kernelnor 0x08180000;" \
164 "cp.l ${kernelnor} ${loadaddr} ${kernelsize};" \
165 "spl export fdt ${loadaddr};" \
166 "setenv nor_img_addr ${fdtargsaddr};" \
167 "setenv nor_img_size 0x20000;" \
168 "setenv nor_bank_start " \
169 __stringify(CONFIG_CMD_SPL_NOR_OFS)";" \
170 "run nor_update\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100171 "tftp_nor_uboot="\
172 "echo 'Update mccmon6 NOR U-BOOT via TFTP'; " \
173 "setenv nor_img_file u-boot.img; " \
174 "setenv nor_img_size 0x80000; " \
175 "setenv nor_bank_start 0x08080000; " \
176 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
177 "run nor_update;" \
178 "fi\0" \
Lukasz Majewski97c07802019-10-15 10:28:46 +0200179 "tftp_nor_fitImg="\
180 "echo 'Update mccmon6 NOR fitImage via TFTP'; " \
181 "setenv nor_img_file fitImage; " \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100182 "setenv nor_img_size 0x500000; " \
183 "setenv nor_bank_start 0x08180000; " \
184 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
185 "run nor_update;" \
186 "fi\0" \
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100187 "tftp_nor_img="\
188 "echo 'Update mccmon6 NOR image via TFTP'; " \
189 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
190 "run nor_update;" \
191 "fi\0" \
192 "tftp_nor_SPL="\
193 "if tftp ${load_addr} SPL_padded; then " \
194 "erase 0x08000000 +0x20000;" \
195 "cp.b ${load_addr} 0x08000000 0x20000;" \
196 "fi;\0" \
197 "tftp_sd_SPL="\
198 "if mmc dev 1; then " \
199 "if tftp ${load_addr} ${SPL_file}; then " \
200 "setexpr fw_sz ${filesize} / 0x200; " \
201 "setexpr fw_sz ${fw_sz} + 1; " \
202 "mmc write ${load_addr} 0x2 ${fw_sz};" \
203 "fi;" \
204 "fi;\0" \
205 "tftp_sd_uboot="\
206 "if mmc dev 1; then " \
207 "if run load_uboot; then " \
208 "setexpr fw_sz ${filesize} / 0x200; " \
209 "setexpr fw_sz ${fw_sz} + 1; " \
210 "mmc write ${load_addr} 0x8A ${fw_sz};" \
211 "fi;" \
212 "fi;\0"
213
214/* Physical Memory Map */
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100215#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
216
Tom Rinibb4dd962022-11-16 13:10:37 -0500217#define CFG_SYS_SDRAM_BASE PHYS_SDRAM
Tom Rini6a5dccc2022-11-16 13:10:41 -0500218#define CFG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
219#define CFG_SYS_INIT_RAM_SIZE IRAM_SIZE
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100220
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100221/* Environment organization */
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100222
223/* Envs are stored in NOR flash */
Lukasz Majewskibe44b182017-01-27 23:16:29 +0100224
225#endif /* __CONFIG_H * */