blob: 152fa6f1c27ddd587681d1ac11c753469496d932 [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
13#ifdef CONFIG_SPL_BUILD
Peng Fan203a2272019-03-05 02:32:49 +000014#define CONFIG_SPL_MAX_SIZE (124 * 1024)
15#define CONFIG_SYS_MONITOR_LEN (1024 * 1024)
16#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
17#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0x800
Peng Fan203a2272019-03-05 02:32:49 +000018
19#define CONFIG_SPL_LDSCRIPT "arch/arm/cpu/armv8/u-boot-spl.lds"
20#define CONFIG_SPL_STACK 0x013E000
21#define CONFIG_SPL_BSS_START_ADDR 0x00128000
22#define CONFIG_SPL_BSS_MAX_SIZE 0x1000 /* 4 KB */
23#define CONFIG_SYS_SPL_MALLOC_START 0x00120000
24#define CONFIG_SYS_SPL_MALLOC_SIZE 0x3000 /* 12 KB */
25#define CONFIG_SERIAL_LPUART_BASE 0x5a060000
Peng Fan203a2272019-03-05 02:32:49 +000026#define CONFIG_MALLOC_F_ADDR 0x00120000
27
28#define CONFIG_SPL_RAW_IMAGE_ARM_TRUSTED_FIRMWARE
29
30#define CONFIG_SPL_ABORT_ON_RAW_IMAGE
31
32#define CONFIG_OF_EMBED
33#endif
34
35#define CONFIG_REMAKE_ELF
36
Peng Fan203a2272019-03-05 02:32:49 +000037/* Flat Device Tree Definitions */
38#define CONFIG_OF_BOARD_SETUP
39
Peng Fan203a2272019-03-05 02:32:49 +000040#define CONFIG_SYS_FSL_ESDHC_ADDR 0
41#define USDHC1_BASE_ADDR 0x5B010000
42#define USDHC2_BASE_ADDR 0x5B020000
43#define CONFIG_SUPPORT_EMMC_BOOT /* eMMC specific */
44
Peng Fan46f9cfb2019-09-25 08:11:17 +000045#ifdef CONFIG_AHAB_BOOT
46#define AHAB_ENV "sec_boot=yes\0"
47#else
48#define AHAB_ENV "sec_boot=no\0"
49#endif
50
Peng Fan203a2272019-03-05 02:32:49 +000051/* Initial environment variables */
52#define CONFIG_EXTRA_ENV_SETTINGS \
Peng Fan46f9cfb2019-09-25 08:11:17 +000053 AHAB_ENV \
Peng Fan203a2272019-03-05 02:32:49 +000054 "script=boot.scr\0" \
55 "image=Image\0" \
56 "panel=NULL\0" \
57 "console=ttyLP0,${baudrate} earlycon=lpuart32,0x5a060000,${baudrate}\0" \
58 "fdt_addr=0x83000000\0" \
59 "fdt_high=0xffffffffffffffff\0" \
60 "boot_fdt=try\0" \
Peng Fan88b119e2020-05-05 20:28:44 +080061 "fdt_file=undefined\0" \
Peng Fan203a2272019-03-05 02:32:49 +000062 "initrd_addr=0x83800000\0" \
63 "initrd_high=0xffffffffffffffff\0" \
64 "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
65 "mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
66 "mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
67 "mmcautodetect=yes\0" \
68 "mmcargs=setenv bootargs console=${console} root=${mmcroot}\0 " \
69 "loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
70 "bootscript=echo Running bootscript from mmc ...; " \
71 "source\0" \
72 "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
73 "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
Peng Fan46f9cfb2019-09-25 08:11:17 +000074 "boot_os=booti ${loadaddr} - ${fdt_addr};\0" \
75 "loadcntr=fatload mmc ${mmcdev}:${mmcpart} ${cntr_addr} ${cntr_file}\0" \
76 "auth_os=auth_cntr ${cntr_addr}\0" \
Peng Fan203a2272019-03-05 02:32:49 +000077 "mmcboot=echo Booting from mmc ...; " \
78 "run mmcargs; " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000079 "if test ${sec_boot} = yes; then " \
80 "if run auth_os; then " \
81 "run boot_os; " \
Peng Fan203a2272019-03-05 02:32:49 +000082 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000083 "echo ERR: failed to authenticate; " \
Peng Fan203a2272019-03-05 02:32:49 +000084 "fi; " \
85 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +000086 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
87 "if run loadfdt; then " \
88 "run boot_os; " \
89 "else " \
90 "echo WARN: Cannot load the DT; " \
91 "fi; " \
92 "else " \
93 "echo wait for boot; " \
94 "fi;" \
Peng Fan203a2272019-03-05 02:32:49 +000095 "fi;\0" \
96 "netargs=setenv bootargs console=${console} " \
97 "root=/dev/nfs " \
98 "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
99 "netboot=echo Booting from net ...; " \
100 "run netargs; " \
101 "if test ${ip_dyn} = yes; then " \
102 "setenv get_cmd dhcp; " \
103 "else " \
104 "setenv get_cmd tftp; " \
105 "fi; " \
Peng Fan46f9cfb2019-09-25 08:11:17 +0000106 "if test ${sec_boot} = yes; then " \
107 "${get_cmd} ${cntr_addr} ${cntr_file}; " \
108 "if run auth_os; then " \
109 "run boot_os; " \
Peng Fan203a2272019-03-05 02:32:49 +0000110 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +0000111 "echo ERR: failed to authenticate; " \
Peng Fan203a2272019-03-05 02:32:49 +0000112 "fi; " \
113 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +0000114 "${get_cmd} ${loadaddr} ${image}; " \
115 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
116 "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
117 "booti ${loadaddr} - ${fdt_addr}; " \
118 "else " \
119 "echo WARN: Cannot load the DT; " \
120 "fi; " \
121 "else " \
122 "booti; " \
123 "fi;" \
Peng Fan203a2272019-03-05 02:32:49 +0000124 "fi;\0"
125
126#define CONFIG_BOOTCOMMAND \
127 "mmc dev ${mmcdev}; if mmc rescan; then " \
128 "if run loadbootscript; then " \
129 "run bootscript; " \
130 "else " \
Peng Fan46f9cfb2019-09-25 08:11:17 +0000131 "if test ${sec_boot} = yes; then " \
132 "if run loadcntr; then " \
133 "run mmcboot; " \
134 "else run netboot; " \
135 "fi; " \
136 "else " \
137 "if run loadimage; then " \
138 "run mmcboot; " \
139 "else run netboot; " \
140 "fi; " \
141 "fi; " \
Peng Fan203a2272019-03-05 02:32:49 +0000142 "fi; " \
143 "else booti ${loadaddr} - ${fdt_addr}; fi"
144
145/* Link Definitions */
Peng Fan203a2272019-03-05 02:32:49 +0000146
147#define CONFIG_SYS_INIT_SP_ADDR 0x80200000
148
149/* Default environment is in SD */
Peng Fan203a2272019-03-05 02:32:49 +0000150
151#define CONFIG_SYS_MMC_IMG_LOAD_PART 1
152
153/* On LPDDR4 board, USDHC1 is for eMMC, USDHC2 is for SD on CPU board */
Peng Fan203a2272019-03-05 02:32:49 +0000154#define CONFIG_MMCROOT "/dev/mmcblk1p2" /* USDHC2 */
155#define CONFIG_SYS_FSL_USDHC_NUM 2
156
Peng Fan203a2272019-03-05 02:32:49 +0000157#define CONFIG_SYS_SDRAM_BASE 0x80000000
158#define PHYS_SDRAM_1 0x80000000
159#define PHYS_SDRAM_2 0x880000000
160#define PHYS_SDRAM_1_SIZE 0x80000000 /* 2 GB */
161#define PHYS_SDRAM_2_SIZE 0x100000000 /* 4 GB */
162
Peng Fan203a2272019-03-05 02:32:49 +0000163/* Generic Timer Definitions */
164#define COUNTER_FREQUENCY 8000000 /* 8MHz */
165
166/* Networking */
167#define CONFIG_FEC_XCV_TYPE RGMII
Peng Fan203a2272019-03-05 02:32:49 +0000168
169#endif /* __IMX8QM_MEK_H */