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