]> git.ipfire.org Git - people/ms/u-boot.git/blob - include/configs/tqma6.h
configs: Migrate CONFIG_SYS_TEXT_BASE
[people/ms/u-boot.git] / include / configs / tqma6.h
1 /*
2 * Copyright (C) 2013, 2014, 2017 Markus Niebel <Markus.Niebel@tq-group.com>
3 *
4 * Configuration settings for the TQ Systems TQMa6<Q,D,DL,S> module.
5 *
6 * SPDX-License-Identifier: GPL-2.0+
7 */
8
9 #ifndef __CONFIG_H
10 #define __CONFIG_H
11
12 #include <linux/kconfig.h>
13 /* SPL */
14 /* #if defined(CONFIG_SPL_BUILD) */
15 /* common IMX6 SPL configuration */
16 #include "imx6_spl.h"
17
18 /* #endif */
19
20 /* place code in last 4 MiB of RAM */
21
22 #include "mx6_common.h"
23
24 #if defined(CONFIG_TQMA6S)
25 #define PHYS_SDRAM_SIZE (512u * SZ_1M)
26 #elif defined(CONFIG_TQMA6DL)
27 #define PHYS_SDRAM_SIZE (SZ_1G)
28 #elif defined(CONFIG_TQMA6Q)
29 #define PHYS_SDRAM_SIZE (SZ_1G)
30 #endif
31
32 #define CONFIG_MXC_UART
33
34 /* SPI */
35 #define CONFIG_MXC_SPI
36
37 /* SPI Flash */
38
39 #define TQMA6_SPI_FLASH_SECTOR_SIZE SZ_64K
40
41 #define CONFIG_SF_DEFAULT_BUS 0
42 #define CONFIG_SF_DEFAULT_CS 0
43 #define CONFIG_SF_DEFAULT_SPEED 50000000
44 #define CONFIG_SF_DEFAULT_MODE (SPI_MODE_0)
45
46 /* I2C Configs */
47 #define CONFIG_SYS_I2C
48 #define CONFIG_SYS_I2C_MXC
49 #define CONFIG_SYS_I2C_MXC_I2C1 /* enable I2C bus 1 */
50 #define CONFIG_SYS_I2C_MXC_I2C2 /* enable I2C bus 2 */
51 #define CONFIG_SYS_I2C_MXC_I2C3 /* enable I2C bus 3 */
52 #define CONFIG_I2C_MULTI_BUS
53 #define CONFIG_SYS_I2C_SPEED 100000
54
55 /* I2C EEPROM (M24C64) */
56 #define CONFIG_SYS_I2C_EEPROM_ADDR 0x50
57 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
58 #define CONFIG_SYS_I2C_EEPROM_PAGE_WRITE_BITS 5 /* 32 Bytes */
59 #define CONFIG_SYS_I2C_EEPROM_PAGE_WRITE_DELAY_MS 20
60
61 #define CONFIG_POWER
62 #define CONFIG_POWER_I2C
63 #define CONFIG_POWER_PFUZE100
64 #define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08
65 #define TQMA6_PFUZE100_I2C_BUS 2
66
67 /* MMC Configs */
68 #define CONFIG_SYS_FSL_ESDHC_ADDR 0
69
70 /* USB Configs */
71 #define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
72 #define CONFIG_USB_MAX_CONTROLLER_COUNT 2
73 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET /* For OTG port */
74
75 #define CONFIG_FEC_MXC
76 #define IMX_FEC_BASE ENET_BASE_ADDR
77 #define CONFIG_MII
78
79 #define CONFIG_ARP_TIMEOUT 200UL
80
81 #define CONFIG_ENV_SIZE (SZ_8K)
82 /* Size of malloc() pool */
83 #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2 * SZ_1M)
84
85 #if defined(CONFIG_TQMA6X_MMC_BOOT)
86
87 #define TQMA6_UBOOT_OFFSET SZ_1K
88 #define TQMA6_UBOOT_SECTOR_START 0x2
89 #define TQMA6_UBOOT_SECTOR_COUNT 0x7fe
90
91 #define CONFIG_ENV_OFFSET SZ_1M
92 #define CONFIG_SYS_MMC_ENV_DEV 0
93
94 #define TQMA6_FDT_OFFSET (2 * SZ_1M)
95 #define TQMA6_FDT_SECTOR_START 0x1000
96 #define TQMA6_FDT_SECTOR_COUNT 0x800
97
98 #define TQMA6_KERNEL_SECTOR_START 0x2000
99 #define TQMA6_KERNEL_SECTOR_COUNT 0x2000
100
101 #define TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
102 "uboot_start="__stringify(TQMA6_UBOOT_SECTOR_START)"\0" \
103 "uboot_size="__stringify(TQMA6_UBOOT_SECTOR_COUNT)"\0" \
104 "fdt_start="__stringify(TQMA6_FDT_SECTOR_START)"\0" \
105 "fdt_size="__stringify(TQMA6_FDT_SECTOR_COUNT)"\0" \
106 "kernel_start="__stringify(TQMA6_KERNEL_SECTOR_START)"\0" \
107 "kernel_size="__stringify(TQMA6_KERNEL_SECTOR_COUNT)"\0" \
108 "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
109 "loadimage=mmc dev ${mmcdev}; " \
110 "mmc read ${loadaddr} ${kernel_start} ${kernel_size};\0" \
111 "loadfdt=mmc dev ${mmcdev}; " \
112 "mmc read ${fdt_addr} ${fdt_start} ${fdt_size};\0" \
113 "update_uboot=if tftp ${uboot}; then " \
114 "if itest ${filesize} > 0; then " \
115 "mmc dev ${mmcdev}; mmc rescan; " \
116 "setexpr blkc ${filesize} + 0x1ff; " \
117 "setexpr blkc ${blkc} / 0x200; " \
118 "if itest ${blkc} <= ${uboot_size}; then " \
119 "mmc write ${loadaddr} ${uboot_start} " \
120 "${blkc}; " \
121 "fi; " \
122 "fi; fi; " \
123 "setenv filesize; setenv blkc \0" \
124 "update_kernel=run kernel_name; " \
125 "if tftp ${kernel}; then " \
126 "if itest ${filesize} > 0; then " \
127 "mmc dev ${mmcdev}; mmc rescan; " \
128 "setexpr blkc ${filesize} + 0x1ff; " \
129 "setexpr blkc ${blkc} / 0x200; " \
130 "if itest ${blkc} <= ${kernel_size}; then " \
131 "mmc write ${loadaddr} " \
132 "${kernel_start} ${blkc}; " \
133 "fi; " \
134 "fi; " \
135 "fi; " \
136 "setenv filesize; setenv blkc \0" \
137 "update_fdt=if tftp ${fdt_file}; then " \
138 "if itest ${filesize} > 0; then " \
139 "mmc dev ${mmcdev}; mmc rescan; " \
140 "setexpr blkc ${filesize} + 0x1ff; " \
141 "setexpr blkc ${blkc} / 0x200; " \
142 "if itest ${blkc} <= ${fdt_size}; then " \
143 "mmc write ${loadaddr} ${fdt_start} ${blkc}; " \
144 "fi; " \
145 "fi; fi; " \
146 "setenv filesize; setenv blkc \0" \
147
148 #define CONFIG_BOOTCOMMAND \
149 "run mmcboot; run netboot; run panicboot"
150
151 #elif defined(CONFIG_TQMA6X_SPI_BOOT)
152
153 #define TQMA6_UBOOT_OFFSET 0x400
154 #define TQMA6_UBOOT_SECTOR_START 0x0
155 /* max u-boot size: 512k */
156 #define TQMA6_UBOOT_SECTOR_SIZE TQMA6_SPI_FLASH_SECTOR_SIZE
157 #define TQMA6_UBOOT_SECTOR_COUNT 0x8
158 #define TQMA6_UBOOT_SIZE (TQMA6_UBOOT_SECTOR_SIZE * \
159 TQMA6_UBOOT_SECTOR_COUNT)
160
161 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
162 #define CONFIG_ENV_OFFSET (TQMA6_UBOOT_SIZE)
163 #define CONFIG_ENV_SECT_SIZE TQMA6_SPI_FLASH_SECTOR_SIZE
164 #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + \
165 CONFIG_ENV_SECT_SIZE)
166
167 #define CONFIG_ENV_SPI_BUS (CONFIG_SF_DEFAULT_BUS)
168 #define CONFIG_ENV_SPI_CS (CONFIG_SF_DEFAULT_CS)
169 #define CONFIG_ENV_SPI_MAX_HZ (CONFIG_SF_DEFAULT_SPEED)
170 #define CONFIG_ENV_SPI_MODE (CONFIG_SF_DEFAULT_MODE)
171
172 #define TQMA6_FDT_OFFSET (CONFIG_ENV_OFFSET_REDUND + \
173 CONFIG_ENV_SECT_SIZE)
174 #define TQMA6_FDT_SECT_SIZE (TQMA6_SPI_FLASH_SECTOR_SIZE)
175
176 #define TQMA6_FDT_SECTOR_START 0x0a /* 8 Sector u-boot, 2 Sector env */
177 #define TQMA6_FDT_SECTOR_COUNT 0x01
178
179 #define TQMA6_KERNEL_SECTOR_START 0x10
180 #define TQMA6_KERNEL_SECTOR_COUNT 0x60
181
182 #define TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
183 "mmcblkdev=0\0" \
184 "uboot_offset="__stringify(TQMA6_UBOOT_OFFSET)"\0" \
185 "uboot_sectors="__stringify(TQMA6_UBOOT_SECTOR_COUNT)"\0" \
186 "fdt_start="__stringify(TQMA6_FDT_SECTOR_START)"\0" \
187 "fdt_sectors="__stringify(TQMA6_FDT_SECTOR_COUNT)"\0" \
188 "kernel_start="__stringify(TQMA6_KERNEL_SECTOR_START)"\0" \
189 "kernel_sectors="__stringify(TQMA6_KERNEL_SECTOR_COUNT)"\0" \
190 "update_uboot=if tftp ${uboot}; then " \
191 "if itest ${filesize} > 0; then " \
192 "setexpr blkc ${filesize} + " \
193 __stringify(TQMA6_UBOOT_OFFSET) "; " \
194 "setexpr size ${uboot_sectors} * " \
195 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
196 "if itest ${blkc} <= ${size}; then " \
197 "sf probe; " \
198 "sf erase 0 ${size}; " \
199 "sf write ${loadaddr} ${uboot_offset} " \
200 "${filesize}; " \
201 "fi; " \
202 "fi; fi; " \
203 "setenv filesize 0; setenv blkc; setenv size \0" \
204 "update_kernel=run kernel_name; if tftp ${kernel}; then " \
205 "if itest ${filesize} > 0; then " \
206 "setexpr size ${kernel_sectors} * " \
207 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
208 "setexpr offset ${kernel_start} * " \
209 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
210 "if itest ${filesize} <= ${size}; then " \
211 "sf probe; " \
212 "sf erase ${offset} ${size}; " \
213 "sf write ${loadaddr} ${offset} " \
214 "${filesize}; " \
215 "fi; " \
216 "fi; fi; " \
217 "setenv filesize 0; setenv size ; setenv offset\0" \
218 "update_fdt=if tftp ${fdt_file}; then " \
219 "if itest ${filesize} > 0; then " \
220 "setexpr size ${fdt_sectors} * " \
221 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
222 "setexpr offset ${fdt_start} * " \
223 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
224 "if itest ${filesize} <= ${size}; then " \
225 "sf probe; " \
226 "sf erase ${offset} ${size}; " \
227 "sf write ${loadaddr} ${offset} " \
228 "${filesize}; " \
229 "fi; " \
230 "fi; fi; " \
231 "setenv filesize 0; setenv size ; setenv offset\0" \
232 "loadimage=sf probe; " \
233 "setexpr size ${kernel_sectors} * " \
234 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
235 "setexpr offset ${kernel_start} * " \
236 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
237 "sf read ${loadaddr} ${offset} ${size}; " \
238 "setenv size ; setenv offset\0" \
239 "loadfdt=sf probe; " \
240 "setexpr size ${fdt_sectors} * " \
241 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
242 "setexpr offset ${fdt_start} * " \
243 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
244 "sf read ${fdt_addr} ${offset} ${size}; " \
245 "setenv size ; setenv offset\0" \
246
247 #define CONFIG_BOOTCOMMAND \
248 "sf probe; run mmcboot; run netboot; run panicboot" \
249
250 #else
251
252 #error "need to define boot source"
253
254 #endif
255
256 /* 128 MiB offset as in ARM related docu for linux suggested */
257 #define TQMA6_FDT_ADDRESS 0x18000000
258
259 /* set to a resonable value, changeable by user */
260 #define TQMA6_CMA_SIZE 160M
261
262 #define CONFIG_EXTRA_ENV_SETTINGS \
263 "board=tqma6\0" \
264 "uimage=uImage\0" \
265 "zimage=zImage\0" \
266 "boot_type=bootz\0" \
267 "kernel_name=if test \"${boot_type}\" != bootz; then " \
268 "setenv kernel ${uimage}; " \
269 "else setenv kernel ${zimage}; fi\0" \
270 "uboot=u-boot.imx\0" \
271 "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
272 "fdt_addr="__stringify(TQMA6_FDT_ADDRESS)"\0" \
273 "console=" CONSOLE_DEV "\0" \
274 "cma_size="__stringify(TQMA6_CMA_SIZE)"\0" \
275 "fdt_high=0xffffffff\0" \
276 "initrd_high=0xffffffff\0" \
277 "rootfsmode=ro\0" \
278 "addcma=setenv bootargs ${bootargs} cma=${cma_size}\0" \
279 "addtty=setenv bootargs ${bootargs} console=${console},${baudrate}\0" \
280 "addfb=setenv bootargs ${bootargs} " \
281 "imx-fbdev.legacyfb_depth=32 consoleblank=0\0" \
282 "mmcpart=2\0" \
283 "mmcblkdev=0\0" \
284 "mmcargs=run addmmc addtty addfb addcma\0" \
285 "addmmc=setenv bootargs ${bootargs} " \
286 "root=/dev/mmcblk${mmcblkdev}p${mmcpart} ${rootfsmode} " \
287 "rootwait\0" \
288 "mmcboot=echo Booting from mmc ...; " \
289 "setenv bootargs; " \
290 "run mmcargs; " \
291 "run loadimage; " \
292 "if run loadfdt; then " \
293 "echo boot device tree kernel ...; " \
294 "${boot_type} ${loadaddr} - ${fdt_addr}; " \
295 "else " \
296 "${boot_type}; " \
297 "fi;\0" \
298 "setenv bootargs \0" \
299 "netdev=eth0\0" \
300 "rootpath=/srv/nfs/tqma6\0" \
301 "ipmode=static\0" \
302 "netargs=run addnfs addip addtty addfb addcma\0" \
303 "addnfs=setenv bootargs ${bootargs} " \
304 "root=/dev/nfs rw " \
305 "nfsroot=${serverip}:${rootpath},v3,tcp;\0" \
306 "addip_static=setenv bootargs ${bootargs} " \
307 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:" \
308 "${hostname}:${netdev}:off\0" \
309 "addip_dynamic=setenv bootargs ${bootargs} ip=dhcp\0" \
310 "addip=if test \"${ipmode}\" != static; then " \
311 "run addip_dynamic; else run addip_static; fi\0" \
312 "set_getcmd=if test \"${ipmode}\" != static; then " \
313 "setenv getcmd dhcp; setenv autoload yes; " \
314 "else setenv getcmd tftp; setenv autoload no; fi\0" \
315 "netboot=echo Booting from net ...; " \
316 "run kernel_name; " \
317 "run set_getcmd; " \
318 "setenv bootargs; " \
319 "run netargs; " \
320 "if ${getcmd} ${kernel}; then " \
321 "if ${getcmd} ${fdt_addr} ${fdt_file}; then " \
322 "${boot_type} ${loadaddr} - ${fdt_addr}; " \
323 "fi; " \
324 "fi; " \
325 "echo ... failed\0" \
326 "panicboot=echo No boot device !!! reset\0" \
327 TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
328
329 /* Physical Memory Map */
330 #define CONFIG_NR_DRAM_BANKS 1
331 #define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
332
333 #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
334 #define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
335 #define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
336
337 #define CONFIG_SYS_INIT_SP_OFFSET \
338 (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
339 #define CONFIG_SYS_INIT_SP_ADDR \
340 (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
341
342 /*
343 * All the defines above are for the TQMa6 SoM
344 *
345 * Now include the baseboard specific configuration
346 */
347 #ifdef CONFIG_MBA6
348 #include "tqma6_mba6.h"
349 #elif CONFIG_WRU4
350 #include "tqma6_wru4.h"
351 #else
352 #error "No baseboard for the TQMa6 defined!"
353 #endif
354
355 /* Support at least the sensor on TQMa6 SOM */
356
357 #endif /* __CONFIG_H */