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