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