blob: 01577932884b59cabbac5758caa88cbe1e525edd [file] [log] [blame]
Peng Fand0dd7392018-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 Glass1af3c7f2020-05-10 11:40:09 -060010#include <linux/stringify.h>
Peng Fand0dd7392018-10-18 14:28:37 +020011#include <asm/arch/imx-regs.h>
12
Peng Fan018e3fd2018-12-21 06:21:34 +000013#ifdef CONFIG_SPL_BUILD
Peng Fan018e3fd2018-12-21 06:21:34 +000014#define CONFIG_SPL_MAX_SIZE (124 * 1024)
15#define CONFIG_SYS_MONITOR_LEN (1024 * 1024)
Peng Fan018e3fd2018-12-21 06:21:34 +000016
Peng Fan018e3fd2018-12-21 06:21:34 +000017#define CONFIG_SPL_STACK 0x013E000
18#define CONFIG_SPL_BSS_START_ADDR 0x00128000
19#define CONFIG_SPL_BSS_MAX_SIZE 0x1000 /* 4 KB */
20#define CONFIG_SYS_SPL_MALLOC_START 0x00120000
21#define CONFIG_SYS_SPL_MALLOC_SIZE 0x3000 /* 12 KB */
22#define CONFIG_SERIAL_LPUART_BASE 0x5a060000
Peng Fan018e3fd2018-12-21 06:21:34 +000023#define CONFIG_MALLOC_F_ADDR 0x00120000
24
25#define CONFIG_SPL_RAW_IMAGE_ARM_TRUSTED_FIRMWARE
26
27#define CONFIG_SPL_ABORT_ON_RAW_IMAGE
Peng Fan018e3fd2018-12-21 06:21:34 +000028#endif
29
Peng Fan6dcc6ce2019-09-25 08:11:19 +000030#ifdef CONFIG_AHAB_BOOT
31#define AHAB_ENV "sec_boot=yes\0"
32#else
33#define AHAB_ENV "sec_boot=no\0"
34#endif
35
Peng Fand0dd7392018-10-18 14:28:37 +020036/* Initial environment variables */
37#define CONFIG_EXTRA_ENV_SETTINGS \
Peng Fan6dcc6ce2019-09-25 08:11:19 +000038 AHAB_ENV \
Peng Fand0dd7392018-10-18 14:28:37 +020039 "script=boot.scr\0" \
40 "image=Image\0" \
41 "panel=NULL\0" \
Fabio Estevam10a8cc02020-02-17 15:17:01 -030042 "console=ttyLP0\0" \
Peng Fand0dd7392018-10-18 14:28:37 +020043 "fdt_addr=0x83000000\0" \
44 "fdt_high=0xffffffffffffffff\0" \
45 "boot_fdt=try\0" \
Peng Fana6c36f12020-05-05 20:28:45 +080046 "fdt_file=undefined\0" \
Peng Fand0dd7392018-10-18 14:28:37 +020047 "initrd_addr=0x83800000\0" \
48 "initrd_high=0xffffffffffffffff\0" \
49 "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
Tom Rinide35b8f2021-12-11 14:55:52 -050050 "mmcpart=1\0" \
Peng Fand0dd7392018-10-18 14:28:37 +020051 "mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
52 "mmcautodetect=yes\0" \
Fabio Estevam10a8cc02020-02-17 15:17:01 -030053 "mmcargs=setenv bootargs console=${console},${baudrate} root=${mmcroot}\0 " \
Peng Fand0dd7392018-10-18 14:28:37 +020054 "loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
55 "bootscript=echo Running bootscript from mmc ...; " \
56 "source\0" \
57 "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
58 "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
Peng Fan6dcc6ce2019-09-25 08:11:19 +000059 "loadcntr=fatload mmc ${mmcdev}:${mmcpart} ${cntr_addr} ${cntr_file}\0" \
60 "auth_os=auth_cntr ${cntr_addr}\0" \
61 "boot_os=booti ${loadaddr} - ${fdt_addr};\0" \
Peng Fand0dd7392018-10-18 14:28:37 +020062 "mmcboot=echo Booting from mmc ...; " \
63 "run mmcargs; " \
Peng Fan6dcc6ce2019-09-25 08:11:19 +000064 "if test ${sec_boot} = yes; then " \
65 "if run auth_os; then " \
66 "run boot_os; " \
Peng Fand0dd7392018-10-18 14:28:37 +020067 "else " \
Peng Fan6dcc6ce2019-09-25 08:11:19 +000068 "echo ERR: failed to authenticate; " \
Peng Fand0dd7392018-10-18 14:28:37 +020069 "fi; " \
70 "else " \
Peng Fan6dcc6ce2019-09-25 08:11:19 +000071 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
72 "if run loadfdt; then " \
73 "run boot_os; " \
74 "else " \
75 "echo WARN: Cannot load the DT; " \
76 "fi; " \
77 "else " \
78 "echo wait for boot; " \
79 "fi;" \
Peng Fand0dd7392018-10-18 14:28:37 +020080 "fi;\0" \
Fabio Estevam10a8cc02020-02-17 15:17:01 -030081 "netargs=setenv bootargs console=${console},${baudrate} " \
Peng Fand0dd7392018-10-18 14:28:37 +020082 "root=/dev/nfs " \
83 "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
84 "netboot=echo Booting from net ...; " \
85 "run netargs; " \
86 "if test ${ip_dyn} = yes; then " \
87 "setenv get_cmd dhcp; " \
88 "else " \
89 "setenv get_cmd tftp; " \
90 "fi; " \
Peng Fan6dcc6ce2019-09-25 08:11:19 +000091 "if test ${sec_boot} = yes; then " \
92 "${get_cmd} ${cntr_addr} ${cntr_file}; " \
93 "if run auth_os; then " \
94 "run boot_os; " \
Peng Fand0dd7392018-10-18 14:28:37 +020095 "else " \
Peng Fan6dcc6ce2019-09-25 08:11:19 +000096 "echo ERR: failed to authenticate; " \
Peng Fand0dd7392018-10-18 14:28:37 +020097 "fi; " \
98 "else " \
Peng Fan6dcc6ce2019-09-25 08:11:19 +000099 "${get_cmd} ${loadaddr} ${image}; " \
100 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
101 "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
102 "run boot_os; " \
103 "else " \
104 "echo WARN: Cannot load the DT; " \
105 "fi; " \
106 "else " \
107 "booti; " \
108 "fi;" \
Peng Fand0dd7392018-10-18 14:28:37 +0200109 "fi;\0"
110
Peng Fand0dd7392018-10-18 14:28:37 +0200111/* Link Definitions */
Peng Fand0dd7392018-10-18 14:28:37 +0200112
113#define CONFIG_SYS_INIT_SP_ADDR 0x80200000
114
115/* Default environment is in SD */
Peng Fand0dd7392018-10-18 14:28:37 +0200116
Peng Fand0dd7392018-10-18 14:28:37 +0200117/* On LPDDR4 board, USDHC1 is for eMMC, USDHC2 is for SD on CPU board */
Peng Fand0dd7392018-10-18 14:28:37 +0200118#define CONFIG_MMCROOT "/dev/mmcblk1p2" /* USDHC2 */
Peng Fand0dd7392018-10-18 14:28:37 +0200119
Peng Fand0dd7392018-10-18 14:28:37 +0200120#define CONFIG_SYS_SDRAM_BASE 0x80000000
121#define PHYS_SDRAM_1 0x80000000
122#define PHYS_SDRAM_2 0x880000000
123#define PHYS_SDRAM_1_SIZE 0x80000000 /* 2 GB */
124/* LPDDR4 board total DDR is 3GB */
125#define PHYS_SDRAM_2_SIZE 0x40000000 /* 1 GB */
126
Peng Fand0dd7392018-10-18 14:28:37 +0200127/* Generic Timer Definitions */
128#define COUNTER_FREQUENCY 8000000 /* 8MHz */
129
130#ifndef CONFIG_DM_PCA953X
131#define CONFIG_PCA953X
Peng Fand0dd7392018-10-18 14:28:37 +0200132#endif
133
Anatolij Gustschin5c1c7c12019-10-21 17:31:53 +0200134/* Misc configuration */
135#define CONFIG_SYS_CBSIZE 2048
136#define CONFIG_SYS_MAXARGS 64
137#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
138
Peng Fand0dd7392018-10-18 14:28:37 +0200139#endif /* __IMX8QXP_MEK_H */