1 /* 2 * Copyright (C) 2013 Gateworks Corporation 3 * 4 * SPDX-License-Identifier: GPL-2.0+ 5 */ 6 7 #ifndef __CONFIG_H 8 #define __CONFIG_H 9 10 /* SPL */ 11 /* Location in NAND to read U-Boot from */ 12 #define CONFIG_SYS_NAND_U_BOOT_OFFS (14 * SZ_1M) 13 14 /* Falcon Mode */ 15 #define CONFIG_SYS_SPL_ARGS_ADDR 0x18000000 16 #define CONFIG_CMD_SPL_WRITE_SIZE (128 * SZ_1K) 17 18 /* Falcon Mode - NAND support: args@17MB kernel@18MB */ 19 #define CONFIG_SYS_NAND_SPL_KERNEL_OFFS (18 * SZ_1M) 20 21 /* Falcon Mode - MMC support: args@1MB kernel@2MB */ 22 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x800 /* 1MB */ 23 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (CONFIG_CMD_SPL_WRITE_SIZE / 512) 24 #define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x1000 /* 2MB */ 25 26 #include "imx6_spl.h" /* common IMX6 SPL configuration */ 27 #include "mx6_common.h" 28 #define CONFIG_DISPLAY_BOARDINFO_LATE 29 30 #define CONFIG_MACH_TYPE 4520 /* Gateworks Ventana Platform */ 31 32 /* Serial ATAG */ 33 #define CONFIG_SERIAL_TAG 34 35 /* Size of malloc() pool */ 36 #define CONFIG_SYS_MALLOC_LEN (10 * SZ_1M) 37 38 /* Init Functions */ 39 #define CONFIG_MISC_INIT_R 40 41 /* Driver Model */ 42 #ifndef CONFIG_SPL_BUILD 43 #define CONFIG_DM_GPIO 44 #define CONFIG_DM_THERMAL 45 #endif 46 47 /* Thermal */ 48 #define CONFIG_IMX_THERMAL 49 50 /* Serial */ 51 #define CONFIG_MXC_UART 52 #define CONFIG_MXC_UART_BASE UART2_BASE 53 54 #ifdef CONFIG_SPI_FLASH 55 56 /* SPI */ 57 #ifdef CONFIG_CMD_SF 58 #define CONFIG_MXC_SPI 59 #define CONFIG_SPI_FLASH_MTD 60 #define CONFIG_SPI_FLASH_BAR 61 #define CONFIG_SF_DEFAULT_BUS 0 62 #define CONFIG_SF_DEFAULT_CS 0 63 /* GPIO 3-19 (21248) */ 64 #define CONFIG_SF_DEFAULT_SPEED 30000000 65 #define CONFIG_SF_DEFAULT_MODE (SPI_MODE_0) 66 #endif 67 68 #elif defined(CONFIG_SPL_NAND_SUPPORT) 69 /* Enable NAND support */ 70 #ifdef CONFIG_CMD_NAND 71 #define CONFIG_NAND_MXS 72 #define CONFIG_SYS_MAX_NAND_DEVICE 1 73 #define CONFIG_SYS_NAND_BASE 0x40000000 74 #define CONFIG_SYS_NAND_5_ADDR_CYCLE 75 #define CONFIG_SYS_NAND_ONFI_DETECTION 76 77 /* DMA stuff, needed for GPMI/MXS NAND support */ 78 #define CONFIG_APBH_DMA 79 #define CONFIG_APBH_DMA_BURST 80 #define CONFIG_APBH_DMA_BURST8 81 #endif 82 83 #endif /* CONFIG_SPI_FLASH */ 84 85 /* I2C Configs */ 86 #define CONFIG_SYS_I2C 87 #define CONFIG_SYS_I2C_MXC 88 #define CONFIG_SYS_I2C_MXC_I2C1 /* enable I2C bus 1 */ 89 #define CONFIG_SYS_I2C_MXC_I2C2 /* enable I2C bus 2 */ 90 #define CONFIG_SYS_I2C_MXC_I2C3 /* enable I2C bus 3 */ 91 #define CONFIG_SYS_I2C_SPEED 100000 92 #define CONFIG_I2C_GSC 0 93 #define CONFIG_I2C_EDID 94 95 /* MMC Configs */ 96 #define CONFIG_SYS_FSL_ESDHC_ADDR 0 97 98 /* eMMC Configs */ 99 #define CONFIG_SUPPORT_EMMC_BOOT 100 #define CONFIG_SUPPORT_EMMC_RPMB 101 102 /* 103 * SATA Configs 104 */ 105 #ifdef CONFIG_CMD_SATA 106 #define CONFIG_DWC_AHSATA 107 #define CONFIG_SYS_SATA_MAX_DEVICE 1 108 #define CONFIG_DWC_AHSATA_PORT_ID 0 109 #define CONFIG_DWC_AHSATA_BASE_ADDR SATA_ARB_BASE_ADDR 110 #define CONFIG_LBA48 111 #define CONFIG_LIBATA 112 #endif 113 114 /* 115 * PCI express 116 */ 117 #ifdef CONFIG_CMD_PCI 118 #define CONFIG_PCI_SCAN_SHOW 119 #define CONFIG_PCI_FIXUP_DEV 120 #define CONFIG_PCIE_IMX 121 #endif 122 123 /* 124 * PMIC 125 */ 126 #define CONFIG_POWER 127 #define CONFIG_POWER_I2C 128 #define CONFIG_POWER_PFUZE100 129 #define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08 130 #define CONFIG_POWER_LTC3676 131 #define CONFIG_POWER_LTC3676_I2C_ADDR 0x3c 132 133 /* Various command support */ 134 #define CONFIG_CMD_UNZIP /* gzwrite */ 135 136 /* Ethernet support */ 137 #define CONFIG_FEC_MXC 138 #define CONFIG_MII 139 #define IMX_FEC_BASE ENET_BASE_ADDR 140 #define CONFIG_FEC_XCV_TYPE RGMII 141 #define CONFIG_FEC_MXC_PHYADDR 0 142 #define CONFIG_ARP_TIMEOUT 200UL 143 144 /* USB Configs */ 145 #define CONFIG_USB_HOST_ETHER 146 #define CONFIG_USB_ETHER_ASIX 147 #define CONFIG_USB_ETHER_SMSC95XX 148 #define CONFIG_USB_MAX_CONTROLLER_COUNT 2 149 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET /* For OTG port */ 150 #define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW) 151 #define CONFIG_MXC_USB_FLAGS 0 152 #define CONFIG_USBD_HS 153 #define CONFIG_USB_ETHER 154 #define CONFIG_USB_ETH_CDC 155 #define CONFIG_NETCONSOLE 156 #define CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP 157 158 /* USB Mass Storage Gadget */ 159 #define CONFIG_USB_FUNCTION_MASS_STORAGE 160 161 /* Framebuffer and LCD */ 162 #define CONFIG_VIDEO_IPUV3 163 #define CONFIG_VIDEO_LOGO 164 #define CONFIG_IPUV3_CLK 260000000 165 #define CONFIG_IMX_HDMI 166 #define CONFIG_IMX_VIDEO_SKIP 167 #define CONFIG_VIDEO_BMP_LOGO 168 #define CONFIG_SPLASH_SCREEN_ALIGN 169 #define CONFIG_HIDE_LOGO_VERSION /* Custom config to hide U-boot version */ 170 171 /* Miscellaneous configurable options */ 172 #define CONFIG_HWCONFIG 173 #define CONFIG_PREBOOT 174 175 /* Print Buffer Size */ 176 #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16) 177 178 /* Memory configuration */ 179 #define CONFIG_SYS_MEMTEST_START 0x10000000 180 #define CONFIG_SYS_MEMTEST_END 0x10010000 181 #define CONFIG_SYS_MEMTEST_SCRATCH 0x10800000 182 183 /* Physical Memory Map */ 184 #define CONFIG_NR_DRAM_BANKS 1 185 #define PHYS_SDRAM MMDC0_ARB_BASE_ADDR 186 #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM 187 #define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR 188 #define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE 189 190 #define CONFIG_SYS_INIT_SP_OFFSET \ 191 (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) 192 #define CONFIG_SYS_INIT_SP_ADDR \ 193 (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET) 194 195 /* 196 * MTD Command for mtdparts 197 */ 198 #define CONFIG_MTD_DEVICE 199 #define CONFIG_MTD_PARTITIONS 200 #ifdef CONFIG_SPI_FLASH 201 #define MTDIDS_DEFAULT "nor0=nor" 202 #define MTDPARTS_DEFAULT \ 203 "mtdparts=nor:512k(uboot),64k(env),2m(kernel),-(rootfs)" 204 #else 205 #define MTDIDS_DEFAULT "nand0=nand" 206 #define MTDPARTS_DEFAULT "mtdparts=nand:16m(uboot),1m(env),-(rootfs)" 207 #endif 208 209 /* Persistent Environment Config */ 210 #if defined(CONFIG_ENV_IS_IN_MMC) 211 #define CONFIG_SYS_MMC_ENV_DEV 0 212 #define CONFIG_SYS_MMC_ENV_PART 1 213 #define CONFIG_ENV_OFFSET (709 * SZ_1K) 214 #define CONFIG_ENV_SIZE (128 * SZ_1K) 215 #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + (128 * SZ_1K)) 216 #elif defined(CONFIG_ENV_IS_IN_NAND) 217 #define CONFIG_ENV_OFFSET (16 * SZ_1M) 218 #define CONFIG_ENV_SECT_SIZE (128 * SZ_1K) 219 #define CONFIG_ENV_SIZE CONFIG_ENV_SECT_SIZE 220 #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + (512 * SZ_1K)) 221 #define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE 222 #elif defined(CONFIG_ENV_IS_IN_SPI_FLASH) 223 #define CONFIG_ENV_OFFSET (512 * SZ_1K) 224 #define CONFIG_ENV_SECT_SIZE (64 * SZ_1K) 225 #define CONFIG_ENV_SIZE (8 * SZ_1K) 226 #define CONFIG_ENV_SPI_BUS CONFIG_SF_DEFAULT_BUS 227 #define CONFIG_ENV_SPI_CS CONFIG_SF_DEFAULT_CS 228 #define CONFIG_ENV_SPI_MODE CONFIG_SF_DEFAULT_MODE 229 #define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED 230 #endif 231 232 /* Environment */ 233 #define CONFIG_IPADDR 192.168.1.1 234 #define CONFIG_SERVERIP 192.168.1.146 235 236 #define CONFIG_EXTRA_ENV_SETTINGS_COMMON \ 237 "pcidisable=1\0" \ 238 "splashpos=m,m\0" \ 239 "usb_pgood_delay=2000\0" \ 240 "console=ttymxc1\0" \ 241 "bootdevs=usb mmc sata flash\0" \ 242 "hwconfig=_UNKNOWN_\0" \ 243 "video=\0" \ 244 \ 245 "mtdparts=" MTDPARTS_DEFAULT "\0" \ 246 "mtdids=" MTDIDS_DEFAULT "\0" \ 247 "disk=0\0" \ 248 "part=1\0" \ 249 \ 250 "fdt_high=0xffffffff\0" \ 251 "fdt_addr=0x18000000\0" \ 252 "initrd_high=0xffffffff\0" \ 253 "fixfdt=" \ 254 "fdt addr ${fdt_addr}\0" \ 255 "bootdir=boot\0" \ 256 "loadfdt=" \ 257 "if ${fsload} ${fdt_addr} ${bootdir}/${fdt_file}; then " \ 258 "echo Loaded DTB from ${bootdir}/${fdt_file}; " \ 259 "run fixfdt; " \ 260 "elif ${fsload} ${fdt_addr} ${bootdir}/${fdt_file1}; then " \ 261 "echo Loaded DTB from ${bootdir}/${fdt_file1}; " \ 262 "run fixfdt; " \ 263 "elif ${fsload} ${fdt_addr} ${bootdir}/${fdt_file2}; then " \ 264 "echo Loaded DTB from ${bootdir}/${fdt_file2}; " \ 265 "run fixfdt; " \ 266 "fi\0" \ 267 \ 268 "fs=ext4\0" \ 269 "script=6x_bootscript-ventana\0" \ 270 "loadscript=" \ 271 "if ${fsload} ${loadaddr} ${bootdir}/${script}; then " \ 272 "source ${loadaddr}; " \ 273 "fi\0" \ 274 \ 275 "uimage=uImage\0" \ 276 "mmc_root=mmcblk0p1\0" \ 277 "mmc_boot=" \ 278 "setenv fsload \"${fs}load mmc ${disk}:${part}\"; " \ 279 "mmc dev ${disk} && mmc rescan && " \ 280 "setenv dtype mmc; run loadscript; " \ 281 "if ${fsload} ${loadaddr} ${bootdir}/${uimage}; then " \ 282 "setenv bootargs console=${console},${baudrate} " \ 283 "root=/dev/${mmc_root} rootfstype=${fs} " \ 284 "rootwait rw ${video} ${extra}; " \ 285 "if run loadfdt; then " \ 286 "bootm ${loadaddr} - ${fdt_addr}; " \ 287 "else " \ 288 "bootm; " \ 289 "fi; " \ 290 "fi\0" \ 291 \ 292 "sata_boot=" \ 293 "setenv fsload \"${fs}load sata ${disk}:${part}\"; " \ 294 "sata init && " \ 295 "setenv dtype sata; run loadscript; " \ 296 "if ${fsload} ${loadaddr} ${bootdir}/${uimage}; then " \ 297 "setenv bootargs console=${console},${baudrate} " \ 298 "root=/dev/sda1 rootfstype=${fs} " \ 299 "rootwait rw ${video} ${extra}; " \ 300 "if run loadfdt; then " \ 301 "bootm ${loadaddr} - ${fdt_addr}; " \ 302 "else " \ 303 "bootm; " \ 304 "fi; " \ 305 "fi\0" \ 306 "usb_boot=" \ 307 "setenv fsload \"${fs}load usb ${disk}:${part}\"; " \ 308 "usb start && usb dev ${disk} && " \ 309 "setenv dtype usb; run loadscript; " \ 310 "if ${fsload} ${loadaddr} ${bootdir}/${uimage}; then " \ 311 "setenv bootargs console=${console},${baudrate} " \ 312 "root=/dev/sda1 rootfstype=${fs} " \ 313 "rootwait rw ${video} ${extra}; " \ 314 "if run loadfdt; then " \ 315 "bootm ${loadaddr} - ${fdt_addr}; " \ 316 "else " \ 317 "bootm; " \ 318 "fi; " \ 319 "fi\0" 320 321 #ifdef CONFIG_SPI_FLASH 322 #define CONFIG_EXTRA_ENV_SETTINGS \ 323 CONFIG_EXTRA_ENV_SETTINGS_COMMON \ 324 "image_os=ventana/openwrt-imx6-imx6q-gw5400-a-squashfs.bin\0" \ 325 "image_uboot=ventana/u-boot_spi.imx\0" \ 326 \ 327 "spi_koffset=0x90000\0" \ 328 "spi_klen=0x200000\0" \ 329 \ 330 "spi_updateuboot=echo Updating uboot from " \ 331 "${serverip}:${image_uboot}...; " \ 332 "tftpboot ${loadaddr} ${image_uboot} && " \ 333 "sf probe && sf erase 0 80000 && " \ 334 "sf write ${loadaddr} 400 ${filesize}\0" \ 335 "spi_update=echo Updating OS from ${serverip}:${image_os} " \ 336 "to ${spi_koffset} ...; " \ 337 "tftp ${loadaddr} ${image_os} && " \ 338 "sf probe && " \ 339 "sf update ${loadaddr} ${spi_koffset} ${filesize}\0" \ 340 \ 341 "flash_boot=" \ 342 "if sf probe && " \ 343 "sf read ${loadaddr} ${spi_koffset} ${spi_klen}; then " \ 344 "setenv bootargs console=${console},${baudrate} " \ 345 "root=/dev/mtdblock3 " \ 346 "rootfstype=squashfs,jffs2 " \ 347 "${video} ${extra}; " \ 348 "bootm; " \ 349 "fi\0" 350 #else 351 #define CONFIG_EXTRA_ENV_SETTINGS \ 352 CONFIG_EXTRA_ENV_SETTINGS_COMMON \ 353 \ 354 "image_rootfs=openwrt-imx6-ventana-rootfs.ubi\0" \ 355 "nand_update=echo Updating NAND from ${serverip}:${image_rootfs}...; " \ 356 "tftp ${loadaddr} ${image_rootfs} && " \ 357 "nand erase.part rootfs && " \ 358 "nand write ${loadaddr} rootfs ${filesize}\0" \ 359 \ 360 "flash_boot=" \ 361 "setenv fsload 'ubifsload'; " \ 362 "ubi part rootfs; " \ 363 "if ubi check boot; then " \ 364 "ubifsmount ubi0:boot; " \ 365 "setenv root ubi0:rootfs ubi.mtd=2 " \ 366 "rootfstype=squashfs,ubifs; " \ 367 "setenv bootdir; " \ 368 "elif ubi check rootfs; then " \ 369 "ubifsmount ubi0:rootfs; " \ 370 "setenv root ubi0:rootfs ubi.mtd=2 " \ 371 "rootfstype=ubifs; " \ 372 "fi; " \ 373 "setenv dtype nand; run loadscript; " \ 374 "if ${fsload} ${loadaddr} ${bootdir}/${uimage}; then " \ 375 "setenv bootargs console=${console},${baudrate} " \ 376 "root=${root} ${video} ${extra}; " \ 377 "if run loadfdt; then " \ 378 "ubifsumount; " \ 379 "bootm ${loadaddr} - ${fdt_addr}; " \ 380 "else " \ 381 "ubifsumount; bootm; " \ 382 "fi; " \ 383 "fi\0" 384 #endif 385 386 #define CONFIG_BOOTCOMMAND \ 387 "for btype in ${bootdevs}; do " \ 388 "echo; echo Attempting ${btype} boot...; " \ 389 "if run ${btype}_boot; then; fi; " \ 390 "done" 391 392 #endif /* __CONFIG_H */ 393