blob: a7d623a9b9e358c97695aca89ec5344bcc566fdd [file] [log] [blame]
Peng Fan702c6dc2018-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 Glassfb64e362020-05-10 11:40:09 -060010#include <linux/stringify.h>
Peng Fan702c6dc2018-10-18 14:28:37 +020011#include <asm/arch/imx-regs.h>
12
Peng Fan0b2236d2018-12-21 06:21:34 +000013#ifdef CONFIG_SPL_BUILD
Peng Fan0b2236d2018-12-21 06:21:34 +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
Peng Fan9d6819fd2019-08-21 08:28:15 +000017#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0x800
Peng Fan0b2236d2018-12-21 06:21:34 +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 Fan0b2236d2018-12-21 06:21:34 +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
Peng Fan702c6dc2018-10-18 14:28:37 +020035#define CONFIG_REMAKE_ELF
36
Peng Fan702c6dc2018-10-18 14:28:37 +020037/* Flat Device Tree Definitions */
38#define CONFIG_OF_BOARD_SETUP
39
Peng Fan702c6dc2018-10-18 14:28:37 +020040#define CONFIG_SYS_FSL_ESDHC_ADDR 0
41#define USDHC1_BASE_ADDR 0x5B010000
42#define USDHC2_BASE_ADDR 0x5B020000
Peng Fan702c6dc2018-10-18 14:28:37 +020043
Peng Fan702c6dc2018-10-18 14:28:37 +020044#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
45
Peng Fan128f1892019-09-25 08:11:19 +000046#ifdef CONFIG_AHAB_BOOT
47#define AHAB_ENV "sec_boot=yes\0"
48#else
49#define AHAB_ENV "sec_boot=no\0"
50#endif
51
Peng Fan702c6dc2018-10-18 14:28:37 +020052/* Initial environment variables */
53#define CONFIG_EXTRA_ENV_SETTINGS \
Peng Fan128f1892019-09-25 08:11:19 +000054 AHAB_ENV \
Peng Fan702c6dc2018-10-18 14:28:37 +020055 "script=boot.scr\0" \
56 "image=Image\0" \
57 "panel=NULL\0" \
Fabio Estevam1f9ce1d2020-02-17 15:17:01 -030058 "console=ttyLP0\0" \
Peng Fan702c6dc2018-10-18 14:28:37 +020059 "fdt_addr=0x83000000\0" \
60 "fdt_high=0xffffffffffffffff\0" \
61 "boot_fdt=try\0" \
Peng Fane95219d2020-05-05 20:28:45 +080062 "fdt_file=undefined\0" \
Peng Fan702c6dc2018-10-18 14:28:37 +020063 "initrd_addr=0x83800000\0" \
64 "initrd_high=0xffffffffffffffff\0" \
65 "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
66 "mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
67 "mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
68 "mmcautodetect=yes\0" \
Fabio Estevam1f9ce1d2020-02-17 15:17:01 -030069 "mmcargs=setenv bootargs console=${console},${baudrate} root=${mmcroot}\0 " \
Peng Fan702c6dc2018-10-18 14:28:37 +020070 "loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
71 "bootscript=echo Running bootscript from mmc ...; " \
72 "source\0" \
73 "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
74 "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
Peng Fan128f1892019-09-25 08:11:19 +000075 "loadcntr=fatload mmc ${mmcdev}:${mmcpart} ${cntr_addr} ${cntr_file}\0" \
76 "auth_os=auth_cntr ${cntr_addr}\0" \
77 "boot_os=booti ${loadaddr} - ${fdt_addr};\0" \
Peng Fan702c6dc2018-10-18 14:28:37 +020078 "mmcboot=echo Booting from mmc ...; " \
79 "run mmcargs; " \
Peng Fan128f1892019-09-25 08:11:19 +000080 "if test ${sec_boot} = yes; then " \
81 "if run auth_os; then " \
82 "run boot_os; " \
Peng Fan702c6dc2018-10-18 14:28:37 +020083 "else " \
Peng Fan128f1892019-09-25 08:11:19 +000084 "echo ERR: failed to authenticate; " \
Peng Fan702c6dc2018-10-18 14:28:37 +020085 "fi; " \
86 "else " \
Peng Fan128f1892019-09-25 08:11:19 +000087 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
88 "if run loadfdt; then " \
89 "run boot_os; " \
90 "else " \
91 "echo WARN: Cannot load the DT; " \
92 "fi; " \
93 "else " \
94 "echo wait for boot; " \
95 "fi;" \
Peng Fan702c6dc2018-10-18 14:28:37 +020096 "fi;\0" \
Fabio Estevam1f9ce1d2020-02-17 15:17:01 -030097 "netargs=setenv bootargs console=${console},${baudrate} " \
Peng Fan702c6dc2018-10-18 14:28:37 +020098 "root=/dev/nfs " \
99 "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
100 "netboot=echo Booting from net ...; " \
101 "run netargs; " \
102 "if test ${ip_dyn} = yes; then " \
103 "setenv get_cmd dhcp; " \
104 "else " \
105 "setenv get_cmd tftp; " \
106 "fi; " \
Peng Fan128f1892019-09-25 08:11:19 +0000107 "if test ${sec_boot} = yes; then " \
108 "${get_cmd} ${cntr_addr} ${cntr_file}; " \
109 "if run auth_os; then " \
110 "run boot_os; " \
Peng Fan702c6dc2018-10-18 14:28:37 +0200111 "else " \
Peng Fan128f1892019-09-25 08:11:19 +0000112 "echo ERR: failed to authenticate; " \
Peng Fan702c6dc2018-10-18 14:28:37 +0200113 "fi; " \
114 "else " \
Peng Fan128f1892019-09-25 08:11:19 +0000115 "${get_cmd} ${loadaddr} ${image}; " \
116 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
117 "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
118 "run boot_os; " \
119 "else " \
120 "echo WARN: Cannot load the DT; " \
121 "fi; " \
122 "else " \
123 "booti; " \
124 "fi;" \
Peng Fan702c6dc2018-10-18 14:28:37 +0200125 "fi;\0"
126
127#define CONFIG_BOOTCOMMAND \
128 "mmc dev ${mmcdev}; if mmc rescan; then " \
129 "if run loadbootscript; then " \
130 "run bootscript; " \
131 "else " \
Peng Fan128f1892019-09-25 08:11:19 +0000132 "if test ${sec_boot} = yes; then " \
133 "if run loadcntr; then " \
134 "run mmcboot; " \
135 "else run netboot; " \
136 "fi; " \
137 "else " \
138 "if run loadimage; then " \
139 "run mmcboot; " \
140 "else run netboot; " \
141 "fi; " \
142 "fi; " \
Peng Fan702c6dc2018-10-18 14:28:37 +0200143 "fi; " \
144 "else booti ${loadaddr} - ${fdt_addr}; fi"
145
146/* Link Definitions */
147#define CONFIG_LOADADDR 0x80280000
148
149#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
150
151#define CONFIG_SYS_INIT_SP_ADDR 0x80200000
152
153/* Default environment is in SD */
Peng Fan702c6dc2018-10-18 14:28:37 +0200154
155#define CONFIG_SYS_MMC_IMG_LOAD_PART 1
156
157/* On LPDDR4 board, USDHC1 is for eMMC, USDHC2 is for SD on CPU board */
Peng Fan702c6dc2018-10-18 14:28:37 +0200158#define CONFIG_MMCROOT "/dev/mmcblk1p2" /* USDHC2 */
159#define CONFIG_SYS_FSL_USDHC_NUM 2
160
161/* Size of malloc() pool */
162#define CONFIG_SYS_MALLOC_LEN ((CONFIG_ENV_SIZE + (32 * 1024)) * 1024)
163
164#define CONFIG_SYS_SDRAM_BASE 0x80000000
165#define PHYS_SDRAM_1 0x80000000
166#define PHYS_SDRAM_2 0x880000000
167#define PHYS_SDRAM_1_SIZE 0x80000000 /* 2 GB */
168/* LPDDR4 board total DDR is 3GB */
169#define PHYS_SDRAM_2_SIZE 0x40000000 /* 1 GB */
170
Peng Fan702c6dc2018-10-18 14:28:37 +0200171/* Generic Timer Definitions */
172#define COUNTER_FREQUENCY 8000000 /* 8MHz */
173
174#ifndef CONFIG_DM_PCA953X
175#define CONFIG_PCA953X
Peng Fan702c6dc2018-10-18 14:28:37 +0200176#endif
177
178/* Networking */
179#define CONFIG_FEC_XCV_TYPE RGMII
Peng Fan702c6dc2018-10-18 14:28:37 +0200180
Anatolij Gustschin1bfd6f42019-10-21 17:31:53 +0200181/* Misc configuration */
182#define CONFIG_SYS_CBSIZE 2048
183#define CONFIG_SYS_MAXARGS 64
184#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
185
Peng Fan702c6dc2018-10-18 14:28:37 +0200186#endif /* __IMX8QXP_MEK_H */