blob: 61d56e269ac49a5f846b50c879510752466db5df [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_SPL_MAX_SIZE (124 * 1024)
17#define CONFIG_SYS_MONITOR_LEN (1024 * 1024)
Peng Fan203a2272019-03-05 02:32:49 +000018
Peng Fan203a2272019-03-05 02:32:49 +000019#define CONFIG_SPL_STACK 0x013E000
20#define CONFIG_SPL_BSS_START_ADDR 0x00128000
21#define CONFIG_SPL_BSS_MAX_SIZE 0x1000 /* 4 KB */
22#define CONFIG_SYS_SPL_MALLOC_START 0x00120000
23#define CONFIG_SYS_SPL_MALLOC_SIZE 0x3000 /* 12 KB */
24#define CONFIG_SERIAL_LPUART_BASE 0x5a060000
Peng Fan203a2272019-03-05 02:32:49 +000025#define CONFIG_MALLOC_F_ADDR 0x00120000
26
27#define CONFIG_SPL_RAW_IMAGE_ARM_TRUSTED_FIRMWARE
28
29#define CONFIG_SPL_ABORT_ON_RAW_IMAGE
Peng Fan203a2272019-03-05 02:32:49 +000030#endif
31
Peng Fan46f9cfb2019-09-25 08:11:17 +000032#ifdef CONFIG_AHAB_BOOT
33#define AHAB_ENV "sec_boot=yes\0"
34#else
35#define AHAB_ENV "sec_boot=no\0"
36#endif
37
Peng Fan203a2272019-03-05 02:32:49 +000038/* Initial environment variables */
39#define CONFIG_EXTRA_ENV_SETTINGS \
Peng Fan46f9cfb2019-09-25 08:11:17 +000040 AHAB_ENV \
Peng Fan203a2272019-03-05 02:32:49 +000041 "script=boot.scr\0" \
42 "image=Image\0" \
43 "panel=NULL\0" \
44 "console=ttyLP0,${baudrate} earlycon=lpuart32,0x5a060000,${baudrate}\0" \
45 "fdt_addr=0x83000000\0" \
46 "fdt_high=0xffffffffffffffff\0" \
47 "boot_fdt=try\0" \
Peng Fan88b119e2020-05-05 20:28:44 +080048 "fdt_file=undefined\0" \
Peng Fan203a2272019-03-05 02:32:49 +000049 "initrd_addr=0x83800000\0" \
50 "initrd_high=0xffffffffffffffff\0" \
51 "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
Tom Rinib113bca2021-12-11 14:55:52 -050052 "mmcpart=1\0" \
Peng Fanbb4bb582022-04-15 12:23:41 +080053 "mmcroot=/dev/mmcblk1p2 rootwait rw\0" \
Peng Fan203a2272019-03-05 02:32:49 +000054 "mmcautodetect=yes\0" \
55 "mmcargs=setenv bootargs console=${console} root=${mmcroot}\0 " \
56 "loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
57 "bootscript=echo Running bootscript from mmc ...; " \
58 "source\0" \
59 "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
60 "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
Peng Fan46f9cfb2019-09-25 08:11:17 +000061 "boot_os=booti ${loadaddr} - ${fdt_addr};\0" \
62 "loadcntr=fatload mmc ${mmcdev}:${mmcpart} ${cntr_addr} ${cntr_file}\0" \
63 "auth_os=auth_cntr ${cntr_addr}\0" \
Peng Fan203a2272019-03-05 02:32:49 +000064 "mmcboot=echo Booting from mmc ...; " \
65 "run mmcargs; " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000066 "if test ${sec_boot} = yes; then " \
67 "if run auth_os; then " \
68 "run boot_os; " \
Peng Fan203a2272019-03-05 02:32:49 +000069 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000070 "echo ERR: failed to authenticate; " \
Peng Fan203a2272019-03-05 02:32:49 +000071 "fi; " \
72 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000073 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
74 "if run loadfdt; then " \
75 "run boot_os; " \
76 "else " \
77 "echo WARN: Cannot load the DT; " \
78 "fi; " \
79 "else " \
80 "echo wait for boot; " \
81 "fi;" \
Peng Fan203a2272019-03-05 02:32:49 +000082 "fi;\0" \
83 "netargs=setenv bootargs console=${console} " \
84 "root=/dev/nfs " \
85 "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
86 "netboot=echo Booting from net ...; " \
87 "run netargs; " \
88 "if test ${ip_dyn} = yes; then " \
89 "setenv get_cmd dhcp; " \
90 "else " \
91 "setenv get_cmd tftp; " \
92 "fi; " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000093 "if test ${sec_boot} = yes; then " \
94 "${get_cmd} ${cntr_addr} ${cntr_file}; " \
95 "if run auth_os; then " \
96 "run boot_os; " \
Peng Fan203a2272019-03-05 02:32:49 +000097 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000098 "echo ERR: failed to authenticate; " \
Peng Fan203a2272019-03-05 02:32:49 +000099 "fi; " \
100 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +0000101 "${get_cmd} ${loadaddr} ${image}; " \
102 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
103 "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
104 "booti ${loadaddr} - ${fdt_addr}; " \
105 "else " \
106 "echo WARN: Cannot load the DT; " \
107 "fi; " \
108 "else " \
109 "booti; " \
110 "fi;" \
Peng Fan203a2272019-03-05 02:32:49 +0000111 "fi;\0"
112
Peng Fan203a2272019-03-05 02:32:49 +0000113/* Link Definitions */
Peng Fan203a2272019-03-05 02:32:49 +0000114
115#define CONFIG_SYS_INIT_SP_ADDR 0x80200000
116
117/* Default environment is in SD */
Peng Fan203a2272019-03-05 02:32:49 +0000118
Peng Fan203a2272019-03-05 02:32:49 +0000119/* On LPDDR4 board, USDHC1 is for eMMC, USDHC2 is for SD on CPU board */
Peng Fan203a2272019-03-05 02:32:49 +0000120
Peng Fan203a2272019-03-05 02:32:49 +0000121#define CONFIG_SYS_SDRAM_BASE 0x80000000
122#define PHYS_SDRAM_1 0x80000000
123#define PHYS_SDRAM_2 0x880000000
124#define PHYS_SDRAM_1_SIZE 0x80000000 /* 2 GB */
125#define PHYS_SDRAM_2_SIZE 0x100000000 /* 4 GB */
126
Peng Fan203a2272019-03-05 02:32:49 +0000127#endif /* __IMX8QM_MEK_H */