blob: f0b5c42c64973776fb4f2f9919605d4b15b2d72f [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#define CONFIG_MII
74
Markus Niebelcb07d742014-07-18 16:52:44 +020075#define CONFIG_ARP_TIMEOUT 200UL
Markus Niebelcb07d742014-07-18 16:52:44 +020076
Markus Niebelcb07d742014-07-18 16:52:44 +020077#define CONFIG_ENV_SIZE (SZ_8K)
78/* Size of malloc() pool */
79#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2 * SZ_1M)
80
81#if defined(CONFIG_TQMA6X_MMC_BOOT)
82
Markus Niebelcb07d742014-07-18 16:52:44 +020083#define TQMA6_UBOOT_OFFSET SZ_1K
84#define TQMA6_UBOOT_SECTOR_START 0x2
85#define TQMA6_UBOOT_SECTOR_COUNT 0x7fe
86
87#define CONFIG_ENV_OFFSET SZ_1M
88#define CONFIG_SYS_MMC_ENV_DEV 0
89
90#define TQMA6_FDT_OFFSET (2 * SZ_1M)
91#define TQMA6_FDT_SECTOR_START 0x1000
92#define TQMA6_FDT_SECTOR_COUNT 0x800
93
94#define TQMA6_KERNEL_SECTOR_START 0x2000
95#define TQMA6_KERNEL_SECTOR_COUNT 0x2000
96
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; " \
Markus Niebele7203d72017-02-03 16:14:02 +0100112 "setexpr blkc ${filesize} + 0x1ff; " \
113 "setexpr blkc ${blkc} / 0x200; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200114 "if itest ${blkc} <= ${uboot_size}; then " \
115 "mmc write ${loadaddr} ${uboot_start} " \
116 "${blkc}; " \
117 "fi; " \
118 "fi; fi; " \
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; " \
Markus Niebele7203d72017-02-03 16:14:02 +0100124 "setexpr blkc ${filesize} + 0x1ff; " \
125 "setexpr blkc ${blkc} / 0x200; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200126 "if itest ${blkc} <= ${kernel_size}; then " \
127 "mmc write ${loadaddr} " \
128 "${kernel_start} ${blkc}; " \
129 "fi; " \
130 "fi; " \
131 "fi; " \
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; " \
Markus Niebele7203d72017-02-03 16:14:02 +0100136 "setexpr blkc ${filesize} + 0x1ff; " \
137 "setexpr blkc ${blkc} / 0x200; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200138 "if itest ${blkc} <= ${fdt_size}; then " \
139 "mmc write ${loadaddr} ${fdt_start} ${blkc}; " \
140 "fi; " \
141 "fi; fi; " \
142 "setenv filesize; setenv blkc \0" \
143
144#define CONFIG_BOOTCOMMAND \
145 "run mmcboot; run netboot; run panicboot"
146
147#elif defined(CONFIG_TQMA6X_SPI_BOOT)
148
Markus Niebelcb07d742014-07-18 16:52:44 +0200149#define TQMA6_UBOOT_OFFSET 0x400
150#define TQMA6_UBOOT_SECTOR_START 0x0
151/* max u-boot size: 512k */
Markus Niebel52835462014-11-18 13:22:54 +0100152#define TQMA6_UBOOT_SECTOR_SIZE TQMA6_SPI_FLASH_SECTOR_SIZE
Markus Niebelcb07d742014-07-18 16:52:44 +0200153#define TQMA6_UBOOT_SECTOR_COUNT 0x8
154#define TQMA6_UBOOT_SIZE (TQMA6_UBOOT_SECTOR_SIZE * \
155 TQMA6_UBOOT_SECTOR_COUNT)
156
Markus Niebelcb07d742014-07-18 16:52:44 +0200157#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
158#define CONFIG_ENV_OFFSET (TQMA6_UBOOT_SIZE)
Markus Niebel52835462014-11-18 13:22:54 +0100159#define CONFIG_ENV_SECT_SIZE TQMA6_SPI_FLASH_SECTOR_SIZE
Markus Niebelcb07d742014-07-18 16:52:44 +0200160#define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + \
161 CONFIG_ENV_SECT_SIZE)
162
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)
167
168#define TQMA6_FDT_OFFSET (CONFIG_ENV_OFFSET_REDUND + \
169 CONFIG_ENV_SECT_SIZE)
Markus Niebel52835462014-11-18 13:22:54 +0100170#define TQMA6_FDT_SECT_SIZE (TQMA6_SPI_FLASH_SECTOR_SIZE)
Markus Niebelcb07d742014-07-18 16:52:44 +0200171
172#define TQMA6_FDT_SECTOR_START 0x0a /* 8 Sector u-boot, 2 Sector env */
173#define TQMA6_FDT_SECTOR_COUNT 0x01
174
175#define TQMA6_KERNEL_SECTOR_START 0x10
176#define TQMA6_KERNEL_SECTOR_COUNT 0x60
177
178#define TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
179 "mmcblkdev=0\0" \
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} * " \
Markus Niebel52835462014-11-18 13:22:54 +0100191 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200192 "if itest ${blkc} <= ${size}; then " \
193 "sf probe; " \
194 "sf erase 0 ${size}; " \
195 "sf write ${loadaddr} ${uboot_offset} " \
196 "${filesize}; " \
197 "fi; " \
198 "fi; fi; " \
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} * " \
Markus Niebel52835462014-11-18 13:22:54 +0100203 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200204 "setexpr offset ${kernel_start} * " \
Markus Niebel52835462014-11-18 13:22:54 +0100205 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200206 "if itest ${filesize} <= ${size}; then " \
207 "sf probe; " \
208 "sf erase ${offset} ${size}; " \
209 "sf write ${loadaddr} ${offset} " \
210 "${filesize}; " \
211 "fi; " \
212 "fi; fi; " \
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} * " \
Markus Niebel52835462014-11-18 13:22:54 +0100217 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200218 "setexpr offset ${fdt_start} * " \
Markus Niebel52835462014-11-18 13:22:54 +0100219 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200220 "if itest ${filesize} <= ${size}; then " \
221 "sf probe; " \
222 "sf erase ${offset} ${size}; " \
223 "sf write ${loadaddr} ${offset} " \
224 "${filesize}; " \
225 "fi; " \
226 "fi; fi; " \
227 "setenv filesize 0; setenv size ; setenv offset\0" \
228 "loadimage=sf probe; " \
229 "setexpr size ${kernel_sectors} * " \
Markus Niebel52835462014-11-18 13:22:54 +0100230 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200231 "setexpr offset ${kernel_start} * " \
Markus Niebel52835462014-11-18 13:22:54 +0100232 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200233 "sf read ${loadaddr} ${offset} ${size}; " \
234 "setenv size ; setenv offset\0" \
235 "loadfdt=sf probe; " \
236 "setexpr size ${fdt_sectors} * " \
Markus Niebel52835462014-11-18 13:22:54 +0100237 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200238 "setexpr offset ${fdt_start} * " \
Markus Niebel52835462014-11-18 13:22:54 +0100239 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebel0b14f1a2017-02-03 16:14:00 +0100240 "sf read ${fdt_addr} ${offset} ${size}; " \
Markus Niebelcb07d742014-07-18 16:52:44 +0200241 "setenv size ; setenv offset\0" \
242
Markus Niebelcb07d742014-07-18 16:52:44 +0200243#define CONFIG_BOOTCOMMAND \
244 "sf probe; run mmcboot; run netboot; run panicboot" \
245
246#else
247
248#error "need to define boot source"
249
250#endif
251
252/* 128 MiB offset as in ARM related docu for linux suggested */
253#define TQMA6_FDT_ADDRESS 0x18000000
254
Markus Niebel9e9846a2017-02-03 16:13:58 +0100255/* set to a resonable value, changeable by user */
256#define TQMA6_CMA_SIZE 160M
257
Markus Niebelcb07d742014-07-18 16:52:44 +0200258#define CONFIG_EXTRA_ENV_SETTINGS \
259 "board=tqma6\0" \
260 "uimage=uImage\0" \
261 "zimage=zImage\0" \
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" \
Markus Niebeldc05e472017-02-03 16:14:03 +0100269 "console=" CONSOLE_DEV "\0" \
Markus Niebel9e9846a2017-02-03 16:13:58 +0100270 "cma_size="__stringify(TQMA6_CMA_SIZE)"\0" \
Markus Niebelcb07d742014-07-18 16:52:44 +0200271 "fdt_high=0xffffffff\0" \
272 "initrd_high=0xffffffff\0" \
Markus Niebel34713902017-02-03 16:14:01 +0100273 "rootfsmode=ro\0" \
Markus Niebel9e9846a2017-02-03 16:13:58 +0100274 "addcma=setenv bootargs ${bootargs} cma=${cma_size}\0" \
Markus Niebelcb07d742014-07-18 16:52:44 +0200275 "addtty=setenv bootargs ${bootargs} console=${console},${baudrate}\0" \
276 "addfb=setenv bootargs ${bootargs} " \
277 "imx-fbdev.legacyfb_depth=32 consoleblank=0\0" \
278 "mmcpart=2\0" \
279 "mmcblkdev=0\0" \
Markus Niebel9e9846a2017-02-03 16:13:58 +0100280 "mmcargs=run addmmc addtty addfb addcma\0" \
Markus Niebelcb07d742014-07-18 16:52:44 +0200281 "addmmc=setenv bootargs ${bootargs} " \
Markus Niebel34713902017-02-03 16:14:01 +0100282 "root=/dev/mmcblk${mmcblkdev}p${mmcpart} ${rootfsmode} " \
283 "rootwait\0" \
Markus Niebelcb07d742014-07-18 16:52:44 +0200284 "mmcboot=echo Booting from mmc ...; " \
285 "setenv bootargs; " \
286 "run mmcargs; " \
287 "run loadimage; " \
288 "if run loadfdt; then " \
289 "echo boot device tree kernel ...; " \
290 "${boot_type} ${loadaddr} - ${fdt_addr}; " \
291 "else " \
292 "${boot_type}; " \
293 "fi;\0" \
294 "setenv bootargs \0" \
295 "netdev=eth0\0" \
296 "rootpath=/srv/nfs/tqma6\0" \
297 "ipmode=static\0" \
Markus Niebel9e9846a2017-02-03 16:13:58 +0100298 "netargs=run addnfs addip addtty addfb addcma\0" \
Markus Niebelcb07d742014-07-18 16:52:44 +0200299 "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; " \
313 "run set_getcmd; " \
314 "setenv bootargs; " \
315 "run netargs; " \
316 "if ${getcmd} ${kernel}; then " \
317 "if ${getcmd} ${fdt_addr} ${fdt_file}; then " \
318 "${boot_type} ${loadaddr} - ${fdt_addr}; " \
319 "fi; " \
320 "fi; " \
321 "echo ... failed\0" \
322 "panicboot=echo No boot device !!! reset\0" \
323 TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
324
Markus Niebelcb07d742014-07-18 16:52:44 +0200325/* Physical Memory Map */
326#define CONFIG_NR_DRAM_BANKS 1
327#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
328
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
332
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)
337
Stefan Roese6b396b32015-03-12 16:34:16 +0100338/*
339 * All the defines above are for the TQMa6 SoM
340 *
341 * Now include the baseboard specific configuration
342 */
343#ifdef CONFIG_MBA6
344#include "tqma6_mba6.h"
Stefan Roese452308c2015-07-06 13:36:33 +0200345#elif CONFIG_WRU4
346#include "tqma6_wru4.h"
Stefan Roese6b396b32015-03-12 16:34:16 +0100347#else
348#error "No baseboard for the TQMa6 defined!"
349#endif
350
351/* Support at least the sensor on TQMa6 SOM */
Stefan Roese6b396b32015-03-12 16:34:16 +0100352
Markus Niebelcb07d742014-07-18 16:52:44 +0200353#endif /* __CONFIG_H */