blob: 884d741789f309b8924290c3bab8c72bc09d3eae [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
32#define CONFIG_REMAKE_ELF
33
Peng Fan203a2272019-03-05 02:32:49 +000034#define CONFIG_SYS_FSL_ESDHC_ADDR 0
35#define USDHC1_BASE_ADDR 0x5B010000
36#define USDHC2_BASE_ADDR 0x5B020000
Peng Fan203a2272019-03-05 02:32:49 +000037
Peng Fan46f9cfb2019-09-25 08:11:17 +000038#ifdef CONFIG_AHAB_BOOT
39#define AHAB_ENV "sec_boot=yes\0"
40#else
41#define AHAB_ENV "sec_boot=no\0"
42#endif
43
Peng Fan203a2272019-03-05 02:32:49 +000044/* Initial environment variables */
45#define CONFIG_EXTRA_ENV_SETTINGS \
Peng Fan46f9cfb2019-09-25 08:11:17 +000046 AHAB_ENV \
Peng Fan203a2272019-03-05 02:32:49 +000047 "script=boot.scr\0" \
48 "image=Image\0" \
49 "panel=NULL\0" \
50 "console=ttyLP0,${baudrate} earlycon=lpuart32,0x5a060000,${baudrate}\0" \
51 "fdt_addr=0x83000000\0" \
52 "fdt_high=0xffffffffffffffff\0" \
53 "boot_fdt=try\0" \
Peng Fan88b119e2020-05-05 20:28:44 +080054 "fdt_file=undefined\0" \
Peng Fan203a2272019-03-05 02:32:49 +000055 "initrd_addr=0x83800000\0" \
56 "initrd_high=0xffffffffffffffff\0" \
57 "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
Tom Rinib113bca2021-12-11 14:55:52 -050058 "mmcpart=1\0" \
Peng Fan203a2272019-03-05 02:32:49 +000059 "mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
60 "mmcautodetect=yes\0" \
61 "mmcargs=setenv bootargs console=${console} root=${mmcroot}\0 " \
62 "loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
63 "bootscript=echo Running bootscript from mmc ...; " \
64 "source\0" \
65 "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
66 "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
Peng Fan46f9cfb2019-09-25 08:11:17 +000067 "boot_os=booti ${loadaddr} - ${fdt_addr};\0" \
68 "loadcntr=fatload mmc ${mmcdev}:${mmcpart} ${cntr_addr} ${cntr_file}\0" \
69 "auth_os=auth_cntr ${cntr_addr}\0" \
Peng Fan203a2272019-03-05 02:32:49 +000070 "mmcboot=echo Booting from mmc ...; " \
71 "run mmcargs; " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000072 "if test ${sec_boot} = yes; then " \
73 "if run auth_os; then " \
74 "run boot_os; " \
Peng Fan203a2272019-03-05 02:32:49 +000075 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000076 "echo ERR: failed to authenticate; " \
Peng Fan203a2272019-03-05 02:32:49 +000077 "fi; " \
78 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000079 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
80 "if run loadfdt; then " \
81 "run boot_os; " \
82 "else " \
83 "echo WARN: Cannot load the DT; " \
84 "fi; " \
85 "else " \
86 "echo wait for boot; " \
87 "fi;" \
Peng Fan203a2272019-03-05 02:32:49 +000088 "fi;\0" \
89 "netargs=setenv bootargs console=${console} " \
90 "root=/dev/nfs " \
91 "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
92 "netboot=echo Booting from net ...; " \
93 "run netargs; " \
94 "if test ${ip_dyn} = yes; then " \
95 "setenv get_cmd dhcp; " \
96 "else " \
97 "setenv get_cmd tftp; " \
98 "fi; " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000099 "if test ${sec_boot} = yes; then " \
100 "${get_cmd} ${cntr_addr} ${cntr_file}; " \
101 "if run auth_os; then " \
102 "run boot_os; " \
Peng Fan203a2272019-03-05 02:32:49 +0000103 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +0000104 "echo ERR: failed to authenticate; " \
Peng Fan203a2272019-03-05 02:32:49 +0000105 "fi; " \
106 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +0000107 "${get_cmd} ${loadaddr} ${image}; " \
108 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
109 "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
110 "booti ${loadaddr} - ${fdt_addr}; " \
111 "else " \
112 "echo WARN: Cannot load the DT; " \
113 "fi; " \
114 "else " \
115 "booti; " \
116 "fi;" \
Peng Fan203a2272019-03-05 02:32:49 +0000117 "fi;\0"
118
Peng Fan203a2272019-03-05 02:32:49 +0000119/* Link Definitions */
Peng Fan203a2272019-03-05 02:32:49 +0000120
121#define CONFIG_SYS_INIT_SP_ADDR 0x80200000
122
123/* Default environment is in SD */
Peng Fan203a2272019-03-05 02:32:49 +0000124
Peng Fan203a2272019-03-05 02:32:49 +0000125/* On LPDDR4 board, USDHC1 is for eMMC, USDHC2 is for SD on CPU board */
Peng Fan203a2272019-03-05 02:32:49 +0000126#define CONFIG_MMCROOT "/dev/mmcblk1p2" /* USDHC2 */
127#define CONFIG_SYS_FSL_USDHC_NUM 2
128
Peng Fan203a2272019-03-05 02:32:49 +0000129#define CONFIG_SYS_SDRAM_BASE 0x80000000
130#define PHYS_SDRAM_1 0x80000000
131#define PHYS_SDRAM_2 0x880000000
132#define PHYS_SDRAM_1_SIZE 0x80000000 /* 2 GB */
133#define PHYS_SDRAM_2_SIZE 0x100000000 /* 4 GB */
134
Peng Fan203a2272019-03-05 02:32:49 +0000135/* Generic Timer Definitions */
136#define COUNTER_FREQUENCY 8000000 /* 8MHz */
137
138/* Networking */
139#define CONFIG_FEC_XCV_TYPE RGMII
Peng Fan203a2272019-03-05 02:32:49 +0000140
141#endif /* __IMX8QM_MEK_H */