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