blob: 6cc49378fedc55c6e2f6a4a660640868f9b78ba2 [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
Tom Rini65cc0e22022-11-16 13:10:41 -050012#define CFG_SYS_UBOOT_BASE (CFG_SYS_FLASH_BASE + 0x80000)
Lukasz Majewski11bd5e72017-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 Majewski11bd5e72017-01-27 23:16:29 +010019
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010020#define CONFIG_MXC_UART_BASE UART1_BASE
21
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010022/* MMC Configuration */
Tom Rini6cc04542022-10-28 20:27:13 -040023#define CFG_SYS_FSL_USDHC_NUM 2
24#define CFG_SYS_FSL_ESDHC_ADDR 0
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010025
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010026/* NOR 16-bit mode */
Tom Rini65cc0e22022-11-16 13:10:41 -050027#define CFG_SYS_FLASH_BASE WEIM_ARB_BASE_ADDR
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010028
29/* NOR Flash MTD */
Tom Rini65cc0e22022-11-16 13:10:41 -050030#define CFG_SYS_FLASH_BANKS_LIST { (CFG_SYS_FLASH_BASE) }
31#define CFG_SYS_FLASH_BANKS_SIZES { (32 * SZ_1M) }
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010032
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010033/* Ethernet Configuration */
Tom Rinifa760c32022-12-04 10:03:53 -050034#define CFG_FEC_MXC_PHYADDR 1
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010035
Tom Rini0613c362022-12-04 10:03:50 -050036#define CFG_EXTRA_ENV_SETTINGS \
Lukasz Majewskicb11a282017-02-21 22:45:20 +010037 "console=ttymxc0,115200 quiet\0" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010038 "fdt_high=0xffffffff\0" \
39 "initrd_high=0xffffffff\0" \
40 "boot_os=yes\0" \
Lukasz Majewskie4417ed2019-10-15 10:28:46 +020041 "kernelsize=0x300000\0" \
Lukasz Majewski917964c2019-05-16 09:41:44 +020042 "disable_giga=yes\0" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010043 "download_kernel=" \
Lukasz Majewskie4417ed2019-10-15 10:28:46 +020044 "tftpboot ${loadaddr} ${kernel_file};\0" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010045 "get_boot_medium=" \
46 "setenv boot_medium nor;" \
47 "setexpr.l _src_sbmr1 *0x020d8004;" \
48 "setexpr _b_medium ${_src_sbmr1} '&' 0x00000040;" \
49 "if test ${_b_medium} = 40; then " \
50 "setenv boot_medium sdcard;" \
51 "fi\0" \
Lukasz Majewskie4417ed2019-10-15 10:28:46 +020052 "kernel_file=fitImage\0" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010053 "boot_sd=" \
54 "echo '#######################';" \
55 "echo '# Factory SDcard Boot #';" \
56 "echo '#######################';" \
57 "setenv mmcdev 1;" \
58 "setenv mmcfactorydev 0;" \
59 "setenv mmcfactorypart 1;" \
60 "run factory_flash_img;\0" \
61 "boot_nor=" \
62 "setenv kernelnor 0x08180000;" \
Lukasz Majewskicb11a282017-02-21 22:45:20 +010063 "setenv bootargs console=${console} " \
Tom Rini43ede0b2017-10-22 17:55:07 -040064 CONFIG_MTDPARTS_DEFAULT " " \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010065 "root=/dev/mmcblk1 rootfstype=ext4 rw rootwait noinitrd;" \
Lukasz Majewskie4417ed2019-10-15 10:28:46 +020066 "cp.l ${kernelnor} ${loadaddr} ${kernelsize};" \
67 "bootm ${loadaddr};reset;\0" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010068 "boot_recovery=" \
69 "echo '#######################';" \
70 "echo '# RECOVERY SWU Boot #';" \
71 "echo '#######################';" \
72 "setenv rootfsloadaddr 0x13000000;" \
73 "setenv swukernelnor 0x08980000;" \
74 "setenv swurootfsnor 0x09180000;" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010075 "setenv bootargs console=${console} " \
Tom Rini43ede0b2017-10-22 17:55:07 -040076 CONFIG_MTDPARTS_DEFAULT " " \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010077 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
78 ":${hostname}::off root=/dev/ram rw;" \
79 "cp.l ${swurootfsnor} ${rootfsloadaddr} 0x200000;" \
Lukasz Majewskie4417ed2019-10-15 10:28:46 +020080 "cp.l ${swukernelnor} ${loadaddr} ${kernelsize};" \
81 "bootm ${loadaddr} ${rootfsloadaddr};reset;\0" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010082 "boot_tftp=" \
83 "echo '#######################';" \
84 "echo '# TFTP Boot #';" \
85 "echo '#######################';" \
86 "if run download_kernel; then " \
87 "setenv bootargs console=${console} " \
88 "root=/dev/mmcblk0p2 rootwait;" \
Lukasz Majewskie4417ed2019-10-15 10:28:46 +020089 "bootm $loadaddr};reset;" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010090 "fi\0" \
91 "bootcmd=" \
92 "if test -n ${recovery_status}; then " \
93 "run boot_recovery;" \
94 "else " \
95 "if test ! -n ${boot_medium}; then " \
96 "run get_boot_medium;" \
97 "if test ${boot_medium} = sdcard; then " \
98 "run boot_sd;" \
99 "else " \
100 "run boot_nor;" \
101 "fi;" \
102 "else " \
103 "if test ${boot_medium} = tftp; then " \
104 "run boot_tftp;" \
105 "fi;" \
106 "fi;" \
107 "fi\0" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100108 "bootdev=1\0" \
109 "bootpart=1\0" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100110 "netdev=eth0\0" \
111 "load_addr=0x11000000\0" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100112 "uboot_file=u-boot.img\0" \
113 "SPL_file=SPL\0" \
114 "load_uboot=tftp ${load_addr} ${uboot_file}\0" \
115 "nor_img_addr=0x11000000\0" \
116 "nor_img_file=core-image-lwn-mccmon6.nor\0" \
117 "emmc_img_file=core-image-lwn-mccmon6.ext4\0" \
Tom Rini65cc0e22022-11-16 13:10:41 -0500118 "nor_bank_start=" __stringify(CFG_SYS_FLASH_BASE) "\0" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100119 "nor_img_size=0x02000000\0" \
120 "factory_script_file=factory.scr\0" \
121 "factory_load_script=" \
122 "if test -e mmc ${mmcdev}:${mmcfactorypart} " \
123 "${factory_script_file}; then " \
124 "load mmc ${mmcdev}:${mmcfactorypart} " \
125 "${loadaddr} ${factory_script_file};" \
126 "fi\0" \
127 "factory_script=echo Running factory script from mmc${mmcdev} ...; " \
128 "source ${loadaddr}\0" \
129 "factory_flash_img="\
130 "echo 'Flash mccmon6 with factory images'; " \
131 "if run factory_load_script; then " \
132 "run factory_script;" \
133 "else " \
134 "echo No factory script: ${factory_script_file} found on " \
135 "device ${mmcdev};" \
136 "run factory_nor_img;" \
137 "run factory_eMMC_img;" \
Lukasz Majewskie4417ed2019-10-15 10:28:46 +0200138 "run factory_SPL_falcon_setup;" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100139 "fi\0" \
140 "factory_eMMC_img="\
141 "echo 'Update mccmon6 eMMC image'; " \
142 "if load mmc ${mmcdev}:${mmcfactorypart} " \
143 "${loadaddr} ${emmc_img_file}; then " \
144 "setexpr fw_sz ${filesize} / 0x200;" \
145 "setexpr fw_sz ${fw_sz} + 1;" \
146 "mmc dev ${mmcfactorydev};" \
147 "mmc write ${loadaddr} 0x0 ${fw_sz};" \
148 "fi\0" \
149 "factory_nor_img="\
150 "echo 'Update mccmon6 NOR image'; " \
151 "if load mmc ${mmcdev}:${mmcfactorypart} " \
152 "${nor_img_addr} ${nor_img_file}; then " \
153 "run nor_update;" \
154 "fi\0" \
155 "nor_update=" \
156 "protect off ${nor_bank_start} +${nor_img_size};" \
157 "erase ${nor_bank_start} +${nor_img_size};" \
158 "setexpr nor_img_size ${nor_img_size} / 4; " \
159 "cp.l ${nor_img_addr} ${nor_bank_start} ${nor_img_size}\0" \
Lukasz Majewskie4417ed2019-10-15 10:28:46 +0200160 "factory_SPL_falcon_setup="\
161 "echo 'Write Falcon boot data'; " \
162 "setenv kernelnor 0x08180000;" \
163 "cp.l ${kernelnor} ${loadaddr} ${kernelsize};" \
164 "spl export fdt ${loadaddr};" \
165 "setenv nor_img_addr ${fdtargsaddr};" \
166 "setenv nor_img_size 0x20000;" \
167 "setenv nor_bank_start " \
168 __stringify(CONFIG_CMD_SPL_NOR_OFS)";" \
169 "run nor_update\0" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100170 "tftp_nor_uboot="\
171 "echo 'Update mccmon6 NOR U-BOOT via TFTP'; " \
172 "setenv nor_img_file u-boot.img; " \
173 "setenv nor_img_size 0x80000; " \
174 "setenv nor_bank_start 0x08080000; " \
175 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
176 "run nor_update;" \
177 "fi\0" \
Lukasz Majewskie4417ed2019-10-15 10:28:46 +0200178 "tftp_nor_fitImg="\
179 "echo 'Update mccmon6 NOR fitImage via TFTP'; " \
180 "setenv nor_img_file fitImage; " \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100181 "setenv nor_img_size 0x500000; " \
182 "setenv nor_bank_start 0x08180000; " \
183 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
184 "run nor_update;" \
185 "fi\0" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100186 "tftp_nor_img="\
187 "echo 'Update mccmon6 NOR image via TFTP'; " \
188 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
189 "run nor_update;" \
190 "fi\0" \
191 "tftp_nor_SPL="\
192 "if tftp ${load_addr} SPL_padded; then " \
193 "erase 0x08000000 +0x20000;" \
194 "cp.b ${load_addr} 0x08000000 0x20000;" \
195 "fi;\0" \
196 "tftp_sd_SPL="\
197 "if mmc dev 1; then " \
198 "if tftp ${load_addr} ${SPL_file}; then " \
199 "setexpr fw_sz ${filesize} / 0x200; " \
200 "setexpr fw_sz ${fw_sz} + 1; " \
201 "mmc write ${load_addr} 0x2 ${fw_sz};" \
202 "fi;" \
203 "fi;\0" \
204 "tftp_sd_uboot="\
205 "if mmc dev 1; then " \
206 "if run load_uboot; then " \
207 "setexpr fw_sz ${filesize} / 0x200; " \
208 "setexpr fw_sz ${fw_sz} + 1; " \
209 "mmc write ${load_addr} 0x8A ${fw_sz};" \
210 "fi;" \
211 "fi;\0"
212
213/* Physical Memory Map */
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100214#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
215
Tom Riniaa6e94d2022-11-16 13:10:37 -0500216#define CFG_SYS_SDRAM_BASE PHYS_SDRAM
Tom Rini65cc0e22022-11-16 13:10:41 -0500217#define CFG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
218#define CFG_SYS_INIT_RAM_SIZE IRAM_SIZE
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100219
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100220/* Environment organization */
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100221
222/* Envs are stored in NOR flash */
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100223
224#endif /* __CONFIG_H * */