blob: 4859e038906b037ff0d16148b032c653474af076 [file] [log] [blame]
Markus Niebelcb07d742014-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 Niebel1719d492014-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 Niebelcb07d742014-07-18 16:52:44 +020025#include "mx6_common.h"
Markus Niebelcb07d742014-07-18 16:52:44 +020026
Markus Niebelcb07d742014-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 Niebelcb07d742014-07-18 16:52:44 +020033#define CONFIG_BOARD_EARLY_INIT_F
34#define CONFIG_BOARD_LATE_INIT
35
Markus Niebelcb07d742014-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 Niebel52835462014-11-18 13:22:54 +010046#define TQMA6_SPI_FLASH_SECTOR_SIZE SZ_64K
47
Markus Niebelcb07d742014-07-18 16:52:44 +020048#define CONFIG_CMD_SF
49#define CONFIG_SF_DEFAULT_BUS 0
Markus Niebel1719d492014-10-23 15:47:05 +020050#define CONFIG_SF_DEFAULT_CS 0
Markus Niebelcb07d742014-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 Sunf8cb1012015-03-20 10:20:40 -070058#define CONFIG_SYS_I2C_MXC_I2C3 /* enable I2C bus 3 */
Markus Niebelcb07d742014-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 Niebelcb07d742014-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 Niebelcb07d742014-07-18 16:52:44 +020083#define CONFIG_SYS_FSL_ESDHC_ADDR 0
84
Markus Niebelcb07d742014-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 Niebelcb07d742014-07-18 16:52:44 +020092#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
Stefan Roese911b5ea2015-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 Niebelcb07d742014-07-18 16:52:44 +020095
96/* Fuses */
97#define CONFIG_MXC_OCOTP
98#define CONFIG_CMD_FUSE
99
Markus Niebelcb07d742014-07-18 16:52:44 +0200100#define CONFIG_CMD_PING
101#define CONFIG_CMD_DHCP
102#define CONFIG_CMD_MII
Markus Niebelcb07d742014-07-18 16:52:44 +0200103
104#define CONFIG_FEC_MXC
105#define IMX_FEC_BASE ENET_BASE_ADDR
106#define CONFIG_PHYLIB
107#define CONFIG_MII
108
Markus Niebelcb07d742014-07-18 16:52:44 +0200109#define CONFIG_ARP_TIMEOUT 200UL
110/* Network config - Allow larger/faster download for TFTP/NFS */
111#define CONFIG_IP_DEFRAG
112#define CONFIG_TFTP_BLOCKSIZE 4096
113#define CONFIG_NFS_READ_SIZE 4096
114
Markus Niebelcb07d742014-07-18 16:52:44 +0200115/* Command definition */
Markus Niebelcb07d742014-07-18 16:52:44 +0200116#define CONFIG_CMD_BMODE
Markus Niebelcb07d742014-07-18 16:52:44 +0200117#define CONFIG_CMD_ITEST
Markus Niebelcb07d742014-07-18 16:52:44 +0200118
Markus Niebelcb07d742014-07-18 16:52:44 +0200119/* place code in last 4 MiB of RAM */
120#if defined(CONFIG_MX6DL) || defined(CONFIG_MX6S)
121#define CONFIG_SYS_TEXT_BASE 0x2fc00000
122#elif defined(CONFIG_MX6Q) || defined(CONFIG_MX6D)
123#define CONFIG_SYS_TEXT_BASE 0x4fc00000
124#endif
125
126#define CONFIG_ENV_SIZE (SZ_8K)
127/* Size of malloc() pool */
128#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2 * SZ_1M)
129
130#if defined(CONFIG_TQMA6X_MMC_BOOT)
131
132#define CONFIG_ENV_IS_IN_MMC
133#define TQMA6_UBOOT_OFFSET SZ_1K
134#define TQMA6_UBOOT_SECTOR_START 0x2
135#define TQMA6_UBOOT_SECTOR_COUNT 0x7fe
136
137#define CONFIG_ENV_OFFSET SZ_1M
138#define CONFIG_SYS_MMC_ENV_DEV 0
139
140#define TQMA6_FDT_OFFSET (2 * SZ_1M)
141#define TQMA6_FDT_SECTOR_START 0x1000
142#define TQMA6_FDT_SECTOR_COUNT 0x800
143
144#define TQMA6_KERNEL_SECTOR_START 0x2000
145#define TQMA6_KERNEL_SECTOR_COUNT 0x2000
146
147#define TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
148 "uboot_start="__stringify(TQMA6_UBOOT_SECTOR_START)"\0" \
149 "uboot_size="__stringify(TQMA6_UBOOT_SECTOR_COUNT)"\0" \
150 "fdt_start="__stringify(TQMA6_FDT_SECTOR_START)"\0" \
151 "fdt_size="__stringify(TQMA6_FDT_SECTOR_COUNT)"\0" \
152 "kernel_start="__stringify(TQMA6_KERNEL_SECTOR_START)"\0" \
153 "kernel_size="__stringify(TQMA6_KERNEL_SECTOR_COUNT)"\0" \
154 "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
155 "loadimage=mmc dev ${mmcdev}; " \
156 "mmc read ${loadaddr} ${kernel_start} ${kernel_size};\0" \
157 "loadfdt=mmc dev ${mmcdev}; " \
158 "mmc read ${fdt_addr} ${fdt_start} ${fdt_size};\0" \
159 "update_uboot=if tftp ${uboot}; then " \
160 "if itest ${filesize} > 0; then " \
161 "mmc dev ${mmcdev}; mmc rescan; " \
162 "setexpr blkc ${filesize} / 0x200; " \
163 "setexpr blkc ${blkc} + 1; " \
164 "if itest ${blkc} <= ${uboot_size}; then " \
165 "mmc write ${loadaddr} ${uboot_start} " \
166 "${blkc}; " \
167 "fi; " \
168 "fi; fi; " \
169 "setenv filesize; setenv blkc \0" \
170 "update_kernel=run kernel_name; " \
171 "if tftp ${kernel}; then " \
172 "if itest ${filesize} > 0; then " \
173 "mmc dev ${mmcdev}; mmc rescan; " \
174 "setexpr blkc ${filesize} / 0x200; " \
175 "setexpr blkc ${blkc} + 1; " \
176 "if itest ${blkc} <= ${kernel_size}; then " \
177 "mmc write ${loadaddr} " \
178 "${kernel_start} ${blkc}; " \
179 "fi; " \
180 "fi; " \
181 "fi; " \
182 "setenv filesize; setenv blkc \0" \
183 "update_fdt=if tftp ${fdt_file}; then " \
184 "if itest ${filesize} > 0; then " \
185 "mmc dev ${mmcdev}; mmc rescan; " \
186 "setexpr blkc ${filesize} / 0x200; " \
187 "setexpr blkc ${blkc} + 1; " \
188 "if itest ${blkc} <= ${fdt_size}; then " \
189 "mmc write ${loadaddr} ${fdt_start} ${blkc}; " \
190 "fi; " \
191 "fi; fi; " \
192 "setenv filesize; setenv blkc \0" \
193
194#define CONFIG_BOOTCOMMAND \
195 "run mmcboot; run netboot; run panicboot"
196
197#elif defined(CONFIG_TQMA6X_SPI_BOOT)
198
Markus Niebelcb07d742014-07-18 16:52:44 +0200199#define TQMA6_UBOOT_OFFSET 0x400
200#define TQMA6_UBOOT_SECTOR_START 0x0
201/* max u-boot size: 512k */
Markus Niebel52835462014-11-18 13:22:54 +0100202#define TQMA6_UBOOT_SECTOR_SIZE TQMA6_SPI_FLASH_SECTOR_SIZE
Markus Niebelcb07d742014-07-18 16:52:44 +0200203#define TQMA6_UBOOT_SECTOR_COUNT 0x8
204#define TQMA6_UBOOT_SIZE (TQMA6_UBOOT_SECTOR_SIZE * \
205 TQMA6_UBOOT_SECTOR_COUNT)
206
207#define CONFIG_ENV_IS_IN_SPI_FLASH
208#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
209#define CONFIG_ENV_OFFSET (TQMA6_UBOOT_SIZE)
Markus Niebel52835462014-11-18 13:22:54 +0100210#define CONFIG_ENV_SECT_SIZE TQMA6_SPI_FLASH_SECTOR_SIZE
Markus Niebelcb07d742014-07-18 16:52:44 +0200211#define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + \
212 CONFIG_ENV_SECT_SIZE)
213
214#define CONFIG_ENV_SPI_BUS (CONFIG_SF_DEFAULT_BUS)
215#define CONFIG_ENV_SPI_CS (CONFIG_SF_DEFAULT_CS)
216#define CONFIG_ENV_SPI_MAX_HZ (CONFIG_SF_DEFAULT_SPEED)
217#define CONFIG_ENV_SPI_MODE (CONFIG_SF_DEFAULT_MODE)
218
219#define TQMA6_FDT_OFFSET (CONFIG_ENV_OFFSET_REDUND + \
220 CONFIG_ENV_SECT_SIZE)
Markus Niebel52835462014-11-18 13:22:54 +0100221#define TQMA6_FDT_SECT_SIZE (TQMA6_SPI_FLASH_SECTOR_SIZE)
Markus Niebelcb07d742014-07-18 16:52:44 +0200222
223#define TQMA6_FDT_SECTOR_START 0x0a /* 8 Sector u-boot, 2 Sector env */
224#define TQMA6_FDT_SECTOR_COUNT 0x01
225
226#define TQMA6_KERNEL_SECTOR_START 0x10
227#define TQMA6_KERNEL_SECTOR_COUNT 0x60
228
229#define TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
230 "mmcblkdev=0\0" \
231 "uboot_offset="__stringify(TQMA6_UBOOT_OFFSET)"\0" \
232 "uboot_sectors="__stringify(TQMA6_UBOOT_SECTOR_COUNT)"\0" \
233 "fdt_start="__stringify(TQMA6_FDT_SECTOR_START)"\0" \
234 "fdt_sectors="__stringify(TQMA6_FDT_SECTOR_COUNT)"\0" \
235 "kernel_start="__stringify(TQMA6_KERNEL_SECTOR_START)"\0" \
236 "kernel_sectors="__stringify(TQMA6_KERNEL_SECTOR_COUNT)"\0" \
237 "update_uboot=if tftp ${uboot}; then " \
238 "if itest ${filesize} > 0; then " \
239 "setexpr blkc ${filesize} + " \
240 __stringify(TQMA6_UBOOT_OFFSET) "; " \
241 "setexpr size ${uboot_sectors} * " \
Markus Niebel52835462014-11-18 13:22:54 +0100242 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200243 "if itest ${blkc} <= ${size}; then " \
244 "sf probe; " \
245 "sf erase 0 ${size}; " \
246 "sf write ${loadaddr} ${uboot_offset} " \
247 "${filesize}; " \
248 "fi; " \
249 "fi; fi; " \
250 "setenv filesize 0; setenv blkc; setenv size \0" \
251 "update_kernel=run kernel_name; if tftp ${kernel}; then " \
252 "if itest ${filesize} > 0; then " \
253 "setexpr size ${kernel_sectors} * " \
Markus Niebel52835462014-11-18 13:22:54 +0100254 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200255 "setexpr offset ${kernel_start} * " \
Markus Niebel52835462014-11-18 13:22:54 +0100256 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200257 "if itest ${filesize} <= ${size}; then " \
258 "sf probe; " \
259 "sf erase ${offset} ${size}; " \
260 "sf write ${loadaddr} ${offset} " \
261 "${filesize}; " \
262 "fi; " \
263 "fi; fi; " \
264 "setenv filesize 0; setenv size ; setenv offset\0" \
265 "update_fdt=if tftp ${fdt_file}; then " \
266 "if itest ${filesize} > 0; then " \
267 "setexpr size ${fdt_sectors} * " \
Markus Niebel52835462014-11-18 13:22:54 +0100268 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200269 "setexpr offset ${fdt_start} * " \
Markus Niebel52835462014-11-18 13:22:54 +0100270 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200271 "if itest ${filesize} <= ${size}; then " \
272 "sf probe; " \
273 "sf erase ${offset} ${size}; " \
274 "sf write ${loadaddr} ${offset} " \
275 "${filesize}; " \
276 "fi; " \
277 "fi; fi; " \
278 "setenv filesize 0; setenv size ; setenv offset\0" \
279 "loadimage=sf probe; " \
280 "setexpr size ${kernel_sectors} * " \
Markus Niebel52835462014-11-18 13:22:54 +0100281 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200282 "setexpr offset ${kernel_start} * " \
Markus Niebel52835462014-11-18 13:22:54 +0100283 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200284 "sf read ${loadaddr} ${offset} ${size}; " \
285 "setenv size ; setenv offset\0" \
286 "loadfdt=sf probe; " \
287 "setexpr size ${fdt_sectors} * " \
Markus Niebel52835462014-11-18 13:22:54 +0100288 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200289 "setexpr offset ${fdt_start} * " \
Markus Niebel52835462014-11-18 13:22:54 +0100290 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200291 "sf read ${${fdt_addr}} ${offset} ${size}; " \
292 "setenv size ; setenv offset\0" \
293
294
295#define CONFIG_BOOTCOMMAND \
296 "sf probe; run mmcboot; run netboot; run panicboot" \
297
298#else
299
300#error "need to define boot source"
301
302#endif
303
304/* 128 MiB offset as in ARM related docu for linux suggested */
305#define TQMA6_FDT_ADDRESS 0x18000000
306
307#define CONFIG_EXTRA_ENV_SETTINGS \
308 "board=tqma6\0" \
309 "uimage=uImage\0" \
310 "zimage=zImage\0" \
311 "boot_type=bootz\0" \
312 "kernel_name=if test \"${boot_type}\" != bootz; then " \
313 "setenv kernel ${uimage}; " \
314 "else setenv kernel ${zimage}; fi\0" \
315 "uboot=u-boot.imx\0" \
316 "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
317 "fdt_addr="__stringify(TQMA6_FDT_ADDRESS)"\0" \
318 "console=" CONFIG_CONSOLE_DEV "\0" \
319 "fdt_high=0xffffffff\0" \
320 "initrd_high=0xffffffff\0" \
321 "addtty=setenv bootargs ${bootargs} console=${console},${baudrate}\0" \
322 "addfb=setenv bootargs ${bootargs} " \
323 "imx-fbdev.legacyfb_depth=32 consoleblank=0\0" \
324 "mmcpart=2\0" \
325 "mmcblkdev=0\0" \
326 "mmcargs=run addmmc addtty addfb\0" \
327 "addmmc=setenv bootargs ${bootargs} " \
328 "root=/dev/mmcblk${mmcblkdev}p${mmcpart} rw rootwait\0" \
329 "mmcboot=echo Booting from mmc ...; " \
330 "setenv bootargs; " \
331 "run mmcargs; " \
332 "run loadimage; " \
333 "if run loadfdt; then " \
334 "echo boot device tree kernel ...; " \
335 "${boot_type} ${loadaddr} - ${fdt_addr}; " \
336 "else " \
337 "${boot_type}; " \
338 "fi;\0" \
339 "setenv bootargs \0" \
340 "netdev=eth0\0" \
341 "rootpath=/srv/nfs/tqma6\0" \
342 "ipmode=static\0" \
343 "netargs=run addnfs addip addtty addfb\0" \
344 "addnfs=setenv bootargs ${bootargs} " \
345 "root=/dev/nfs rw " \
346 "nfsroot=${serverip}:${rootpath},v3,tcp;\0" \
347 "addip_static=setenv bootargs ${bootargs} " \
348 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:" \
349 "${hostname}:${netdev}:off\0" \
350 "addip_dynamic=setenv bootargs ${bootargs} ip=dhcp\0" \
351 "addip=if test \"${ipmode}\" != static; then " \
352 "run addip_dynamic; else run addip_static; fi\0" \
353 "set_getcmd=if test \"${ipmode}\" != static; then " \
354 "setenv getcmd dhcp; setenv autoload yes; " \
355 "else setenv getcmd tftp; setenv autoload no; fi\0" \
356 "netboot=echo Booting from net ...; " \
357 "run kernel_name; " \
358 "run set_getcmd; " \
359 "setenv bootargs; " \
360 "run netargs; " \
361 "if ${getcmd} ${kernel}; then " \
362 "if ${getcmd} ${fdt_addr} ${fdt_file}; then " \
363 "${boot_type} ${loadaddr} - ${fdt_addr}; " \
364 "fi; " \
365 "fi; " \
366 "echo ... failed\0" \
367 "panicboot=echo No boot device !!! reset\0" \
368 TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
369
Markus Niebelcb07d742014-07-18 16:52:44 +0200370/* Print Buffer Size */
371#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
372 sizeof(CONFIG_SYS_PROMPT) + 16)
Markus Niebelcb07d742014-07-18 16:52:44 +0200373
Markus Niebelcb07d742014-07-18 16:52:44 +0200374#define CONFIG_STACKSIZE (128u * SZ_1K)
375
376/* Physical Memory Map */
377#define CONFIG_NR_DRAM_BANKS 1
378#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
379
380#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
381#define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
382#define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
383
384#define CONFIG_SYS_INIT_SP_OFFSET \
385 (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
386#define CONFIG_SYS_INIT_SP_ADDR \
387 (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
388
Markus Niebelcb07d742014-07-18 16:52:44 +0200389#define CONFIG_OF_LIBFDT
390#define CONFIG_OF_BOARD_SETUP
391#define CONFIG_FIT
392#define CONFIG_FIT_VERBOSE
393
Stefan Roese6b396b32015-03-12 16:34:16 +0100394/*
395 * All the defines above are for the TQMa6 SoM
396 *
397 * Now include the baseboard specific configuration
398 */
399#ifdef CONFIG_MBA6
400#include "tqma6_mba6.h"
401#else
402#error "No baseboard for the TQMa6 defined!"
403#endif
404
405/* Support at least the sensor on TQMa6 SOM */
406#if !defined(CONFIG_DTT_SENSORS)
407#define CONFIG_DTT_SENSORS { 0 }
408#endif
409
Markus Niebelcb07d742014-07-18 16:52:44 +0200410#endif /* __CONFIG_H */