blob: e0c4ada711dde9b9a46294dd9e913cc50991969d [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 Niebelc34054e2015-06-04 17:25:30 +020012#include <linux/kconfig.h>
Markus Niebela116f6f2014-10-23 15:47:05 +020013/* SPL */
14/* #if defined(CONFIG_SPL_BUILD) */
15
16#define CONFIG_SPL_MMC_SUPPORT
17#define CONFIG_SPL_SPI_SUPPORT
18#define CONFIG_SPL_FAT_SUPPORT
19#define CONFIG_SPL_EXT_SUPPORT
20
21/* common IMX6 SPL configuration */
22#include "imx6_spl.h"
23
24/* #endif */
25
Fabio Estevam8c717e52015-05-28 12:33:34 -030026/* place code in last 4 MiB of RAM */
27#if defined(CONFIG_MX6DL) || defined(CONFIG_MX6S)
28#define CONFIG_SYS_TEXT_BASE 0x2fc00000
29#elif defined(CONFIG_MX6Q) || defined(CONFIG_MX6D)
30#define CONFIG_SYS_TEXT_BASE 0x4fc00000
31#endif
32
Markus Niebelee2cd2b2014-07-18 16:52:44 +020033#include "mx6_common.h"
Markus Niebelee2cd2b2014-07-18 16:52:44 +020034
Markus Niebelee2cd2b2014-07-18 16:52:44 +020035#if defined(CONFIG_MX6DL) || defined(CONFIG_MX6S)
36#define PHYS_SDRAM_SIZE (512u * SZ_1M)
37#elif defined(CONFIG_MX6Q) || defined(CONFIG_MX6D)
38#define PHYS_SDRAM_SIZE (1024u * SZ_1M)
39#endif
40
Markus Niebelee2cd2b2014-07-18 16:52:44 +020041#define CONFIG_BOARD_EARLY_INIT_F
42#define CONFIG_BOARD_LATE_INIT
43
Markus Niebelee2cd2b2014-07-18 16:52:44 +020044#define CONFIG_MXC_UART
45
46/* SPI */
47#define CONFIG_CMD_SPI
48#define CONFIG_MXC_SPI
49
50/* SPI Flash */
Markus Niebelee2cd2b2014-07-18 16:52:44 +020051#define CONFIG_SPI_FLASH_STMICRO
52
Markus Niebela02eaa52014-11-18 13:22:54 +010053#define TQMA6_SPI_FLASH_SECTOR_SIZE SZ_64K
54
Markus Niebelee2cd2b2014-07-18 16:52:44 +020055#define CONFIG_CMD_SF
56#define CONFIG_SF_DEFAULT_BUS 0
Markus Niebela116f6f2014-10-23 15:47:05 +020057#define CONFIG_SF_DEFAULT_CS 0
Markus Niebelee2cd2b2014-07-18 16:52:44 +020058#define CONFIG_SF_DEFAULT_SPEED 50000000
59#define CONFIG_SF_DEFAULT_MODE (SPI_MODE_0)
60
61/* I2C Configs */
62#define CONFIG_CMD_I2C
63#define CONFIG_SYS_I2C
64#define CONFIG_SYS_I2C_MXC
York Sunf1a52162015-03-20 10:20:40 -070065#define CONFIG_SYS_I2C_MXC_I2C3 /* enable I2C bus 3 */
Markus Niebelee2cd2b2014-07-18 16:52:44 +020066#define CONFIG_I2C_MULTI_BUS
67#define CONFIG_SYS_I2C_SPEED 100000
68
69/* I2C SYSMON (LM75) */
70#define CONFIG_DTT_LM75
Markus Niebelee2cd2b2014-07-18 16:52:44 +020071#define CONFIG_DTT_MAX_TEMP 70
72#define CONFIG_DTT_MIN_TEMP -30
73#define CONFIG_DTT_HYSTERESIS 3
74#define CONFIG_CMD_DTT
75
76/* I2C EEPROM (M24C64) */
77#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50
78#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
79#define CONFIG_SYS_I2C_EEPROM_PAGE_WRITE_BITS 5 /* 32 Bytes */
80#define CONFIG_SYS_I2C_EEPROM_PAGE_WRITE_DELAY_MS 20
81#define CONFIG_CMD_EEPROM
82
83#define CONFIG_POWER
84#define CONFIG_POWER_I2C
85#define CONFIG_POWER_PFUZE100
86#define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08
87#define TQMA6_PFUZE100_I2C_BUS 2
88
89/* MMC Configs */
Markus Niebelee2cd2b2014-07-18 16:52:44 +020090#define CONFIG_SYS_FSL_ESDHC_ADDR 0
91
Markus Niebelee2cd2b2014-07-18 16:52:44 +020092/* USB Configs */
93#define CONFIG_CMD_USB
94#define CONFIG_USB_EHCI
95#define CONFIG_USB_EHCI_MX6
96#define CONFIG_USB_STORAGE
97#define CONFIG_USB_HOST_ETHER
98#define CONFIG_USB_ETHER_SMSC95XX
Markus Niebelee2cd2b2014-07-18 16:52:44 +020099#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
Stefan Roese4cbf1882015-03-12 13:34:29 +0100100#define CONFIG_USB_MAX_CONTROLLER_COUNT 2
101#define CONFIG_EHCI_HCD_INIT_AFTER_RESET /* For OTG port */
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200102
103/* Fuses */
104#define CONFIG_MXC_OCOTP
105#define CONFIG_CMD_FUSE
106
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200107#define CONFIG_CMD_PING
108#define CONFIG_CMD_DHCP
109#define CONFIG_CMD_MII
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200110
111#define CONFIG_FEC_MXC
112#define IMX_FEC_BASE ENET_BASE_ADDR
113#define CONFIG_PHYLIB
114#define CONFIG_MII
115
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200116#define CONFIG_ARP_TIMEOUT 200UL
117/* Network config - Allow larger/faster download for TFTP/NFS */
118#define CONFIG_IP_DEFRAG
119#define CONFIG_TFTP_BLOCKSIZE 4096
120#define CONFIG_NFS_READ_SIZE 4096
121
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200122/* Command definition */
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200123#define CONFIG_CMD_BMODE
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200124
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200125#define CONFIG_ENV_SIZE (SZ_8K)
126/* Size of malloc() pool */
127#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2 * SZ_1M)
128
129#if defined(CONFIG_TQMA6X_MMC_BOOT)
130
131#define CONFIG_ENV_IS_IN_MMC
132#define TQMA6_UBOOT_OFFSET SZ_1K
133#define TQMA6_UBOOT_SECTOR_START 0x2
134#define TQMA6_UBOOT_SECTOR_COUNT 0x7fe
135
136#define CONFIG_ENV_OFFSET SZ_1M
137#define CONFIG_SYS_MMC_ENV_DEV 0
138
139#define TQMA6_FDT_OFFSET (2 * SZ_1M)
140#define TQMA6_FDT_SECTOR_START 0x1000
141#define TQMA6_FDT_SECTOR_COUNT 0x800
142
143#define TQMA6_KERNEL_SECTOR_START 0x2000
144#define TQMA6_KERNEL_SECTOR_COUNT 0x2000
145
146#define TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
147 "uboot_start="__stringify(TQMA6_UBOOT_SECTOR_START)"\0" \
148 "uboot_size="__stringify(TQMA6_UBOOT_SECTOR_COUNT)"\0" \
149 "fdt_start="__stringify(TQMA6_FDT_SECTOR_START)"\0" \
150 "fdt_size="__stringify(TQMA6_FDT_SECTOR_COUNT)"\0" \
151 "kernel_start="__stringify(TQMA6_KERNEL_SECTOR_START)"\0" \
152 "kernel_size="__stringify(TQMA6_KERNEL_SECTOR_COUNT)"\0" \
153 "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
154 "loadimage=mmc dev ${mmcdev}; " \
155 "mmc read ${loadaddr} ${kernel_start} ${kernel_size};\0" \
156 "loadfdt=mmc dev ${mmcdev}; " \
157 "mmc read ${fdt_addr} ${fdt_start} ${fdt_size};\0" \
158 "update_uboot=if tftp ${uboot}; then " \
159 "if itest ${filesize} > 0; then " \
160 "mmc dev ${mmcdev}; mmc rescan; " \
161 "setexpr blkc ${filesize} / 0x200; " \
162 "setexpr blkc ${blkc} + 1; " \
163 "if itest ${blkc} <= ${uboot_size}; then " \
164 "mmc write ${loadaddr} ${uboot_start} " \
165 "${blkc}; " \
166 "fi; " \
167 "fi; fi; " \
168 "setenv filesize; setenv blkc \0" \
169 "update_kernel=run kernel_name; " \
170 "if tftp ${kernel}; then " \
171 "if itest ${filesize} > 0; then " \
172 "mmc dev ${mmcdev}; mmc rescan; " \
173 "setexpr blkc ${filesize} / 0x200; " \
174 "setexpr blkc ${blkc} + 1; " \
175 "if itest ${blkc} <= ${kernel_size}; then " \
176 "mmc write ${loadaddr} " \
177 "${kernel_start} ${blkc}; " \
178 "fi; " \
179 "fi; " \
180 "fi; " \
181 "setenv filesize; setenv blkc \0" \
182 "update_fdt=if tftp ${fdt_file}; then " \
183 "if itest ${filesize} > 0; then " \
184 "mmc dev ${mmcdev}; mmc rescan; " \
185 "setexpr blkc ${filesize} / 0x200; " \
186 "setexpr blkc ${blkc} + 1; " \
187 "if itest ${blkc} <= ${fdt_size}; then " \
188 "mmc write ${loadaddr} ${fdt_start} ${blkc}; " \
189 "fi; " \
190 "fi; fi; " \
191 "setenv filesize; setenv blkc \0" \
192
193#define CONFIG_BOOTCOMMAND \
194 "run mmcboot; run netboot; run panicboot"
195
196#elif defined(CONFIG_TQMA6X_SPI_BOOT)
197
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200198#define TQMA6_UBOOT_OFFSET 0x400
199#define TQMA6_UBOOT_SECTOR_START 0x0
200/* max u-boot size: 512k */
Markus Niebela02eaa52014-11-18 13:22:54 +0100201#define TQMA6_UBOOT_SECTOR_SIZE TQMA6_SPI_FLASH_SECTOR_SIZE
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200202#define TQMA6_UBOOT_SECTOR_COUNT 0x8
203#define TQMA6_UBOOT_SIZE (TQMA6_UBOOT_SECTOR_SIZE * \
204 TQMA6_UBOOT_SECTOR_COUNT)
205
206#define CONFIG_ENV_IS_IN_SPI_FLASH
207#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
208#define CONFIG_ENV_OFFSET (TQMA6_UBOOT_SIZE)
Markus Niebela02eaa52014-11-18 13:22:54 +0100209#define CONFIG_ENV_SECT_SIZE TQMA6_SPI_FLASH_SECTOR_SIZE
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200210#define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + \
211 CONFIG_ENV_SECT_SIZE)
212
213#define CONFIG_ENV_SPI_BUS (CONFIG_SF_DEFAULT_BUS)
214#define CONFIG_ENV_SPI_CS (CONFIG_SF_DEFAULT_CS)
215#define CONFIG_ENV_SPI_MAX_HZ (CONFIG_SF_DEFAULT_SPEED)
216#define CONFIG_ENV_SPI_MODE (CONFIG_SF_DEFAULT_MODE)
217
218#define TQMA6_FDT_OFFSET (CONFIG_ENV_OFFSET_REDUND + \
219 CONFIG_ENV_SECT_SIZE)
Markus Niebela02eaa52014-11-18 13:22:54 +0100220#define TQMA6_FDT_SECT_SIZE (TQMA6_SPI_FLASH_SECTOR_SIZE)
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200221
222#define TQMA6_FDT_SECTOR_START 0x0a /* 8 Sector u-boot, 2 Sector env */
223#define TQMA6_FDT_SECTOR_COUNT 0x01
224
225#define TQMA6_KERNEL_SECTOR_START 0x10
226#define TQMA6_KERNEL_SECTOR_COUNT 0x60
227
228#define TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
229 "mmcblkdev=0\0" \
230 "uboot_offset="__stringify(TQMA6_UBOOT_OFFSET)"\0" \
231 "uboot_sectors="__stringify(TQMA6_UBOOT_SECTOR_COUNT)"\0" \
232 "fdt_start="__stringify(TQMA6_FDT_SECTOR_START)"\0" \
233 "fdt_sectors="__stringify(TQMA6_FDT_SECTOR_COUNT)"\0" \
234 "kernel_start="__stringify(TQMA6_KERNEL_SECTOR_START)"\0" \
235 "kernel_sectors="__stringify(TQMA6_KERNEL_SECTOR_COUNT)"\0" \
236 "update_uboot=if tftp ${uboot}; then " \
237 "if itest ${filesize} > 0; then " \
238 "setexpr blkc ${filesize} + " \
239 __stringify(TQMA6_UBOOT_OFFSET) "; " \
240 "setexpr size ${uboot_sectors} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100241 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200242 "if itest ${blkc} <= ${size}; then " \
243 "sf probe; " \
244 "sf erase 0 ${size}; " \
245 "sf write ${loadaddr} ${uboot_offset} " \
246 "${filesize}; " \
247 "fi; " \
248 "fi; fi; " \
249 "setenv filesize 0; setenv blkc; setenv size \0" \
250 "update_kernel=run kernel_name; if tftp ${kernel}; then " \
251 "if itest ${filesize} > 0; then " \
252 "setexpr size ${kernel_sectors} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100253 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200254 "setexpr offset ${kernel_start} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100255 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200256 "if itest ${filesize} <= ${size}; then " \
257 "sf probe; " \
258 "sf erase ${offset} ${size}; " \
259 "sf write ${loadaddr} ${offset} " \
260 "${filesize}; " \
261 "fi; " \
262 "fi; fi; " \
263 "setenv filesize 0; setenv size ; setenv offset\0" \
264 "update_fdt=if tftp ${fdt_file}; then " \
265 "if itest ${filesize} > 0; then " \
266 "setexpr size ${fdt_sectors} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100267 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200268 "setexpr offset ${fdt_start} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100269 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200270 "if itest ${filesize} <= ${size}; then " \
271 "sf probe; " \
272 "sf erase ${offset} ${size}; " \
273 "sf write ${loadaddr} ${offset} " \
274 "${filesize}; " \
275 "fi; " \
276 "fi; fi; " \
277 "setenv filesize 0; setenv size ; setenv offset\0" \
278 "loadimage=sf probe; " \
279 "setexpr size ${kernel_sectors} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100280 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200281 "setexpr offset ${kernel_start} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100282 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200283 "sf read ${loadaddr} ${offset} ${size}; " \
284 "setenv size ; setenv offset\0" \
285 "loadfdt=sf probe; " \
286 "setexpr size ${fdt_sectors} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100287 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200288 "setexpr offset ${fdt_start} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100289 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200290 "sf read ${${fdt_addr}} ${offset} ${size}; " \
291 "setenv size ; setenv offset\0" \
292
293
294#define CONFIG_BOOTCOMMAND \
295 "sf probe; run mmcboot; run netboot; run panicboot" \
296
297#else
298
299#error "need to define boot source"
300
301#endif
302
303/* 128 MiB offset as in ARM related docu for linux suggested */
304#define TQMA6_FDT_ADDRESS 0x18000000
305
306#define CONFIG_EXTRA_ENV_SETTINGS \
307 "board=tqma6\0" \
308 "uimage=uImage\0" \
309 "zimage=zImage\0" \
310 "boot_type=bootz\0" \
311 "kernel_name=if test \"${boot_type}\" != bootz; then " \
312 "setenv kernel ${uimage}; " \
313 "else setenv kernel ${zimage}; fi\0" \
314 "uboot=u-boot.imx\0" \
315 "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
316 "fdt_addr="__stringify(TQMA6_FDT_ADDRESS)"\0" \
317 "console=" CONFIG_CONSOLE_DEV "\0" \
318 "fdt_high=0xffffffff\0" \
319 "initrd_high=0xffffffff\0" \
320 "addtty=setenv bootargs ${bootargs} console=${console},${baudrate}\0" \
321 "addfb=setenv bootargs ${bootargs} " \
322 "imx-fbdev.legacyfb_depth=32 consoleblank=0\0" \
323 "mmcpart=2\0" \
324 "mmcblkdev=0\0" \
325 "mmcargs=run addmmc addtty addfb\0" \
326 "addmmc=setenv bootargs ${bootargs} " \
327 "root=/dev/mmcblk${mmcblkdev}p${mmcpart} rw rootwait\0" \
328 "mmcboot=echo Booting from mmc ...; " \
329 "setenv bootargs; " \
330 "run mmcargs; " \
331 "run loadimage; " \
332 "if run loadfdt; then " \
333 "echo boot device tree kernel ...; " \
334 "${boot_type} ${loadaddr} - ${fdt_addr}; " \
335 "else " \
336 "${boot_type}; " \
337 "fi;\0" \
338 "setenv bootargs \0" \
339 "netdev=eth0\0" \
340 "rootpath=/srv/nfs/tqma6\0" \
341 "ipmode=static\0" \
342 "netargs=run addnfs addip addtty addfb\0" \
343 "addnfs=setenv bootargs ${bootargs} " \
344 "root=/dev/nfs rw " \
345 "nfsroot=${serverip}:${rootpath},v3,tcp;\0" \
346 "addip_static=setenv bootargs ${bootargs} " \
347 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:" \
348 "${hostname}:${netdev}:off\0" \
349 "addip_dynamic=setenv bootargs ${bootargs} ip=dhcp\0" \
350 "addip=if test \"${ipmode}\" != static; then " \
351 "run addip_dynamic; else run addip_static; fi\0" \
352 "set_getcmd=if test \"${ipmode}\" != static; then " \
353 "setenv getcmd dhcp; setenv autoload yes; " \
354 "else setenv getcmd tftp; setenv autoload no; fi\0" \
355 "netboot=echo Booting from net ...; " \
356 "run kernel_name; " \
357 "run set_getcmd; " \
358 "setenv bootargs; " \
359 "run netargs; " \
360 "if ${getcmd} ${kernel}; then " \
361 "if ${getcmd} ${fdt_addr} ${fdt_file}; then " \
362 "${boot_type} ${loadaddr} - ${fdt_addr}; " \
363 "fi; " \
364 "fi; " \
365 "echo ... failed\0" \
366 "panicboot=echo No boot device !!! reset\0" \
367 TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
368
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200369#define CONFIG_STACKSIZE (128u * SZ_1K)
370
371/* Physical Memory Map */
372#define CONFIG_NR_DRAM_BANKS 1
373#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
374
375#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
376#define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
377#define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
378
379#define CONFIG_SYS_INIT_SP_OFFSET \
380 (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
381#define CONFIG_SYS_INIT_SP_ADDR \
382 (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
383
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200384#define CONFIG_OF_LIBFDT
385#define CONFIG_OF_BOARD_SETUP
386#define CONFIG_FIT
387#define CONFIG_FIT_VERBOSE
388
Stefan Roeseb125fd42015-03-12 16:34:16 +0100389/*
390 * All the defines above are for the TQMa6 SoM
391 *
392 * Now include the baseboard specific configuration
393 */
394#ifdef CONFIG_MBA6
395#include "tqma6_mba6.h"
396#else
397#error "No baseboard for the TQMa6 defined!"
398#endif
399
400/* Support at least the sensor on TQMa6 SOM */
401#if !defined(CONFIG_DTT_SENSORS)
402#define CONFIG_DTT_SENSORS { 0 }
403#endif
404
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200405#endif /* __CONFIG_H */