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