blob: b59502e5895b27f624f303b12bf3b48a1b8857b6 [file] [log] [blame]
Peng Fan203a2272019-03-05 02:32:49 +00001/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * Copyright 2018 NXP
4 */
5
6#ifndef __IMX8QM_MEK_H
7#define __IMX8QM_MEK_H
8
9#include <linux/sizes.h>
Simon Glassfb64e362020-05-10 11:40:09 -060010#include <linux/stringify.h>
Peng Fan203a2272019-03-05 02:32:49 +000011#include <asm/arch/imx-regs.h>
12
Oleksandr Suvorov74022d72021-08-29 22:39:13 +030013#define CONFIG_SYS_BOOTM_LEN (64 * SZ_1M)
14
Peng Fan203a2272019-03-05 02:32:49 +000015#ifdef CONFIG_SPL_BUILD
Peng Fan203a2272019-03-05 02:32:49 +000016#define CONFIG_SYS_MONITOR_LEN (1024 * 1024)
Peng Fan203a2272019-03-05 02:32:49 +000017
Peng Fan203a2272019-03-05 02:32:49 +000018#define CONFIG_SERIAL_LPUART_BASE 0x5a060000
Peng Fan203a2272019-03-05 02:32:49 +000019#define CONFIG_MALLOC_F_ADDR 0x00120000
20
21#define CONFIG_SPL_RAW_IMAGE_ARM_TRUSTED_FIRMWARE
22
Peng Fan203a2272019-03-05 02:32:49 +000023#endif
24
Peng Fan46f9cfb2019-09-25 08:11:17 +000025#ifdef CONFIG_AHAB_BOOT
26#define AHAB_ENV "sec_boot=yes\0"
27#else
28#define AHAB_ENV "sec_boot=no\0"
29#endif
30
Peng Fan203a2272019-03-05 02:32:49 +000031/* Initial environment variables */
32#define CONFIG_EXTRA_ENV_SETTINGS \
Peng Fan46f9cfb2019-09-25 08:11:17 +000033 AHAB_ENV \
Peng Fan203a2272019-03-05 02:32:49 +000034 "script=boot.scr\0" \
35 "image=Image\0" \
36 "panel=NULL\0" \
37 "console=ttyLP0,${baudrate} earlycon=lpuart32,0x5a060000,${baudrate}\0" \
38 "fdt_addr=0x83000000\0" \
39 "fdt_high=0xffffffffffffffff\0" \
40 "boot_fdt=try\0" \
Peng Fan88b119e2020-05-05 20:28:44 +080041 "fdt_file=undefined\0" \
Peng Fan203a2272019-03-05 02:32:49 +000042 "initrd_addr=0x83800000\0" \
43 "initrd_high=0xffffffffffffffff\0" \
44 "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
Tom Rinib113bca2021-12-11 14:55:52 -050045 "mmcpart=1\0" \
Peng Fanbb4bb582022-04-15 12:23:41 +080046 "mmcroot=/dev/mmcblk1p2 rootwait rw\0" \
Peng Fan203a2272019-03-05 02:32:49 +000047 "mmcautodetect=yes\0" \
48 "mmcargs=setenv bootargs console=${console} root=${mmcroot}\0 " \
49 "loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
50 "bootscript=echo Running bootscript from mmc ...; " \
51 "source\0" \
52 "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
53 "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
Peng Fan46f9cfb2019-09-25 08:11:17 +000054 "boot_os=booti ${loadaddr} - ${fdt_addr};\0" \
55 "loadcntr=fatload mmc ${mmcdev}:${mmcpart} ${cntr_addr} ${cntr_file}\0" \
56 "auth_os=auth_cntr ${cntr_addr}\0" \
Peng Fan203a2272019-03-05 02:32:49 +000057 "mmcboot=echo Booting from mmc ...; " \
58 "run mmcargs; " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000059 "if test ${sec_boot} = yes; then " \
60 "if run auth_os; then " \
61 "run boot_os; " \
Peng Fan203a2272019-03-05 02:32:49 +000062 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000063 "echo ERR: failed to authenticate; " \
Peng Fan203a2272019-03-05 02:32:49 +000064 "fi; " \
65 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000066 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
67 "if run loadfdt; then " \
68 "run boot_os; " \
69 "else " \
70 "echo WARN: Cannot load the DT; " \
71 "fi; " \
72 "else " \
73 "echo wait for boot; " \
74 "fi;" \
Peng Fan203a2272019-03-05 02:32:49 +000075 "fi;\0" \
76 "netargs=setenv bootargs console=${console} " \
77 "root=/dev/nfs " \
78 "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
79 "netboot=echo Booting from net ...; " \
80 "run netargs; " \
81 "if test ${ip_dyn} = yes; then " \
82 "setenv get_cmd dhcp; " \
83 "else " \
84 "setenv get_cmd tftp; " \
85 "fi; " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000086 "if test ${sec_boot} = yes; then " \
87 "${get_cmd} ${cntr_addr} ${cntr_file}; " \
88 "if run auth_os; then " \
89 "run boot_os; " \
Peng Fan203a2272019-03-05 02:32:49 +000090 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000091 "echo ERR: failed to authenticate; " \
Peng Fan203a2272019-03-05 02:32:49 +000092 "fi; " \
93 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000094 "${get_cmd} ${loadaddr} ${image}; " \
95 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
96 "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
97 "booti ${loadaddr} - ${fdt_addr}; " \
98 "else " \
99 "echo WARN: Cannot load the DT; " \
100 "fi; " \
101 "else " \
102 "booti; " \
103 "fi;" \
Peng Fan203a2272019-03-05 02:32:49 +0000104 "fi;\0"
105
Peng Fan203a2272019-03-05 02:32:49 +0000106/* Link Definitions */
Peng Fan203a2272019-03-05 02:32:49 +0000107
Peng Fan203a2272019-03-05 02:32:49 +0000108/* Default environment is in SD */
Peng Fan203a2272019-03-05 02:32:49 +0000109
Peng Fan203a2272019-03-05 02:32:49 +0000110/* On LPDDR4 board, USDHC1 is for eMMC, USDHC2 is for SD on CPU board */
Peng Fan203a2272019-03-05 02:32:49 +0000111
Peng Fan203a2272019-03-05 02:32:49 +0000112#define CONFIG_SYS_SDRAM_BASE 0x80000000
113#define PHYS_SDRAM_1 0x80000000
114#define PHYS_SDRAM_2 0x880000000
115#define PHYS_SDRAM_1_SIZE 0x80000000 /* 2 GB */
116#define PHYS_SDRAM_2_SIZE 0x100000000 /* 4 GB */
117
Peng Fan203a2272019-03-05 02:32:49 +0000118#endif /* __IMX8QM_MEK_H */