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