blob: 11b5c16e37ef81202289a4703bf850acdde46adb [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)
18#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
19#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0x800
Peng Fan203a2272019-03-05 02:32:49 +000020
Peng Fan203a2272019-03-05 02:32:49 +000021#define CONFIG_SPL_STACK 0x013E000
22#define CONFIG_SPL_BSS_START_ADDR 0x00128000
23#define CONFIG_SPL_BSS_MAX_SIZE 0x1000 /* 4 KB */
24#define CONFIG_SYS_SPL_MALLOC_START 0x00120000
25#define CONFIG_SYS_SPL_MALLOC_SIZE 0x3000 /* 12 KB */
26#define CONFIG_SERIAL_LPUART_BASE 0x5a060000
Peng Fan203a2272019-03-05 02:32:49 +000027#define CONFIG_MALLOC_F_ADDR 0x00120000
28
29#define CONFIG_SPL_RAW_IMAGE_ARM_TRUSTED_FIRMWARE
30
31#define CONFIG_SPL_ABORT_ON_RAW_IMAGE
Peng Fan203a2272019-03-05 02:32:49 +000032#endif
33
34#define CONFIG_REMAKE_ELF
35
Peng Fan203a2272019-03-05 02:32:49 +000036/* Flat Device Tree Definitions */
37#define CONFIG_OF_BOARD_SETUP
38
Peng Fan203a2272019-03-05 02:32:49 +000039#define CONFIG_SYS_FSL_ESDHC_ADDR 0
40#define USDHC1_BASE_ADDR 0x5B010000
41#define USDHC2_BASE_ADDR 0x5B020000
Peng Fan203a2272019-03-05 02:32:49 +000042
Peng Fan46f9cfb2019-09-25 08:11:17 +000043#ifdef CONFIG_AHAB_BOOT
44#define AHAB_ENV "sec_boot=yes\0"
45#else
46#define AHAB_ENV "sec_boot=no\0"
47#endif
48
Peng Fan203a2272019-03-05 02:32:49 +000049/* Initial environment variables */
50#define CONFIG_EXTRA_ENV_SETTINGS \
Peng Fan46f9cfb2019-09-25 08:11:17 +000051 AHAB_ENV \
Peng Fan203a2272019-03-05 02:32:49 +000052 "script=boot.scr\0" \
53 "image=Image\0" \
54 "panel=NULL\0" \
55 "console=ttyLP0,${baudrate} earlycon=lpuart32,0x5a060000,${baudrate}\0" \
56 "fdt_addr=0x83000000\0" \
57 "fdt_high=0xffffffffffffffff\0" \
58 "boot_fdt=try\0" \
Peng Fan88b119e2020-05-05 20:28:44 +080059 "fdt_file=undefined\0" \
Peng Fan203a2272019-03-05 02:32:49 +000060 "initrd_addr=0x83800000\0" \
61 "initrd_high=0xffffffffffffffff\0" \
62 "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
63 "mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
64 "mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
65 "mmcautodetect=yes\0" \
66 "mmcargs=setenv bootargs console=${console} root=${mmcroot}\0 " \
67 "loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
68 "bootscript=echo Running bootscript from mmc ...; " \
69 "source\0" \
70 "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
71 "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
Peng Fan46f9cfb2019-09-25 08:11:17 +000072 "boot_os=booti ${loadaddr} - ${fdt_addr};\0" \
73 "loadcntr=fatload mmc ${mmcdev}:${mmcpart} ${cntr_addr} ${cntr_file}\0" \
74 "auth_os=auth_cntr ${cntr_addr}\0" \
Peng Fan203a2272019-03-05 02:32:49 +000075 "mmcboot=echo Booting from mmc ...; " \
76 "run mmcargs; " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000077 "if test ${sec_boot} = yes; then " \
78 "if run auth_os; then " \
79 "run boot_os; " \
Peng Fan203a2272019-03-05 02:32:49 +000080 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000081 "echo ERR: failed to authenticate; " \
Peng Fan203a2272019-03-05 02:32:49 +000082 "fi; " \
83 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000084 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
85 "if run loadfdt; then " \
86 "run boot_os; " \
87 "else " \
88 "echo WARN: Cannot load the DT; " \
89 "fi; " \
90 "else " \
91 "echo wait for boot; " \
92 "fi;" \
Peng Fan203a2272019-03-05 02:32:49 +000093 "fi;\0" \
94 "netargs=setenv bootargs console=${console} " \
95 "root=/dev/nfs " \
96 "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
97 "netboot=echo Booting from net ...; " \
98 "run netargs; " \
99 "if test ${ip_dyn} = yes; then " \
100 "setenv get_cmd dhcp; " \
101 "else " \
102 "setenv get_cmd tftp; " \
103 "fi; " \
Peng Fan46f9cfb2019-09-25 08:11:17 +0000104 "if test ${sec_boot} = yes; then " \
105 "${get_cmd} ${cntr_addr} ${cntr_file}; " \
106 "if run auth_os; then " \
107 "run boot_os; " \
Peng Fan203a2272019-03-05 02:32:49 +0000108 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +0000109 "echo ERR: failed to authenticate; " \
Peng Fan203a2272019-03-05 02:32:49 +0000110 "fi; " \
111 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +0000112 "${get_cmd} ${loadaddr} ${image}; " \
113 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
114 "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
115 "booti ${loadaddr} - ${fdt_addr}; " \
116 "else " \
117 "echo WARN: Cannot load the DT; " \
118 "fi; " \
119 "else " \
120 "booti; " \
121 "fi;" \
Peng Fan203a2272019-03-05 02:32:49 +0000122 "fi;\0"
123
124#define CONFIG_BOOTCOMMAND \
125 "mmc dev ${mmcdev}; if mmc rescan; then " \
126 "if run loadbootscript; then " \
127 "run bootscript; " \
128 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +0000129 "if test ${sec_boot} = yes; then " \
130 "if run loadcntr; then " \
131 "run mmcboot; " \
132 "else run netboot; " \
133 "fi; " \
134 "else " \
135 "if run loadimage; then " \
136 "run mmcboot; " \
137 "else run netboot; " \
138 "fi; " \
139 "fi; " \
Peng Fan203a2272019-03-05 02:32:49 +0000140 "fi; " \
141 "else booti ${loadaddr} - ${fdt_addr}; fi"
142
143/* Link Definitions */
Peng Fan203a2272019-03-05 02:32:49 +0000144
145#define CONFIG_SYS_INIT_SP_ADDR 0x80200000
146
147/* Default environment is in SD */
Peng Fan203a2272019-03-05 02:32:49 +0000148
149#define CONFIG_SYS_MMC_IMG_LOAD_PART 1
150
151/* On LPDDR4 board, USDHC1 is for eMMC, USDHC2 is for SD on CPU board */
Peng Fan203a2272019-03-05 02:32:49 +0000152#define CONFIG_MMCROOT "/dev/mmcblk1p2" /* USDHC2 */
153#define CONFIG_SYS_FSL_USDHC_NUM 2
154
Peng Fan203a2272019-03-05 02:32:49 +0000155#define CONFIG_SYS_SDRAM_BASE 0x80000000
156#define PHYS_SDRAM_1 0x80000000
157#define PHYS_SDRAM_2 0x880000000
158#define PHYS_SDRAM_1_SIZE 0x80000000 /* 2 GB */
159#define PHYS_SDRAM_2_SIZE 0x100000000 /* 4 GB */
160
Peng Fan203a2272019-03-05 02:32:49 +0000161/* Generic Timer Definitions */
162#define COUNTER_FREQUENCY 8000000 /* 8MHz */
163
164/* Networking */
165#define CONFIG_FEC_XCV_TYPE RGMII
Peng Fan203a2272019-03-05 02:32:49 +0000166
167#endif /* __IMX8QM_MEK_H */