blob: 4c04bbf644717049e4effa5c602085e5f6d6a92b [file] [log] [blame]
Oliver Grauteaf5e29b2021-05-31 15:50:40 +02001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright 2017-2018 NXP
4 * Copyright 2018 congatec AG
5 *
6 */
7
8#ifndef __CGTQMX8_H
9#define __CGTQMX8_H
10
11#include <linux/sizes.h>
12#include <asm/arch/imx-regs.h>
13
14#ifdef CONFIG_SPL_BUILD
Oliver Grauteaf5e29b2021-05-31 15:50:40 +020015#define CONFIG_SPL_MAX_SIZE (124 * 1024)
16#define CONFIG_SYS_MONITOR_LEN (1024 * 1024)
Oliver Grauteaf5e29b2021-05-31 15:50:40 +020017
Oliver Grauteaf5e29b2021-05-31 15:50:40 +020018#define CONFIG_SPL_STACK 0x013E000
19#define CONFIG_SPL_BSS_START_ADDR 0x00128000
20#define CONFIG_SPL_BSS_MAX_SIZE 0x1000 /* 4 KB */
21#define CONFIG_SYS_SPL_MALLOC_START 0x00120000
22#define CONFIG_SYS_SPL_MALLOC_SIZE 0x3000 /* 12 KB */
23#define CONFIG_SERIAL_LPUART_BASE 0x5a060000
24#define CONFIG_MALLOC_F_ADDR 0x00120000
25
26#define CONFIG_SPL_RAW_IMAGE_ARM_TRUSTED_FIRMWARE
27
28#define CONFIG_SPL_ABORT_ON_RAW_IMAGE
Oliver Grauteaf5e29b2021-05-31 15:50:40 +020029#endif
30
Oliver Grauteaf5e29b2021-05-31 15:50:40 +020031/* Flat Device Tree Definitions */
Oliver Grauteaf5e29b2021-05-31 15:50:40 +020032
33#define CONFIG_SYS_BOOTMAPSZ (256 << 20)
34#define CONFIG_SYS_FSL_ESDHC_ADDR 0
35#define USDHC1_BASE_ADDR 0x5B010000
36#define USDHC2_BASE_ADDR 0x5B020000
37#define USDHC3_BASE_ADDR 0x5B030000
Oliver Grauteaf5e29b2021-05-31 15:50:40 +020038
Oliver Grauteaf5e29b2021-05-31 15:50:40 +020039/* Boot M4 */
40#define M4_BOOT_ENV \
41 "m4_0_image=m4_0.bin\0" \
42 "m4_1_image=m4_1.bin\0" \
43 "loadm4image_0=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${m4_0_image}\0" \
44 "loadm4image_1=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${m4_1_image}\0" \
45 "m4boot_0=run loadm4image_0; dcache flush; bootaux ${loadaddr} 0\0" \
46 "m4boot_1=run loadm4image_1; dcache flush; bootaux ${loadaddr} 1\0" \
47
48#ifdef CONFIG_NAND_BOOT
49#define MFG_NAND_PARTITION "mtdparts=gpmi-nand:128m(boot),32m(kernel),16m(dtb),8m(misc),-(rootfs) "
50#else
51#define MFG_NAND_PARTITION ""
52#endif
53#define FEC0_RESET IMX_GPIO_NR(2, 5)
54#define FEC0_PDOMAIN "conn_enet0"
55
56#define CONFIG_MFG_ENV_SETTINGS \
57 "mfgtool_args=setenv bootargs console=${console},${baudrate} " \
58 "rdinit=/linuxrc " \
59 "g_mass_storage.stall=0 g_mass_storage.removable=1 " \
60 "g_mass_storage.idVendor=0x066F g_mass_storage.idProduct=0x37FF "\
61 "g_mass_storage.iSerialNumber=\"\" "\
62 MFG_NAND_PARTITION \
63 "clk_ignore_unused "\
64 "\0" \
65 "initrd_addr=0x83800000\0" \
66 "bootcmd_mfg=run mfgtool_args;booti ${loadaddr} ${initrd_addr} ${fdt_addr};\0" \
67
68/* Initial environment variables */
69#define CONFIG_EXTRA_ENV_SETTINGS \
70 CONFIG_MFG_ENV_SETTINGS \
71 M4_BOOT_ENV \
72 "script=boot.scr\0" \
73 "image=Image\0" \
74 "panel=NULL\0" \
75 "console=ttyLP0\0" \
76 "fdt_addr=0x83000000\0" \
77 "boot_fdt=try\0" \
78 "fdt_file=imx8qm-cgt-qmx8.dtb\0" \
79 "mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \
Tom Rinib113bca2021-12-11 14:55:52 -050080 "mmcpart=1\0" \
Peng Fanbb4bb582022-04-15 12:23:41 +080081 "mmcroot=/dev/mmcblk1p2 rootwait rw\0" \
Oliver Grauteaf5e29b2021-05-31 15:50:40 +020082 "mmcautodetect=yes\0" \
83 "mmcargs=setenv bootargs console=${console},${baudrate} root=${mmcroot} earlycon\0 " \
84 "loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
85 "bootscript=echo Running bootscript from mmc ...; " \
86 "source\0" \
87 "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
88 "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
89 "mmcboot=echo Booting from mmc ...; " \
90 "run mmcargs; " \
91 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
92 "if run loadfdt; then " \
93 "booti ${loadaddr} - ${fdt_addr}; " \
94 "else " \
95 "echo WARN: Cannot load the DT; " \
96 "fi; " \
97 "else " \
98 "echo wait for boot; " \
99 "fi;\0" \
100 "netargs=setenv bootargs console=${console},${baudrate} " \
101 "root=/dev/nfs " \
102 "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp rw earlycon\0" \
103 "netboot=echo Booting from net ...; " \
104 "run netargs; " \
105 "if test ${ip_dyn} = yes; then " \
106 "setenv get_cmd dhcp; " \
107 "else " \
108 "setenv get_cmd tftp; " \
109 "fi; " \
110 "${get_cmd} ${loadaddr} ${image}; " \
111 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
112 "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
113 "booti ${loadaddr} - ${fdt_addr}; " \
114 "else " \
115 "echo WARN: Cannot load the DT; " \
116 "fi; " \
117 "else " \
118 "booti; " \
119 "fi;\0"
120
Oliver Grauteaf5e29b2021-05-31 15:50:40 +0200121/* Link Definitions */
Oliver Grauteaf5e29b2021-05-31 15:50:40 +0200122
123#define CONFIG_SYS_INIT_SP_ADDR 0x80200000
124
Oliver Grauteaf5e29b2021-05-31 15:50:40 +0200125#define CONFIG_SYS_FSL_USDHC_NUM 3
126
Oliver Grauteaf5e29b2021-05-31 15:50:40 +0200127#define CONFIG_SYS_SDRAM_BASE 0x80000000
128#define PHYS_SDRAM_1 0x80000000
129#define PHYS_SDRAM_2 0x880000000
130#define PHYS_SDRAM_1_SIZE 0x80000000 /* 2 GB */
131#define PHYS_SDRAM_2_SIZE 0x100000000 /* 4 GB */
132
Oliver Grauteaf5e29b2021-05-31 15:50:40 +0200133/* Networking */
134#define CONFIG_FEC_MXC_PHYADDR -1
Oliver Grauteaf5e29b2021-05-31 15:50:40 +0200135
136#endif /* __CGTQMX8_H */