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