blob: f4d19f87312f340d3e7e8deca93114c46a5d3151 [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
23#define CONFIG_SPL_ABORT_ON_RAW_IMAGE
Peng Fan203a2272019-03-05 02:32:49 +000024#endif
25
Peng Fan46f9cfb2019-09-25 08:11:17 +000026#ifdef CONFIG_AHAB_BOOT
27#define AHAB_ENV "sec_boot=yes\0"
28#else
29#define AHAB_ENV "sec_boot=no\0"
30#endif
31
Peng Fan203a2272019-03-05 02:32:49 +000032/* Initial environment variables */
33#define CONFIG_EXTRA_ENV_SETTINGS \
Peng Fan46f9cfb2019-09-25 08:11:17 +000034 AHAB_ENV \
Peng Fan203a2272019-03-05 02:32:49 +000035 "script=boot.scr\0" \
36 "image=Image\0" \
37 "panel=NULL\0" \
38 "console=ttyLP0,${baudrate} earlycon=lpuart32,0x5a060000,${baudrate}\0" \
39 "fdt_addr=0x83000000\0" \
40 "fdt_high=0xffffffffffffffff\0" \
41 "boot_fdt=try\0" \
Peng Fan88b119e2020-05-05 20:28:44 +080042 "fdt_file=undefined\0" \
Peng Fan203a2272019-03-05 02:32:49 +000043 "initrd_addr=0x83800000\0" \
44 "initrd_high=0xffffffffffffffff\0" \
45 "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
Tom Rinib113bca2021-12-11 14:55:52 -050046 "mmcpart=1\0" \
Peng Fanbb4bb582022-04-15 12:23:41 +080047 "mmcroot=/dev/mmcblk1p2 rootwait rw\0" \
Peng Fan203a2272019-03-05 02:32:49 +000048 "mmcautodetect=yes\0" \
49 "mmcargs=setenv bootargs console=${console} root=${mmcroot}\0 " \
50 "loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
51 "bootscript=echo Running bootscript from mmc ...; " \
52 "source\0" \
53 "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
54 "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
Peng Fan46f9cfb2019-09-25 08:11:17 +000055 "boot_os=booti ${loadaddr} - ${fdt_addr};\0" \
56 "loadcntr=fatload mmc ${mmcdev}:${mmcpart} ${cntr_addr} ${cntr_file}\0" \
57 "auth_os=auth_cntr ${cntr_addr}\0" \
Peng Fan203a2272019-03-05 02:32:49 +000058 "mmcboot=echo Booting from mmc ...; " \
59 "run mmcargs; " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000060 "if test ${sec_boot} = yes; then " \
61 "if run auth_os; then " \
62 "run boot_os; " \
Peng Fan203a2272019-03-05 02:32:49 +000063 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000064 "echo ERR: failed to authenticate; " \
Peng Fan203a2272019-03-05 02:32:49 +000065 "fi; " \
66 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000067 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
68 "if run loadfdt; then " \
69 "run boot_os; " \
70 "else " \
71 "echo WARN: Cannot load the DT; " \
72 "fi; " \
73 "else " \
74 "echo wait for boot; " \
75 "fi;" \
Peng Fan203a2272019-03-05 02:32:49 +000076 "fi;\0" \
77 "netargs=setenv bootargs console=${console} " \
78 "root=/dev/nfs " \
79 "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
80 "netboot=echo Booting from net ...; " \
81 "run netargs; " \
82 "if test ${ip_dyn} = yes; then " \
83 "setenv get_cmd dhcp; " \
84 "else " \
85 "setenv get_cmd tftp; " \
86 "fi; " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000087 "if test ${sec_boot} = yes; then " \
88 "${get_cmd} ${cntr_addr} ${cntr_file}; " \
89 "if run auth_os; then " \
90 "run boot_os; " \
Peng Fan203a2272019-03-05 02:32:49 +000091 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000092 "echo ERR: failed to authenticate; " \
Peng Fan203a2272019-03-05 02:32:49 +000093 "fi; " \
94 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000095 "${get_cmd} ${loadaddr} ${image}; " \
96 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
97 "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
98 "booti ${loadaddr} - ${fdt_addr}; " \
99 "else " \
100 "echo WARN: Cannot load the DT; " \
101 "fi; " \
102 "else " \
103 "booti; " \
104 "fi;" \
Peng Fan203a2272019-03-05 02:32:49 +0000105 "fi;\0"
106
Peng Fan203a2272019-03-05 02:32:49 +0000107/* Link Definitions */
Peng Fan203a2272019-03-05 02:32:49 +0000108
Peng Fan203a2272019-03-05 02:32:49 +0000109/* Default environment is in SD */
Peng Fan203a2272019-03-05 02:32:49 +0000110
Peng Fan203a2272019-03-05 02:32:49 +0000111/* On LPDDR4 board, USDHC1 is for eMMC, USDHC2 is for SD on CPU board */
Peng Fan203a2272019-03-05 02:32:49 +0000112
Peng Fan203a2272019-03-05 02:32:49 +0000113#define CONFIG_SYS_SDRAM_BASE 0x80000000
114#define PHYS_SDRAM_1 0x80000000
115#define PHYS_SDRAM_2 0x880000000
116#define PHYS_SDRAM_1_SIZE 0x80000000 /* 2 GB */
117#define PHYS_SDRAM_2_SIZE 0x100000000 /* 4 GB */
118
Peng Fan203a2272019-03-05 02:32:49 +0000119#endif /* __IMX8QM_MEK_H */