blob: 9ba015560b737bb5062235a3b5423412739af8d3 [file] [log] [blame]
Markus Niebelee2cd2b2014-07-18 16:52:44 +02001/*
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
Markus Niebela116f6f2014-10-23 15:47:05 +020012#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
Markus Niebelee2cd2b2014-07-18 16:52:44 +020027#include "mx6_common.h"
28#include <asm/arch/imx-regs.h>
29#include <asm/imx-common/gpio.h>
30#include <linux/sizes.h>
31
Markus Niebelee2cd2b2014-07-18 16:52:44 +020032#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 CONFIG_CMD_SF
72#define CONFIG_SF_DEFAULT_BUS 0
Markus Niebela116f6f2014-10-23 15:47:05 +020073#define CONFIG_SF_DEFAULT_CS 0
Markus Niebelee2cd2b2014-07-18 16:52:44 +020074#define CONFIG_SF_DEFAULT_SPEED 50000000
75#define CONFIG_SF_DEFAULT_MODE (SPI_MODE_0)
76
77/* I2C Configs */
78#define CONFIG_CMD_I2C
79#define CONFIG_SYS_I2C
80#define CONFIG_SYS_I2C_MXC
81#define CONFIG_I2C_MULTI_BUS
82#define CONFIG_SYS_I2C_SPEED 100000
83
84/* I2C SYSMON (LM75) */
85#define CONFIG_DTT_LM75
86#if defined(CONFIG_MBA6)
87#define CONFIG_DTT_SENSORS { 0, 1 }
88#else
89#define CONFIG_DTT_SENSORS { 0 }
90#endif
91#define CONFIG_DTT_MAX_TEMP 70
92#define CONFIG_DTT_MIN_TEMP -30
93#define CONFIG_DTT_HYSTERESIS 3
94#define CONFIG_CMD_DTT
95
96/* I2C EEPROM (M24C64) */
97#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50
98#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
99#define CONFIG_SYS_I2C_EEPROM_PAGE_WRITE_BITS 5 /* 32 Bytes */
100#define CONFIG_SYS_I2C_EEPROM_PAGE_WRITE_DELAY_MS 20
101#define CONFIG_CMD_EEPROM
102
103#define CONFIG_POWER
104#define CONFIG_POWER_I2C
105#define CONFIG_POWER_PFUZE100
106#define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08
107#define TQMA6_PFUZE100_I2C_BUS 2
108
109/* MMC Configs */
110#define CONFIG_FSL_ESDHC
111#define CONFIG_FSL_USDHC
112#define CONFIG_SYS_FSL_ESDHC_ADDR 0
113
114#define CONFIG_MMC
115#define CONFIG_CMD_MMC
116#define CONFIG_GENERIC_MMC
117#define CONFIG_BOUNCE_BUFFER
118
119/* USB Configs */
120#define CONFIG_CMD_USB
121#define CONFIG_USB_EHCI
122#define CONFIG_USB_EHCI_MX6
123#define CONFIG_USB_STORAGE
124#define CONFIG_USB_HOST_ETHER
125#define CONFIG_USB_ETHER_SMSC95XX
126#define CONFIG_MXC_USB_PORT 1
127#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
128#define CONFIG_MXC_USB_FLAGS 0
129
130/* Fuses */
131#define CONFIG_MXC_OCOTP
132#define CONFIG_CMD_FUSE
133
134#define CONFIG_CMD_EXT2
135#define CONFIG_CMD_FAT
136#define CONFIG_DOS_PARTITION
137
138#define CONFIG_CMD_PING
139#define CONFIG_CMD_DHCP
140#define CONFIG_CMD_MII
141#define CONFIG_CMD_NET
142
143#define CONFIG_FEC_MXC
144#define IMX_FEC_BASE ENET_BASE_ADDR
145#define CONFIG_PHYLIB
146#define CONFIG_MII
147
148#if defined(CONFIG_MBA6)
149
150#define CONFIG_FEC_XCV_TYPE RGMII
151#define CONFIG_ETHPRIME "FEC"
152
153#define CONFIG_FEC_MXC_PHYADDR 0x03
154#define CONFIG_PHY_MICREL
155#define CONFIG_PHY_KSZ9031
156
157#else
158
159#error "define PHY to use for your baseboard"
160
161#endif
162
163#define CONFIG_ARP_TIMEOUT 200UL
164/* Network config - Allow larger/faster download for TFTP/NFS */
165#define CONFIG_IP_DEFRAG
166#define CONFIG_TFTP_BLOCKSIZE 4096
167#define CONFIG_NFS_READ_SIZE 4096
168
169#if defined(CONFIG_MBA6)
170
171#define CONFIG_MXC_UART_BASE UART2_BASE
172#define CONFIG_CONSOLE_DEV "ttymxc1"
173
174#else
175
176#error "define baseboard specific things (uart, number of SD-card slots)"
177
178#endif
179
180/* allow to overwrite serial and ethaddr */
181#define CONFIG_ENV_OVERWRITE
182#define CONFIG_CONS_INDEX 1
183#define CONFIG_BAUDRATE 115200
184
185/* Command definition */
186#include <config_cmd_default.h>
187
188#define CONFIG_CMD_BMODE
189#define CONFIG_CMD_BOOTZ
190#define CONFIG_CMD_ITEST
191#define CONFIG_CMD_SETEXPR
192#undef CONFIG_CMD_IMLS
193
194#define CONFIG_BOOTDELAY 3
195
196#define CONFIG_LOADADDR 0x12000000
197
198/* place code in last 4 MiB of RAM */
199#if defined(CONFIG_MX6DL) || defined(CONFIG_MX6S)
200#define CONFIG_SYS_TEXT_BASE 0x2fc00000
201#elif defined(CONFIG_MX6Q) || defined(CONFIG_MX6D)
202#define CONFIG_SYS_TEXT_BASE 0x4fc00000
203#endif
204
205#define CONFIG_ENV_SIZE (SZ_8K)
206/* Size of malloc() pool */
207#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2 * SZ_1M)
208
209#if defined(CONFIG_TQMA6X_MMC_BOOT)
210
211#define CONFIG_ENV_IS_IN_MMC
212#define TQMA6_UBOOT_OFFSET SZ_1K
213#define TQMA6_UBOOT_SECTOR_START 0x2
214#define TQMA6_UBOOT_SECTOR_COUNT 0x7fe
215
216#define CONFIG_ENV_OFFSET SZ_1M
217#define CONFIG_SYS_MMC_ENV_DEV 0
218
219#define TQMA6_FDT_OFFSET (2 * SZ_1M)
220#define TQMA6_FDT_SECTOR_START 0x1000
221#define TQMA6_FDT_SECTOR_COUNT 0x800
222
223#define TQMA6_KERNEL_SECTOR_START 0x2000
224#define TQMA6_KERNEL_SECTOR_COUNT 0x2000
225
226#define TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
227 "uboot_start="__stringify(TQMA6_UBOOT_SECTOR_START)"\0" \
228 "uboot_size="__stringify(TQMA6_UBOOT_SECTOR_COUNT)"\0" \
229 "fdt_start="__stringify(TQMA6_FDT_SECTOR_START)"\0" \
230 "fdt_size="__stringify(TQMA6_FDT_SECTOR_COUNT)"\0" \
231 "kernel_start="__stringify(TQMA6_KERNEL_SECTOR_START)"\0" \
232 "kernel_size="__stringify(TQMA6_KERNEL_SECTOR_COUNT)"\0" \
233 "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
234 "loadimage=mmc dev ${mmcdev}; " \
235 "mmc read ${loadaddr} ${kernel_start} ${kernel_size};\0" \
236 "loadfdt=mmc dev ${mmcdev}; " \
237 "mmc read ${fdt_addr} ${fdt_start} ${fdt_size};\0" \
238 "update_uboot=if tftp ${uboot}; then " \
239 "if itest ${filesize} > 0; then " \
240 "mmc dev ${mmcdev}; mmc rescan; " \
241 "setexpr blkc ${filesize} / 0x200; " \
242 "setexpr blkc ${blkc} + 1; " \
243 "if itest ${blkc} <= ${uboot_size}; then " \
244 "mmc write ${loadaddr} ${uboot_start} " \
245 "${blkc}; " \
246 "fi; " \
247 "fi; fi; " \
248 "setenv filesize; setenv blkc \0" \
249 "update_kernel=run kernel_name; " \
250 "if tftp ${kernel}; then " \
251 "if itest ${filesize} > 0; then " \
252 "mmc dev ${mmcdev}; mmc rescan; " \
253 "setexpr blkc ${filesize} / 0x200; " \
254 "setexpr blkc ${blkc} + 1; " \
255 "if itest ${blkc} <= ${kernel_size}; then " \
256 "mmc write ${loadaddr} " \
257 "${kernel_start} ${blkc}; " \
258 "fi; " \
259 "fi; " \
260 "fi; " \
261 "setenv filesize; setenv blkc \0" \
262 "update_fdt=if tftp ${fdt_file}; then " \
263 "if itest ${filesize} > 0; then " \
264 "mmc dev ${mmcdev}; mmc rescan; " \
265 "setexpr blkc ${filesize} / 0x200; " \
266 "setexpr blkc ${blkc} + 1; " \
267 "if itest ${blkc} <= ${fdt_size}; then " \
268 "mmc write ${loadaddr} ${fdt_start} ${blkc}; " \
269 "fi; " \
270 "fi; fi; " \
271 "setenv filesize; setenv blkc \0" \
272
273#define CONFIG_BOOTCOMMAND \
274 "run mmcboot; run netboot; run panicboot"
275
276#elif defined(CONFIG_TQMA6X_SPI_BOOT)
277
278#define CONFIG_FLASH_SECTOR_SIZE 0x10000
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 CONFIG_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 CONFIG_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 (CONFIG_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(CONFIG_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(CONFIG_FLASH_SECTOR_SIZE)"; " \
336 "setexpr offset ${kernel_start} * " \
337 __stringify(CONFIG_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(CONFIG_FLASH_SECTOR_SIZE)"; " \
350 "setexpr offset ${fdt_start} * " \
351 __stringify(CONFIG_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(CONFIG_FLASH_SECTOR_SIZE)"; " \
363 "setexpr offset ${kernel_start} * " \
364 __stringify(CONFIG_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(CONFIG_FLASH_SECTOR_SIZE)"; " \
370 "setexpr offset ${fdt_start} * " \
371 __stringify(CONFIG_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#define CONFIG_SYS_HZ 1000
467
468#define CONFIG_CMDLINE_EDITING
469#define CONFIG_STACKSIZE (128u * SZ_1K)
470
471/* Physical Memory Map */
472#define CONFIG_NR_DRAM_BANKS 1
473#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
474
475#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
476#define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
477#define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
478
479#define CONFIG_SYS_INIT_SP_OFFSET \
480 (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
481#define CONFIG_SYS_INIT_SP_ADDR \
482 (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
483
484/* FLASH and environment organization */
485#define CONFIG_SYS_NO_FLASH
486
487#define CONFIG_OF_LIBFDT
488#define CONFIG_OF_BOARD_SETUP
489#define CONFIG_FIT
490#define CONFIG_FIT_VERBOSE
491
492#ifndef CONFIG_SYS_DCACHE_OFF
493#define CONFIG_CMD_CACHE
494#endif
495
496#endif /* __CONFIG_H */