Peng Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 1 | /* 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 Glass | 1af3c7f | 2020-05-10 11:40:09 -0600 | [diff] [blame] | 10 | #include <linux/stringify.h> |
Peng Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 11 | #include <asm/arch/imx-regs.h> |
| 12 | |
Oleksandr Suvorov | 32139c2 | 2021-08-29 22:39:13 +0300 | [diff] [blame] | 13 | #define CONFIG_SYS_BOOTM_LEN (64 * SZ_1M) |
| 14 | |
Peng Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 15 | #ifdef CONFIG_SPL_BUILD |
Peng Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 16 | #define CONFIG_SPL_MAX_SIZE (124 * 1024) |
| 17 | #define CONFIG_SYS_MONITOR_LEN (1024 * 1024) |
Peng Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 18 | |
Peng Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 19 | #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 Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 25 | #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 Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 30 | #endif |
| 31 | |
Peng Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 32 | #define CONFIG_SYS_FSL_ESDHC_ADDR 0 |
| 33 | #define USDHC1_BASE_ADDR 0x5B010000 |
| 34 | #define USDHC2_BASE_ADDR 0x5B020000 |
Peng Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 35 | |
Peng Fan | b06ff8f | 2019-09-25 08:11:17 +0000 | [diff] [blame] | 36 | #ifdef CONFIG_AHAB_BOOT |
| 37 | #define AHAB_ENV "sec_boot=yes\0" |
| 38 | #else |
| 39 | #define AHAB_ENV "sec_boot=no\0" |
| 40 | #endif |
| 41 | |
Peng Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 42 | /* Initial environment variables */ |
| 43 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
Peng Fan | b06ff8f | 2019-09-25 08:11:17 +0000 | [diff] [blame] | 44 | AHAB_ENV \ |
Peng Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 45 | "script=boot.scr\0" \ |
| 46 | "image=Image\0" \ |
| 47 | "panel=NULL\0" \ |
| 48 | "console=ttyLP0,${baudrate} earlycon=lpuart32,0x5a060000,${baudrate}\0" \ |
| 49 | "fdt_addr=0x83000000\0" \ |
| 50 | "fdt_high=0xffffffffffffffff\0" \ |
| 51 | "boot_fdt=try\0" \ |
Peng Fan | e825d30 | 2020-05-05 20:28:44 +0800 | [diff] [blame] | 52 | "fdt_file=undefined\0" \ |
Peng Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 53 | "initrd_addr=0x83800000\0" \ |
| 54 | "initrd_high=0xffffffffffffffff\0" \ |
| 55 | "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \ |
Tom Rini | de35b8f | 2021-12-11 14:55:52 -0500 | [diff] [blame] | 56 | "mmcpart=1\0" \ |
Peng Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 57 | "mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \ |
| 58 | "mmcautodetect=yes\0" \ |
| 59 | "mmcargs=setenv bootargs console=${console} root=${mmcroot}\0 " \ |
| 60 | "loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ |
| 61 | "bootscript=echo Running bootscript from mmc ...; " \ |
| 62 | "source\0" \ |
| 63 | "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ |
| 64 | "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ |
Peng Fan | b06ff8f | 2019-09-25 08:11:17 +0000 | [diff] [blame] | 65 | "boot_os=booti ${loadaddr} - ${fdt_addr};\0" \ |
| 66 | "loadcntr=fatload mmc ${mmcdev}:${mmcpart} ${cntr_addr} ${cntr_file}\0" \ |
| 67 | "auth_os=auth_cntr ${cntr_addr}\0" \ |
Peng Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 68 | "mmcboot=echo Booting from mmc ...; " \ |
| 69 | "run mmcargs; " \ |
Peng Fan | b06ff8f | 2019-09-25 08:11:17 +0000 | [diff] [blame] | 70 | "if test ${sec_boot} = yes; then " \ |
| 71 | "if run auth_os; then " \ |
| 72 | "run boot_os; " \ |
Peng Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 73 | "else " \ |
Peng Fan | b06ff8f | 2019-09-25 08:11:17 +0000 | [diff] [blame] | 74 | "echo ERR: failed to authenticate; " \ |
Peng Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 75 | "fi; " \ |
| 76 | "else " \ |
Peng Fan | b06ff8f | 2019-09-25 08:11:17 +0000 | [diff] [blame] | 77 | "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ |
| 78 | "if run loadfdt; then " \ |
| 79 | "run boot_os; " \ |
| 80 | "else " \ |
| 81 | "echo WARN: Cannot load the DT; " \ |
| 82 | "fi; " \ |
| 83 | "else " \ |
| 84 | "echo wait for boot; " \ |
| 85 | "fi;" \ |
Peng Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 86 | "fi;\0" \ |
| 87 | "netargs=setenv bootargs console=${console} " \ |
| 88 | "root=/dev/nfs " \ |
| 89 | "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ |
| 90 | "netboot=echo Booting from net ...; " \ |
| 91 | "run netargs; " \ |
| 92 | "if test ${ip_dyn} = yes; then " \ |
| 93 | "setenv get_cmd dhcp; " \ |
| 94 | "else " \ |
| 95 | "setenv get_cmd tftp; " \ |
| 96 | "fi; " \ |
Peng Fan | b06ff8f | 2019-09-25 08:11:17 +0000 | [diff] [blame] | 97 | "if test ${sec_boot} = yes; then " \ |
| 98 | "${get_cmd} ${cntr_addr} ${cntr_file}; " \ |
| 99 | "if run auth_os; then " \ |
| 100 | "run boot_os; " \ |
Peng Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 101 | "else " \ |
Peng Fan | b06ff8f | 2019-09-25 08:11:17 +0000 | [diff] [blame] | 102 | "echo ERR: failed to authenticate; " \ |
Peng Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 103 | "fi; " \ |
| 104 | "else " \ |
Peng Fan | b06ff8f | 2019-09-25 08:11:17 +0000 | [diff] [blame] | 105 | "${get_cmd} ${loadaddr} ${image}; " \ |
| 106 | "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ |
| 107 | "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ |
| 108 | "booti ${loadaddr} - ${fdt_addr}; " \ |
| 109 | "else " \ |
| 110 | "echo WARN: Cannot load the DT; " \ |
| 111 | "fi; " \ |
| 112 | "else " \ |
| 113 | "booti; " \ |
| 114 | "fi;" \ |
Peng Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 115 | "fi;\0" |
| 116 | |
Peng Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 117 | /* Link Definitions */ |
Peng Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 118 | |
| 119 | #define CONFIG_SYS_INIT_SP_ADDR 0x80200000 |
| 120 | |
| 121 | /* Default environment is in SD */ |
Peng Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 122 | |
Peng Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 123 | /* On LPDDR4 board, USDHC1 is for eMMC, USDHC2 is for SD on CPU board */ |
Peng Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 124 | #define CONFIG_MMCROOT "/dev/mmcblk1p2" /* USDHC2 */ |
| 125 | #define CONFIG_SYS_FSL_USDHC_NUM 2 |
| 126 | |
Peng Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 127 | #define CONFIG_SYS_SDRAM_BASE 0x80000000 |
| 128 | #define PHYS_SDRAM_1 0x80000000 |
| 129 | #define PHYS_SDRAM_2 0x880000000 |
| 130 | #define PHYS_SDRAM_1_SIZE 0x80000000 /* 2 GB */ |
| 131 | #define PHYS_SDRAM_2_SIZE 0x100000000 /* 4 GB */ |
| 132 | |
Peng Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 133 | /* Generic Timer Definitions */ |
| 134 | #define COUNTER_FREQUENCY 8000000 /* 8MHz */ |
| 135 | |
| 136 | /* Networking */ |
| 137 | #define CONFIG_FEC_XCV_TYPE RGMII |
Peng Fan | 0d331c0 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 138 | |
| 139 | #endif /* __IMX8QM_MEK_H */ |