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