Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 1 | /* 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 Glass | fb64e36 | 2020-05-10 11:40:09 -0600 | [diff] [blame] | 10 | #include <linux/stringify.h> |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 11 | #include <asm/arch/imx-regs.h> |
| 12 | |
Peng Fan | 0b2236d | 2018-12-21 06:21:34 +0000 | [diff] [blame] | 13 | #ifdef CONFIG_SPL_BUILD |
Peng Fan | 0b2236d | 2018-12-21 06:21:34 +0000 | [diff] [blame] | 14 | #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 Fan | 9d6819fd | 2019-08-21 08:28:15 +0000 | [diff] [blame] | 17 | #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0x800 |
Peng Fan | 0b2236d | 2018-12-21 06:21:34 +0000 | [diff] [blame] | 18 | |
| 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 Fan | 0b2236d | 2018-12-21 06:21:34 +0000 | [diff] [blame] | 26 | #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 Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 35 | #define CONFIG_REMAKE_ELF |
| 36 | |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 37 | /* Flat Device Tree Definitions */ |
| 38 | #define CONFIG_OF_BOARD_SETUP |
| 39 | |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 40 | #define CONFIG_SYS_FSL_ESDHC_ADDR 0 |
| 41 | #define USDHC1_BASE_ADDR 0x5B010000 |
| 42 | #define USDHC2_BASE_ADDR 0x5B020000 |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 43 | |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 44 | #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG |
| 45 | |
Peng Fan | 128f189 | 2019-09-25 08:11:19 +0000 | [diff] [blame] | 46 | #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 Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 52 | /* Initial environment variables */ |
| 53 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
Peng Fan | 128f189 | 2019-09-25 08:11:19 +0000 | [diff] [blame] | 54 | AHAB_ENV \ |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 55 | "script=boot.scr\0" \ |
| 56 | "image=Image\0" \ |
| 57 | "panel=NULL\0" \ |
Fabio Estevam | 1f9ce1d | 2020-02-17 15:17:01 -0300 | [diff] [blame] | 58 | "console=ttyLP0\0" \ |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 59 | "fdt_addr=0x83000000\0" \ |
| 60 | "fdt_high=0xffffffffffffffff\0" \ |
| 61 | "boot_fdt=try\0" \ |
Peng Fan | e95219d | 2020-05-05 20:28:45 +0800 | [diff] [blame] | 62 | "fdt_file=undefined\0" \ |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 63 | "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 Estevam | 1f9ce1d | 2020-02-17 15:17:01 -0300 | [diff] [blame] | 69 | "mmcargs=setenv bootargs console=${console},${baudrate} root=${mmcroot}\0 " \ |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 70 | "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 Fan | 128f189 | 2019-09-25 08:11:19 +0000 | [diff] [blame] | 75 | "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 Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 78 | "mmcboot=echo Booting from mmc ...; " \ |
| 79 | "run mmcargs; " \ |
Peng Fan | 128f189 | 2019-09-25 08:11:19 +0000 | [diff] [blame] | 80 | "if test ${sec_boot} = yes; then " \ |
| 81 | "if run auth_os; then " \ |
| 82 | "run boot_os; " \ |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 83 | "else " \ |
Peng Fan | 128f189 | 2019-09-25 08:11:19 +0000 | [diff] [blame] | 84 | "echo ERR: failed to authenticate; " \ |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 85 | "fi; " \ |
| 86 | "else " \ |
Peng Fan | 128f189 | 2019-09-25 08:11:19 +0000 | [diff] [blame] | 87 | "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 Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 96 | "fi;\0" \ |
Fabio Estevam | 1f9ce1d | 2020-02-17 15:17:01 -0300 | [diff] [blame] | 97 | "netargs=setenv bootargs console=${console},${baudrate} " \ |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 98 | "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 Fan | 128f189 | 2019-09-25 08:11:19 +0000 | [diff] [blame] | 107 | "if test ${sec_boot} = yes; then " \ |
| 108 | "${get_cmd} ${cntr_addr} ${cntr_file}; " \ |
| 109 | "if run auth_os; then " \ |
| 110 | "run boot_os; " \ |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 111 | "else " \ |
Peng Fan | 128f189 | 2019-09-25 08:11:19 +0000 | [diff] [blame] | 112 | "echo ERR: failed to authenticate; " \ |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 113 | "fi; " \ |
| 114 | "else " \ |
Peng Fan | 128f189 | 2019-09-25 08:11:19 +0000 | [diff] [blame] | 115 | "${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 Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 125 | "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 Fan | 128f189 | 2019-09-25 08:11:19 +0000 | [diff] [blame] | 132 | "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 Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 143 | "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 Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 154 | |
| 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 Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 158 | #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 Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 171 | /* Generic Timer Definitions */ |
| 172 | #define COUNTER_FREQUENCY 8000000 /* 8MHz */ |
| 173 | |
| 174 | #ifndef CONFIG_DM_PCA953X |
| 175 | #define CONFIG_PCA953X |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 176 | #endif |
| 177 | |
| 178 | /* Networking */ |
| 179 | #define CONFIG_FEC_XCV_TYPE RGMII |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 180 | |
Anatolij Gustschin | 1bfd6f4 | 2019-10-21 17:31:53 +0200 | [diff] [blame] | 181 | /* Misc configuration */ |
| 182 | #define CONFIG_SYS_CBSIZE 2048 |
| 183 | #define CONFIG_SYS_MAXARGS 64 |
| 184 | #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE |
| 185 | |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 186 | #endif /* __IMX8QXP_MEK_H */ |