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