blob: 65cc12f1c19de10e28cb58220639b5ac6b187c63 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Markus Niebelcb07d742014-07-18 16:52:44 +02002/*
Markus Niebel468fb1e2017-02-28 16:37:33 +01003 * Copyright (C) 2013, 2014, 2017 Markus Niebel <Markus.Niebel@tq-group.com>
Markus Niebelcb07d742014-07-18 16:52:44 +02004 *
Markus Niebel468fb1e2017-02-28 16:37:33 +01005 * Configuration settings for the TQ Systems TQMa6<Q,D,DL,S> module.
Markus Niebelcb07d742014-07-18 16:52:44 +02006 */
7
8#ifndef __CONFIG_H
9#define __CONFIG_H
10
Markus Niebel66cacc92015-06-04 17:25:30 +020011#include <linux/kconfig.h>
Markus Niebel1719d492014-10-23 15:47:05 +020012/* SPL */
13/* #if defined(CONFIG_SPL_BUILD) */
Markus Niebel1719d492014-10-23 15:47:05 +020014/* common IMX6 SPL configuration */
15#include "imx6_spl.h"
16
17/* #endif */
18
Fabio Estevamcd6ddc42015-05-28 12:33:34 -030019/* place code in last 4 MiB of RAM */
Fabio Estevamcd6ddc42015-05-28 12:33:34 -030020
Markus Niebelcb07d742014-07-18 16:52:44 +020021#include "mx6_common.h"
Markus Niebelcb07d742014-07-18 16:52:44 +020022
Markus Niebeld4b349e2017-02-28 16:37:32 +010023#if defined(CONFIG_TQMA6S)
Markus Niebelcb07d742014-07-18 16:52:44 +020024#define PHYS_SDRAM_SIZE (512u * SZ_1M)
Markus Niebel468fb1e2017-02-28 16:37:33 +010025#elif defined(CONFIG_TQMA6DL)
26#define PHYS_SDRAM_SIZE (SZ_1G)
Markus Niebeld4b349e2017-02-28 16:37:32 +010027#elif defined(CONFIG_TQMA6Q)
Markus Niebel468fb1e2017-02-28 16:37:33 +010028#define PHYS_SDRAM_SIZE (SZ_1G)
Markus Niebelcb07d742014-07-18 16:52:44 +020029#endif
30
Markus Niebelcb07d742014-07-18 16:52:44 +020031#define CONFIG_MXC_UART
32
Markus Niebelcb07d742014-07-18 16:52:44 +020033/* SPI Flash */
Markus Niebelcb07d742014-07-18 16:52:44 +020034
Markus Niebel52835462014-11-18 13:22:54 +010035#define TQMA6_SPI_FLASH_SECTOR_SIZE SZ_64K
36
Markus Niebelcb07d742014-07-18 16:52:44 +020037#define CONFIG_SF_DEFAULT_BUS 0
Markus Niebel1719d492014-10-23 15:47:05 +020038#define CONFIG_SF_DEFAULT_CS 0
Markus Niebelcb07d742014-07-18 16:52:44 +020039#define CONFIG_SF_DEFAULT_SPEED 50000000
40#define CONFIG_SF_DEFAULT_MODE (SPI_MODE_0)
41
42/* I2C Configs */
Markus Niebelcb07d742014-07-18 16:52:44 +020043#define CONFIG_SYS_I2C
44#define CONFIG_SYS_I2C_MXC
Albert ARIBAUD \\(3ADEV\\)03544c62015-09-21 22:43:38 +020045#define CONFIG_SYS_I2C_MXC_I2C1 /* enable I2C bus 1 */
46#define CONFIG_SYS_I2C_MXC_I2C2 /* enable I2C bus 2 */
York Sunf8cb1012015-03-20 10:20:40 -070047#define CONFIG_SYS_I2C_MXC_I2C3 /* enable I2C bus 3 */
Markus Niebelcb07d742014-07-18 16:52:44 +020048#define CONFIG_I2C_MULTI_BUS
49#define CONFIG_SYS_I2C_SPEED 100000
50
Markus Niebelcb07d742014-07-18 16:52:44 +020051/* 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
Markus Niebelcb07d742014-07-18 16:52:44 +020056
57#define CONFIG_POWER
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
62
63/* MMC Configs */
Markus Niebelcb07d742014-07-18 16:52:44 +020064#define CONFIG_SYS_FSL_ESDHC_ADDR 0
65
Markus Niebelcb07d742014-07-18 16:52:44 +020066/* USB Configs */
Markus Niebelcb07d742014-07-18 16:52:44 +020067#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
Stefan Roese911b5ea2015-03-12 13:34:29 +010068#define CONFIG_USB_MAX_CONTROLLER_COUNT 2
69#define CONFIG_EHCI_HCD_INIT_AFTER_RESET /* For OTG port */
Markus Niebelcb07d742014-07-18 16:52:44 +020070
Markus Niebelcb07d742014-07-18 16:52:44 +020071#define CONFIG_FEC_MXC
72#define IMX_FEC_BASE ENET_BASE_ADDR
Markus Niebelcb07d742014-07-18 16:52:44 +020073
Markus Niebelcb07d742014-07-18 16:52:44 +020074#define CONFIG_ARP_TIMEOUT 200UL
Markus Niebelcb07d742014-07-18 16:52:44 +020075
Markus Niebelcb07d742014-07-18 16:52:44 +020076#define CONFIG_ENV_SIZE (SZ_8K)
77/* Size of malloc() pool */
78#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2 * SZ_1M)
79
80#if defined(CONFIG_TQMA6X_MMC_BOOT)
81
Markus Niebelcb07d742014-07-18 16:52:44 +020082#define TQMA6_UBOOT_OFFSET SZ_1K
83#define TQMA6_UBOOT_SECTOR_START 0x2
84#define TQMA6_UBOOT_SECTOR_COUNT 0x7fe
85
86#define CONFIG_ENV_OFFSET SZ_1M
87#define CONFIG_SYS_MMC_ENV_DEV 0
88
89#define TQMA6_FDT_OFFSET (2 * SZ_1M)
90#define TQMA6_FDT_SECTOR_START 0x1000
91#define TQMA6_FDT_SECTOR_COUNT 0x800
92
93#define TQMA6_KERNEL_SECTOR_START 0x2000
94#define TQMA6_KERNEL_SECTOR_COUNT 0x2000
95
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; " \
Markus Niebele7203d72017-02-03 16:14:02 +0100111 "setexpr blkc ${filesize} + 0x1ff; " \
112 "setexpr blkc ${blkc} / 0x200; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200113 "if itest ${blkc} <= ${uboot_size}; then " \
114 "mmc write ${loadaddr} ${uboot_start} " \
115 "${blkc}; " \
116 "fi; " \
117 "fi; fi; " \
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; " \
Markus Niebele7203d72017-02-03 16:14:02 +0100123 "setexpr blkc ${filesize} + 0x1ff; " \
124 "setexpr blkc ${blkc} / 0x200; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200125 "if itest ${blkc} <= ${kernel_size}; then " \
126 "mmc write ${loadaddr} " \
127 "${kernel_start} ${blkc}; " \
128 "fi; " \
129 "fi; " \
130 "fi; " \
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; " \
Markus Niebele7203d72017-02-03 16:14:02 +0100135 "setexpr blkc ${filesize} + 0x1ff; " \
136 "setexpr blkc ${blkc} / 0x200; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200137 "if itest ${blkc} <= ${fdt_size}; then " \
138 "mmc write ${loadaddr} ${fdt_start} ${blkc}; " \
139 "fi; " \
140 "fi; fi; " \
141 "setenv filesize; setenv blkc \0" \
142
143#define CONFIG_BOOTCOMMAND \
144 "run mmcboot; run netboot; run panicboot"
145
146#elif defined(CONFIG_TQMA6X_SPI_BOOT)
147
Markus Niebelcb07d742014-07-18 16:52:44 +0200148#define TQMA6_UBOOT_OFFSET 0x400
149#define TQMA6_UBOOT_SECTOR_START 0x0
150/* max u-boot size: 512k */
Markus Niebel52835462014-11-18 13:22:54 +0100151#define TQMA6_UBOOT_SECTOR_SIZE TQMA6_SPI_FLASH_SECTOR_SIZE
Markus Niebelcb07d742014-07-18 16:52:44 +0200152#define TQMA6_UBOOT_SECTOR_COUNT 0x8
153#define TQMA6_UBOOT_SIZE (TQMA6_UBOOT_SECTOR_SIZE * \
154 TQMA6_UBOOT_SECTOR_COUNT)
155
Markus Niebelcb07d742014-07-18 16:52:44 +0200156#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
157#define CONFIG_ENV_OFFSET (TQMA6_UBOOT_SIZE)
Markus Niebel52835462014-11-18 13:22:54 +0100158#define CONFIG_ENV_SECT_SIZE TQMA6_SPI_FLASH_SECTOR_SIZE
Markus Niebelcb07d742014-07-18 16:52:44 +0200159#define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + \
160 CONFIG_ENV_SECT_SIZE)
161
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)
166
167#define TQMA6_FDT_OFFSET (CONFIG_ENV_OFFSET_REDUND + \
168 CONFIG_ENV_SECT_SIZE)
Markus Niebel52835462014-11-18 13:22:54 +0100169#define TQMA6_FDT_SECT_SIZE (TQMA6_SPI_FLASH_SECTOR_SIZE)
Markus Niebelcb07d742014-07-18 16:52:44 +0200170
171#define TQMA6_FDT_SECTOR_START 0x0a /* 8 Sector u-boot, 2 Sector env */
172#define TQMA6_FDT_SECTOR_COUNT 0x01
173
174#define TQMA6_KERNEL_SECTOR_START 0x10
175#define TQMA6_KERNEL_SECTOR_COUNT 0x60
176
177#define TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
178 "mmcblkdev=0\0" \
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} * " \
Markus Niebel52835462014-11-18 13:22:54 +0100190 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200191 "if itest ${blkc} <= ${size}; then " \
192 "sf probe; " \
193 "sf erase 0 ${size}; " \
194 "sf write ${loadaddr} ${uboot_offset} " \
195 "${filesize}; " \
196 "fi; " \
197 "fi; fi; " \
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} * " \
Markus Niebel52835462014-11-18 13:22:54 +0100202 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200203 "setexpr offset ${kernel_start} * " \
Markus Niebel52835462014-11-18 13:22:54 +0100204 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200205 "if itest ${filesize} <= ${size}; then " \
206 "sf probe; " \
207 "sf erase ${offset} ${size}; " \
208 "sf write ${loadaddr} ${offset} " \
209 "${filesize}; " \
210 "fi; " \
211 "fi; fi; " \
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} * " \
Markus Niebel52835462014-11-18 13:22:54 +0100216 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200217 "setexpr offset ${fdt_start} * " \
Markus Niebel52835462014-11-18 13:22:54 +0100218 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200219 "if itest ${filesize} <= ${size}; then " \
220 "sf probe; " \
221 "sf erase ${offset} ${size}; " \
222 "sf write ${loadaddr} ${offset} " \
223 "${filesize}; " \
224 "fi; " \
225 "fi; fi; " \
226 "setenv filesize 0; setenv size ; setenv offset\0" \
227 "loadimage=sf probe; " \
228 "setexpr size ${kernel_sectors} * " \
Markus Niebel52835462014-11-18 13:22:54 +0100229 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200230 "setexpr offset ${kernel_start} * " \
Markus Niebel52835462014-11-18 13:22:54 +0100231 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200232 "sf read ${loadaddr} ${offset} ${size}; " \
233 "setenv size ; setenv offset\0" \
234 "loadfdt=sf probe; " \
235 "setexpr size ${fdt_sectors} * " \
Markus Niebel52835462014-11-18 13:22:54 +0100236 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200237 "setexpr offset ${fdt_start} * " \
Markus Niebel52835462014-11-18 13:22:54 +0100238 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebel0b14f1a2017-02-03 16:14:00 +0100239 "sf read ${fdt_addr} ${offset} ${size}; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200240 "setenv size ; setenv offset\0" \
241
Markus Niebelcb07d742014-07-18 16:52:44 +0200242#define CONFIG_BOOTCOMMAND \
243 "sf probe; run mmcboot; run netboot; run panicboot" \
244
245#else
246
247#error "need to define boot source"
248
249#endif
250
251/* 128 MiB offset as in ARM related docu for linux suggested */
252#define TQMA6_FDT_ADDRESS 0x18000000
253
Markus Niebel9e9846a2017-02-03 16:13:58 +0100254/* set to a resonable value, changeable by user */
255#define TQMA6_CMA_SIZE 160M
256
Markus Niebelcb07d742014-07-18 16:52:44 +0200257#define CONFIG_EXTRA_ENV_SETTINGS \
258 "board=tqma6\0" \
259 "uimage=uImage\0" \
260 "zimage=zImage\0" \
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" \
Markus Niebeldc05e472017-02-03 16:14:03 +0100268 "console=" CONSOLE_DEV "\0" \
Markus Niebel9e9846a2017-02-03 16:13:58 +0100269 "cma_size="__stringify(TQMA6_CMA_SIZE)"\0" \
Markus Niebelcb07d742014-07-18 16:52:44 +0200270 "fdt_high=0xffffffff\0" \
271 "initrd_high=0xffffffff\0" \
Markus Niebel34713902017-02-03 16:14:01 +0100272 "rootfsmode=ro\0" \
Markus Niebel9e9846a2017-02-03 16:13:58 +0100273 "addcma=setenv bootargs ${bootargs} cma=${cma_size}\0" \
Markus Niebelcb07d742014-07-18 16:52:44 +0200274 "addtty=setenv bootargs ${bootargs} console=${console},${baudrate}\0" \
275 "addfb=setenv bootargs ${bootargs} " \
276 "imx-fbdev.legacyfb_depth=32 consoleblank=0\0" \
277 "mmcpart=2\0" \
278 "mmcblkdev=0\0" \
Markus Niebel9e9846a2017-02-03 16:13:58 +0100279 "mmcargs=run addmmc addtty addfb addcma\0" \
Markus Niebelcb07d742014-07-18 16:52:44 +0200280 "addmmc=setenv bootargs ${bootargs} " \
Markus Niebel34713902017-02-03 16:14:01 +0100281 "root=/dev/mmcblk${mmcblkdev}p${mmcpart} ${rootfsmode} " \
282 "rootwait\0" \
Markus Niebelcb07d742014-07-18 16:52:44 +0200283 "mmcboot=echo Booting from mmc ...; " \
284 "setenv bootargs; " \
285 "run mmcargs; " \
286 "run loadimage; " \
287 "if run loadfdt; then " \
288 "echo boot device tree kernel ...; " \
289 "${boot_type} ${loadaddr} - ${fdt_addr}; " \
290 "else " \
291 "${boot_type}; " \
292 "fi;\0" \
293 "setenv bootargs \0" \
294 "netdev=eth0\0" \
295 "rootpath=/srv/nfs/tqma6\0" \
296 "ipmode=static\0" \
Markus Niebel9e9846a2017-02-03 16:13:58 +0100297 "netargs=run addnfs addip addtty addfb addcma\0" \
Markus Niebelcb07d742014-07-18 16:52:44 +0200298 "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; " \
312 "run set_getcmd; " \
313 "setenv bootargs; " \
314 "run netargs; " \
315 "if ${getcmd} ${kernel}; then " \
316 "if ${getcmd} ${fdt_addr} ${fdt_file}; then " \
317 "${boot_type} ${loadaddr} - ${fdt_addr}; " \
318 "fi; " \
319 "fi; " \
320 "echo ... failed\0" \
321 "panicboot=echo No boot device !!! reset\0" \
322 TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
323
Markus Niebelcb07d742014-07-18 16:52:44 +0200324/* Physical Memory Map */
Markus Niebelcb07d742014-07-18 16:52:44 +0200325#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
326
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
330
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)
335
Stefan Roese6b396b32015-03-12 16:34:16 +0100336/*
337 * All the defines above are for the TQMa6 SoM
338 *
339 * Now include the baseboard specific configuration
340 */
341#ifdef CONFIG_MBA6
342#include "tqma6_mba6.h"
Stefan Roese452308c2015-07-06 13:36:33 +0200343#elif CONFIG_WRU4
344#include "tqma6_wru4.h"
Stefan Roese6b396b32015-03-12 16:34:16 +0100345#else
346#error "No baseboard for the TQMa6 defined!"
347#endif
348
349/* Support at least the sensor on TQMa6 SOM */
Stefan Roese6b396b32015-03-12 16:34:16 +0100350
Markus Niebelcb07d742014-07-18 16:52:44 +0200351#endif /* __CONFIG_H */