Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2016-2017 |
| 4 | * Lukasz Majewski, DENX Software Engineering, lukma@denx.de |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef __CONFIG_H |
| 8 | #define __CONFIG_H |
| 9 | |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 10 | #include "mx6_common.h" |
| 11 | |
| 12 | #define CONFIG_SPL_LIBCOMMON_SUPPORT |
| 13 | #include "imx6_spl.h" |
| 14 | |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 15 | #define CONFIG_SYS_UBOOT_START CONFIG_SYS_TEXT_BASE |
| 16 | #define CONFIG_SYS_UBOOT_BASE (CONFIG_SYS_FLASH_BASE + 0x80000) |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 17 | #define CONFIG_SYS_SPL_ARGS_ADDR 0x18000000 |
| 18 | |
| 19 | /* |
| 20 | * Below defines are set but NOT really used since we by |
| 21 | * design force U-Boot run when we boot in development |
| 22 | * mode from SD card (SD2) |
| 23 | */ |
| 24 | #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR (0x800) |
| 25 | #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (0x80) |
| 26 | #define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR (0x1000) |
Lukasz Majewski | e4417ed | 2019-10-15 10:28:46 +0200 | [diff] [blame] | 27 | #define CONFIG_SPL_FS_LOAD_KERNEL_NAME "fitImage" |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 28 | |
| 29 | /* Size of malloc() pool */ |
| 30 | #define CONFIG_SYS_MALLOC_LEN (10 * SZ_1M) |
| 31 | |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 32 | #define CONFIG_BOARD_LATE_INIT |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 33 | #define CONFIG_MXC_UART_BASE UART1_BASE |
| 34 | |
| 35 | #define CONFIG_SYS_MEMTEST_START 0x10000000 |
| 36 | #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + 500 * SZ_1M) |
| 37 | |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 38 | /* MMC Configuration */ |
| 39 | #define CONFIG_SYS_FSL_USDHC_NUM 2 |
| 40 | #define CONFIG_SYS_FSL_ESDHC_ADDR 0 |
| 41 | |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 42 | /* NOR 16-bit mode */ |
| 43 | #define CONFIG_SYS_FLASH_BASE WEIM_ARB_BASE_ADDR |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 44 | #define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 45 | #define CONFIG_SYS_FLASH_EMPTY_INFO |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 46 | #define CONFIG_FLASH_VERIFY |
| 47 | |
| 48 | /* NOR Flash MTD */ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 49 | #define CONFIG_SYS_MAX_FLASH_BANKS_DETECT 1 |
| 50 | #define CONFIG_SYS_FLASH_BANKS_LIST { (CONFIG_SYS_FLASH_BASE) } |
| 51 | #define CONFIG_SYS_FLASH_BANKS_SIZES { (32 * SZ_1M) } |
| 52 | |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 53 | /* Ethernet Configuration */ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 54 | #define IMX_FEC_BASE ENET_BASE_ADDR |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 55 | #define CONFIG_FEC_MXC_PHYADDR 1 |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 56 | |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 57 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
Lukasz Majewski | cb11a28 | 2017-02-21 22:45:20 +0100 | [diff] [blame] | 58 | "console=ttymxc0,115200 quiet\0" \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 59 | "fdt_high=0xffffffff\0" \ |
| 60 | "initrd_high=0xffffffff\0" \ |
| 61 | "boot_os=yes\0" \ |
Lukasz Majewski | e4417ed | 2019-10-15 10:28:46 +0200 | [diff] [blame] | 62 | "kernelsize=0x300000\0" \ |
Lukasz Majewski | 917964c | 2019-05-16 09:41:44 +0200 | [diff] [blame] | 63 | "disable_giga=yes\0" \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 64 | "download_kernel=" \ |
Lukasz Majewski | e4417ed | 2019-10-15 10:28:46 +0200 | [diff] [blame] | 65 | "tftpboot ${loadaddr} ${kernel_file};\0" \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 66 | "get_boot_medium=" \ |
| 67 | "setenv boot_medium nor;" \ |
| 68 | "setexpr.l _src_sbmr1 *0x020d8004;" \ |
| 69 | "setexpr _b_medium ${_src_sbmr1} '&' 0x00000040;" \ |
| 70 | "if test ${_b_medium} = 40; then " \ |
| 71 | "setenv boot_medium sdcard;" \ |
| 72 | "fi\0" \ |
Lukasz Majewski | e4417ed | 2019-10-15 10:28:46 +0200 | [diff] [blame] | 73 | "kernel_file=fitImage\0" \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 74 | "boot_sd=" \ |
| 75 | "echo '#######################';" \ |
| 76 | "echo '# Factory SDcard Boot #';" \ |
| 77 | "echo '#######################';" \ |
| 78 | "setenv mmcdev 1;" \ |
| 79 | "setenv mmcfactorydev 0;" \ |
| 80 | "setenv mmcfactorypart 1;" \ |
| 81 | "run factory_flash_img;\0" \ |
| 82 | "boot_nor=" \ |
| 83 | "setenv kernelnor 0x08180000;" \ |
Lukasz Majewski | cb11a28 | 2017-02-21 22:45:20 +0100 | [diff] [blame] | 84 | "setenv bootargs console=${console} " \ |
Tom Rini | 43ede0b | 2017-10-22 17:55:07 -0400 | [diff] [blame] | 85 | CONFIG_MTDPARTS_DEFAULT " " \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 86 | "root=/dev/mmcblk1 rootfstype=ext4 rw rootwait noinitrd;" \ |
Lukasz Majewski | e4417ed | 2019-10-15 10:28:46 +0200 | [diff] [blame] | 87 | "cp.l ${kernelnor} ${loadaddr} ${kernelsize};" \ |
| 88 | "bootm ${loadaddr};reset;\0" \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 89 | "boot_recovery=" \ |
| 90 | "echo '#######################';" \ |
| 91 | "echo '# RECOVERY SWU Boot #';" \ |
| 92 | "echo '#######################';" \ |
| 93 | "setenv rootfsloadaddr 0x13000000;" \ |
| 94 | "setenv swukernelnor 0x08980000;" \ |
| 95 | "setenv swurootfsnor 0x09180000;" \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 96 | "setenv bootargs console=${console} " \ |
Tom Rini | 43ede0b | 2017-10-22 17:55:07 -0400 | [diff] [blame] | 97 | CONFIG_MTDPARTS_DEFAULT " " \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 98 | "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \ |
| 99 | ":${hostname}::off root=/dev/ram rw;" \ |
| 100 | "cp.l ${swurootfsnor} ${rootfsloadaddr} 0x200000;" \ |
Lukasz Majewski | e4417ed | 2019-10-15 10:28:46 +0200 | [diff] [blame] | 101 | "cp.l ${swukernelnor} ${loadaddr} ${kernelsize};" \ |
| 102 | "bootm ${loadaddr} ${rootfsloadaddr};reset;\0" \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 103 | "boot_tftp=" \ |
| 104 | "echo '#######################';" \ |
| 105 | "echo '# TFTP Boot #';" \ |
| 106 | "echo '#######################';" \ |
| 107 | "if run download_kernel; then " \ |
| 108 | "setenv bootargs console=${console} " \ |
| 109 | "root=/dev/mmcblk0p2 rootwait;" \ |
Lukasz Majewski | e4417ed | 2019-10-15 10:28:46 +0200 | [diff] [blame] | 110 | "bootm $loadaddr};reset;" \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 111 | "fi\0" \ |
| 112 | "bootcmd=" \ |
| 113 | "if test -n ${recovery_status}; then " \ |
| 114 | "run boot_recovery;" \ |
| 115 | "else " \ |
| 116 | "if test ! -n ${boot_medium}; then " \ |
| 117 | "run get_boot_medium;" \ |
| 118 | "if test ${boot_medium} = sdcard; then " \ |
| 119 | "run boot_sd;" \ |
| 120 | "else " \ |
| 121 | "run boot_nor;" \ |
| 122 | "fi;" \ |
| 123 | "else " \ |
| 124 | "if test ${boot_medium} = tftp; then " \ |
| 125 | "run boot_tftp;" \ |
| 126 | "fi;" \ |
| 127 | "fi;" \ |
| 128 | "fi\0" \ |
Tom Rini | 43ede0b | 2017-10-22 17:55:07 -0400 | [diff] [blame] | 129 | "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 130 | "bootdev=1\0" \ |
| 131 | "bootpart=1\0" \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 132 | "netdev=eth0\0" \ |
| 133 | "load_addr=0x11000000\0" \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 134 | "uboot_file=u-boot.img\0" \ |
| 135 | "SPL_file=SPL\0" \ |
| 136 | "load_uboot=tftp ${load_addr} ${uboot_file}\0" \ |
| 137 | "nor_img_addr=0x11000000\0" \ |
| 138 | "nor_img_file=core-image-lwn-mccmon6.nor\0" \ |
| 139 | "emmc_img_file=core-image-lwn-mccmon6.ext4\0" \ |
| 140 | "nor_bank_start=" __stringify(CONFIG_SYS_FLASH_BASE) "\0" \ |
| 141 | "nor_img_size=0x02000000\0" \ |
| 142 | "factory_script_file=factory.scr\0" \ |
| 143 | "factory_load_script=" \ |
| 144 | "if test -e mmc ${mmcdev}:${mmcfactorypart} " \ |
| 145 | "${factory_script_file}; then " \ |
| 146 | "load mmc ${mmcdev}:${mmcfactorypart} " \ |
| 147 | "${loadaddr} ${factory_script_file};" \ |
| 148 | "fi\0" \ |
| 149 | "factory_script=echo Running factory script from mmc${mmcdev} ...; " \ |
| 150 | "source ${loadaddr}\0" \ |
| 151 | "factory_flash_img="\ |
| 152 | "echo 'Flash mccmon6 with factory images'; " \ |
| 153 | "if run factory_load_script; then " \ |
| 154 | "run factory_script;" \ |
| 155 | "else " \ |
| 156 | "echo No factory script: ${factory_script_file} found on " \ |
| 157 | "device ${mmcdev};" \ |
| 158 | "run factory_nor_img;" \ |
| 159 | "run factory_eMMC_img;" \ |
Lukasz Majewski | e4417ed | 2019-10-15 10:28:46 +0200 | [diff] [blame] | 160 | "run factory_SPL_falcon_setup;" \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 161 | "fi\0" \ |
| 162 | "factory_eMMC_img="\ |
| 163 | "echo 'Update mccmon6 eMMC image'; " \ |
| 164 | "if load mmc ${mmcdev}:${mmcfactorypart} " \ |
| 165 | "${loadaddr} ${emmc_img_file}; then " \ |
| 166 | "setexpr fw_sz ${filesize} / 0x200;" \ |
| 167 | "setexpr fw_sz ${fw_sz} + 1;" \ |
| 168 | "mmc dev ${mmcfactorydev};" \ |
| 169 | "mmc write ${loadaddr} 0x0 ${fw_sz};" \ |
| 170 | "fi\0" \ |
| 171 | "factory_nor_img="\ |
| 172 | "echo 'Update mccmon6 NOR image'; " \ |
| 173 | "if load mmc ${mmcdev}:${mmcfactorypart} " \ |
| 174 | "${nor_img_addr} ${nor_img_file}; then " \ |
| 175 | "run nor_update;" \ |
| 176 | "fi\0" \ |
| 177 | "nor_update=" \ |
| 178 | "protect off ${nor_bank_start} +${nor_img_size};" \ |
| 179 | "erase ${nor_bank_start} +${nor_img_size};" \ |
| 180 | "setexpr nor_img_size ${nor_img_size} / 4; " \ |
| 181 | "cp.l ${nor_img_addr} ${nor_bank_start} ${nor_img_size}\0" \ |
Lukasz Majewski | e4417ed | 2019-10-15 10:28:46 +0200 | [diff] [blame] | 182 | "factory_SPL_falcon_setup="\ |
| 183 | "echo 'Write Falcon boot data'; " \ |
| 184 | "setenv kernelnor 0x08180000;" \ |
| 185 | "cp.l ${kernelnor} ${loadaddr} ${kernelsize};" \ |
| 186 | "spl export fdt ${loadaddr};" \ |
| 187 | "setenv nor_img_addr ${fdtargsaddr};" \ |
| 188 | "setenv nor_img_size 0x20000;" \ |
| 189 | "setenv nor_bank_start " \ |
| 190 | __stringify(CONFIG_CMD_SPL_NOR_OFS)";" \ |
| 191 | "run nor_update\0" \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 192 | "tftp_nor_uboot="\ |
| 193 | "echo 'Update mccmon6 NOR U-BOOT via TFTP'; " \ |
| 194 | "setenv nor_img_file u-boot.img; " \ |
| 195 | "setenv nor_img_size 0x80000; " \ |
| 196 | "setenv nor_bank_start 0x08080000; " \ |
| 197 | "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \ |
| 198 | "run nor_update;" \ |
| 199 | "fi\0" \ |
Lukasz Majewski | e4417ed | 2019-10-15 10:28:46 +0200 | [diff] [blame] | 200 | "tftp_nor_fitImg="\ |
| 201 | "echo 'Update mccmon6 NOR fitImage via TFTP'; " \ |
| 202 | "setenv nor_img_file fitImage; " \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 203 | "setenv nor_img_size 0x500000; " \ |
| 204 | "setenv nor_bank_start 0x08180000; " \ |
| 205 | "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \ |
| 206 | "run nor_update;" \ |
| 207 | "fi\0" \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 208 | "tftp_nor_img="\ |
| 209 | "echo 'Update mccmon6 NOR image via TFTP'; " \ |
| 210 | "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \ |
| 211 | "run nor_update;" \ |
| 212 | "fi\0" \ |
| 213 | "tftp_nor_SPL="\ |
| 214 | "if tftp ${load_addr} SPL_padded; then " \ |
| 215 | "erase 0x08000000 +0x20000;" \ |
| 216 | "cp.b ${load_addr} 0x08000000 0x20000;" \ |
| 217 | "fi;\0" \ |
| 218 | "tftp_sd_SPL="\ |
| 219 | "if mmc dev 1; then " \ |
| 220 | "if tftp ${load_addr} ${SPL_file}; then " \ |
| 221 | "setexpr fw_sz ${filesize} / 0x200; " \ |
| 222 | "setexpr fw_sz ${fw_sz} + 1; " \ |
| 223 | "mmc write ${load_addr} 0x2 ${fw_sz};" \ |
| 224 | "fi;" \ |
| 225 | "fi;\0" \ |
| 226 | "tftp_sd_uboot="\ |
| 227 | "if mmc dev 1; then " \ |
| 228 | "if run load_uboot; then " \ |
| 229 | "setexpr fw_sz ${filesize} / 0x200; " \ |
| 230 | "setexpr fw_sz ${fw_sz} + 1; " \ |
| 231 | "mmc write ${load_addr} 0x8A ${fw_sz};" \ |
| 232 | "fi;" \ |
| 233 | "fi;\0" |
| 234 | |
| 235 | /* Physical Memory Map */ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 236 | #define PHYS_SDRAM MMDC0_ARB_BASE_ADDR |
| 237 | |
| 238 | #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM |
| 239 | #define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR |
| 240 | #define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE |
| 241 | |
| 242 | #define CONFIG_SYS_INIT_SP_OFFSET \ |
| 243 | (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) |
| 244 | #define CONFIG_SYS_INIT_SP_ADDR \ |
| 245 | (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET) |
| 246 | |
| 247 | /* Environment organization */ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 248 | |
| 249 | /* Envs are stored in NOR flash */ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 250 | |
| 251 | #endif /* __CONFIG_H * */ |