2 * Copyright (C) 2013, 2014 Markus Niebel <Markus.Niebel@tq-group.com>
4 * Configuration settings for the TQ Systems TQMa6<Q,S> module.
6 * SPDX-License-Identifier: GPL-2.0+
13 /* #if defined(CONFIG_SPL_BUILD) */
15 #define CONFIG_SPL_MMC_SUPPORT
16 #define CONFIG_SPL_SPI_SUPPORT
17 #define CONFIG_SPL_FAT_SUPPORT
18 #define CONFIG_SPL_EXT_SUPPORT
20 /* common IMX6 SPL configuration */
25 #include "mx6_common.h"
27 #define PHYS_SDRAM_SIZE (512u * SZ_1M)
28 #define PHYS_SDRAM_SIZE (1024u * SZ_1M)
31 #define CONFIG_BOARD_EARLY_INIT_F
32 #define CONFIG_BOARD_LATE_INIT
34 #define CONFIG_MXC_UART
37 #define CONFIG_CMD_SPI
38 #define CONFIG_MXC_SPI
41 #define CONFIG_SPI_FLASH
42 #define CONFIG_SPI_FLASH_STMICRO
44 #define TQMA6_SPI_FLASH_SECTOR_SIZE SZ_64K
47 #define CONFIG_SF_DEFAULT_BUS 0
48 #define CONFIG_SF_DEFAULT_CS 0
49 #define CONFIG_SF_DEFAULT_SPEED 50000000
50 #define CONFIG_SF_DEFAULT_MODE (SPI_MODE_0)
53 #define CONFIG_CMD_I2C
54 #define CONFIG_SYS_I2C
55 #define CONFIG_SYS_I2C_MXC
56 #define CONFIG_SYS_I2C_MXC_I2C3 /* enable I2C bus 3 */
57 #define CONFIG_I2C_MULTI_BUS
58 #define CONFIG_SYS_I2C_SPEED 100000
60 /* I2C SYSMON (LM75) */
61 #define CONFIG_DTT_LM75
62 #define CONFIG_DTT_MAX_TEMP 70
63 #define CONFIG_DTT_MIN_TEMP -30
64 #define CONFIG_DTT_HYSTERESIS 3
65 #define CONFIG_CMD_DTT
67 /* I2C EEPROM (M24C64) */
68 #define CONFIG_SYS_I2C_EEPROM_ADDR 0x50
69 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
70 #define CONFIG_SYS_I2C_EEPROM_PAGE_WRITE_BITS 5 /* 32 Bytes */
71 #define CONFIG_SYS_I2C_EEPROM_PAGE_WRITE_DELAY_MS 20
72 #define CONFIG_CMD_EEPROM
75 #define CONFIG_POWER_I2C
76 #define CONFIG_POWER_PFUZE100
77 #define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08
78 #define TQMA6_PFUZE100_I2C_BUS 2
81 #define CONFIG_FSL_ESDHC
82 #define CONFIG_FSL_USDHC
83 #define CONFIG_SYS_FSL_ESDHC_ADDR 0
86 #define CONFIG_CMD_MMC
87 #define CONFIG_GENERIC_MMC
88 #define CONFIG_BOUNCE_BUFFER
91 #define CONFIG_CMD_USB
92 #define CONFIG_USB_EHCI
93 #define CONFIG_USB_EHCI_MX6
94 #define CONFIG_USB_STORAGE
95 #define CONFIG_USB_HOST_ETHER
96 #define CONFIG_USB_ETHER_SMSC95XX
97 #define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
98 #define CONFIG_USB_MAX_CONTROLLER_COUNT 2
99 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET /* For OTG port */
102 #define CONFIG_MXC_OCOTP
103 #define CONFIG_CMD_FUSE
105 #define CONFIG_CMD_EXT2
106 #define CONFIG_CMD_EXT4
107 #define CONFIG_CMD_EXT4_WRITE
108 #define CONFIG_CMD_FAT
109 #define CONFIG_CMD_FS_GENERIC
110 #define CONFIG_DOS_PARTITION
112 #define CONFIG_CMD_PING
113 #define CONFIG_CMD_DHCP
114 #define CONFIG_CMD_MII
115 #define CONFIG_CMD_NET
117 #define CONFIG_FEC_MXC
118 #define IMX_FEC_BASE ENET_BASE_ADDR
119 #define CONFIG_PHYLIB
122 #define CONFIG_ARP_TIMEOUT 200UL
123 /* Network config - Allow larger/faster download for TFTP/NFS */
124 #define CONFIG_IP_DEFRAG
125 #define CONFIG_TFTP_BLOCKSIZE 4096
126 #define CONFIG_NFS_READ_SIZE 4096
128 /* allow to overwrite serial and ethaddr */
129 #define CONFIG_ENV_OVERWRITE
130 #define CONFIG_CONS_INDEX 1
131 #define CONFIG_BAUDRATE 115200
133 /* Command definition */
134 #define CONFIG_CMD_BMODE
135 #define CONFIG_CMD_BOOTZ
136 #define CONFIG_CMD_ITEST
137 #define CONFIG_CMD_SETEXPR
139 /* place code in last 4 MiB of RAM */
140 #define CONFIG_SYS_TEXT_BASE 0x2fc00000
141 #define CONFIG_SYS_TEXT_BASE 0x4fc00000
144 #define CONFIG_ENV_SIZE (SZ_8K)
145 /* Size of malloc() pool */
146 #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2 * SZ_1M)
148 #if defined(CONFIG_TQMA6X_MMC_BOOT)
150 #define CONFIG_ENV_IS_IN_MMC
151 #define TQMA6_UBOOT_OFFSET SZ_1K
152 #define TQMA6_UBOOT_SECTOR_START 0x2
153 #define TQMA6_UBOOT_SECTOR_COUNT 0x7fe
155 #define CONFIG_ENV_OFFSET SZ_1M
156 #define CONFIG_SYS_MMC_ENV_DEV 0
158 #define TQMA6_FDT_OFFSET (2 * SZ_1M)
159 #define TQMA6_FDT_SECTOR_START 0x1000
160 #define TQMA6_FDT_SECTOR_COUNT 0x800
162 #define TQMA6_KERNEL_SECTOR_START 0x2000
163 #define TQMA6_KERNEL_SECTOR_COUNT 0x2000
165 #define TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
166 "uboot_start="__stringify(TQMA6_UBOOT_SECTOR_START)"\0" \
167 "uboot_size="__stringify(TQMA6_UBOOT_SECTOR_COUNT)"\0" \
168 "fdt_start="__stringify(TQMA6_FDT_SECTOR_START)"\0" \
169 "fdt_size="__stringify(TQMA6_FDT_SECTOR_COUNT)"\0" \
170 "kernel_start="__stringify(TQMA6_KERNEL_SECTOR_START)"\0" \
171 "kernel_size="__stringify(TQMA6_KERNEL_SECTOR_COUNT)"\0" \
172 "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
173 "loadimage=mmc dev ${mmcdev}; " \
174 "mmc read ${loadaddr} ${kernel_start} ${kernel_size};\0" \
175 "loadfdt=mmc dev ${mmcdev}; " \
176 "mmc read ${fdt_addr} ${fdt_start} ${fdt_size};\0" \
177 "update_uboot=if tftp ${uboot}; then " \
178 "if itest ${filesize} > 0; then " \
179 "mmc dev ${mmcdev}; mmc rescan; " \
180 "setexpr blkc ${filesize} / 0x200; " \
181 "setexpr blkc ${blkc} + 1; " \
182 "if itest ${blkc} <= ${uboot_size}; then " \
183 "mmc write ${loadaddr} ${uboot_start} " \
187 "setenv filesize; setenv blkc \0" \
188 "update_kernel=run kernel_name; " \
189 "if tftp ${kernel}; then " \
190 "if itest ${filesize} > 0; then " \
191 "mmc dev ${mmcdev}; mmc rescan; " \
192 "setexpr blkc ${filesize} / 0x200; " \
193 "setexpr blkc ${blkc} + 1; " \
194 "if itest ${blkc} <= ${kernel_size}; then " \
195 "mmc write ${loadaddr} " \
196 "${kernel_start} ${blkc}; " \
200 "setenv filesize; setenv blkc \0" \
201 "update_fdt=if tftp ${fdt_file}; then " \
202 "if itest ${filesize} > 0; then " \
203 "mmc dev ${mmcdev}; mmc rescan; " \
204 "setexpr blkc ${filesize} / 0x200; " \
205 "setexpr blkc ${blkc} + 1; " \
206 "if itest ${blkc} <= ${fdt_size}; then " \
207 "mmc write ${loadaddr} ${fdt_start} ${blkc}; " \
210 "setenv filesize; setenv blkc \0" \
212 #define CONFIG_BOOTCOMMAND \
213 "run mmcboot; run netboot; run panicboot"
215 #elif defined(CONFIG_TQMA6X_SPI_BOOT)
217 #define TQMA6_UBOOT_OFFSET 0x400
218 #define TQMA6_UBOOT_SECTOR_START 0x0
219 /* max u-boot size: 512k */
220 #define TQMA6_UBOOT_SECTOR_SIZE TQMA6_SPI_FLASH_SECTOR_SIZE
221 #define TQMA6_UBOOT_SECTOR_COUNT 0x8
222 #define TQMA6_UBOOT_SIZE (TQMA6_UBOOT_SECTOR_SIZE * \
223 TQMA6_UBOOT_SECTOR_COUNT)
225 #define CONFIG_ENV_IS_IN_SPI_FLASH
226 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
227 #define CONFIG_ENV_OFFSET (TQMA6_UBOOT_SIZE)
228 #define CONFIG_ENV_SECT_SIZE TQMA6_SPI_FLASH_SECTOR_SIZE
229 #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + \
230 CONFIG_ENV_SECT_SIZE)
232 #define CONFIG_ENV_SPI_BUS (CONFIG_SF_DEFAULT_BUS)
233 #define CONFIG_ENV_SPI_CS (CONFIG_SF_DEFAULT_CS)
234 #define CONFIG_ENV_SPI_MAX_HZ (CONFIG_SF_DEFAULT_SPEED)
235 #define CONFIG_ENV_SPI_MODE (CONFIG_SF_DEFAULT_MODE)
237 #define TQMA6_FDT_OFFSET (CONFIG_ENV_OFFSET_REDUND + \
238 CONFIG_ENV_SECT_SIZE)
239 #define TQMA6_FDT_SECT_SIZE (TQMA6_SPI_FLASH_SECTOR_SIZE)
241 #define TQMA6_FDT_SECTOR_START 0x0a /* 8 Sector u-boot, 2 Sector env */
242 #define TQMA6_FDT_SECTOR_COUNT 0x01
244 #define TQMA6_KERNEL_SECTOR_START 0x10
245 #define TQMA6_KERNEL_SECTOR_COUNT 0x60
247 #define TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
249 "uboot_offset="__stringify(TQMA6_UBOOT_OFFSET)"\0" \
250 "uboot_sectors="__stringify(TQMA6_UBOOT_SECTOR_COUNT)"\0" \
251 "fdt_start="__stringify(TQMA6_FDT_SECTOR_START)"\0" \
252 "fdt_sectors="__stringify(TQMA6_FDT_SECTOR_COUNT)"\0" \
253 "kernel_start="__stringify(TQMA6_KERNEL_SECTOR_START)"\0" \
254 "kernel_sectors="__stringify(TQMA6_KERNEL_SECTOR_COUNT)"\0" \
255 "update_uboot=if tftp ${uboot}; then " \
256 "if itest ${filesize} > 0; then " \
257 "setexpr blkc ${filesize} + " \
258 __stringify(TQMA6_UBOOT_OFFSET) "; " \
259 "setexpr size ${uboot_sectors} * " \
260 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
261 "if itest ${blkc} <= ${size}; then " \
263 "sf erase 0 ${size}; " \
264 "sf write ${loadaddr} ${uboot_offset} " \
268 "setenv filesize 0; setenv blkc; setenv size \0" \
269 "update_kernel=run kernel_name; if tftp ${kernel}; then " \
270 "if itest ${filesize} > 0; then " \
271 "setexpr size ${kernel_sectors} * " \
272 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
273 "setexpr offset ${kernel_start} * " \
274 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
275 "if itest ${filesize} <= ${size}; then " \
277 "sf erase ${offset} ${size}; " \
278 "sf write ${loadaddr} ${offset} " \
282 "setenv filesize 0; setenv size ; setenv offset\0" \
283 "update_fdt=if tftp ${fdt_file}; then " \
284 "if itest ${filesize} > 0; then " \
285 "setexpr size ${fdt_sectors} * " \
286 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
287 "setexpr offset ${fdt_start} * " \
288 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
289 "if itest ${filesize} <= ${size}; then " \
291 "sf erase ${offset} ${size}; " \
292 "sf write ${loadaddr} ${offset} " \
296 "setenv filesize 0; setenv size ; setenv offset\0" \
297 "loadimage=sf probe; " \
298 "setexpr size ${kernel_sectors} * " \
299 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
300 "setexpr offset ${kernel_start} * " \
301 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
302 "sf read ${loadaddr} ${offset} ${size}; " \
303 "setenv size ; setenv offset\0" \
304 "loadfdt=sf probe; " \
305 "setexpr size ${fdt_sectors} * " \
306 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
307 "setexpr offset ${fdt_start} * " \
308 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
309 "sf read ${${fdt_addr}} ${offset} ${size}; " \
310 "setenv size ; setenv offset\0" \
313 #define CONFIG_BOOTCOMMAND \
314 "sf probe; run mmcboot; run netboot; run panicboot" \
318 #error "need to define boot source"
322 /* 128 MiB offset as in ARM related docu for linux suggested */
323 #define TQMA6_FDT_ADDRESS 0x18000000
325 #define CONFIG_EXTRA_ENV_SETTINGS \
329 "boot_type=bootz\0" \
330 "kernel_name=if test \"${boot_type}\" != bootz; then " \
331 "setenv kernel ${uimage}; " \
332 "else setenv kernel ${zimage}; fi\0" \
333 "uboot=u-boot.imx\0" \
334 "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
335 "fdt_addr="__stringify(TQMA6_FDT_ADDRESS)"\0" \
336 "console=" CONFIG_CONSOLE_DEV "\0" \
337 "fdt_high=0xffffffff\0" \
338 "initrd_high=0xffffffff\0" \
339 "addtty=setenv bootargs ${bootargs} console=${console},${baudrate}\0" \
340 "addfb=setenv bootargs ${bootargs} " \
341 "imx-fbdev.legacyfb_depth=32 consoleblank=0\0" \
344 "mmcargs=run addmmc addtty addfb\0" \
345 "addmmc=setenv bootargs ${bootargs} " \
346 "root=/dev/mmcblk${mmcblkdev}p${mmcpart} rw rootwait\0" \
347 "mmcboot=echo Booting from mmc ...; " \
348 "setenv bootargs; " \
351 "if run loadfdt; then " \
352 "echo boot device tree kernel ...; " \
353 "${boot_type} ${loadaddr} - ${fdt_addr}; " \
357 "setenv bootargs \0" \
359 "rootpath=/srv/nfs/tqma6\0" \
361 "netargs=run addnfs addip addtty addfb\0" \
362 "addnfs=setenv bootargs ${bootargs} " \
363 "root=/dev/nfs rw " \
364 "nfsroot=${serverip}:${rootpath},v3,tcp;\0" \
365 "addip_static=setenv bootargs ${bootargs} " \
366 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:" \
367 "${hostname}:${netdev}:off\0" \
368 "addip_dynamic=setenv bootargs ${bootargs} ip=dhcp\0" \
369 "addip=if test \"${ipmode}\" != static; then " \
370 "run addip_dynamic; else run addip_static; fi\0" \
371 "set_getcmd=if test \"${ipmode}\" != static; then " \
372 "setenv getcmd dhcp; setenv autoload yes; " \
373 "else setenv getcmd tftp; setenv autoload no; fi\0" \
374 "netboot=echo Booting from net ...; " \
375 "run kernel_name; " \
377 "setenv bootargs; " \
379 "if ${getcmd} ${kernel}; then " \
380 "if ${getcmd} ${fdt_addr} ${fdt_file}; then " \
381 "${boot_type} ${loadaddr} - ${fdt_addr}; " \
384 "echo ... failed\0" \
385 "panicboot=echo No boot device !!! reset\0" \
386 TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
388 /* Miscellaneous configurable options */
389 #define CONFIG_SYS_LONGHELP
390 #define CONFIG_SYS_HUSH_PARSER
391 #define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
393 #define CONFIG_AUTO_COMPLETE
394 #define CONFIG_SYS_CBSIZE 512
396 /* Print Buffer Size */
397 #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
398 sizeof(CONFIG_SYS_PROMPT) + 16)
399 #define CONFIG_SYS_MAXARGS 16
400 #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
402 #define CONFIG_CMDLINE_EDITING
403 #define CONFIG_STACKSIZE (128u * SZ_1K)
405 /* Physical Memory Map */
406 #define CONFIG_NR_DRAM_BANKS 1
407 #define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
409 #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
410 #define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
411 #define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
413 #define CONFIG_SYS_INIT_SP_OFFSET \
414 (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
415 #define CONFIG_SYS_INIT_SP_ADDR \
416 (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
418 #define CONFIG_OF_LIBFDT
419 #define CONFIG_OF_BOARD_SETUP
421 #define CONFIG_FIT_VERBOSE
423 #ifndef CONFIG_SYS_DCACHE_OFF
424 #define CONFIG_CMD_CACHE
428 * All the defines above are for the TQMa6 SoM
430 * Now include the baseboard specific configuration
433 #include "tqma6_mba6.h"
435 #error "No baseboard for the TQMa6 defined!"
438 /* Support at least the sensor on TQMa6 SOM */
439 #if !defined(CONFIG_DTT_SENSORS)
440 #define CONFIG_DTT_SENSORS { 0 }
443 #endif /* __CONFIG_H */