1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 /* 3 * Copyright (C) 2016-2017 4 * Lukasz Majewski, DENX Software Engineering, lukma@denx.de 5 */ 6 7 #ifndef __CONFIG_H 8 #define __CONFIG_H 9 10 #include "mx6_common.h" 11 12 #define CONFIG_SPL_LIBCOMMON_SUPPORT 13 #include "imx6_spl.h" 14 15 #define CONFIG_SYS_UBOOT_START CONFIG_SYS_TEXT_BASE 16 #define CONFIG_SYS_UBOOT_BASE (CONFIG_SYS_FLASH_BASE + 0x80000) 17 #define CONFIG_SPL_OS_BOOT 18 #define CONFIG_SYS_OS_BASE (CONFIG_SYS_FLASH_BASE + 0x180000) 19 #define CONFIG_SYS_FDT_BASE (CONFIG_SYS_FLASH_BASE + 0x1980000) 20 #define CONFIG_SYS_FDT_SIZE (48 * SZ_1K) 21 #define CONFIG_SYS_SPL_ARGS_ADDR 0x18000000 22 23 /* 24 * Below defines are set but NOT really used since we by 25 * design force U-Boot run when we boot in development 26 * mode from SD card (SD2) 27 */ 28 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR (0x800) 29 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (0x80) 30 #define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR (0x1000) 31 #define CONFIG_SPL_FS_LOAD_KERNEL_NAME "uImage" 32 #define CONFIG_SPL_FS_LOAD_ARGS_NAME "imx6q-mccmon.dtb" 33 34 /* Size of malloc() pool */ 35 #define CONFIG_SYS_MALLOC_LEN (10 * SZ_1M) 36 37 #define CONFIG_BOARD_EARLY_INIT_F 38 #define CONFIG_BOARD_LATE_INIT 39 40 #define CONFIG_MXC_UART 41 #define CONFIG_MXC_UART_BASE UART1_BASE 42 43 #define CONFIG_SYS_MEMTEST_START 0x10000000 44 #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + 500 * SZ_1M) 45 46 #define CONFIG_SF_DEFAULT_BUS 2 47 #define CONFIG_SF_DEFAULT_CS 0 48 #define CONFIG_SF_DEFAULT_SPEED 25000000 49 #define CONFIG_SF_DEFAULT_MODE (SPI_MODE_0) 50 51 /* I2C Configs */ 52 #define CONFIG_SYS_I2C 53 #define CONFIG_SYS_I2C_MXC 54 #define CONFIG_SYS_I2C_MXC_I2C1 /* enable I2C bus 1 */ 55 #define CONFIG_SYS_I2C_MXC_I2C2 /* enable I2C bus 2 */ 56 #define CONFIG_SYS_I2C_SPEED 100000 57 58 /* MMC Configuration */ 59 #define CONFIG_SYS_FSL_USDHC_NUM 2 60 #define CONFIG_SYS_FSL_ESDHC_ADDR 0 61 62 /* NOR 16-bit mode */ 63 #define CONFIG_SYS_FLASH_BASE WEIM_ARB_BASE_ADDR 64 #define CONFIG_SYS_FLASH_PROTECTION 65 #define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT 66 #define CONFIG_SYS_FLASH_CFI /* Flash memory is CFI compliant */ 67 #define CONFIG_SYS_FLASH_USE_BUFFER_WRITE /* Use buffered writes*/ 68 #define CONFIG_SYS_FLASH_EMPTY_INFO 69 #define CONFIG_FLASH_CFI_DRIVER /* Use drivers/cfi_flash.c */ 70 #define CONFIG_FLASH_VERIFY 71 72 /* NOR Flash MTD */ 73 #define CONFIG_FLASH_CFI_DRIVER 74 #define CONFIG_FLASH_CFI_MTD 75 #define CONFIG_SYS_MAX_FLASH_BANKS_DETECT 1 76 #define CONFIG_SYS_FLASH_BANKS_LIST { (CONFIG_SYS_FLASH_BASE) } 77 #define CONFIG_SYS_FLASH_BANKS_SIZES { (32 * SZ_1M) } 78 79 /* MTD support */ 80 81 /* USB Configs */ 82 #define CONFIG_USB_MAX_CONTROLLER_COUNT 2 83 #define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW) 84 #define CONFIG_MXC_USB_FLAGS 0 85 86 /* Ethernet Configuration */ 87 #define CONFIG_FEC_MXC 88 #define CONFIG_MII 89 #define IMX_FEC_BASE ENET_BASE_ADDR 90 #define CONFIG_FEC_XCV_TYPE RGMII 91 #define CONFIG_ETHPRIME "FEC" 92 #define CONFIG_FEC_MXC_PHYADDR 1 93 94 #define CONFIG_EXTRA_ENV_SETTINGS \ 95 "console=ttymxc0,115200 quiet\0" \ 96 "fdtfile=imx6q-mccmon6.dtb\0" \ 97 "fdt_high=0xffffffff\0" \ 98 "initrd_high=0xffffffff\0" \ 99 "boot_os=yes\0" \ 100 "download_kernel=" \ 101 "tftpboot ${kernel_addr} ${kernel_file};" \ 102 "tftpboot ${fdt_addr} ${fdtfile};\0" \ 103 "get_boot_medium=" \ 104 "setenv boot_medium nor;" \ 105 "setexpr.l _src_sbmr1 *0x020d8004;" \ 106 "setexpr _b_medium ${_src_sbmr1} '&' 0x00000040;" \ 107 "if test ${_b_medium} = 40; then " \ 108 "setenv boot_medium sdcard;" \ 109 "fi\0" \ 110 "kernel_file=uImage\0" \ 111 "load_kernel=" \ 112 "load mmc ${bootdev}:${bootpart} ${kernel_addr} uImage;" \ 113 "load mmc ${bootdev}:${bootpart} ${fdt_addr} ${fdtfile};\0" \ 114 "boot_sd=" \ 115 "echo '#######################';" \ 116 "echo '# Factory SDcard Boot #';" \ 117 "echo '#######################';" \ 118 "setenv mmcdev 1;" \ 119 "setenv mmcfactorydev 0;" \ 120 "setenv mmcfactorypart 1;" \ 121 "run factory_flash_img;\0" \ 122 "boot_nor=" \ 123 "setenv kernelnor 0x08180000;" \ 124 "setenv dtbnor 0x09980000;" \ 125 "setenv bootargs console=${console} " \ 126 CONFIG_MTDPARTS_DEFAULT " " \ 127 "root=/dev/mmcblk1 rootfstype=ext4 rw rootwait noinitrd;" \ 128 "cp.l ${dtbnor} ${dtbloadaddr} 0x8000;" \ 129 "bootm ${kernelnor} - ${dtbloadaddr};\0" \ 130 "boot_recovery=" \ 131 "echo '#######################';" \ 132 "echo '# RECOVERY SWU Boot #';" \ 133 "echo '#######################';" \ 134 "setenv rootfsloadaddr 0x13000000;" \ 135 "setenv swukernelnor 0x08980000;" \ 136 "setenv swurootfsnor 0x09180000;" \ 137 "setenv swudtbnor 0x099A0000;" \ 138 "setenv bootargs console=${console} " \ 139 CONFIG_MTDPARTS_DEFAULT " " \ 140 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \ 141 ":${hostname}::off root=/dev/ram rw;" \ 142 "cp.l ${swurootfsnor} ${rootfsloadaddr} 0x200000;" \ 143 "cp.l ${swudtbnor} ${dtbloadaddr} 0x8000;" \ 144 "bootm ${swukernelnor} ${rootfsloadaddr} ${dtbloadaddr};\0" \ 145 "boot_tftp=" \ 146 "echo '#######################';" \ 147 "echo '# TFTP Boot #';" \ 148 "echo '#######################';" \ 149 "if run download_kernel; then " \ 150 "setenv bootargs console=${console} " \ 151 "root=/dev/mmcblk0p2 rootwait;" \ 152 "bootm ${kernel_addr} - ${fdt_addr};" \ 153 "fi\0" \ 154 "bootcmd=" \ 155 "if test -n ${recovery_status}; then " \ 156 "run boot_recovery;" \ 157 "else " \ 158 "if test ! -n ${boot_medium}; then " \ 159 "run get_boot_medium;" \ 160 "if test ${boot_medium} = sdcard; then " \ 161 "run boot_sd;" \ 162 "else " \ 163 "run boot_nor;" \ 164 "fi;" \ 165 "else " \ 166 "if test ${boot_medium} = tftp; then " \ 167 "run boot_tftp;" \ 168 "fi;" \ 169 "fi;" \ 170 "fi\0" \ 171 "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \ 172 "fdt_addr=0x18000000\0" \ 173 "bootdev=1\0" \ 174 "bootpart=1\0" \ 175 "kernel_addr=" __stringify(CONFIG_LOADADDR) "\0" \ 176 "netdev=eth0\0" \ 177 "load_addr=0x11000000\0" \ 178 "dtbloadaddr=0x12000000\0" \ 179 "uboot_file=u-boot.img\0" \ 180 "SPL_file=SPL\0" \ 181 "load_uboot=tftp ${load_addr} ${uboot_file}\0" \ 182 "nor_img_addr=0x11000000\0" \ 183 "nor_img_file=core-image-lwn-mccmon6.nor\0" \ 184 "emmc_img_file=core-image-lwn-mccmon6.ext4\0" \ 185 "nor_bank_start=" __stringify(CONFIG_SYS_FLASH_BASE) "\0" \ 186 "nor_img_size=0x02000000\0" \ 187 "factory_script_file=factory.scr\0" \ 188 "factory_load_script=" \ 189 "if test -e mmc ${mmcdev}:${mmcfactorypart} " \ 190 "${factory_script_file}; then " \ 191 "load mmc ${mmcdev}:${mmcfactorypart} " \ 192 "${loadaddr} ${factory_script_file};" \ 193 "fi\0" \ 194 "factory_script=echo Running factory script from mmc${mmcdev} ...; " \ 195 "source ${loadaddr}\0" \ 196 "factory_flash_img="\ 197 "echo 'Flash mccmon6 with factory images'; " \ 198 "if run factory_load_script; then " \ 199 "run factory_script;" \ 200 "else " \ 201 "echo No factory script: ${factory_script_file} found on " \ 202 "device ${mmcdev};" \ 203 "run factory_nor_img;" \ 204 "run factory_eMMC_img;" \ 205 "fi\0" \ 206 "factory_eMMC_img="\ 207 "echo 'Update mccmon6 eMMC image'; " \ 208 "if load mmc ${mmcdev}:${mmcfactorypart} " \ 209 "${loadaddr} ${emmc_img_file}; then " \ 210 "setexpr fw_sz ${filesize} / 0x200;" \ 211 "setexpr fw_sz ${fw_sz} + 1;" \ 212 "mmc dev ${mmcfactorydev};" \ 213 "mmc write ${loadaddr} 0x0 ${fw_sz};" \ 214 "fi\0" \ 215 "factory_nor_img="\ 216 "echo 'Update mccmon6 NOR image'; " \ 217 "if load mmc ${mmcdev}:${mmcfactorypart} " \ 218 "${nor_img_addr} ${nor_img_file}; then " \ 219 "run nor_update;" \ 220 "fi\0" \ 221 "nor_update=" \ 222 "protect off ${nor_bank_start} +${nor_img_size};" \ 223 "erase ${nor_bank_start} +${nor_img_size};" \ 224 "setexpr nor_img_size ${nor_img_size} / 4; " \ 225 "cp.l ${nor_img_addr} ${nor_bank_start} ${nor_img_size}\0" \ 226 "tftp_nor_uboot="\ 227 "echo 'Update mccmon6 NOR U-BOOT via TFTP'; " \ 228 "setenv nor_img_file u-boot.img; " \ 229 "setenv nor_img_size 0x80000; " \ 230 "setenv nor_bank_start 0x08080000; " \ 231 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \ 232 "run nor_update;" \ 233 "fi\0" \ 234 "tftp_nor_uImg="\ 235 "echo 'Update mccmon6 NOR uImage via TFTP'; " \ 236 "setenv nor_img_file uImage; " \ 237 "setenv nor_img_size 0x500000; " \ 238 "setenv nor_bank_start 0x08180000; " \ 239 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \ 240 "run nor_update;" \ 241 "fi\0" \ 242 "tftp_nor_dtb="\ 243 "echo 'Update mccmon6 NOR DTB via TFTP'; " \ 244 "setenv nor_img_file imx6q-mccmon6.dtb; " \ 245 "setenv nor_img_size 0x20000; " \ 246 "setenv nor_bank_start 0x09980000; " \ 247 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \ 248 "run nor_update;" \ 249 "fi\0" \ 250 "tftp_nor_img="\ 251 "echo 'Update mccmon6 NOR image via TFTP'; " \ 252 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \ 253 "run nor_update;" \ 254 "fi\0" \ 255 "tftp_nor_SPL="\ 256 "if tftp ${load_addr} SPL_padded; then " \ 257 "erase 0x08000000 +0x20000;" \ 258 "cp.b ${load_addr} 0x08000000 0x20000;" \ 259 "fi;\0" \ 260 "tftp_sd_SPL="\ 261 "if mmc dev 1; then " \ 262 "if tftp ${load_addr} ${SPL_file}; then " \ 263 "setexpr fw_sz ${filesize} / 0x200; " \ 264 "setexpr fw_sz ${fw_sz} + 1; " \ 265 "mmc write ${load_addr} 0x2 ${fw_sz};" \ 266 "fi;" \ 267 "fi;\0" \ 268 "tftp_sd_uboot="\ 269 "if mmc dev 1; then " \ 270 "if run load_uboot; then " \ 271 "setexpr fw_sz ${filesize} / 0x200; " \ 272 "setexpr fw_sz ${fw_sz} + 1; " \ 273 "mmc write ${load_addr} 0x8A ${fw_sz};" \ 274 "fi;" \ 275 "fi;\0" 276 277 /* Physical Memory Map */ 278 #define CONFIG_NR_DRAM_BANKS 1 279 #define PHYS_SDRAM MMDC0_ARB_BASE_ADDR 280 281 #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM 282 #define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR 283 #define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE 284 285 #define CONFIG_SYS_INIT_SP_OFFSET \ 286 (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) 287 #define CONFIG_SYS_INIT_SP_ADDR \ 288 (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET) 289 290 /* Environment organization */ 291 #define CONFIG_ENV_SIZE (SZ_128K) 292 293 /* Envs are stored in NOR flash */ 294 #define CONFIG_ENV_SECT_SIZE (SZ_128K) 295 #define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE + 0x40000) 296 297 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT 298 #define CONFIG_ENV_ADDR_REDUND (CONFIG_SYS_FLASH_BASE + 0x60000) 299 #define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE 300 301 #endif /* __CONFIG_H * */ 302