1 /* 2 * Copyright (C) 2013, 2014 Markus Niebel <Markus.Niebel@tq-group.com> 3 * 4 * Configuration settings for the TQ Systems TQMa6<Q,S> module. 5 * 6 * SPDX-License-Identifier: GPL-2.0+ 7 */ 8 9 #ifndef __CONFIG_H 10 #define __CONFIG_H 11 12 #define CONFIG_MX6 13 14 /* SPL */ 15 /* #if defined(CONFIG_SPL_BUILD) */ 16 17 #define CONFIG_SPL_MMC_SUPPORT 18 #define CONFIG_SPL_SPI_SUPPORT 19 #define CONFIG_SPL_FAT_SUPPORT 20 #define CONFIG_SPL_EXT_SUPPORT 21 22 /* common IMX6 SPL configuration */ 23 #include "imx6_spl.h" 24 25 /* #endif */ 26 27 #include "mx6_common.h" 28 #include <asm/arch/imx-regs.h> 29 #include <asm/imx-common/gpio.h> 30 #include <linux/sizes.h> 31 32 #if defined(CONFIG_MX6DL) || defined(CONFIG_MX6S) 33 #define PHYS_SDRAM_SIZE (512u * SZ_1M) 34 #elif defined(CONFIG_MX6Q) || defined(CONFIG_MX6D) 35 #define PHYS_SDRAM_SIZE (1024u * SZ_1M) 36 #endif 37 38 #if defined(CONFIG_MBA6) 39 40 #if defined(CONFIG_MX6DL) || defined(CONFIG_MX6S) 41 #define CONFIG_DEFAULT_FDT_FILE "imx6dl-mba6x.dtb" 42 #elif defined(CONFIG_MX6Q) || defined(CONFIG_MX6Q) 43 #define CONFIG_DEFAULT_FDT_FILE "imx6q-mba6x.dtb" 44 #endif 45 46 #endif 47 48 #define CONFIG_DISPLAY_CPUINFO 49 #define CONFIG_DISPLAY_BOARDINFO 50 #define CONFIG_SYS_GENERIC_BOARD 51 52 #define CONFIG_CMDLINE_TAG 53 #define CONFIG_SETUP_MEMORY_TAGS 54 #define CONFIG_INITRD_TAG 55 #define CONFIG_REVISION_TAG 56 57 #define CONFIG_BOARD_EARLY_INIT_F 58 #define CONFIG_BOARD_LATE_INIT 59 60 #define CONFIG_MXC_GPIO 61 #define CONFIG_MXC_UART 62 63 /* SPI */ 64 #define CONFIG_CMD_SPI 65 #define CONFIG_MXC_SPI 66 67 /* SPI Flash */ 68 #define CONFIG_SPI_FLASH 69 #define CONFIG_SPI_FLASH_STMICRO 70 71 #define TQMA6_SPI_FLASH_SECTOR_SIZE SZ_64K 72 73 #define CONFIG_CMD_SF 74 #define CONFIG_SF_DEFAULT_BUS 0 75 #define CONFIG_SF_DEFAULT_CS 0 76 #define CONFIG_SF_DEFAULT_SPEED 50000000 77 #define CONFIG_SF_DEFAULT_MODE (SPI_MODE_0) 78 79 /* I2C Configs */ 80 #define CONFIG_CMD_I2C 81 #define CONFIG_SYS_I2C 82 #define CONFIG_SYS_I2C_MXC 83 #define CONFIG_I2C_MULTI_BUS 84 #define CONFIG_SYS_I2C_SPEED 100000 85 86 /* I2C SYSMON (LM75) */ 87 #define CONFIG_DTT_LM75 88 #if defined(CONFIG_MBA6) 89 #define CONFIG_DTT_SENSORS { 0, 1 } 90 #else 91 #define CONFIG_DTT_SENSORS { 0 } 92 #endif 93 #define CONFIG_DTT_MAX_TEMP 70 94 #define CONFIG_DTT_MIN_TEMP -30 95 #define CONFIG_DTT_HYSTERESIS 3 96 #define CONFIG_CMD_DTT 97 98 /* I2C EEPROM (M24C64) */ 99 #define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 100 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2 101 #define CONFIG_SYS_I2C_EEPROM_PAGE_WRITE_BITS 5 /* 32 Bytes */ 102 #define CONFIG_SYS_I2C_EEPROM_PAGE_WRITE_DELAY_MS 20 103 #define CONFIG_CMD_EEPROM 104 105 #define CONFIG_POWER 106 #define CONFIG_POWER_I2C 107 #define CONFIG_POWER_PFUZE100 108 #define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08 109 #define TQMA6_PFUZE100_I2C_BUS 2 110 111 /* MMC Configs */ 112 #define CONFIG_FSL_ESDHC 113 #define CONFIG_FSL_USDHC 114 #define CONFIG_SYS_FSL_ESDHC_ADDR 0 115 116 #define CONFIG_MMC 117 #define CONFIG_CMD_MMC 118 #define CONFIG_GENERIC_MMC 119 #define CONFIG_BOUNCE_BUFFER 120 121 /* USB Configs */ 122 #define CONFIG_CMD_USB 123 #define CONFIG_USB_EHCI 124 #define CONFIG_USB_EHCI_MX6 125 #define CONFIG_USB_STORAGE 126 #define CONFIG_USB_HOST_ETHER 127 #define CONFIG_USB_ETHER_SMSC95XX 128 #define CONFIG_MXC_USB_PORT 1 129 #define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW) 130 #define CONFIG_MXC_USB_FLAGS 0 131 132 /* Fuses */ 133 #define CONFIG_MXC_OCOTP 134 #define CONFIG_CMD_FUSE 135 136 #define CONFIG_CMD_EXT2 137 #define CONFIG_CMD_FAT 138 #define CONFIG_DOS_PARTITION 139 140 #define CONFIG_CMD_PING 141 #define CONFIG_CMD_DHCP 142 #define CONFIG_CMD_MII 143 #define CONFIG_CMD_NET 144 145 #define CONFIG_FEC_MXC 146 #define IMX_FEC_BASE ENET_BASE_ADDR 147 #define CONFIG_PHYLIB 148 #define CONFIG_MII 149 150 #if defined(CONFIG_MBA6) 151 152 #define CONFIG_FEC_XCV_TYPE RGMII 153 #define CONFIG_ETHPRIME "FEC" 154 155 #define CONFIG_FEC_MXC_PHYADDR 0x03 156 #define CONFIG_PHY_MICREL 157 #define CONFIG_PHY_KSZ9031 158 159 #else 160 161 #error "define PHY to use for your baseboard" 162 163 #endif 164 165 #define CONFIG_ARP_TIMEOUT 200UL 166 /* Network config - Allow larger/faster download for TFTP/NFS */ 167 #define CONFIG_IP_DEFRAG 168 #define CONFIG_TFTP_BLOCKSIZE 4096 169 #define CONFIG_NFS_READ_SIZE 4096 170 171 #if defined(CONFIG_MBA6) 172 173 #define CONFIG_MXC_UART_BASE UART2_BASE 174 #define CONFIG_CONSOLE_DEV "ttymxc1" 175 176 #else 177 178 #error "define baseboard specific things (uart, number of SD-card slots)" 179 180 #endif 181 182 /* allow to overwrite serial and ethaddr */ 183 #define CONFIG_ENV_OVERWRITE 184 #define CONFIG_CONS_INDEX 1 185 #define CONFIG_BAUDRATE 115200 186 187 /* Command definition */ 188 #include <config_cmd_default.h> 189 190 #define CONFIG_CMD_BMODE 191 #define CONFIG_CMD_BOOTZ 192 #define CONFIG_CMD_ITEST 193 #define CONFIG_CMD_SETEXPR 194 #undef CONFIG_CMD_IMLS 195 196 #define CONFIG_BOOTDELAY 3 197 198 #define CONFIG_LOADADDR 0x12000000 199 200 /* place code in last 4 MiB of RAM */ 201 #if defined(CONFIG_MX6DL) || defined(CONFIG_MX6S) 202 #define CONFIG_SYS_TEXT_BASE 0x2fc00000 203 #elif defined(CONFIG_MX6Q) || defined(CONFIG_MX6D) 204 #define CONFIG_SYS_TEXT_BASE 0x4fc00000 205 #endif 206 207 #define CONFIG_ENV_SIZE (SZ_8K) 208 /* Size of malloc() pool */ 209 #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2 * SZ_1M) 210 211 #if defined(CONFIG_TQMA6X_MMC_BOOT) 212 213 #define CONFIG_ENV_IS_IN_MMC 214 #define TQMA6_UBOOT_OFFSET SZ_1K 215 #define TQMA6_UBOOT_SECTOR_START 0x2 216 #define TQMA6_UBOOT_SECTOR_COUNT 0x7fe 217 218 #define CONFIG_ENV_OFFSET SZ_1M 219 #define CONFIG_SYS_MMC_ENV_DEV 0 220 221 #define TQMA6_FDT_OFFSET (2 * SZ_1M) 222 #define TQMA6_FDT_SECTOR_START 0x1000 223 #define TQMA6_FDT_SECTOR_COUNT 0x800 224 225 #define TQMA6_KERNEL_SECTOR_START 0x2000 226 #define TQMA6_KERNEL_SECTOR_COUNT 0x2000 227 228 #define TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \ 229 "uboot_start="__stringify(TQMA6_UBOOT_SECTOR_START)"\0" \ 230 "uboot_size="__stringify(TQMA6_UBOOT_SECTOR_COUNT)"\0" \ 231 "fdt_start="__stringify(TQMA6_FDT_SECTOR_START)"\0" \ 232 "fdt_size="__stringify(TQMA6_FDT_SECTOR_COUNT)"\0" \ 233 "kernel_start="__stringify(TQMA6_KERNEL_SECTOR_START)"\0" \ 234 "kernel_size="__stringify(TQMA6_KERNEL_SECTOR_COUNT)"\0" \ 235 "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \ 236 "loadimage=mmc dev ${mmcdev}; " \ 237 "mmc read ${loadaddr} ${kernel_start} ${kernel_size};\0" \ 238 "loadfdt=mmc dev ${mmcdev}; " \ 239 "mmc read ${fdt_addr} ${fdt_start} ${fdt_size};\0" \ 240 "update_uboot=if tftp ${uboot}; then " \ 241 "if itest ${filesize} > 0; then " \ 242 "mmc dev ${mmcdev}; mmc rescan; " \ 243 "setexpr blkc ${filesize} / 0x200; " \ 244 "setexpr blkc ${blkc} + 1; " \ 245 "if itest ${blkc} <= ${uboot_size}; then " \ 246 "mmc write ${loadaddr} ${uboot_start} " \ 247 "${blkc}; " \ 248 "fi; " \ 249 "fi; fi; " \ 250 "setenv filesize; setenv blkc \0" \ 251 "update_kernel=run kernel_name; " \ 252 "if tftp ${kernel}; then " \ 253 "if itest ${filesize} > 0; then " \ 254 "mmc dev ${mmcdev}; mmc rescan; " \ 255 "setexpr blkc ${filesize} / 0x200; " \ 256 "setexpr blkc ${blkc} + 1; " \ 257 "if itest ${blkc} <= ${kernel_size}; then " \ 258 "mmc write ${loadaddr} " \ 259 "${kernel_start} ${blkc}; " \ 260 "fi; " \ 261 "fi; " \ 262 "fi; " \ 263 "setenv filesize; setenv blkc \0" \ 264 "update_fdt=if tftp ${fdt_file}; then " \ 265 "if itest ${filesize} > 0; then " \ 266 "mmc dev ${mmcdev}; mmc rescan; " \ 267 "setexpr blkc ${filesize} / 0x200; " \ 268 "setexpr blkc ${blkc} + 1; " \ 269 "if itest ${blkc} <= ${fdt_size}; then " \ 270 "mmc write ${loadaddr} ${fdt_start} ${blkc}; " \ 271 "fi; " \ 272 "fi; fi; " \ 273 "setenv filesize; setenv blkc \0" \ 274 275 #define CONFIG_BOOTCOMMAND \ 276 "run mmcboot; run netboot; run panicboot" 277 278 #elif defined(CONFIG_TQMA6X_SPI_BOOT) 279 280 #define TQMA6_UBOOT_OFFSET 0x400 281 #define TQMA6_UBOOT_SECTOR_START 0x0 282 /* max u-boot size: 512k */ 283 #define TQMA6_UBOOT_SECTOR_SIZE TQMA6_SPI_FLASH_SECTOR_SIZE 284 #define TQMA6_UBOOT_SECTOR_COUNT 0x8 285 #define TQMA6_UBOOT_SIZE (TQMA6_UBOOT_SECTOR_SIZE * \ 286 TQMA6_UBOOT_SECTOR_COUNT) 287 288 #define CONFIG_ENV_IS_IN_SPI_FLASH 289 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT 290 #define CONFIG_ENV_OFFSET (TQMA6_UBOOT_SIZE) 291 #define CONFIG_ENV_SECT_SIZE TQMA6_SPI_FLASH_SECTOR_SIZE 292 #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + \ 293 CONFIG_ENV_SECT_SIZE) 294 295 #define CONFIG_ENV_SPI_BUS (CONFIG_SF_DEFAULT_BUS) 296 #define CONFIG_ENV_SPI_CS (CONFIG_SF_DEFAULT_CS) 297 #define CONFIG_ENV_SPI_MAX_HZ (CONFIG_SF_DEFAULT_SPEED) 298 #define CONFIG_ENV_SPI_MODE (CONFIG_SF_DEFAULT_MODE) 299 300 #define TQMA6_FDT_OFFSET (CONFIG_ENV_OFFSET_REDUND + \ 301 CONFIG_ENV_SECT_SIZE) 302 #define TQMA6_FDT_SECT_SIZE (TQMA6_SPI_FLASH_SECTOR_SIZE) 303 304 #define TQMA6_FDT_SECTOR_START 0x0a /* 8 Sector u-boot, 2 Sector env */ 305 #define TQMA6_FDT_SECTOR_COUNT 0x01 306 307 #define TQMA6_KERNEL_SECTOR_START 0x10 308 #define TQMA6_KERNEL_SECTOR_COUNT 0x60 309 310 #define TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \ 311 "mmcblkdev=0\0" \ 312 "uboot_offset="__stringify(TQMA6_UBOOT_OFFSET)"\0" \ 313 "uboot_sectors="__stringify(TQMA6_UBOOT_SECTOR_COUNT)"\0" \ 314 "fdt_start="__stringify(TQMA6_FDT_SECTOR_START)"\0" \ 315 "fdt_sectors="__stringify(TQMA6_FDT_SECTOR_COUNT)"\0" \ 316 "kernel_start="__stringify(TQMA6_KERNEL_SECTOR_START)"\0" \ 317 "kernel_sectors="__stringify(TQMA6_KERNEL_SECTOR_COUNT)"\0" \ 318 "update_uboot=if tftp ${uboot}; then " \ 319 "if itest ${filesize} > 0; then " \ 320 "setexpr blkc ${filesize} + " \ 321 __stringify(TQMA6_UBOOT_OFFSET) "; " \ 322 "setexpr size ${uboot_sectors} * " \ 323 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \ 324 "if itest ${blkc} <= ${size}; then " \ 325 "sf probe; " \ 326 "sf erase 0 ${size}; " \ 327 "sf write ${loadaddr} ${uboot_offset} " \ 328 "${filesize}; " \ 329 "fi; " \ 330 "fi; fi; " \ 331 "setenv filesize 0; setenv blkc; setenv size \0" \ 332 "update_kernel=run kernel_name; if tftp ${kernel}; then " \ 333 "if itest ${filesize} > 0; then " \ 334 "setexpr size ${kernel_sectors} * " \ 335 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \ 336 "setexpr offset ${kernel_start} * " \ 337 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \ 338 "if itest ${filesize} <= ${size}; then " \ 339 "sf probe; " \ 340 "sf erase ${offset} ${size}; " \ 341 "sf write ${loadaddr} ${offset} " \ 342 "${filesize}; " \ 343 "fi; " \ 344 "fi; fi; " \ 345 "setenv filesize 0; setenv size ; setenv offset\0" \ 346 "update_fdt=if tftp ${fdt_file}; then " \ 347 "if itest ${filesize} > 0; then " \ 348 "setexpr size ${fdt_sectors} * " \ 349 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \ 350 "setexpr offset ${fdt_start} * " \ 351 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \ 352 "if itest ${filesize} <= ${size}; then " \ 353 "sf probe; " \ 354 "sf erase ${offset} ${size}; " \ 355 "sf write ${loadaddr} ${offset} " \ 356 "${filesize}; " \ 357 "fi; " \ 358 "fi; fi; " \ 359 "setenv filesize 0; setenv size ; setenv offset\0" \ 360 "loadimage=sf probe; " \ 361 "setexpr size ${kernel_sectors} * " \ 362 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \ 363 "setexpr offset ${kernel_start} * " \ 364 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \ 365 "sf read ${loadaddr} ${offset} ${size}; " \ 366 "setenv size ; setenv offset\0" \ 367 "loadfdt=sf probe; " \ 368 "setexpr size ${fdt_sectors} * " \ 369 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \ 370 "setexpr offset ${fdt_start} * " \ 371 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \ 372 "sf read ${${fdt_addr}} ${offset} ${size}; " \ 373 "setenv size ; setenv offset\0" \ 374 375 376 #define CONFIG_BOOTCOMMAND \ 377 "sf probe; run mmcboot; run netboot; run panicboot" \ 378 379 #else 380 381 #error "need to define boot source" 382 383 #endif 384 385 /* 128 MiB offset as in ARM related docu for linux suggested */ 386 #define TQMA6_FDT_ADDRESS 0x18000000 387 388 #define CONFIG_EXTRA_ENV_SETTINGS \ 389 "board=tqma6\0" \ 390 "uimage=uImage\0" \ 391 "zimage=zImage\0" \ 392 "boot_type=bootz\0" \ 393 "kernel_name=if test \"${boot_type}\" != bootz; then " \ 394 "setenv kernel ${uimage}; " \ 395 "else setenv kernel ${zimage}; fi\0" \ 396 "uboot=u-boot.imx\0" \ 397 "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \ 398 "fdt_addr="__stringify(TQMA6_FDT_ADDRESS)"\0" \ 399 "console=" CONFIG_CONSOLE_DEV "\0" \ 400 "fdt_high=0xffffffff\0" \ 401 "initrd_high=0xffffffff\0" \ 402 "addtty=setenv bootargs ${bootargs} console=${console},${baudrate}\0" \ 403 "addfb=setenv bootargs ${bootargs} " \ 404 "imx-fbdev.legacyfb_depth=32 consoleblank=0\0" \ 405 "mmcpart=2\0" \ 406 "mmcblkdev=0\0" \ 407 "mmcargs=run addmmc addtty addfb\0" \ 408 "addmmc=setenv bootargs ${bootargs} " \ 409 "root=/dev/mmcblk${mmcblkdev}p${mmcpart} rw rootwait\0" \ 410 "mmcboot=echo Booting from mmc ...; " \ 411 "setenv bootargs; " \ 412 "run mmcargs; " \ 413 "run loadimage; " \ 414 "if run loadfdt; then " \ 415 "echo boot device tree kernel ...; " \ 416 "${boot_type} ${loadaddr} - ${fdt_addr}; " \ 417 "else " \ 418 "${boot_type}; " \ 419 "fi;\0" \ 420 "setenv bootargs \0" \ 421 "netdev=eth0\0" \ 422 "rootpath=/srv/nfs/tqma6\0" \ 423 "ipmode=static\0" \ 424 "netargs=run addnfs addip addtty addfb\0" \ 425 "addnfs=setenv bootargs ${bootargs} " \ 426 "root=/dev/nfs rw " \ 427 "nfsroot=${serverip}:${rootpath},v3,tcp;\0" \ 428 "addip_static=setenv bootargs ${bootargs} " \ 429 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:" \ 430 "${hostname}:${netdev}:off\0" \ 431 "addip_dynamic=setenv bootargs ${bootargs} ip=dhcp\0" \ 432 "addip=if test \"${ipmode}\" != static; then " \ 433 "run addip_dynamic; else run addip_static; fi\0" \ 434 "set_getcmd=if test \"${ipmode}\" != static; then " \ 435 "setenv getcmd dhcp; setenv autoload yes; " \ 436 "else setenv getcmd tftp; setenv autoload no; fi\0" \ 437 "netboot=echo Booting from net ...; " \ 438 "run kernel_name; " \ 439 "run set_getcmd; " \ 440 "setenv bootargs; " \ 441 "run netargs; " \ 442 "if ${getcmd} ${kernel}; then " \ 443 "if ${getcmd} ${fdt_addr} ${fdt_file}; then " \ 444 "${boot_type} ${loadaddr} - ${fdt_addr}; " \ 445 "fi; " \ 446 "fi; " \ 447 "echo ... failed\0" \ 448 "panicboot=echo No boot device !!! reset\0" \ 449 TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \ 450 451 /* Miscellaneous configurable options */ 452 #define CONFIG_SYS_LONGHELP 453 #define CONFIG_SYS_HUSH_PARSER 454 #define CONFIG_SYS_PROMPT_HUSH_PS2 "> " 455 456 #define CONFIG_AUTO_COMPLETE 457 #define CONFIG_SYS_CBSIZE 512 458 459 /* Print Buffer Size */ 460 #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ 461 sizeof(CONFIG_SYS_PROMPT) + 16) 462 #define CONFIG_SYS_MAXARGS 16 463 #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE 464 465 #define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR 466 467 #define CONFIG_CMDLINE_EDITING 468 #define CONFIG_STACKSIZE (128u * SZ_1K) 469 470 /* Physical Memory Map */ 471 #define CONFIG_NR_DRAM_BANKS 1 472 #define PHYS_SDRAM MMDC0_ARB_BASE_ADDR 473 474 #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM 475 #define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR 476 #define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE 477 478 #define CONFIG_SYS_INIT_SP_OFFSET \ 479 (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) 480 #define CONFIG_SYS_INIT_SP_ADDR \ 481 (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET) 482 483 /* FLASH and environment organization */ 484 #define CONFIG_SYS_NO_FLASH 485 486 #define CONFIG_OF_LIBFDT 487 #define CONFIG_OF_BOARD_SETUP 488 #define CONFIG_FIT 489 #define CONFIG_FIT_VERBOSE 490 491 #ifndef CONFIG_SYS_DCACHE_OFF 492 #define CONFIG_CMD_CACHE 493 #endif 494 495 #endif /* __CONFIG_H */ 496