blob: 4c93c9bbb97c126196294123e344e00d23638068 [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/* SPL */
13/* #if defined(CONFIG_SPL_BUILD) */
14
15#define CONFIG_SPL_MMC_SUPPORT
16#define CONFIG_SPL_SPI_SUPPORT
17#define CONFIG_SPL_FAT_SUPPORT
18#define CONFIG_SPL_EXT_SUPPORT
19
20/* common IMX6 SPL configuration */
21#include "imx6_spl.h"
22
23/* #endif */
24
Markus Niebelee2cd2b2014-07-18 16:52:44 +020025#include "mx6_common.h"
Markus Niebelee2cd2b2014-07-18 16:52:44 +020026
Markus Niebelee2cd2b2014-07-18 16:52:44 +020027#if defined(CONFIG_MX6DL) || defined(CONFIG_MX6S)
28#define PHYS_SDRAM_SIZE (512u * SZ_1M)
29#elif defined(CONFIG_MX6Q) || defined(CONFIG_MX6D)
30#define PHYS_SDRAM_SIZE (1024u * SZ_1M)
31#endif
32
Markus Niebelee2cd2b2014-07-18 16:52:44 +020033#define CONFIG_BOARD_EARLY_INIT_F
34#define CONFIG_BOARD_LATE_INIT
35
Markus Niebelee2cd2b2014-07-18 16:52:44 +020036#define CONFIG_MXC_UART
37
38/* SPI */
39#define CONFIG_CMD_SPI
40#define CONFIG_MXC_SPI
41
42/* SPI Flash */
43#define CONFIG_SPI_FLASH
44#define CONFIG_SPI_FLASH_STMICRO
45
Markus Niebela02eaa52014-11-18 13:22:54 +010046#define TQMA6_SPI_FLASH_SECTOR_SIZE SZ_64K
47
Markus Niebelee2cd2b2014-07-18 16:52:44 +020048#define CONFIG_CMD_SF
49#define CONFIG_SF_DEFAULT_BUS 0
Markus Niebela116f6f2014-10-23 15:47:05 +020050#define CONFIG_SF_DEFAULT_CS 0
Markus Niebelee2cd2b2014-07-18 16:52:44 +020051#define CONFIG_SF_DEFAULT_SPEED 50000000
52#define CONFIG_SF_DEFAULT_MODE (SPI_MODE_0)
53
54/* I2C Configs */
55#define CONFIG_CMD_I2C
56#define CONFIG_SYS_I2C
57#define CONFIG_SYS_I2C_MXC
York Sunf1a52162015-03-20 10:20:40 -070058#define CONFIG_SYS_I2C_MXC_I2C3 /* enable I2C bus 3 */
Markus Niebelee2cd2b2014-07-18 16:52:44 +020059#define CONFIG_I2C_MULTI_BUS
60#define CONFIG_SYS_I2C_SPEED 100000
61
62/* I2C SYSMON (LM75) */
63#define CONFIG_DTT_LM75
Markus Niebelee2cd2b2014-07-18 16:52:44 +020064#define CONFIG_DTT_MAX_TEMP 70
65#define CONFIG_DTT_MIN_TEMP -30
66#define CONFIG_DTT_HYSTERESIS 3
67#define CONFIG_CMD_DTT
68
69/* I2C EEPROM (M24C64) */
70#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50
71#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
72#define CONFIG_SYS_I2C_EEPROM_PAGE_WRITE_BITS 5 /* 32 Bytes */
73#define CONFIG_SYS_I2C_EEPROM_PAGE_WRITE_DELAY_MS 20
74#define CONFIG_CMD_EEPROM
75
76#define CONFIG_POWER
77#define CONFIG_POWER_I2C
78#define CONFIG_POWER_PFUZE100
79#define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08
80#define TQMA6_PFUZE100_I2C_BUS 2
81
82/* MMC Configs */
Markus Niebelee2cd2b2014-07-18 16:52:44 +020083#define CONFIG_SYS_FSL_ESDHC_ADDR 0
84
Markus Niebelee2cd2b2014-07-18 16:52:44 +020085/* USB Configs */
86#define CONFIG_CMD_USB
87#define CONFIG_USB_EHCI
88#define CONFIG_USB_EHCI_MX6
89#define CONFIG_USB_STORAGE
90#define CONFIG_USB_HOST_ETHER
91#define CONFIG_USB_ETHER_SMSC95XX
Markus Niebelee2cd2b2014-07-18 16:52:44 +020092#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
Stefan Roese4cbf1882015-03-12 13:34:29 +010093#define CONFIG_USB_MAX_CONTROLLER_COUNT 2
94#define CONFIG_EHCI_HCD_INIT_AFTER_RESET /* For OTG port */
Markus Niebelee2cd2b2014-07-18 16:52:44 +020095
96/* Fuses */
97#define CONFIG_MXC_OCOTP
98#define CONFIG_CMD_FUSE
99
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200100#define CONFIG_CMD_PING
101#define CONFIG_CMD_DHCP
102#define CONFIG_CMD_MII
103#define CONFIG_CMD_NET
104
105#define CONFIG_FEC_MXC
106#define IMX_FEC_BASE ENET_BASE_ADDR
107#define CONFIG_PHYLIB
108#define CONFIG_MII
109
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200110#define CONFIG_ARP_TIMEOUT 200UL
111/* Network config - Allow larger/faster download for TFTP/NFS */
112#define CONFIG_IP_DEFRAG
113#define CONFIG_TFTP_BLOCKSIZE 4096
114#define CONFIG_NFS_READ_SIZE 4096
115
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200116/* Command definition */
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200117#define CONFIG_CMD_BMODE
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200118#define CONFIG_CMD_ITEST
119#define CONFIG_CMD_SETEXPR
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200120
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200121/* place code in last 4 MiB of RAM */
122#if defined(CONFIG_MX6DL) || defined(CONFIG_MX6S)
123#define CONFIG_SYS_TEXT_BASE 0x2fc00000
124#elif defined(CONFIG_MX6Q) || defined(CONFIG_MX6D)
125#define CONFIG_SYS_TEXT_BASE 0x4fc00000
126#endif
127
128#define CONFIG_ENV_SIZE (SZ_8K)
129/* Size of malloc() pool */
130#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2 * SZ_1M)
131
132#if defined(CONFIG_TQMA6X_MMC_BOOT)
133
134#define CONFIG_ENV_IS_IN_MMC
135#define TQMA6_UBOOT_OFFSET SZ_1K
136#define TQMA6_UBOOT_SECTOR_START 0x2
137#define TQMA6_UBOOT_SECTOR_COUNT 0x7fe
138
139#define CONFIG_ENV_OFFSET SZ_1M
140#define CONFIG_SYS_MMC_ENV_DEV 0
141
142#define TQMA6_FDT_OFFSET (2 * SZ_1M)
143#define TQMA6_FDT_SECTOR_START 0x1000
144#define TQMA6_FDT_SECTOR_COUNT 0x800
145
146#define TQMA6_KERNEL_SECTOR_START 0x2000
147#define TQMA6_KERNEL_SECTOR_COUNT 0x2000
148
149#define TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
150 "uboot_start="__stringify(TQMA6_UBOOT_SECTOR_START)"\0" \
151 "uboot_size="__stringify(TQMA6_UBOOT_SECTOR_COUNT)"\0" \
152 "fdt_start="__stringify(TQMA6_FDT_SECTOR_START)"\0" \
153 "fdt_size="__stringify(TQMA6_FDT_SECTOR_COUNT)"\0" \
154 "kernel_start="__stringify(TQMA6_KERNEL_SECTOR_START)"\0" \
155 "kernel_size="__stringify(TQMA6_KERNEL_SECTOR_COUNT)"\0" \
156 "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
157 "loadimage=mmc dev ${mmcdev}; " \
158 "mmc read ${loadaddr} ${kernel_start} ${kernel_size};\0" \
159 "loadfdt=mmc dev ${mmcdev}; " \
160 "mmc read ${fdt_addr} ${fdt_start} ${fdt_size};\0" \
161 "update_uboot=if tftp ${uboot}; then " \
162 "if itest ${filesize} > 0; then " \
163 "mmc dev ${mmcdev}; mmc rescan; " \
164 "setexpr blkc ${filesize} / 0x200; " \
165 "setexpr blkc ${blkc} + 1; " \
166 "if itest ${blkc} <= ${uboot_size}; then " \
167 "mmc write ${loadaddr} ${uboot_start} " \
168 "${blkc}; " \
169 "fi; " \
170 "fi; fi; " \
171 "setenv filesize; setenv blkc \0" \
172 "update_kernel=run kernel_name; " \
173 "if tftp ${kernel}; then " \
174 "if itest ${filesize} > 0; then " \
175 "mmc dev ${mmcdev}; mmc rescan; " \
176 "setexpr blkc ${filesize} / 0x200; " \
177 "setexpr blkc ${blkc} + 1; " \
178 "if itest ${blkc} <= ${kernel_size}; then " \
179 "mmc write ${loadaddr} " \
180 "${kernel_start} ${blkc}; " \
181 "fi; " \
182 "fi; " \
183 "fi; " \
184 "setenv filesize; setenv blkc \0" \
185 "update_fdt=if tftp ${fdt_file}; then " \
186 "if itest ${filesize} > 0; then " \
187 "mmc dev ${mmcdev}; mmc rescan; " \
188 "setexpr blkc ${filesize} / 0x200; " \
189 "setexpr blkc ${blkc} + 1; " \
190 "if itest ${blkc} <= ${fdt_size}; then " \
191 "mmc write ${loadaddr} ${fdt_start} ${blkc}; " \
192 "fi; " \
193 "fi; fi; " \
194 "setenv filesize; setenv blkc \0" \
195
196#define CONFIG_BOOTCOMMAND \
197 "run mmcboot; run netboot; run panicboot"
198
199#elif defined(CONFIG_TQMA6X_SPI_BOOT)
200
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200201#define TQMA6_UBOOT_OFFSET 0x400
202#define TQMA6_UBOOT_SECTOR_START 0x0
203/* max u-boot size: 512k */
Markus Niebela02eaa52014-11-18 13:22:54 +0100204#define TQMA6_UBOOT_SECTOR_SIZE TQMA6_SPI_FLASH_SECTOR_SIZE
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200205#define TQMA6_UBOOT_SECTOR_COUNT 0x8
206#define TQMA6_UBOOT_SIZE (TQMA6_UBOOT_SECTOR_SIZE * \
207 TQMA6_UBOOT_SECTOR_COUNT)
208
209#define CONFIG_ENV_IS_IN_SPI_FLASH
210#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
211#define CONFIG_ENV_OFFSET (TQMA6_UBOOT_SIZE)
Markus Niebela02eaa52014-11-18 13:22:54 +0100212#define CONFIG_ENV_SECT_SIZE TQMA6_SPI_FLASH_SECTOR_SIZE
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200213#define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + \
214 CONFIG_ENV_SECT_SIZE)
215
216#define CONFIG_ENV_SPI_BUS (CONFIG_SF_DEFAULT_BUS)
217#define CONFIG_ENV_SPI_CS (CONFIG_SF_DEFAULT_CS)
218#define CONFIG_ENV_SPI_MAX_HZ (CONFIG_SF_DEFAULT_SPEED)
219#define CONFIG_ENV_SPI_MODE (CONFIG_SF_DEFAULT_MODE)
220
221#define TQMA6_FDT_OFFSET (CONFIG_ENV_OFFSET_REDUND + \
222 CONFIG_ENV_SECT_SIZE)
Markus Niebela02eaa52014-11-18 13:22:54 +0100223#define TQMA6_FDT_SECT_SIZE (TQMA6_SPI_FLASH_SECTOR_SIZE)
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200224
225#define TQMA6_FDT_SECTOR_START 0x0a /* 8 Sector u-boot, 2 Sector env */
226#define TQMA6_FDT_SECTOR_COUNT 0x01
227
228#define TQMA6_KERNEL_SECTOR_START 0x10
229#define TQMA6_KERNEL_SECTOR_COUNT 0x60
230
231#define TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
232 "mmcblkdev=0\0" \
233 "uboot_offset="__stringify(TQMA6_UBOOT_OFFSET)"\0" \
234 "uboot_sectors="__stringify(TQMA6_UBOOT_SECTOR_COUNT)"\0" \
235 "fdt_start="__stringify(TQMA6_FDT_SECTOR_START)"\0" \
236 "fdt_sectors="__stringify(TQMA6_FDT_SECTOR_COUNT)"\0" \
237 "kernel_start="__stringify(TQMA6_KERNEL_SECTOR_START)"\0" \
238 "kernel_sectors="__stringify(TQMA6_KERNEL_SECTOR_COUNT)"\0" \
239 "update_uboot=if tftp ${uboot}; then " \
240 "if itest ${filesize} > 0; then " \
241 "setexpr blkc ${filesize} + " \
242 __stringify(TQMA6_UBOOT_OFFSET) "; " \
243 "setexpr size ${uboot_sectors} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100244 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200245 "if itest ${blkc} <= ${size}; then " \
246 "sf probe; " \
247 "sf erase 0 ${size}; " \
248 "sf write ${loadaddr} ${uboot_offset} " \
249 "${filesize}; " \
250 "fi; " \
251 "fi; fi; " \
252 "setenv filesize 0; setenv blkc; setenv size \0" \
253 "update_kernel=run kernel_name; if tftp ${kernel}; then " \
254 "if itest ${filesize} > 0; then " \
255 "setexpr size ${kernel_sectors} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100256 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200257 "setexpr offset ${kernel_start} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100258 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200259 "if itest ${filesize} <= ${size}; then " \
260 "sf probe; " \
261 "sf erase ${offset} ${size}; " \
262 "sf write ${loadaddr} ${offset} " \
263 "${filesize}; " \
264 "fi; " \
265 "fi; fi; " \
266 "setenv filesize 0; setenv size ; setenv offset\0" \
267 "update_fdt=if tftp ${fdt_file}; then " \
268 "if itest ${filesize} > 0; then " \
269 "setexpr size ${fdt_sectors} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100270 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200271 "setexpr offset ${fdt_start} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100272 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200273 "if itest ${filesize} <= ${size}; then " \
274 "sf probe; " \
275 "sf erase ${offset} ${size}; " \
276 "sf write ${loadaddr} ${offset} " \
277 "${filesize}; " \
278 "fi; " \
279 "fi; fi; " \
280 "setenv filesize 0; setenv size ; setenv offset\0" \
281 "loadimage=sf probe; " \
282 "setexpr size ${kernel_sectors} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100283 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200284 "setexpr offset ${kernel_start} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100285 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200286 "sf read ${loadaddr} ${offset} ${size}; " \
287 "setenv size ; setenv offset\0" \
288 "loadfdt=sf probe; " \
289 "setexpr size ${fdt_sectors} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100290 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200291 "setexpr offset ${fdt_start} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100292 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200293 "sf read ${${fdt_addr}} ${offset} ${size}; " \
294 "setenv size ; setenv offset\0" \
295
296
297#define CONFIG_BOOTCOMMAND \
298 "sf probe; run mmcboot; run netboot; run panicboot" \
299
300#else
301
302#error "need to define boot source"
303
304#endif
305
306/* 128 MiB offset as in ARM related docu for linux suggested */
307#define TQMA6_FDT_ADDRESS 0x18000000
308
309#define CONFIG_EXTRA_ENV_SETTINGS \
310 "board=tqma6\0" \
311 "uimage=uImage\0" \
312 "zimage=zImage\0" \
313 "boot_type=bootz\0" \
314 "kernel_name=if test \"${boot_type}\" != bootz; then " \
315 "setenv kernel ${uimage}; " \
316 "else setenv kernel ${zimage}; fi\0" \
317 "uboot=u-boot.imx\0" \
318 "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
319 "fdt_addr="__stringify(TQMA6_FDT_ADDRESS)"\0" \
320 "console=" CONFIG_CONSOLE_DEV "\0" \
321 "fdt_high=0xffffffff\0" \
322 "initrd_high=0xffffffff\0" \
323 "addtty=setenv bootargs ${bootargs} console=${console},${baudrate}\0" \
324 "addfb=setenv bootargs ${bootargs} " \
325 "imx-fbdev.legacyfb_depth=32 consoleblank=0\0" \
326 "mmcpart=2\0" \
327 "mmcblkdev=0\0" \
328 "mmcargs=run addmmc addtty addfb\0" \
329 "addmmc=setenv bootargs ${bootargs} " \
330 "root=/dev/mmcblk${mmcblkdev}p${mmcpart} rw rootwait\0" \
331 "mmcboot=echo Booting from mmc ...; " \
332 "setenv bootargs; " \
333 "run mmcargs; " \
334 "run loadimage; " \
335 "if run loadfdt; then " \
336 "echo boot device tree kernel ...; " \
337 "${boot_type} ${loadaddr} - ${fdt_addr}; " \
338 "else " \
339 "${boot_type}; " \
340 "fi;\0" \
341 "setenv bootargs \0" \
342 "netdev=eth0\0" \
343 "rootpath=/srv/nfs/tqma6\0" \
344 "ipmode=static\0" \
345 "netargs=run addnfs addip addtty addfb\0" \
346 "addnfs=setenv bootargs ${bootargs} " \
347 "root=/dev/nfs rw " \
348 "nfsroot=${serverip}:${rootpath},v3,tcp;\0" \
349 "addip_static=setenv bootargs ${bootargs} " \
350 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:" \
351 "${hostname}:${netdev}:off\0" \
352 "addip_dynamic=setenv bootargs ${bootargs} ip=dhcp\0" \
353 "addip=if test \"${ipmode}\" != static; then " \
354 "run addip_dynamic; else run addip_static; fi\0" \
355 "set_getcmd=if test \"${ipmode}\" != static; then " \
356 "setenv getcmd dhcp; setenv autoload yes; " \
357 "else setenv getcmd tftp; setenv autoload no; fi\0" \
358 "netboot=echo Booting from net ...; " \
359 "run kernel_name; " \
360 "run set_getcmd; " \
361 "setenv bootargs; " \
362 "run netargs; " \
363 "if ${getcmd} ${kernel}; then " \
364 "if ${getcmd} ${fdt_addr} ${fdt_file}; then " \
365 "${boot_type} ${loadaddr} - ${fdt_addr}; " \
366 "fi; " \
367 "fi; " \
368 "echo ... failed\0" \
369 "panicboot=echo No boot device !!! reset\0" \
370 TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
371
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200372/* Print Buffer Size */
373#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
374 sizeof(CONFIG_SYS_PROMPT) + 16)
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200375
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200376#define CONFIG_STACKSIZE (128u * SZ_1K)
377
378/* Physical Memory Map */
379#define CONFIG_NR_DRAM_BANKS 1
380#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
381
382#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
383#define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
384#define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
385
386#define CONFIG_SYS_INIT_SP_OFFSET \
387 (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
388#define CONFIG_SYS_INIT_SP_ADDR \
389 (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
390
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200391#define CONFIG_OF_LIBFDT
392#define CONFIG_OF_BOARD_SETUP
393#define CONFIG_FIT
394#define CONFIG_FIT_VERBOSE
395
Stefan Roeseb125fd42015-03-12 16:34:16 +0100396/*
397 * All the defines above are for the TQMa6 SoM
398 *
399 * Now include the baseboard specific configuration
400 */
401#ifdef CONFIG_MBA6
402#include "tqma6_mba6.h"
403#else
404#error "No baseboard for the TQMa6 defined!"
405#endif
406
407/* Support at least the sensor on TQMa6 SOM */
408#if !defined(CONFIG_DTT_SENSORS)
409#define CONFIG_DTT_SENSORS { 0 }
410#endif
411
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200412#endif /* __CONFIG_H */