blob: a1774c027a955823c5d9026864b39f18bf8e0a8b [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_START CONFIG_SYS_TEXT_BASE
16#define CONFIG_SYS_UBOOT_BASE (CONFIG_SYS_FLASH_BASE + 0x80000)
17#define CONFIG_SPL_OS_BOOT
18#define CONFIG_SYS_OS_BASE (CONFIG_SYS_FLASH_BASE + 0x180000)
19#define CONFIG_SYS_FDT_BASE (CONFIG_SYS_FLASH_BASE + 0x1980000)
20#define CONFIG_SYS_FDT_SIZE (48 * SZ_1K)
21#define CONFIG_SYS_SPL_ARGS_ADDR 0x18000000
22
23/*
24 * Below defines are set but NOT really used since we by
25 * design force U-Boot run when we boot in development
26 * mode from SD card (SD2)
27 */
28#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR (0x800)
29#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (0x80)
30#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR (0x1000)
31#define CONFIG_SPL_FS_LOAD_KERNEL_NAME "uImage"
32#define CONFIG_SPL_FS_LOAD_ARGS_NAME "imx6q-mccmon.dtb"
33
34/* Size of malloc() pool */
35#define CONFIG_SYS_MALLOC_LEN (10 * SZ_1M)
36
37#define CONFIG_BOARD_EARLY_INIT_F
38#define CONFIG_BOARD_LATE_INIT
39
40#define CONFIG_MXC_UART
41#define CONFIG_MXC_UART_BASE UART1_BASE
42
43#define CONFIG_SYS_MEMTEST_START 0x10000000
44#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + 500 * SZ_1M)
45
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010046/* I2C Configs */
47#define CONFIG_SYS_I2C
48#define CONFIG_SYS_I2C_MXC
49#define CONFIG_SYS_I2C_MXC_I2C1 /* enable I2C bus 1 */
50#define CONFIG_SYS_I2C_MXC_I2C2 /* enable I2C bus 2 */
51#define CONFIG_SYS_I2C_SPEED 100000
52
53/* MMC Configuration */
54#define CONFIG_SYS_FSL_USDHC_NUM 2
55#define CONFIG_SYS_FSL_ESDHC_ADDR 0
56
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010057/* NOR 16-bit mode */
58#define CONFIG_SYS_FLASH_BASE WEIM_ARB_BASE_ADDR
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010059#define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010060#define CONFIG_SYS_FLASH_EMPTY_INFO
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010061#define CONFIG_FLASH_VERIFY
62
63/* NOR Flash MTD */
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010064#define CONFIG_SYS_MAX_FLASH_BANKS_DETECT 1
65#define CONFIG_SYS_FLASH_BANKS_LIST { (CONFIG_SYS_FLASH_BASE) }
66#define CONFIG_SYS_FLASH_BANKS_SIZES { (32 * SZ_1M) }
67
68/* MTD support */
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010069
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010070/* USB Configs */
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010071#define CONFIG_USB_MAX_CONTROLLER_COUNT 2
72#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
73#define CONFIG_MXC_USB_FLAGS 0
74
75/* Ethernet Configuration */
76#define CONFIG_FEC_MXC
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010077#define IMX_FEC_BASE ENET_BASE_ADDR
78#define CONFIG_FEC_XCV_TYPE RGMII
79#define CONFIG_ETHPRIME "FEC"
80#define CONFIG_FEC_MXC_PHYADDR 1
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010081
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010082#define CONFIG_EXTRA_ENV_SETTINGS \
Lukasz Majewskicb11a282017-02-21 22:45:20 +010083 "console=ttymxc0,115200 quiet\0" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +010084 "fdtfile=imx6q-mccmon6.dtb\0" \
85 "fdt_high=0xffffffff\0" \
86 "initrd_high=0xffffffff\0" \
87 "boot_os=yes\0" \
88 "download_kernel=" \
89 "tftpboot ${kernel_addr} ${kernel_file};" \
90 "tftpboot ${fdt_addr} ${fdtfile};\0" \
91 "get_boot_medium=" \
92 "setenv boot_medium nor;" \
93 "setexpr.l _src_sbmr1 *0x020d8004;" \
94 "setexpr _b_medium ${_src_sbmr1} '&' 0x00000040;" \
95 "if test ${_b_medium} = 40; then " \
96 "setenv boot_medium sdcard;" \
97 "fi\0" \
98 "kernel_file=uImage\0" \
99 "load_kernel=" \
100 "load mmc ${bootdev}:${bootpart} ${kernel_addr} uImage;" \
101 "load mmc ${bootdev}:${bootpart} ${fdt_addr} ${fdtfile};\0" \
102 "boot_sd=" \
103 "echo '#######################';" \
104 "echo '# Factory SDcard Boot #';" \
105 "echo '#######################';" \
106 "setenv mmcdev 1;" \
107 "setenv mmcfactorydev 0;" \
108 "setenv mmcfactorypart 1;" \
109 "run factory_flash_img;\0" \
110 "boot_nor=" \
111 "setenv kernelnor 0x08180000;" \
112 "setenv dtbnor 0x09980000;" \
Lukasz Majewskicb11a282017-02-21 22:45:20 +0100113 "setenv bootargs console=${console} " \
Tom Rini43ede0b2017-10-22 17:55:07 -0400114 CONFIG_MTDPARTS_DEFAULT " " \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100115 "root=/dev/mmcblk1 rootfstype=ext4 rw rootwait noinitrd;" \
116 "cp.l ${dtbnor} ${dtbloadaddr} 0x8000;" \
117 "bootm ${kernelnor} - ${dtbloadaddr};\0" \
118 "boot_recovery=" \
119 "echo '#######################';" \
120 "echo '# RECOVERY SWU Boot #';" \
121 "echo '#######################';" \
122 "setenv rootfsloadaddr 0x13000000;" \
123 "setenv swukernelnor 0x08980000;" \
124 "setenv swurootfsnor 0x09180000;" \
125 "setenv swudtbnor 0x099A0000;" \
126 "setenv bootargs console=${console} " \
Tom Rini43ede0b2017-10-22 17:55:07 -0400127 CONFIG_MTDPARTS_DEFAULT " " \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100128 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
129 ":${hostname}::off root=/dev/ram rw;" \
130 "cp.l ${swurootfsnor} ${rootfsloadaddr} 0x200000;" \
131 "cp.l ${swudtbnor} ${dtbloadaddr} 0x8000;" \
132 "bootm ${swukernelnor} ${rootfsloadaddr} ${dtbloadaddr};\0" \
133 "boot_tftp=" \
134 "echo '#######################';" \
135 "echo '# TFTP Boot #';" \
136 "echo '#######################';" \
137 "if run download_kernel; then " \
138 "setenv bootargs console=${console} " \
139 "root=/dev/mmcblk0p2 rootwait;" \
140 "bootm ${kernel_addr} - ${fdt_addr};" \
141 "fi\0" \
142 "bootcmd=" \
143 "if test -n ${recovery_status}; then " \
144 "run boot_recovery;" \
145 "else " \
146 "if test ! -n ${boot_medium}; then " \
147 "run get_boot_medium;" \
148 "if test ${boot_medium} = sdcard; then " \
149 "run boot_sd;" \
150 "else " \
151 "run boot_nor;" \
152 "fi;" \
153 "else " \
154 "if test ${boot_medium} = tftp; then " \
155 "run boot_tftp;" \
156 "fi;" \
157 "fi;" \
158 "fi\0" \
Tom Rini43ede0b2017-10-22 17:55:07 -0400159 "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100160 "fdt_addr=0x18000000\0" \
161 "bootdev=1\0" \
162 "bootpart=1\0" \
163 "kernel_addr=" __stringify(CONFIG_LOADADDR) "\0" \
164 "netdev=eth0\0" \
165 "load_addr=0x11000000\0" \
166 "dtbloadaddr=0x12000000\0" \
167 "uboot_file=u-boot.img\0" \
168 "SPL_file=SPL\0" \
169 "load_uboot=tftp ${load_addr} ${uboot_file}\0" \
170 "nor_img_addr=0x11000000\0" \
171 "nor_img_file=core-image-lwn-mccmon6.nor\0" \
172 "emmc_img_file=core-image-lwn-mccmon6.ext4\0" \
173 "nor_bank_start=" __stringify(CONFIG_SYS_FLASH_BASE) "\0" \
174 "nor_img_size=0x02000000\0" \
175 "factory_script_file=factory.scr\0" \
176 "factory_load_script=" \
177 "if test -e mmc ${mmcdev}:${mmcfactorypart} " \
178 "${factory_script_file}; then " \
179 "load mmc ${mmcdev}:${mmcfactorypart} " \
180 "${loadaddr} ${factory_script_file};" \
181 "fi\0" \
182 "factory_script=echo Running factory script from mmc${mmcdev} ...; " \
183 "source ${loadaddr}\0" \
184 "factory_flash_img="\
185 "echo 'Flash mccmon6 with factory images'; " \
186 "if run factory_load_script; then " \
187 "run factory_script;" \
188 "else " \
189 "echo No factory script: ${factory_script_file} found on " \
190 "device ${mmcdev};" \
191 "run factory_nor_img;" \
192 "run factory_eMMC_img;" \
193 "fi\0" \
194 "factory_eMMC_img="\
195 "echo 'Update mccmon6 eMMC image'; " \
196 "if load mmc ${mmcdev}:${mmcfactorypart} " \
197 "${loadaddr} ${emmc_img_file}; then " \
198 "setexpr fw_sz ${filesize} / 0x200;" \
199 "setexpr fw_sz ${fw_sz} + 1;" \
200 "mmc dev ${mmcfactorydev};" \
201 "mmc write ${loadaddr} 0x0 ${fw_sz};" \
202 "fi\0" \
203 "factory_nor_img="\
204 "echo 'Update mccmon6 NOR image'; " \
205 "if load mmc ${mmcdev}:${mmcfactorypart} " \
206 "${nor_img_addr} ${nor_img_file}; then " \
207 "run nor_update;" \
208 "fi\0" \
209 "nor_update=" \
210 "protect off ${nor_bank_start} +${nor_img_size};" \
211 "erase ${nor_bank_start} +${nor_img_size};" \
212 "setexpr nor_img_size ${nor_img_size} / 4; " \
213 "cp.l ${nor_img_addr} ${nor_bank_start} ${nor_img_size}\0" \
214 "tftp_nor_uboot="\
215 "echo 'Update mccmon6 NOR U-BOOT via TFTP'; " \
216 "setenv nor_img_file u-boot.img; " \
217 "setenv nor_img_size 0x80000; " \
218 "setenv nor_bank_start 0x08080000; " \
219 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
220 "run nor_update;" \
221 "fi\0" \
222 "tftp_nor_uImg="\
223 "echo 'Update mccmon6 NOR uImage via TFTP'; " \
224 "setenv nor_img_file uImage; " \
225 "setenv nor_img_size 0x500000; " \
226 "setenv nor_bank_start 0x08180000; " \
227 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
228 "run nor_update;" \
229 "fi\0" \
Lukasz Majewski5b8299e2017-03-27 15:38:46 +0200230 "tftp_nor_dtb="\
231 "echo 'Update mccmon6 NOR DTB via TFTP'; " \
232 "setenv nor_img_file imx6q-mccmon6.dtb; " \
233 "setenv nor_img_size 0x20000; " \
234 "setenv nor_bank_start 0x09980000; " \
235 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
236 "run nor_update;" \
237 "fi\0" \
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100238 "tftp_nor_img="\
239 "echo 'Update mccmon6 NOR image via TFTP'; " \
240 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
241 "run nor_update;" \
242 "fi\0" \
243 "tftp_nor_SPL="\
244 "if tftp ${load_addr} SPL_padded; then " \
245 "erase 0x08000000 +0x20000;" \
246 "cp.b ${load_addr} 0x08000000 0x20000;" \
247 "fi;\0" \
248 "tftp_sd_SPL="\
249 "if mmc dev 1; then " \
250 "if tftp ${load_addr} ${SPL_file}; then " \
251 "setexpr fw_sz ${filesize} / 0x200; " \
252 "setexpr fw_sz ${fw_sz} + 1; " \
253 "mmc write ${load_addr} 0x2 ${fw_sz};" \
254 "fi;" \
255 "fi;\0" \
256 "tftp_sd_uboot="\
257 "if mmc dev 1; then " \
258 "if run load_uboot; then " \
259 "setexpr fw_sz ${filesize} / 0x200; " \
260 "setexpr fw_sz ${fw_sz} + 1; " \
261 "mmc write ${load_addr} 0x8A ${fw_sz};" \
262 "fi;" \
263 "fi;\0"
264
265/* Physical Memory Map */
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100266#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
267
268#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
269#define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
270#define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
271
272#define CONFIG_SYS_INIT_SP_OFFSET \
273 (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
274#define CONFIG_SYS_INIT_SP_ADDR \
275 (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
276
277/* Environment organization */
278#define CONFIG_ENV_SIZE (SZ_128K)
279
280/* Envs are stored in NOR flash */
Lukasz Majewski11bd5e72017-01-27 23:16:29 +0100281#define CONFIG_ENV_SECT_SIZE (SZ_128K)
282#define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE + 0x40000)
283
284#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
285#define CONFIG_ENV_ADDR_REDUND (CONFIG_SYS_FLASH_BASE + 0x60000)
286#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
287
288#endif /* __CONFIG_H * */