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
75 #define CONFIG_ARP_TIMEOUT 200UL
77 #define CONFIG_ENV_SIZE (SZ_8K)
78 /* Size of malloc() pool */
79 #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2 * SZ_1M)
81 #if defined(CONFIG_TQMA6X_MMC_BOOT)
83 #define TQMA6_UBOOT_OFFSET SZ_1K
84 #define TQMA6_UBOOT_SECTOR_START 0x2
85 #define TQMA6_UBOOT_SECTOR_COUNT 0x7fe
87 #define CONFIG_ENV_OFFSET SZ_1M
88 #define CONFIG_SYS_MMC_ENV_DEV 0
90 #define TQMA6_FDT_OFFSET (2 * SZ_1M)
91 #define TQMA6_FDT_SECTOR_START 0x1000
92 #define TQMA6_FDT_SECTOR_COUNT 0x800
94 #define TQMA6_KERNEL_SECTOR_START 0x2000
95 #define TQMA6_KERNEL_SECTOR_COUNT 0x2000
97 #define TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
98 "uboot_start="__stringify(TQMA6_UBOOT_SECTOR_START)"\0" \
99 "uboot_size="__stringify(TQMA6_UBOOT_SECTOR_COUNT)"\0" \
100 "fdt_start="__stringify(TQMA6_FDT_SECTOR_START)"\0" \
101 "fdt_size="__stringify(TQMA6_FDT_SECTOR_COUNT)"\0" \
102 "kernel_start="__stringify(TQMA6_KERNEL_SECTOR_START)"\0" \
103 "kernel_size="__stringify(TQMA6_KERNEL_SECTOR_COUNT)"\0" \
104 "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
105 "loadimage=mmc dev ${mmcdev}; " \
106 "mmc read ${loadaddr} ${kernel_start} ${kernel_size};\0" \
107 "loadfdt=mmc dev ${mmcdev}; " \
108 "mmc read ${fdt_addr} ${fdt_start} ${fdt_size};\0" \
109 "update_uboot=if tftp ${uboot}; then " \
110 "if itest ${filesize} > 0; then " \
111 "mmc dev ${mmcdev}; mmc rescan; " \
112 "setexpr blkc ${filesize} + 0x1ff; " \
113 "setexpr blkc ${blkc} / 0x200; " \
114 "if itest ${blkc} <= ${uboot_size}; then " \
115 "mmc write ${loadaddr} ${uboot_start} " \
119 "setenv filesize; setenv blkc \0" \
120 "update_kernel=run kernel_name; " \
121 "if tftp ${kernel}; then " \
122 "if itest ${filesize} > 0; then " \
123 "mmc dev ${mmcdev}; mmc rescan; " \
124 "setexpr blkc ${filesize} + 0x1ff; " \
125 "setexpr blkc ${blkc} / 0x200; " \
126 "if itest ${blkc} <= ${kernel_size}; then " \
127 "mmc write ${loadaddr} " \
128 "${kernel_start} ${blkc}; " \
132 "setenv filesize; setenv blkc \0" \
133 "update_fdt=if tftp ${fdt_file}; then " \
134 "if itest ${filesize} > 0; then " \
135 "mmc dev ${mmcdev}; mmc rescan; " \
136 "setexpr blkc ${filesize} + 0x1ff; " \
137 "setexpr blkc ${blkc} / 0x200; " \
138 "if itest ${blkc} <= ${fdt_size}; then " \
139 "mmc write ${loadaddr} ${fdt_start} ${blkc}; " \
142 "setenv filesize; setenv blkc \0" \
144 #define CONFIG_BOOTCOMMAND \
145 "run mmcboot; run netboot; run panicboot"
147 #elif defined(CONFIG_TQMA6X_SPI_BOOT)
149 #define TQMA6_UBOOT_OFFSET 0x400
150 #define TQMA6_UBOOT_SECTOR_START 0x0
151 /* max u-boot size: 512k */
152 #define TQMA6_UBOOT_SECTOR_SIZE TQMA6_SPI_FLASH_SECTOR_SIZE
153 #define TQMA6_UBOOT_SECTOR_COUNT 0x8
154 #define TQMA6_UBOOT_SIZE (TQMA6_UBOOT_SECTOR_SIZE * \
155 TQMA6_UBOOT_SECTOR_COUNT)
157 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
158 #define CONFIG_ENV_OFFSET (TQMA6_UBOOT_SIZE)
159 #define CONFIG_ENV_SECT_SIZE TQMA6_SPI_FLASH_SECTOR_SIZE
160 #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + \
161 CONFIG_ENV_SECT_SIZE)
163 #define CONFIG_ENV_SPI_BUS (CONFIG_SF_DEFAULT_BUS)
164 #define CONFIG_ENV_SPI_CS (CONFIG_SF_DEFAULT_CS)
165 #define CONFIG_ENV_SPI_MAX_HZ (CONFIG_SF_DEFAULT_SPEED)
166 #define CONFIG_ENV_SPI_MODE (CONFIG_SF_DEFAULT_MODE)
168 #define TQMA6_FDT_OFFSET (CONFIG_ENV_OFFSET_REDUND + \
169 CONFIG_ENV_SECT_SIZE)
170 #define TQMA6_FDT_SECT_SIZE (TQMA6_SPI_FLASH_SECTOR_SIZE)
172 #define TQMA6_FDT_SECTOR_START 0x0a /* 8 Sector u-boot, 2 Sector env */
173 #define TQMA6_FDT_SECTOR_COUNT 0x01
175 #define TQMA6_KERNEL_SECTOR_START 0x10
176 #define TQMA6_KERNEL_SECTOR_COUNT 0x60
178 #define TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
180 "uboot_offset="__stringify(TQMA6_UBOOT_OFFSET)"\0" \
181 "uboot_sectors="__stringify(TQMA6_UBOOT_SECTOR_COUNT)"\0" \
182 "fdt_start="__stringify(TQMA6_FDT_SECTOR_START)"\0" \
183 "fdt_sectors="__stringify(TQMA6_FDT_SECTOR_COUNT)"\0" \
184 "kernel_start="__stringify(TQMA6_KERNEL_SECTOR_START)"\0" \
185 "kernel_sectors="__stringify(TQMA6_KERNEL_SECTOR_COUNT)"\0" \
186 "update_uboot=if tftp ${uboot}; then " \
187 "if itest ${filesize} > 0; then " \
188 "setexpr blkc ${filesize} + " \
189 __stringify(TQMA6_UBOOT_OFFSET) "; " \
190 "setexpr size ${uboot_sectors} * " \
191 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
192 "if itest ${blkc} <= ${size}; then " \
194 "sf erase 0 ${size}; " \
195 "sf write ${loadaddr} ${uboot_offset} " \
199 "setenv filesize 0; setenv blkc; setenv size \0" \
200 "update_kernel=run kernel_name; if tftp ${kernel}; then " \
201 "if itest ${filesize} > 0; then " \
202 "setexpr size ${kernel_sectors} * " \
203 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
204 "setexpr offset ${kernel_start} * " \
205 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
206 "if itest ${filesize} <= ${size}; then " \
208 "sf erase ${offset} ${size}; " \
209 "sf write ${loadaddr} ${offset} " \
213 "setenv filesize 0; setenv size ; setenv offset\0" \
214 "update_fdt=if tftp ${fdt_file}; then " \
215 "if itest ${filesize} > 0; then " \
216 "setexpr size ${fdt_sectors} * " \
217 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
218 "setexpr offset ${fdt_start} * " \
219 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
220 "if itest ${filesize} <= ${size}; then " \
222 "sf erase ${offset} ${size}; " \
223 "sf write ${loadaddr} ${offset} " \
227 "setenv filesize 0; setenv size ; setenv offset\0" \
228 "loadimage=sf probe; " \
229 "setexpr size ${kernel_sectors} * " \
230 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
231 "setexpr offset ${kernel_start} * " \
232 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
233 "sf read ${loadaddr} ${offset} ${size}; " \
234 "setenv size ; setenv offset\0" \
235 "loadfdt=sf probe; " \
236 "setexpr size ${fdt_sectors} * " \
237 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
238 "setexpr offset ${fdt_start} * " \
239 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
240 "sf read ${fdt_addr} ${offset} ${size}; " \
241 "setenv size ; setenv offset\0" \
243 #define CONFIG_BOOTCOMMAND \
244 "sf probe; run mmcboot; run netboot; run panicboot" \
248 #error "need to define boot source"
252 /* 128 MiB offset as in ARM related docu for linux suggested */
253 #define TQMA6_FDT_ADDRESS 0x18000000
255 /* set to a resonable value, changeable by user */
256 #define TQMA6_CMA_SIZE 160M
258 #define CONFIG_EXTRA_ENV_SETTINGS \
262 "boot_type=bootz\0" \
263 "kernel_name=if test \"${boot_type}\" != bootz; then " \
264 "setenv kernel ${uimage}; " \
265 "else setenv kernel ${zimage}; fi\0" \
266 "uboot=u-boot.imx\0" \
267 "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
268 "fdt_addr="__stringify(TQMA6_FDT_ADDRESS)"\0" \
269 "console=" CONSOLE_DEV "\0" \
270 "cma_size="__stringify(TQMA6_CMA_SIZE)"\0" \
271 "fdt_high=0xffffffff\0" \
272 "initrd_high=0xffffffff\0" \
274 "addcma=setenv bootargs ${bootargs} cma=${cma_size}\0" \
275 "addtty=setenv bootargs ${bootargs} console=${console},${baudrate}\0" \
276 "addfb=setenv bootargs ${bootargs} " \
277 "imx-fbdev.legacyfb_depth=32 consoleblank=0\0" \
280 "mmcargs=run addmmc addtty addfb addcma\0" \
281 "addmmc=setenv bootargs ${bootargs} " \
282 "root=/dev/mmcblk${mmcblkdev}p${mmcpart} ${rootfsmode} " \
284 "mmcboot=echo Booting from mmc ...; " \
285 "setenv bootargs; " \
288 "if run loadfdt; then " \
289 "echo boot device tree kernel ...; " \
290 "${boot_type} ${loadaddr} - ${fdt_addr}; " \
294 "setenv bootargs \0" \
296 "rootpath=/srv/nfs/tqma6\0" \
298 "netargs=run addnfs addip addtty addfb addcma\0" \
299 "addnfs=setenv bootargs ${bootargs} " \
300 "root=/dev/nfs rw " \
301 "nfsroot=${serverip}:${rootpath},v3,tcp;\0" \
302 "addip_static=setenv bootargs ${bootargs} " \
303 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:" \
304 "${hostname}:${netdev}:off\0" \
305 "addip_dynamic=setenv bootargs ${bootargs} ip=dhcp\0" \
306 "addip=if test \"${ipmode}\" != static; then " \
307 "run addip_dynamic; else run addip_static; fi\0" \
308 "set_getcmd=if test \"${ipmode}\" != static; then " \
309 "setenv getcmd dhcp; setenv autoload yes; " \
310 "else setenv getcmd tftp; setenv autoload no; fi\0" \
311 "netboot=echo Booting from net ...; " \
312 "run kernel_name; " \
314 "setenv bootargs; " \
316 "if ${getcmd} ${kernel}; then " \
317 "if ${getcmd} ${fdt_addr} ${fdt_file}; then " \
318 "${boot_type} ${loadaddr} - ${fdt_addr}; " \
321 "echo ... failed\0" \
322 "panicboot=echo No boot device !!! reset\0" \
323 TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
325 /* Physical Memory Map */
326 #define CONFIG_NR_DRAM_BANKS 1
327 #define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
329 #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
330 #define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
331 #define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
333 #define CONFIG_SYS_INIT_SP_OFFSET \
334 (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
335 #define CONFIG_SYS_INIT_SP_ADDR \
336 (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
339 * All the defines above are for the TQMa6 SoM
341 * Now include the baseboard specific configuration
344 #include "tqma6_mba6.h"
346 #include "tqma6_wru4.h"
348 #error "No baseboard for the TQMa6 defined!"
351 /* Support at least the sensor on TQMa6 SOM */
353 #endif /* __CONFIG_H */