blob: 842184bcae28e3a8f179ddd729ec71dc6cfc02dd [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
Simon Glass209ae762024-09-29 19:49:49 -060013#ifdef CONFIG_XPL_BUILD
Tom Rinifb52b942022-12-04 10:04:49 -050014#define CFG_MALLOC_F_ADDR 0x00120000
Peng Fan203a2272019-03-05 02:32:49 +000015
Peng Fan203a2272019-03-05 02:32:49 +000016#endif
17
Peng Fan46f9cfb2019-09-25 08:11:17 +000018#ifdef CONFIG_AHAB_BOOT
19#define AHAB_ENV "sec_boot=yes\0"
20#else
21#define AHAB_ENV "sec_boot=no\0"
22#endif
23
Peng Fan203a2272019-03-05 02:32:49 +000024/* Initial environment variables */
Tom Rinic9edebe2022-12-04 10:03:50 -050025#define CFG_EXTRA_ENV_SETTINGS \
Peng Fan46f9cfb2019-09-25 08:11:17 +000026 AHAB_ENV \
Peng Fan203a2272019-03-05 02:32:49 +000027 "script=boot.scr\0" \
28 "image=Image\0" \
29 "panel=NULL\0" \
30 "console=ttyLP0,${baudrate} earlycon=lpuart32,0x5a060000,${baudrate}\0" \
31 "fdt_addr=0x83000000\0" \
32 "fdt_high=0xffffffffffffffff\0" \
33 "boot_fdt=try\0" \
Peng Fan88b119e2020-05-05 20:28:44 +080034 "fdt_file=undefined\0" \
Peng Fan203a2272019-03-05 02:32:49 +000035 "initrd_addr=0x83800000\0" \
36 "initrd_high=0xffffffffffffffff\0" \
37 "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
Tom Rinib113bca2021-12-11 14:55:52 -050038 "mmcpart=1\0" \
Peng Fanbb4bb582022-04-15 12:23:41 +080039 "mmcroot=/dev/mmcblk1p2 rootwait rw\0" \
Peng Fan203a2272019-03-05 02:32:49 +000040 "mmcautodetect=yes\0" \
41 "mmcargs=setenv bootargs console=${console} root=${mmcroot}\0 " \
42 "loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
43 "bootscript=echo Running bootscript from mmc ...; " \
44 "source\0" \
45 "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
46 "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
Peng Fan46f9cfb2019-09-25 08:11:17 +000047 "boot_os=booti ${loadaddr} - ${fdt_addr};\0" \
48 "loadcntr=fatload mmc ${mmcdev}:${mmcpart} ${cntr_addr} ${cntr_file}\0" \
49 "auth_os=auth_cntr ${cntr_addr}\0" \
Peng Fan203a2272019-03-05 02:32:49 +000050 "mmcboot=echo Booting from mmc ...; " \
51 "run mmcargs; " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000052 "if test ${sec_boot} = yes; then " \
53 "if run auth_os; then " \
54 "run boot_os; " \
Peng Fan203a2272019-03-05 02:32:49 +000055 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000056 "echo ERR: failed to authenticate; " \
Peng Fan203a2272019-03-05 02:32:49 +000057 "fi; " \
58 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000059 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
60 "if run loadfdt; then " \
61 "run boot_os; " \
62 "else " \
63 "echo WARN: Cannot load the DT; " \
64 "fi; " \
65 "else " \
66 "echo wait for boot; " \
67 "fi;" \
Peng Fan203a2272019-03-05 02:32:49 +000068 "fi;\0" \
69 "netargs=setenv bootargs console=${console} " \
70 "root=/dev/nfs " \
71 "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
72 "netboot=echo Booting from net ...; " \
73 "run netargs; " \
74 "if test ${ip_dyn} = yes; then " \
75 "setenv get_cmd dhcp; " \
76 "else " \
77 "setenv get_cmd tftp; " \
78 "fi; " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000079 "if test ${sec_boot} = yes; then " \
80 "${get_cmd} ${cntr_addr} ${cntr_file}; " \
81 "if run auth_os; then " \
82 "run boot_os; " \
Peng Fan203a2272019-03-05 02:32:49 +000083 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000084 "echo ERR: failed to authenticate; " \
Peng Fan203a2272019-03-05 02:32:49 +000085 "fi; " \
86 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000087 "${get_cmd} ${loadaddr} ${image}; " \
88 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
89 "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
90 "booti ${loadaddr} - ${fdt_addr}; " \
91 "else " \
92 "echo WARN: Cannot load the DT; " \
93 "fi; " \
94 "else " \
95 "booti; " \
96 "fi;" \
Peng Fan203a2272019-03-05 02:32:49 +000097 "fi;\0"
98
Peng Fan203a2272019-03-05 02:32:49 +000099/* Link Definitions */
Peng Fan203a2272019-03-05 02:32:49 +0000100
Peng Fan203a2272019-03-05 02:32:49 +0000101/* Default environment is in SD */
Peng Fan203a2272019-03-05 02:32:49 +0000102
Peng Fan203a2272019-03-05 02:32:49 +0000103/* On LPDDR4 board, USDHC1 is for eMMC, USDHC2 is for SD on CPU board */
Peng Fan203a2272019-03-05 02:32:49 +0000104
Tom Rinibb4dd962022-11-16 13:10:37 -0500105#define CFG_SYS_SDRAM_BASE 0x80000000
Peng Fan203a2272019-03-05 02:32:49 +0000106#define PHYS_SDRAM_1 0x80000000
107#define PHYS_SDRAM_2 0x880000000
108#define PHYS_SDRAM_1_SIZE 0x80000000 /* 2 GB */
109#define PHYS_SDRAM_2_SIZE 0x100000000 /* 4 GB */
110
Peng Fan203a2272019-03-05 02:32:49 +0000111#endif /* __IMX8QM_MEK_H */