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