blob: ceeed174ec543d4e4613d81c74b61bc258d3bceb [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Markus Niebelee2cd2b2014-07-18 16:52:44 +02002/*
Markus Niebelc01ca162017-02-28 16:37:33 +01003 * Copyright (C) 2013, 2014, 2017 Markus Niebel <Markus.Niebel@tq-group.com>
Markus Niebelee2cd2b2014-07-18 16:52:44 +02004 *
Matthias Schifferb50ae032021-11-02 11:36:46 +01005 * Configuration settings for the TQ-Systems TQMa6<Q,D,DL,S> module.
Markus Niebelee2cd2b2014-07-18 16:52:44 +02006 */
7
8#ifndef __CONFIG_H
9#define __CONFIG_H
10
Simon Glassfb64e362020-05-10 11:40:09 -060011#include <linux/stringify.h>
12
Fabio Estevam8c717e52015-05-28 12:33:34 -030013/* place code in last 4 MiB of RAM */
Fabio Estevam8c717e52015-05-28 12:33:34 -030014
Markus Niebelee2cd2b2014-07-18 16:52:44 +020015#include "mx6_common.h"
Markus Niebelee2cd2b2014-07-18 16:52:44 +020016
Markus Niebel1f33ea52017-02-28 16:37:32 +010017#if defined(CONFIG_TQMA6S)
Markus Niebelee2cd2b2014-07-18 16:52:44 +020018#define PHYS_SDRAM_SIZE (512u * SZ_1M)
Markus Niebelc01ca162017-02-28 16:37:33 +010019#elif defined(CONFIG_TQMA6DL)
20#define PHYS_SDRAM_SIZE (SZ_1G)
Markus Niebel1f33ea52017-02-28 16:37:32 +010021#elif defined(CONFIG_TQMA6Q)
Markus Niebelc01ca162017-02-28 16:37:33 +010022#define PHYS_SDRAM_SIZE (SZ_1G)
Markus Niebelee2cd2b2014-07-18 16:52:44 +020023#endif
24
Markus Niebelee2cd2b2014-07-18 16:52:44 +020025/* SPI Flash */
Markus Niebelee2cd2b2014-07-18 16:52:44 +020026
Markus Niebela02eaa52014-11-18 13:22:54 +010027#define TQMA6_SPI_FLASH_SECTOR_SIZE SZ_64K
28
Michael Krummsdorf3072f6e2020-04-09 15:21:40 +020029#if !defined(CONFIG_DM_PMIC)
Tom Rinif52f9072022-12-04 10:13:35 -050030#define CFG_POWER_PFUZE100_I2C_ADDR 0x08
Markus Niebelee2cd2b2014-07-18 16:52:44 +020031#define TQMA6_PFUZE100_I2C_BUS 2
Michael Krummsdorf3072f6e2020-04-09 15:21:40 +020032#endif
Markus Niebelee2cd2b2014-07-18 16:52:44 +020033
34/* MMC Configs */
Tom Rini376b88a2022-10-28 20:27:13 -040035#define CFG_SYS_FSL_ESDHC_ADDR 0
Markus Niebelee2cd2b2014-07-18 16:52:44 +020036
Markus Niebelee2cd2b2014-07-18 16:52:44 +020037/* USB Configs */
Tom Rinib9796e82022-12-04 10:04:56 -050038#define CFG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
Markus Niebelee2cd2b2014-07-18 16:52:44 +020039
Markus Niebelee2cd2b2014-07-18 16:52:44 +020040#if defined(CONFIG_TQMA6X_MMC_BOOT)
41
Markus Niebelee2cd2b2014-07-18 16:52:44 +020042#define TQMA6_UBOOT_OFFSET SZ_1K
43#define TQMA6_UBOOT_SECTOR_START 0x2
44#define TQMA6_UBOOT_SECTOR_COUNT 0x7fe
45
Markus Niebelee2cd2b2014-07-18 16:52:44 +020046#define TQMA6_FDT_OFFSET (2 * SZ_1M)
47#define TQMA6_FDT_SECTOR_START 0x1000
48#define TQMA6_FDT_SECTOR_COUNT 0x800
49
50#define TQMA6_KERNEL_SECTOR_START 0x2000
51#define TQMA6_KERNEL_SECTOR_COUNT 0x2000
52
53#define TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
54 "uboot_start="__stringify(TQMA6_UBOOT_SECTOR_START)"\0" \
55 "uboot_size="__stringify(TQMA6_UBOOT_SECTOR_COUNT)"\0" \
56 "fdt_start="__stringify(TQMA6_FDT_SECTOR_START)"\0" \
57 "fdt_size="__stringify(TQMA6_FDT_SECTOR_COUNT)"\0" \
58 "kernel_start="__stringify(TQMA6_KERNEL_SECTOR_START)"\0" \
59 "kernel_size="__stringify(TQMA6_KERNEL_SECTOR_COUNT)"\0" \
60 "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
61 "loadimage=mmc dev ${mmcdev}; " \
62 "mmc read ${loadaddr} ${kernel_start} ${kernel_size};\0" \
63 "loadfdt=mmc dev ${mmcdev}; " \
64 "mmc read ${fdt_addr} ${fdt_start} ${fdt_size};\0" \
65 "update_uboot=if tftp ${uboot}; then " \
66 "if itest ${filesize} > 0; then " \
67 "mmc dev ${mmcdev}; mmc rescan; " \
Markus Niebelc08a2d52017-02-03 16:14:02 +010068 "setexpr blkc ${filesize} + 0x1ff; " \
69 "setexpr blkc ${blkc} / 0x200; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +020070 "if itest ${blkc} <= ${uboot_size}; then " \
71 "mmc write ${loadaddr} ${uboot_start} " \
72 "${blkc}; " \
73 "fi; " \
74 "fi; fi; " \
75 "setenv filesize; setenv blkc \0" \
76 "update_kernel=run kernel_name; " \
77 "if tftp ${kernel}; then " \
78 "if itest ${filesize} > 0; then " \
79 "mmc dev ${mmcdev}; mmc rescan; " \
Markus Niebelc08a2d52017-02-03 16:14:02 +010080 "setexpr blkc ${filesize} + 0x1ff; " \
81 "setexpr blkc ${blkc} / 0x200; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +020082 "if itest ${blkc} <= ${kernel_size}; then " \
83 "mmc write ${loadaddr} " \
84 "${kernel_start} ${blkc}; " \
85 "fi; " \
86 "fi; " \
87 "fi; " \
88 "setenv filesize; setenv blkc \0" \
89 "update_fdt=if tftp ${fdt_file}; then " \
90 "if itest ${filesize} > 0; then " \
91 "mmc dev ${mmcdev}; mmc rescan; " \
Markus Niebelc08a2d52017-02-03 16:14:02 +010092 "setexpr blkc ${filesize} + 0x1ff; " \
93 "setexpr blkc ${blkc} / 0x200; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +020094 "if itest ${blkc} <= ${fdt_size}; then " \
95 "mmc write ${loadaddr} ${fdt_start} ${blkc}; " \
96 "fi; " \
97 "fi; fi; " \
98 "setenv filesize; setenv blkc \0" \
99
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200100#elif defined(CONFIG_TQMA6X_SPI_BOOT)
101
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200102#define TQMA6_UBOOT_OFFSET 0x400
103#define TQMA6_UBOOT_SECTOR_START 0x0
104/* max u-boot size: 512k */
Markus Niebela02eaa52014-11-18 13:22:54 +0100105#define TQMA6_UBOOT_SECTOR_SIZE TQMA6_SPI_FLASH_SECTOR_SIZE
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200106#define TQMA6_UBOOT_SECTOR_COUNT 0x8
107#define TQMA6_UBOOT_SIZE (TQMA6_UBOOT_SECTOR_SIZE * \
108 TQMA6_UBOOT_SECTOR_COUNT)
109
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200110#define TQMA6_FDT_OFFSET (CONFIG_ENV_OFFSET_REDUND + \
111 CONFIG_ENV_SECT_SIZE)
Markus Niebela02eaa52014-11-18 13:22:54 +0100112#define TQMA6_FDT_SECT_SIZE (TQMA6_SPI_FLASH_SECTOR_SIZE)
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200113
114#define TQMA6_FDT_SECTOR_START 0x0a /* 8 Sector u-boot, 2 Sector env */
115#define TQMA6_FDT_SECTOR_COUNT 0x01
116
117#define TQMA6_KERNEL_SECTOR_START 0x10
118#define TQMA6_KERNEL_SECTOR_COUNT 0x60
119
120#define TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
121 "mmcblkdev=0\0" \
122 "uboot_offset="__stringify(TQMA6_UBOOT_OFFSET)"\0" \
123 "uboot_sectors="__stringify(TQMA6_UBOOT_SECTOR_COUNT)"\0" \
124 "fdt_start="__stringify(TQMA6_FDT_SECTOR_START)"\0" \
125 "fdt_sectors="__stringify(TQMA6_FDT_SECTOR_COUNT)"\0" \
126 "kernel_start="__stringify(TQMA6_KERNEL_SECTOR_START)"\0" \
127 "kernel_sectors="__stringify(TQMA6_KERNEL_SECTOR_COUNT)"\0" \
128 "update_uboot=if tftp ${uboot}; then " \
129 "if itest ${filesize} > 0; then " \
130 "setexpr blkc ${filesize} + " \
131 __stringify(TQMA6_UBOOT_OFFSET) "; " \
132 "setexpr size ${uboot_sectors} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100133 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200134 "if itest ${blkc} <= ${size}; then " \
135 "sf probe; " \
136 "sf erase 0 ${size}; " \
137 "sf write ${loadaddr} ${uboot_offset} " \
138 "${filesize}; " \
139 "fi; " \
140 "fi; fi; " \
141 "setenv filesize 0; setenv blkc; setenv size \0" \
142 "update_kernel=run kernel_name; if tftp ${kernel}; then " \
143 "if itest ${filesize} > 0; then " \
144 "setexpr size ${kernel_sectors} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100145 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200146 "setexpr offset ${kernel_start} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100147 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200148 "if itest ${filesize} <= ${size}; then " \
149 "sf probe; " \
150 "sf erase ${offset} ${size}; " \
151 "sf write ${loadaddr} ${offset} " \
152 "${filesize}; " \
153 "fi; " \
154 "fi; fi; " \
155 "setenv filesize 0; setenv size ; setenv offset\0" \
156 "update_fdt=if tftp ${fdt_file}; then " \
157 "if itest ${filesize} > 0; then " \
158 "setexpr size ${fdt_sectors} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100159 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200160 "setexpr offset ${fdt_start} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100161 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200162 "if itest ${filesize} <= ${size}; then " \
163 "sf probe; " \
164 "sf erase ${offset} ${size}; " \
165 "sf write ${loadaddr} ${offset} " \
166 "${filesize}; " \
167 "fi; " \
168 "fi; fi; " \
169 "setenv filesize 0; setenv size ; setenv offset\0" \
170 "loadimage=sf probe; " \
171 "setexpr size ${kernel_sectors} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100172 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200173 "setexpr offset ${kernel_start} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100174 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200175 "sf read ${loadaddr} ${offset} ${size}; " \
176 "setenv size ; setenv offset\0" \
177 "loadfdt=sf probe; " \
178 "setexpr size ${fdt_sectors} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100179 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200180 "setexpr offset ${fdt_start} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100181 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebel2bbd0542017-02-03 16:14:00 +0100182 "sf read ${fdt_addr} ${offset} ${size}; " \
Tom Rini5ddf1722021-11-10 09:11:40 -0500183 "setenv size ; setenv offset\0"
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200184#else
185
186#error "need to define boot source"
187
188#endif
189
190/* 128 MiB offset as in ARM related docu for linux suggested */
191#define TQMA6_FDT_ADDRESS 0x18000000
192
Markus Niebelb78ff632017-02-03 16:13:58 +0100193/* set to a resonable value, changeable by user */
194#define TQMA6_CMA_SIZE 160M
195
Tom Rinic9edebe2022-12-04 10:03:50 -0500196#define CFG_EXTRA_ENV_SETTINGS \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200197 "board=tqma6\0" \
198 "uimage=uImage\0" \
199 "zimage=zImage\0" \
200 "boot_type=bootz\0" \
201 "kernel_name=if test \"${boot_type}\" != bootz; then " \
202 "setenv kernel ${uimage}; " \
203 "else setenv kernel ${zimage}; fi\0" \
204 "uboot=u-boot.imx\0" \
205 "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
206 "fdt_addr="__stringify(TQMA6_FDT_ADDRESS)"\0" \
Markus Niebel8dcb9052017-02-03 16:14:03 +0100207 "console=" CONSOLE_DEV "\0" \
Markus Niebelb78ff632017-02-03 16:13:58 +0100208 "cma_size="__stringify(TQMA6_CMA_SIZE)"\0" \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200209 "fdt_high=0xffffffff\0" \
210 "initrd_high=0xffffffff\0" \
Markus Niebelf9111432017-02-03 16:14:01 +0100211 "rootfsmode=ro\0" \
Markus Niebelb78ff632017-02-03 16:13:58 +0100212 "addcma=setenv bootargs ${bootargs} cma=${cma_size}\0" \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200213 "addtty=setenv bootargs ${bootargs} console=${console},${baudrate}\0" \
214 "addfb=setenv bootargs ${bootargs} " \
215 "imx-fbdev.legacyfb_depth=32 consoleblank=0\0" \
216 "mmcpart=2\0" \
217 "mmcblkdev=0\0" \
Markus Niebelb78ff632017-02-03 16:13:58 +0100218 "mmcargs=run addmmc addtty addfb addcma\0" \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200219 "addmmc=setenv bootargs ${bootargs} " \
Markus Niebelf9111432017-02-03 16:14:01 +0100220 "root=/dev/mmcblk${mmcblkdev}p${mmcpart} ${rootfsmode} " \
221 "rootwait\0" \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200222 "mmcboot=echo Booting from mmc ...; " \
223 "setenv bootargs; " \
224 "run mmcargs; " \
225 "run loadimage; " \
226 "if run loadfdt; then " \
227 "echo boot device tree kernel ...; " \
228 "${boot_type} ${loadaddr} - ${fdt_addr}; " \
229 "else " \
230 "${boot_type}; " \
231 "fi;\0" \
232 "setenv bootargs \0" \
233 "netdev=eth0\0" \
234 "rootpath=/srv/nfs/tqma6\0" \
235 "ipmode=static\0" \
Markus Niebelb78ff632017-02-03 16:13:58 +0100236 "netargs=run addnfs addip addtty addfb addcma\0" \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200237 "addnfs=setenv bootargs ${bootargs} " \
238 "root=/dev/nfs rw " \
239 "nfsroot=${serverip}:${rootpath},v3,tcp;\0" \
240 "addip_static=setenv bootargs ${bootargs} " \
241 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:" \
242 "${hostname}:${netdev}:off\0" \
243 "addip_dynamic=setenv bootargs ${bootargs} ip=dhcp\0" \
244 "addip=if test \"${ipmode}\" != static; then " \
245 "run addip_dynamic; else run addip_static; fi\0" \
246 "set_getcmd=if test \"${ipmode}\" != static; then " \
247 "setenv getcmd dhcp; setenv autoload yes; " \
248 "else setenv getcmd tftp; setenv autoload no; fi\0" \
249 "netboot=echo Booting from net ...; " \
250 "run kernel_name; " \
251 "run set_getcmd; " \
252 "setenv bootargs; " \
253 "run netargs; " \
254 "if ${getcmd} ${kernel}; then " \
255 "if ${getcmd} ${fdt_addr} ${fdt_file}; then " \
256 "${boot_type} ${loadaddr} - ${fdt_addr}; " \
257 "fi; " \
258 "fi; " \
259 "echo ... failed\0" \
260 "panicboot=echo No boot device !!! reset\0" \
261 TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
262
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200263/* Physical Memory Map */
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200264#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
265
Tom Rinibb4dd962022-11-16 13:10:37 -0500266#define CFG_SYS_SDRAM_BASE PHYS_SDRAM
Tom Rini6a5dccc2022-11-16 13:10:41 -0500267#define CFG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
268#define CFG_SYS_INIT_RAM_SIZE IRAM_SIZE
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200269
Stefan Roeseb125fd42015-03-12 16:34:16 +0100270/*
271 * All the defines above are for the TQMa6 SoM
272 *
273 * Now include the baseboard specific configuration
274 */
275#ifdef CONFIG_MBA6
276#include "tqma6_mba6.h"
Stefan Roesebe4cb042015-07-06 13:36:33 +0200277#elif CONFIG_WRU4
278#include "tqma6_wru4.h"
Stefan Roeseb125fd42015-03-12 16:34:16 +0100279#else
280#error "No baseboard for the TQMa6 defined!"
281#endif
282
283/* Support at least the sensor on TQMa6 SOM */
Stefan Roeseb125fd42015-03-12 16:34:16 +0100284
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200285#endif /* __CONFIG_H */