blob: 0266d6988ce12ceb4fbb0114fcebc4bfd36b03a4 [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_SYS_MONITOR_LEN (1024 * 1024)
Oliver Grauteaf5e29b2021-05-31 15:50:40 +020016
Oliver Grauteaf5e29b2021-05-31 15:50:40 +020017#define CONFIG_SERIAL_LPUART_BASE 0x5a060000
18#define CONFIG_MALLOC_F_ADDR 0x00120000
19
20#define CONFIG_SPL_RAW_IMAGE_ARM_TRUSTED_FIRMWARE
21
22#define CONFIG_SPL_ABORT_ON_RAW_IMAGE
Oliver Grauteaf5e29b2021-05-31 15:50:40 +020023#endif
24
Oliver Grauteaf5e29b2021-05-31 15:50:40 +020025/* Flat Device Tree Definitions */
Oliver Grauteaf5e29b2021-05-31 15:50:40 +020026
27#define CONFIG_SYS_BOOTMAPSZ (256 << 20)
28#define CONFIG_SYS_FSL_ESDHC_ADDR 0
29#define USDHC1_BASE_ADDR 0x5B010000
30#define USDHC2_BASE_ADDR 0x5B020000
31#define USDHC3_BASE_ADDR 0x5B030000
Oliver Grauteaf5e29b2021-05-31 15:50:40 +020032
Oliver Grauteaf5e29b2021-05-31 15:50:40 +020033/* Boot M4 */
34#define M4_BOOT_ENV \
35 "m4_0_image=m4_0.bin\0" \
36 "m4_1_image=m4_1.bin\0" \
37 "loadm4image_0=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${m4_0_image}\0" \
38 "loadm4image_1=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${m4_1_image}\0" \
39 "m4boot_0=run loadm4image_0; dcache flush; bootaux ${loadaddr} 0\0" \
40 "m4boot_1=run loadm4image_1; dcache flush; bootaux ${loadaddr} 1\0" \
41
42#ifdef CONFIG_NAND_BOOT
43#define MFG_NAND_PARTITION "mtdparts=gpmi-nand:128m(boot),32m(kernel),16m(dtb),8m(misc),-(rootfs) "
44#else
45#define MFG_NAND_PARTITION ""
46#endif
47#define FEC0_RESET IMX_GPIO_NR(2, 5)
48#define FEC0_PDOMAIN "conn_enet0"
49
50#define CONFIG_MFG_ENV_SETTINGS \
51 "mfgtool_args=setenv bootargs console=${console},${baudrate} " \
52 "rdinit=/linuxrc " \
53 "g_mass_storage.stall=0 g_mass_storage.removable=1 " \
54 "g_mass_storage.idVendor=0x066F g_mass_storage.idProduct=0x37FF "\
55 "g_mass_storage.iSerialNumber=\"\" "\
56 MFG_NAND_PARTITION \
57 "clk_ignore_unused "\
58 "\0" \
59 "initrd_addr=0x83800000\0" \
60 "bootcmd_mfg=run mfgtool_args;booti ${loadaddr} ${initrd_addr} ${fdt_addr};\0" \
61
62/* Initial environment variables */
63#define CONFIG_EXTRA_ENV_SETTINGS \
64 CONFIG_MFG_ENV_SETTINGS \
65 M4_BOOT_ENV \
66 "script=boot.scr\0" \
67 "image=Image\0" \
68 "panel=NULL\0" \
69 "console=ttyLP0\0" \
70 "fdt_addr=0x83000000\0" \
71 "boot_fdt=try\0" \
72 "fdt_file=imx8qm-cgt-qmx8.dtb\0" \
73 "mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \
Tom Rinib113bca2021-12-11 14:55:52 -050074 "mmcpart=1\0" \
Peng Fanbb4bb582022-04-15 12:23:41 +080075 "mmcroot=/dev/mmcblk1p2 rootwait rw\0" \
Oliver Grauteaf5e29b2021-05-31 15:50:40 +020076 "mmcautodetect=yes\0" \
77 "mmcargs=setenv bootargs console=${console},${baudrate} root=${mmcroot} earlycon\0 " \
78 "loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
79 "bootscript=echo Running bootscript from mmc ...; " \
80 "source\0" \
81 "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
82 "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
83 "mmcboot=echo Booting from mmc ...; " \
84 "run mmcargs; " \
85 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
86 "if run loadfdt; then " \
87 "booti ${loadaddr} - ${fdt_addr}; " \
88 "else " \
89 "echo WARN: Cannot load the DT; " \
90 "fi; " \
91 "else " \
92 "echo wait for boot; " \
93 "fi;\0" \
94 "netargs=setenv bootargs console=${console},${baudrate} " \
95 "root=/dev/nfs " \
96 "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp rw earlycon\0" \
97 "netboot=echo Booting from net ...; " \
98 "run netargs; " \
99 "if test ${ip_dyn} = yes; then " \
100 "setenv get_cmd dhcp; " \
101 "else " \
102 "setenv get_cmd tftp; " \
103 "fi; " \
104 "${get_cmd} ${loadaddr} ${image}; " \
105 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
106 "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
107 "booti ${loadaddr} - ${fdt_addr}; " \
108 "else " \
109 "echo WARN: Cannot load the DT; " \
110 "fi; " \
111 "else " \
112 "booti; " \
113 "fi;\0"
114
Oliver Grauteaf5e29b2021-05-31 15:50:40 +0200115/* Link Definitions */
Oliver Grauteaf5e29b2021-05-31 15:50:40 +0200116
Oliver Grauteaf5e29b2021-05-31 15:50:40 +0200117#define CONFIG_SYS_FSL_USDHC_NUM 3
118
Oliver Grauteaf5e29b2021-05-31 15:50:40 +0200119#define CONFIG_SYS_SDRAM_BASE 0x80000000
120#define PHYS_SDRAM_1 0x80000000
121#define PHYS_SDRAM_2 0x880000000
122#define PHYS_SDRAM_1_SIZE 0x80000000 /* 2 GB */
123#define PHYS_SDRAM_2_SIZE 0x100000000 /* 4 GB */
124
Oliver Grauteaf5e29b2021-05-31 15:50:40 +0200125/* Networking */
126#define CONFIG_FEC_MXC_PHYADDR -1
Oliver Grauteaf5e29b2021-05-31 15:50:40 +0200127
128#endif /* __CGTQMX8_H */