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 | |
Tom Rini | 65cc0e2 | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 12 | #define CFG_SYS_UBOOT_BASE (CFG_SYS_FLASH_BASE + 0x80000) |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 13 | |
| 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 Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 19 | |
Tom Rini | 4db3866 | 2022-12-04 10:04:55 -0500 | [diff] [blame] | 20 | #define CFG_MXC_UART_BASE UART1_BASE |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 21 | |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 22 | /* MMC Configuration */ |
Tom Rini | 6cc0454 | 2022-10-28 20:27:13 -0400 | [diff] [blame] | 23 | #define CFG_SYS_FSL_USDHC_NUM 2 |
| 24 | #define CFG_SYS_FSL_ESDHC_ADDR 0 |
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 | /* NOR 16-bit mode */ |
Tom Rini | 65cc0e2 | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 27 | #define CFG_SYS_FLASH_BASE WEIM_ARB_BASE_ADDR |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 28 | |
| 29 | /* NOR Flash MTD */ |
Tom Rini | 65cc0e2 | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 30 | #define CFG_SYS_FLASH_BANKS_LIST { (CFG_SYS_FLASH_BASE) } |
| 31 | #define CFG_SYS_FLASH_BANKS_SIZES { (32 * SZ_1M) } |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 32 | |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 33 | /* Ethernet Configuration */ |
Tom Rini | fa760c3 | 2022-12-04 10:03:53 -0500 | [diff] [blame] | 34 | #define CFG_FEC_MXC_PHYADDR 1 |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 35 | |
Tom Rini | 0613c36 | 2022-12-04 10:03:50 -0500 | [diff] [blame] | 36 | #define CFG_EXTRA_ENV_SETTINGS \ |
Lukasz Majewski | cb11a28 | 2017-02-21 22:45:20 +0100 | [diff] [blame] | 37 | "console=ttymxc0,115200 quiet\0" \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 38 | "fdt_high=0xffffffff\0" \ |
| 39 | "initrd_high=0xffffffff\0" \ |
| 40 | "boot_os=yes\0" \ |
Lukasz Majewski | e4417ed | 2019-10-15 10:28:46 +0200 | [diff] [blame] | 41 | "kernelsize=0x300000\0" \ |
Lukasz Majewski | 917964c | 2019-05-16 09:41:44 +0200 | [diff] [blame] | 42 | "disable_giga=yes\0" \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 43 | "download_kernel=" \ |
Lukasz Majewski | e4417ed | 2019-10-15 10:28:46 +0200 | [diff] [blame] | 44 | "tftpboot ${loadaddr} ${kernel_file};\0" \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 45 | "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 Majewski | e4417ed | 2019-10-15 10:28:46 +0200 | [diff] [blame] | 52 | "kernel_file=fitImage\0" \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 53 | "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 Majewski | cb11a28 | 2017-02-21 22:45:20 +0100 | [diff] [blame] | 63 | "setenv bootargs console=${console} " \ |
Tom Rini | 43ede0b | 2017-10-22 17:55:07 -0400 | [diff] [blame] | 64 | CONFIG_MTDPARTS_DEFAULT " " \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 65 | "root=/dev/mmcblk1 rootfstype=ext4 rw rootwait noinitrd;" \ |
Lukasz Majewski | e4417ed | 2019-10-15 10:28:46 +0200 | [diff] [blame] | 66 | "cp.l ${kernelnor} ${loadaddr} ${kernelsize};" \ |
| 67 | "bootm ${loadaddr};reset;\0" \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 68 | "boot_recovery=" \ |
| 69 | "echo '#######################';" \ |
| 70 | "echo '# RECOVERY SWU Boot #';" \ |
| 71 | "echo '#######################';" \ |
| 72 | "setenv rootfsloadaddr 0x13000000;" \ |
| 73 | "setenv swukernelnor 0x08980000;" \ |
| 74 | "setenv swurootfsnor 0x09180000;" \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 75 | "setenv bootargs console=${console} " \ |
Tom Rini | 43ede0b | 2017-10-22 17:55:07 -0400 | [diff] [blame] | 76 | CONFIG_MTDPARTS_DEFAULT " " \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 77 | "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \ |
| 78 | ":${hostname}::off root=/dev/ram rw;" \ |
| 79 | "cp.l ${swurootfsnor} ${rootfsloadaddr} 0x200000;" \ |
Lukasz Majewski | e4417ed | 2019-10-15 10:28:46 +0200 | [diff] [blame] | 80 | "cp.l ${swukernelnor} ${loadaddr} ${kernelsize};" \ |
| 81 | "bootm ${loadaddr} ${rootfsloadaddr};reset;\0" \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 82 | "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 Majewski | e4417ed | 2019-10-15 10:28:46 +0200 | [diff] [blame] | 89 | "bootm $loadaddr};reset;" \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 90 | "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 Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 108 | "bootdev=1\0" \ |
| 109 | "bootpart=1\0" \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 110 | "netdev=eth0\0" \ |
| 111 | "load_addr=0x11000000\0" \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 112 | "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 Rini | 65cc0e2 | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 118 | "nor_bank_start=" __stringify(CFG_SYS_FLASH_BASE) "\0" \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 119 | "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 Majewski | e4417ed | 2019-10-15 10:28:46 +0200 | [diff] [blame] | 138 | "run factory_SPL_falcon_setup;" \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 139 | "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 Majewski | e4417ed | 2019-10-15 10:28:46 +0200 | [diff] [blame] | 160 | "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 Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 170 | "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 Majewski | e4417ed | 2019-10-15 10:28:46 +0200 | [diff] [blame] | 178 | "tftp_nor_fitImg="\ |
| 179 | "echo 'Update mccmon6 NOR fitImage via TFTP'; " \ |
| 180 | "setenv nor_img_file fitImage; " \ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 181 | "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 Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 186 | "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 Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 214 | #define PHYS_SDRAM MMDC0_ARB_BASE_ADDR |
| 215 | |
Tom Rini | aa6e94d | 2022-11-16 13:10:37 -0500 | [diff] [blame] | 216 | #define CFG_SYS_SDRAM_BASE PHYS_SDRAM |
Tom Rini | 65cc0e2 | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 217 | #define CFG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR |
| 218 | #define CFG_SYS_INIT_RAM_SIZE IRAM_SIZE |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 219 | |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 220 | /* Environment organization */ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 221 | |
| 222 | /* Envs are stored in NOR flash */ |
Lukasz Majewski | 11bd5e7 | 2017-01-27 23:16:29 +0100 | [diff] [blame] | 223 | |
| 224 | #endif /* __CONFIG_H * */ |