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