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