blob: 93999509948a15d4393039dd01e980cba0964365 [file] [log] [blame]
Peng Fand0dd7392018-10-18 14:28:37 +02001/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * Copyright 2018 NXP
4 */
5
6#ifndef __IMX8QXP_MEK_H
7#define __IMX8QXP_MEK_H
8
9#include <linux/sizes.h>
Simon Glass1af3c7f2020-05-10 11:40:09 -060010#include <linux/stringify.h>
Peng Fand0dd7392018-10-18 14:28:37 +020011#include <asm/arch/imx-regs.h>
12
Peng Fan018e3fd2018-12-21 06:21:34 +000013#ifdef CONFIG_SPL_BUILD
Tom Rinidd5b58c2022-12-04 10:04:49 -050014#define CFG_MALLOC_F_ADDR 0x00120000
Peng Fan018e3fd2018-12-21 06:21:34 +000015
Peng Fan018e3fd2018-12-21 06:21:34 +000016#endif
17
Peng Fan6dcc6ce2019-09-25 08:11:19 +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 Fand0dd7392018-10-18 14:28:37 +020024/* Initial environment variables */
Tom Rini0613c362022-12-04 10:03:50 -050025#define CFG_EXTRA_ENV_SETTINGS \
Peng Fan6dcc6ce2019-09-25 08:11:19 +000026 AHAB_ENV \
Peng Fand0dd7392018-10-18 14:28:37 +020027 "script=boot.scr\0" \
28 "image=Image\0" \
29 "panel=NULL\0" \
Fabio Estevam10a8cc02020-02-17 15:17:01 -030030 "console=ttyLP0\0" \
Peng Fand0dd7392018-10-18 14:28:37 +020031 "fdt_addr=0x83000000\0" \
32 "fdt_high=0xffffffffffffffff\0" \
33 "boot_fdt=try\0" \
Peng Fana6c36f12020-05-05 20:28:45 +080034 "fdt_file=undefined\0" \
Peng Fand0dd7392018-10-18 14:28:37 +020035 "initrd_addr=0x83800000\0" \
36 "initrd_high=0xffffffffffffffff\0" \
37 "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
Tom Rinide35b8f2021-12-11 14:55:52 -050038 "mmcpart=1\0" \
Peng Fanadfaa422022-04-15 12:23:41 +080039 "mmcroot=/dev/mmcblk1p2 rootwait rw\0" \
Peng Fand0dd7392018-10-18 14:28:37 +020040 "mmcautodetect=yes\0" \
Fabio Estevam10a8cc02020-02-17 15:17:01 -030041 "mmcargs=setenv bootargs console=${console},${baudrate} root=${mmcroot}\0 " \
Peng Fand0dd7392018-10-18 14:28:37 +020042 "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 Fan6dcc6ce2019-09-25 08:11:19 +000047 "loadcntr=fatload mmc ${mmcdev}:${mmcpart} ${cntr_addr} ${cntr_file}\0" \
48 "auth_os=auth_cntr ${cntr_addr}\0" \
49 "boot_os=booti ${loadaddr} - ${fdt_addr};\0" \
Peng Fand0dd7392018-10-18 14:28:37 +020050 "mmcboot=echo Booting from mmc ...; " \
51 "run mmcargs; " \
Peng Fan6dcc6ce2019-09-25 08:11:19 +000052 "if test ${sec_boot} = yes; then " \
53 "if run auth_os; then " \
54 "run boot_os; " \
Peng Fand0dd7392018-10-18 14:28:37 +020055 "else " \
Peng Fan6dcc6ce2019-09-25 08:11:19 +000056 "echo ERR: failed to authenticate; " \
Peng Fand0dd7392018-10-18 14:28:37 +020057 "fi; " \
58 "else " \
Peng Fan6dcc6ce2019-09-25 08:11:19 +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 Fand0dd7392018-10-18 14:28:37 +020068 "fi;\0" \
Fabio Estevam10a8cc02020-02-17 15:17:01 -030069 "netargs=setenv bootargs console=${console},${baudrate} " \
Peng Fand0dd7392018-10-18 14:28:37 +020070 "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 Fan6dcc6ce2019-09-25 08:11:19 +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 Fand0dd7392018-10-18 14:28:37 +020083 "else " \
Peng Fan6dcc6ce2019-09-25 08:11:19 +000084 "echo ERR: failed to authenticate; " \
Peng Fand0dd7392018-10-18 14:28:37 +020085 "fi; " \
86 "else " \
Peng Fan6dcc6ce2019-09-25 08:11:19 +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 "run boot_os; " \
91 "else " \
92 "echo WARN: Cannot load the DT; " \
93 "fi; " \
94 "else " \
95 "booti; " \
96 "fi;" \
Peng Fand0dd7392018-10-18 14:28:37 +020097 "fi;\0"
98
Peng Fand0dd7392018-10-18 14:28:37 +020099/* Link Definitions */
Peng Fand0dd7392018-10-18 14:28:37 +0200100
Peng Fand0dd7392018-10-18 14:28:37 +0200101/* Default environment is in SD */
Peng Fand0dd7392018-10-18 14:28:37 +0200102
Peng Fand0dd7392018-10-18 14:28:37 +0200103/* On LPDDR4 board, USDHC1 is for eMMC, USDHC2 is for SD on CPU board */
Peng Fand0dd7392018-10-18 14:28:37 +0200104
Tom Riniaa6e94d2022-11-16 13:10:37 -0500105#define CFG_SYS_SDRAM_BASE 0x80000000
Peng Fand0dd7392018-10-18 14:28:37 +0200106#define PHYS_SDRAM_1 0x80000000
107#define PHYS_SDRAM_2 0x880000000
108#define PHYS_SDRAM_1_SIZE 0x80000000 /* 2 GB */
109/* LPDDR4 board total DDR is 3GB */
110#define PHYS_SDRAM_2_SIZE 0x40000000 /* 1 GB */
111
Anatolij Gustschin5c1c7c12019-10-21 17:31:53 +0200112/* Misc configuration */
Anatolij Gustschin5c1c7c12019-10-21 17:31:53 +0200113
Peng Fand0dd7392018-10-18 14:28:37 +0200114#endif /* __IMX8QXP_MEK_H */