blob: f59a9ef5e2c21429267e07fdcf80c6dd52b91bfa [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
Peng Fan0b2236d2018-12-21 06:21:34 +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 Fan0b2236d2018-12-21 06:21:34 +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 Fan0b2236d2018-12-21 06:21:34 +000030#endif
31
Peng Fan702c6dc2018-10-18 14:28:37 +020032#define CONFIG_REMAKE_ELF
33
Peng Fan702c6dc2018-10-18 14:28:37 +020034/* Flat Device Tree Definitions */
35#define CONFIG_OF_BOARD_SETUP
36
Peng Fan702c6dc2018-10-18 14:28:37 +020037#define CONFIG_SYS_FSL_ESDHC_ADDR 0
38#define USDHC1_BASE_ADDR 0x5B010000
39#define USDHC2_BASE_ADDR 0x5B020000
Peng Fan702c6dc2018-10-18 14:28:37 +020040
Peng Fan128f1892019-09-25 08:11:19 +000041#ifdef CONFIG_AHAB_BOOT
42#define AHAB_ENV "sec_boot=yes\0"
43#else
44#define AHAB_ENV "sec_boot=no\0"
45#endif
46
Peng Fan702c6dc2018-10-18 14:28:37 +020047/* Initial environment variables */
48#define CONFIG_EXTRA_ENV_SETTINGS \
Peng Fan128f1892019-09-25 08:11:19 +000049 AHAB_ENV \
Peng Fan702c6dc2018-10-18 14:28:37 +020050 "script=boot.scr\0" \
51 "image=Image\0" \
52 "panel=NULL\0" \
Fabio Estevam1f9ce1d2020-02-17 15:17:01 -030053 "console=ttyLP0\0" \
Peng Fan702c6dc2018-10-18 14:28:37 +020054 "fdt_addr=0x83000000\0" \
55 "fdt_high=0xffffffffffffffff\0" \
56 "boot_fdt=try\0" \
Peng Fane95219d2020-05-05 20:28:45 +080057 "fdt_file=undefined\0" \
Peng Fan702c6dc2018-10-18 14:28:37 +020058 "initrd_addr=0x83800000\0" \
59 "initrd_high=0xffffffffffffffff\0" \
60 "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
61 "mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
62 "mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
63 "mmcautodetect=yes\0" \
Fabio Estevam1f9ce1d2020-02-17 15:17:01 -030064 "mmcargs=setenv bootargs console=${console},${baudrate} root=${mmcroot}\0 " \
Peng Fan702c6dc2018-10-18 14:28:37 +020065 "loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
66 "bootscript=echo Running bootscript from mmc ...; " \
67 "source\0" \
68 "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
69 "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
Peng Fan128f1892019-09-25 08:11:19 +000070 "loadcntr=fatload mmc ${mmcdev}:${mmcpart} ${cntr_addr} ${cntr_file}\0" \
71 "auth_os=auth_cntr ${cntr_addr}\0" \
72 "boot_os=booti ${loadaddr} - ${fdt_addr};\0" \
Peng Fan702c6dc2018-10-18 14:28:37 +020073 "mmcboot=echo Booting from mmc ...; " \
74 "run mmcargs; " \
Peng Fan128f1892019-09-25 08:11:19 +000075 "if test ${sec_boot} = yes; then " \
76 "if run auth_os; then " \
77 "run boot_os; " \
Peng Fan702c6dc2018-10-18 14:28:37 +020078 "else " \
Peng Fan128f1892019-09-25 08:11:19 +000079 "echo ERR: failed to authenticate; " \
Peng Fan702c6dc2018-10-18 14:28:37 +020080 "fi; " \
81 "else " \
Peng Fan128f1892019-09-25 08:11:19 +000082 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
83 "if run loadfdt; then " \
84 "run boot_os; " \
85 "else " \
86 "echo WARN: Cannot load the DT; " \
87 "fi; " \
88 "else " \
89 "echo wait for boot; " \
90 "fi;" \
Peng Fan702c6dc2018-10-18 14:28:37 +020091 "fi;\0" \
Fabio Estevam1f9ce1d2020-02-17 15:17:01 -030092 "netargs=setenv bootargs console=${console},${baudrate} " \
Peng Fan702c6dc2018-10-18 14:28:37 +020093 "root=/dev/nfs " \
94 "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
95 "netboot=echo Booting from net ...; " \
96 "run netargs; " \
97 "if test ${ip_dyn} = yes; then " \
98 "setenv get_cmd dhcp; " \
99 "else " \
100 "setenv get_cmd tftp; " \
101 "fi; " \
Peng Fan128f1892019-09-25 08:11:19 +0000102 "if test ${sec_boot} = yes; then " \
103 "${get_cmd} ${cntr_addr} ${cntr_file}; " \
104 "if run auth_os; then " \
105 "run boot_os; " \
Peng Fan702c6dc2018-10-18 14:28:37 +0200106 "else " \
Peng Fan128f1892019-09-25 08:11:19 +0000107 "echo ERR: failed to authenticate; " \
Peng Fan702c6dc2018-10-18 14:28:37 +0200108 "fi; " \
109 "else " \
Peng Fan128f1892019-09-25 08:11:19 +0000110 "${get_cmd} ${loadaddr} ${image}; " \
111 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
112 "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
113 "run boot_os; " \
114 "else " \
115 "echo WARN: Cannot load the DT; " \
116 "fi; " \
117 "else " \
118 "booti; " \
119 "fi;" \
Peng Fan702c6dc2018-10-18 14:28:37 +0200120 "fi;\0"
121
122#define CONFIG_BOOTCOMMAND \
123 "mmc dev ${mmcdev}; if mmc rescan; then " \
124 "if run loadbootscript; then " \
125 "run bootscript; " \
126 "else " \
Peng Fan128f1892019-09-25 08:11:19 +0000127 "if test ${sec_boot} = yes; then " \
128 "if run loadcntr; then " \
129 "run mmcboot; " \
130 "else run netboot; " \
131 "fi; " \
132 "else " \
133 "if run loadimage; then " \
134 "run mmcboot; " \
135 "else run netboot; " \
136 "fi; " \
137 "fi; " \
Peng Fan702c6dc2018-10-18 14:28:37 +0200138 "fi; " \
139 "else booti ${loadaddr} - ${fdt_addr}; fi"
140
141/* Link Definitions */
Peng Fan702c6dc2018-10-18 14:28:37 +0200142
143#define CONFIG_SYS_INIT_SP_ADDR 0x80200000
144
145/* Default environment is in SD */
Peng Fan702c6dc2018-10-18 14:28:37 +0200146
147#define CONFIG_SYS_MMC_IMG_LOAD_PART 1
148
149/* On LPDDR4 board, USDHC1 is for eMMC, USDHC2 is for SD on CPU board */
Peng Fan702c6dc2018-10-18 14:28:37 +0200150#define CONFIG_MMCROOT "/dev/mmcblk1p2" /* USDHC2 */
151#define CONFIG_SYS_FSL_USDHC_NUM 2
152
Peng Fan702c6dc2018-10-18 14:28:37 +0200153#define CONFIG_SYS_SDRAM_BASE 0x80000000
154#define PHYS_SDRAM_1 0x80000000
155#define PHYS_SDRAM_2 0x880000000
156#define PHYS_SDRAM_1_SIZE 0x80000000 /* 2 GB */
157/* LPDDR4 board total DDR is 3GB */
158#define PHYS_SDRAM_2_SIZE 0x40000000 /* 1 GB */
159
Peng Fan702c6dc2018-10-18 14:28:37 +0200160/* Generic Timer Definitions */
161#define COUNTER_FREQUENCY 8000000 /* 8MHz */
162
163#ifndef CONFIG_DM_PCA953X
164#define CONFIG_PCA953X
Peng Fan702c6dc2018-10-18 14:28:37 +0200165#endif
166
167/* Networking */
168#define CONFIG_FEC_XCV_TYPE RGMII
Peng Fan702c6dc2018-10-18 14:28:37 +0200169
Anatolij Gustschin1bfd6f42019-10-21 17:31:53 +0200170/* Misc configuration */
171#define CONFIG_SYS_CBSIZE 2048
172#define CONFIG_SYS_MAXARGS 64
173#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
174
Peng Fan702c6dc2018-10-18 14:28:37 +0200175#endif /* __IMX8QXP_MEK_H */