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