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) |
Peng Fan | 0b2236d | 2018-12-21 06:21:34 +0000 | [diff] [blame] | 16 | |
Peng Fan | 0b2236d | 2018-12-21 06:21:34 +0000 | [diff] [blame] | 17 | #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 Fan | 0b2236d | 2018-12-21 06:21:34 +0000 | [diff] [blame] | 23 | #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 Fan | 0b2236d | 2018-12-21 06:21:34 +0000 | [diff] [blame] | 28 | #endif |
| 29 | |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 30 | #define CONFIG_SYS_FSL_ESDHC_ADDR 0 |
| 31 | #define USDHC1_BASE_ADDR 0x5B010000 |
| 32 | #define USDHC2_BASE_ADDR 0x5B020000 |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 33 | |
Peng Fan | 128f189 | 2019-09-25 08:11:19 +0000 | [diff] [blame] | 34 | #ifdef CONFIG_AHAB_BOOT |
| 35 | #define AHAB_ENV "sec_boot=yes\0" |
| 36 | #else |
| 37 | #define AHAB_ENV "sec_boot=no\0" |
| 38 | #endif |
| 39 | |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 40 | /* Initial environment variables */ |
| 41 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
Peng Fan | 128f189 | 2019-09-25 08:11:19 +0000 | [diff] [blame] | 42 | AHAB_ENV \ |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 43 | "script=boot.scr\0" \ |
| 44 | "image=Image\0" \ |
| 45 | "panel=NULL\0" \ |
Fabio Estevam | 1f9ce1d | 2020-02-17 15:17:01 -0300 | [diff] [blame] | 46 | "console=ttyLP0\0" \ |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 47 | "fdt_addr=0x83000000\0" \ |
| 48 | "fdt_high=0xffffffffffffffff\0" \ |
| 49 | "boot_fdt=try\0" \ |
Peng Fan | e95219d | 2020-05-05 20:28:45 +0800 | [diff] [blame] | 50 | "fdt_file=undefined\0" \ |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 51 | "initrd_addr=0x83800000\0" \ |
| 52 | "initrd_high=0xffffffffffffffff\0" \ |
| 53 | "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \ |
Tom Rini | b113bca | 2021-12-11 14:55:52 -0500 | [diff] [blame] | 54 | "mmcpart=1\0" \ |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 55 | "mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \ |
| 56 | "mmcautodetect=yes\0" \ |
Fabio Estevam | 1f9ce1d | 2020-02-17 15:17:01 -0300 | [diff] [blame] | 57 | "mmcargs=setenv bootargs console=${console},${baudrate} root=${mmcroot}\0 " \ |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 58 | "loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ |
| 59 | "bootscript=echo Running bootscript from mmc ...; " \ |
| 60 | "source\0" \ |
| 61 | "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ |
| 62 | "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ |
Peng Fan | 128f189 | 2019-09-25 08:11:19 +0000 | [diff] [blame] | 63 | "loadcntr=fatload mmc ${mmcdev}:${mmcpart} ${cntr_addr} ${cntr_file}\0" \ |
| 64 | "auth_os=auth_cntr ${cntr_addr}\0" \ |
| 65 | "boot_os=booti ${loadaddr} - ${fdt_addr};\0" \ |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 66 | "mmcboot=echo Booting from mmc ...; " \ |
| 67 | "run mmcargs; " \ |
Peng Fan | 128f189 | 2019-09-25 08:11:19 +0000 | [diff] [blame] | 68 | "if test ${sec_boot} = yes; then " \ |
| 69 | "if run auth_os; then " \ |
| 70 | "run boot_os; " \ |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 71 | "else " \ |
Peng Fan | 128f189 | 2019-09-25 08:11:19 +0000 | [diff] [blame] | 72 | "echo ERR: failed to authenticate; " \ |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 73 | "fi; " \ |
| 74 | "else " \ |
Peng Fan | 128f189 | 2019-09-25 08:11:19 +0000 | [diff] [blame] | 75 | "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ |
| 76 | "if run loadfdt; then " \ |
| 77 | "run boot_os; " \ |
| 78 | "else " \ |
| 79 | "echo WARN: Cannot load the DT; " \ |
| 80 | "fi; " \ |
| 81 | "else " \ |
| 82 | "echo wait for boot; " \ |
| 83 | "fi;" \ |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 84 | "fi;\0" \ |
Fabio Estevam | 1f9ce1d | 2020-02-17 15:17:01 -0300 | [diff] [blame] | 85 | "netargs=setenv bootargs console=${console},${baudrate} " \ |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 86 | "root=/dev/nfs " \ |
| 87 | "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ |
| 88 | "netboot=echo Booting from net ...; " \ |
| 89 | "run netargs; " \ |
| 90 | "if test ${ip_dyn} = yes; then " \ |
| 91 | "setenv get_cmd dhcp; " \ |
| 92 | "else " \ |
| 93 | "setenv get_cmd tftp; " \ |
| 94 | "fi; " \ |
Peng Fan | 128f189 | 2019-09-25 08:11:19 +0000 | [diff] [blame] | 95 | "if test ${sec_boot} = yes; then " \ |
| 96 | "${get_cmd} ${cntr_addr} ${cntr_file}; " \ |
| 97 | "if run auth_os; then " \ |
| 98 | "run boot_os; " \ |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 99 | "else " \ |
Peng Fan | 128f189 | 2019-09-25 08:11:19 +0000 | [diff] [blame] | 100 | "echo ERR: failed to authenticate; " \ |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 101 | "fi; " \ |
| 102 | "else " \ |
Peng Fan | 128f189 | 2019-09-25 08:11:19 +0000 | [diff] [blame] | 103 | "${get_cmd} ${loadaddr} ${image}; " \ |
| 104 | "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ |
| 105 | "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ |
| 106 | "run boot_os; " \ |
| 107 | "else " \ |
| 108 | "echo WARN: Cannot load the DT; " \ |
| 109 | "fi; " \ |
| 110 | "else " \ |
| 111 | "booti; " \ |
| 112 | "fi;" \ |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 113 | "fi;\0" |
| 114 | |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 115 | /* Link Definitions */ |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 116 | |
| 117 | #define CONFIG_SYS_INIT_SP_ADDR 0x80200000 |
| 118 | |
| 119 | /* Default environment is in SD */ |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 120 | |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 121 | /* 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] | 122 | #define CONFIG_MMCROOT "/dev/mmcblk1p2" /* USDHC2 */ |
| 123 | #define CONFIG_SYS_FSL_USDHC_NUM 2 |
| 124 | |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 125 | #define CONFIG_SYS_SDRAM_BASE 0x80000000 |
| 126 | #define PHYS_SDRAM_1 0x80000000 |
| 127 | #define PHYS_SDRAM_2 0x880000000 |
| 128 | #define PHYS_SDRAM_1_SIZE 0x80000000 /* 2 GB */ |
| 129 | /* LPDDR4 board total DDR is 3GB */ |
| 130 | #define PHYS_SDRAM_2_SIZE 0x40000000 /* 1 GB */ |
| 131 | |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 132 | /* Generic Timer Definitions */ |
| 133 | #define COUNTER_FREQUENCY 8000000 /* 8MHz */ |
| 134 | |
| 135 | #ifndef CONFIG_DM_PCA953X |
| 136 | #define CONFIG_PCA953X |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 137 | #endif |
| 138 | |
Anatolij Gustschin | 1bfd6f4 | 2019-10-21 17:31:53 +0200 | [diff] [blame] | 139 | /* Misc configuration */ |
| 140 | #define CONFIG_SYS_CBSIZE 2048 |
| 141 | #define CONFIG_SYS_MAXARGS 64 |
| 142 | #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE |
| 143 | |
Peng Fan | 702c6dc | 2018-10-18 14:28:37 +0200 | [diff] [blame] | 144 | #endif /* __IMX8QXP_MEK_H */ |