blob: fd4d170456a4842e738afe8ef5e5da70312f4a1d [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#if defined(CONFIG_TQMA6X_MMC_BOOT)
38
Markus Niebelee2cd2b2014-07-18 16:52:44 +020039#define TQMA6_UBOOT_OFFSET SZ_1K
40#define TQMA6_UBOOT_SECTOR_START 0x2
41#define TQMA6_UBOOT_SECTOR_COUNT 0x7fe
42
Markus Niebelee2cd2b2014-07-18 16:52:44 +020043#define TQMA6_FDT_OFFSET (2 * SZ_1M)
44#define TQMA6_FDT_SECTOR_START 0x1000
45#define TQMA6_FDT_SECTOR_COUNT 0x800
46
47#define TQMA6_KERNEL_SECTOR_START 0x2000
48#define TQMA6_KERNEL_SECTOR_COUNT 0x2000
49
50#define TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
51 "uboot_start="__stringify(TQMA6_UBOOT_SECTOR_START)"\0" \
52 "uboot_size="__stringify(TQMA6_UBOOT_SECTOR_COUNT)"\0" \
53 "fdt_start="__stringify(TQMA6_FDT_SECTOR_START)"\0" \
54 "fdt_size="__stringify(TQMA6_FDT_SECTOR_COUNT)"\0" \
55 "kernel_start="__stringify(TQMA6_KERNEL_SECTOR_START)"\0" \
56 "kernel_size="__stringify(TQMA6_KERNEL_SECTOR_COUNT)"\0" \
57 "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
58 "loadimage=mmc dev ${mmcdev}; " \
59 "mmc read ${loadaddr} ${kernel_start} ${kernel_size};\0" \
60 "loadfdt=mmc dev ${mmcdev}; " \
61 "mmc read ${fdt_addr} ${fdt_start} ${fdt_size};\0" \
62 "update_uboot=if tftp ${uboot}; then " \
63 "if itest ${filesize} > 0; then " \
64 "mmc dev ${mmcdev}; mmc rescan; " \
Markus Niebelc08a2d52017-02-03 16:14:02 +010065 "setexpr blkc ${filesize} + 0x1ff; " \
66 "setexpr blkc ${blkc} / 0x200; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +020067 "if itest ${blkc} <= ${uboot_size}; then " \
68 "mmc write ${loadaddr} ${uboot_start} " \
69 "${blkc}; " \
70 "fi; " \
71 "fi; fi; " \
72 "setenv filesize; setenv blkc \0" \
73 "update_kernel=run kernel_name; " \
74 "if tftp ${kernel}; then " \
75 "if itest ${filesize} > 0; then " \
76 "mmc dev ${mmcdev}; mmc rescan; " \
Markus Niebelc08a2d52017-02-03 16:14:02 +010077 "setexpr blkc ${filesize} + 0x1ff; " \
78 "setexpr blkc ${blkc} / 0x200; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +020079 "if itest ${blkc} <= ${kernel_size}; then " \
80 "mmc write ${loadaddr} " \
81 "${kernel_start} ${blkc}; " \
82 "fi; " \
83 "fi; " \
84 "fi; " \
85 "setenv filesize; setenv blkc \0" \
86 "update_fdt=if tftp ${fdt_file}; then " \
87 "if itest ${filesize} > 0; then " \
88 "mmc dev ${mmcdev}; mmc rescan; " \
Markus Niebelc08a2d52017-02-03 16:14:02 +010089 "setexpr blkc ${filesize} + 0x1ff; " \
90 "setexpr blkc ${blkc} / 0x200; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +020091 "if itest ${blkc} <= ${fdt_size}; then " \
92 "mmc write ${loadaddr} ${fdt_start} ${blkc}; " \
93 "fi; " \
94 "fi; fi; " \
95 "setenv filesize; setenv blkc \0" \
96
Markus Niebelee2cd2b2014-07-18 16:52:44 +020097#elif defined(CONFIG_TQMA6X_SPI_BOOT)
98
Markus Niebelee2cd2b2014-07-18 16:52:44 +020099#define TQMA6_UBOOT_OFFSET 0x400
100#define TQMA6_UBOOT_SECTOR_START 0x0
101/* max u-boot size: 512k */
Markus Niebela02eaa52014-11-18 13:22:54 +0100102#define TQMA6_UBOOT_SECTOR_SIZE TQMA6_SPI_FLASH_SECTOR_SIZE
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200103#define TQMA6_UBOOT_SECTOR_COUNT 0x8
104#define TQMA6_UBOOT_SIZE (TQMA6_UBOOT_SECTOR_SIZE * \
105 TQMA6_UBOOT_SECTOR_COUNT)
106
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200107#define TQMA6_FDT_OFFSET (CONFIG_ENV_OFFSET_REDUND + \
108 CONFIG_ENV_SECT_SIZE)
Markus Niebela02eaa52014-11-18 13:22:54 +0100109#define TQMA6_FDT_SECT_SIZE (TQMA6_SPI_FLASH_SECTOR_SIZE)
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200110
111#define TQMA6_FDT_SECTOR_START 0x0a /* 8 Sector u-boot, 2 Sector env */
112#define TQMA6_FDT_SECTOR_COUNT 0x01
113
114#define TQMA6_KERNEL_SECTOR_START 0x10
115#define TQMA6_KERNEL_SECTOR_COUNT 0x60
116
117#define TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
118 "mmcblkdev=0\0" \
119 "uboot_offset="__stringify(TQMA6_UBOOT_OFFSET)"\0" \
120 "uboot_sectors="__stringify(TQMA6_UBOOT_SECTOR_COUNT)"\0" \
121 "fdt_start="__stringify(TQMA6_FDT_SECTOR_START)"\0" \
122 "fdt_sectors="__stringify(TQMA6_FDT_SECTOR_COUNT)"\0" \
123 "kernel_start="__stringify(TQMA6_KERNEL_SECTOR_START)"\0" \
124 "kernel_sectors="__stringify(TQMA6_KERNEL_SECTOR_COUNT)"\0" \
125 "update_uboot=if tftp ${uboot}; then " \
126 "if itest ${filesize} > 0; then " \
127 "setexpr blkc ${filesize} + " \
128 __stringify(TQMA6_UBOOT_OFFSET) "; " \
129 "setexpr size ${uboot_sectors} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100130 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200131 "if itest ${blkc} <= ${size}; then " \
132 "sf probe; " \
133 "sf erase 0 ${size}; " \
134 "sf write ${loadaddr} ${uboot_offset} " \
135 "${filesize}; " \
136 "fi; " \
137 "fi; fi; " \
138 "setenv filesize 0; setenv blkc; setenv size \0" \
139 "update_kernel=run kernel_name; if tftp ${kernel}; then " \
140 "if itest ${filesize} > 0; then " \
141 "setexpr size ${kernel_sectors} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100142 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200143 "setexpr offset ${kernel_start} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100144 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200145 "if itest ${filesize} <= ${size}; then " \
146 "sf probe; " \
147 "sf erase ${offset} ${size}; " \
148 "sf write ${loadaddr} ${offset} " \
149 "${filesize}; " \
150 "fi; " \
151 "fi; fi; " \
152 "setenv filesize 0; setenv size ; setenv offset\0" \
153 "update_fdt=if tftp ${fdt_file}; then " \
154 "if itest ${filesize} > 0; then " \
155 "setexpr size ${fdt_sectors} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100156 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200157 "setexpr offset ${fdt_start} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100158 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200159 "if itest ${filesize} <= ${size}; then " \
160 "sf probe; " \
161 "sf erase ${offset} ${size}; " \
162 "sf write ${loadaddr} ${offset} " \
163 "${filesize}; " \
164 "fi; " \
165 "fi; fi; " \
166 "setenv filesize 0; setenv size ; setenv offset\0" \
167 "loadimage=sf probe; " \
168 "setexpr size ${kernel_sectors} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100169 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200170 "setexpr offset ${kernel_start} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100171 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200172 "sf read ${loadaddr} ${offset} ${size}; " \
173 "setenv size ; setenv offset\0" \
174 "loadfdt=sf probe; " \
175 "setexpr size ${fdt_sectors} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100176 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200177 "setexpr offset ${fdt_start} * " \
Markus Niebela02eaa52014-11-18 13:22:54 +0100178 __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
Markus Niebel2bbd0542017-02-03 16:14:00 +0100179 "sf read ${fdt_addr} ${offset} ${size}; " \
Tom Rini5ddf1722021-11-10 09:11:40 -0500180 "setenv size ; setenv offset\0"
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200181#else
182
183#error "need to define boot source"
184
185#endif
186
187/* 128 MiB offset as in ARM related docu for linux suggested */
188#define TQMA6_FDT_ADDRESS 0x18000000
189
Markus Niebelb78ff632017-02-03 16:13:58 +0100190/* set to a resonable value, changeable by user */
191#define TQMA6_CMA_SIZE 160M
192
Tom Rinic9edebe2022-12-04 10:03:50 -0500193#define CFG_EXTRA_ENV_SETTINGS \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200194 "board=tqma6\0" \
195 "uimage=uImage\0" \
196 "zimage=zImage\0" \
197 "boot_type=bootz\0" \
198 "kernel_name=if test \"${boot_type}\" != bootz; then " \
199 "setenv kernel ${uimage}; " \
200 "else setenv kernel ${zimage}; fi\0" \
201 "uboot=u-boot.imx\0" \
202 "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
203 "fdt_addr="__stringify(TQMA6_FDT_ADDRESS)"\0" \
Markus Niebel8dcb9052017-02-03 16:14:03 +0100204 "console=" CONSOLE_DEV "\0" \
Markus Niebelb78ff632017-02-03 16:13:58 +0100205 "cma_size="__stringify(TQMA6_CMA_SIZE)"\0" \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200206 "fdt_high=0xffffffff\0" \
207 "initrd_high=0xffffffff\0" \
Markus Niebelf9111432017-02-03 16:14:01 +0100208 "rootfsmode=ro\0" \
Markus Niebelb78ff632017-02-03 16:13:58 +0100209 "addcma=setenv bootargs ${bootargs} cma=${cma_size}\0" \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200210 "addtty=setenv bootargs ${bootargs} console=${console},${baudrate}\0" \
211 "addfb=setenv bootargs ${bootargs} " \
212 "imx-fbdev.legacyfb_depth=32 consoleblank=0\0" \
213 "mmcpart=2\0" \
214 "mmcblkdev=0\0" \
Markus Niebelb78ff632017-02-03 16:13:58 +0100215 "mmcargs=run addmmc addtty addfb addcma\0" \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200216 "addmmc=setenv bootargs ${bootargs} " \
Markus Niebelf9111432017-02-03 16:14:01 +0100217 "root=/dev/mmcblk${mmcblkdev}p${mmcpart} ${rootfsmode} " \
218 "rootwait\0" \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200219 "mmcboot=echo Booting from mmc ...; " \
220 "setenv bootargs; " \
221 "run mmcargs; " \
222 "run loadimage; " \
223 "if run loadfdt; then " \
224 "echo boot device tree kernel ...; " \
225 "${boot_type} ${loadaddr} - ${fdt_addr}; " \
226 "else " \
227 "${boot_type}; " \
228 "fi;\0" \
229 "setenv bootargs \0" \
230 "netdev=eth0\0" \
231 "rootpath=/srv/nfs/tqma6\0" \
232 "ipmode=static\0" \
Markus Niebelb78ff632017-02-03 16:13:58 +0100233 "netargs=run addnfs addip addtty addfb addcma\0" \
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200234 "addnfs=setenv bootargs ${bootargs} " \
235 "root=/dev/nfs rw " \
236 "nfsroot=${serverip}:${rootpath},v3,tcp;\0" \
237 "addip_static=setenv bootargs ${bootargs} " \
238 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:" \
239 "${hostname}:${netdev}:off\0" \
240 "addip_dynamic=setenv bootargs ${bootargs} ip=dhcp\0" \
241 "addip=if test \"${ipmode}\" != static; then " \
242 "run addip_dynamic; else run addip_static; fi\0" \
243 "set_getcmd=if test \"${ipmode}\" != static; then " \
244 "setenv getcmd dhcp; setenv autoload yes; " \
245 "else setenv getcmd tftp; setenv autoload no; fi\0" \
246 "netboot=echo Booting from net ...; " \
247 "run kernel_name; " \
248 "run set_getcmd; " \
249 "setenv bootargs; " \
250 "run netargs; " \
251 "if ${getcmd} ${kernel}; then " \
252 "if ${getcmd} ${fdt_addr} ${fdt_file}; then " \
253 "${boot_type} ${loadaddr} - ${fdt_addr}; " \
254 "fi; " \
255 "fi; " \
256 "echo ... failed\0" \
257 "panicboot=echo No boot device !!! reset\0" \
258 TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
259
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200260/* Physical Memory Map */
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200261#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
262
Tom Rinibb4dd962022-11-16 13:10:37 -0500263#define CFG_SYS_SDRAM_BASE PHYS_SDRAM
Tom Rini6a5dccc2022-11-16 13:10:41 -0500264#define CFG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
265#define CFG_SYS_INIT_RAM_SIZE IRAM_SIZE
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200266
Stefan Roeseb125fd42015-03-12 16:34:16 +0100267/*
268 * All the defines above are for the TQMa6 SoM
269 *
270 * Now include the baseboard specific configuration
271 */
272#ifdef CONFIG_MBA6
273#include "tqma6_mba6.h"
Stefan Roesebe4cb042015-07-06 13:36:33 +0200274#elif CONFIG_WRU4
275#include "tqma6_wru4.h"
Stefan Roeseb125fd42015-03-12 16:34:16 +0100276#else
277#error "No baseboard for the TQMa6 defined!"
278#endif
279
280/* Support at least the sensor on TQMa6 SOM */
Stefan Roeseb125fd42015-03-12 16:34:16 +0100281
Markus Niebelee2cd2b2014-07-18 16:52:44 +0200282#endif /* __CONFIG_H */