Mathew McBride | e605fb1 | 2022-01-31 18:34:43 +0530 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 | /* |
| 3 | * Copyright 2017 NXP |
| 4 | * Copyright 2019-2021 Traverse Technologies |
| 5 | */ |
| 6 | |
| 7 | #ifndef __TEN64_H |
| 8 | #define __TEN64_H |
| 9 | |
| 10 | #include "ls1088a_common.h" |
| 11 | |
Mathew McBride | e605fb1 | 2022-01-31 18:34:43 +0530 | [diff] [blame] | 12 | |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 13 | #define CFG_SYS_LS_MC_BOOT_TIMEOUT_MS 5000 |
Mathew McBride | e605fb1 | 2022-01-31 18:34:43 +0530 | [diff] [blame] | 14 | |
| 15 | #define QSPI_NOR_BOOTCOMMAND "run distro_bootcmd" |
| 16 | #define SD_BOOTCOMMAND "run distro_bootcmd" |
| 17 | |
Mathew McBride | a7b761b | 2023-07-21 04:39:19 +0000 | [diff] [blame] | 18 | #define SD_FIRMWARE_PATH "firmware/traverse/ten64/" |
| 19 | |
Mathew McBride | e605fb1 | 2022-01-31 18:34:43 +0530 | [diff] [blame] | 20 | #define QSPI_MC_INIT_CMD \ |
| 21 | "sf probe 0:0 && sf read 0x80000000 0x300000 0x200000 &&" \ |
| 22 | "sf read 0x80200000 0x5C0000 0x40000 &&" \ |
| 23 | "fsl_mc start mc 0x80000000 0x80200000 && " \ |
Mathew McBride | 6b02edf | 2023-07-21 04:39:18 +0000 | [diff] [blame] | 24 | "sf read 0x8E000000 0x580000 0x40000 && fsl_mc lazyapply DPL 0x8E000000 && "\ |
| 25 | "echo 'default DPL loaded'\0" |
Mathew McBride | e605fb1 | 2022-01-31 18:34:43 +0530 | [diff] [blame] | 26 | #define SD_MC_INIT_CMD \ |
Mathew McBride | a7b761b | 2023-07-21 04:39:19 +0000 | [diff] [blame] | 27 | "mmcinfo; fatload mmc 0 0x80000000 " SD_FIRMWARE_PATH "mc_ls1088a.itb; "\ |
| 28 | "fatload mmc 0 0x80200000 " SD_FIRMWARE_PATH "dpc.0x1D-0x0D.dtb; "\ |
Mathew McBride | 6b02edf | 2023-07-21 04:39:18 +0000 | [diff] [blame] | 29 | "fsl_mc start mc 0x80000000 0x80200000 && " \ |
Mathew McBride | a7b761b | 2023-07-21 04:39:19 +0000 | [diff] [blame] | 30 | "fatload mmc 0 0x8E000000 " SD_FIRMWARE_PATH "eth-dpl-all.dtb && " \ |
Mathew McBride | 6b02edf | 2023-07-21 04:39:18 +0000 | [diff] [blame] | 31 | "fsl_mc lazyapply DPL 0x8E000000 && echo 'default DPL loaded'\0" |
Mathew McBride | e605fb1 | 2022-01-31 18:34:43 +0530 | [diff] [blame] | 32 | |
| 33 | #define BOOT_TARGET_DEVICES(func) \ |
| 34 | func(NVME, nvme, 0) \ |
| 35 | func(USB, usb, 0) \ |
| 36 | func(MMC, mmc, 0) \ |
| 37 | func(SCSI, scsi, 0) \ |
| 38 | func(DHCP, dhcp, 0) \ |
| 39 | func(PXE, pxe, 0) |
| 40 | #include <config_distro_bootcmd.h> |
| 41 | |
Mathew McBride | 2bfac3e | 2023-07-21 04:39:21 +0000 | [diff] [blame] | 42 | #define OPENWRT_NAND_BOOTCMD \ |
| 43 | "bootcmd_openwrt_nand=ubi part ubi${openwrt_active_sys} && "\ |
| 44 | "ubi read $load_addr kernel && " \ |
| 45 | "setenv bootargs \"root=/dev/ubiblock0_1 earlycon ubi.mtd=ubi${openwrt_active_sys}\" &&"\ |
| 46 | "bootm $load_addr#ten64\0" |
Tom Rini | c9edebe | 2022-12-04 10:03:50 -0500 | [diff] [blame] | 47 | #undef CFG_EXTRA_ENV_SETTINGS |
Mathew McBride | e605fb1 | 2022-01-31 18:34:43 +0530 | [diff] [blame] | 48 | |
Mathew McBride | ed0cd7b | 2023-07-21 04:39:22 +0000 | [diff] [blame] | 49 | #if CONFIG_IS_ENABLED(CMD_BOOTMENU) |
| 50 | #define DEFAULT_MENU_ENTRIES \ |
| 51 | "bootmenu_0=Continue standard boot=run bootcmd\0" \ |
| 52 | "bootmenu_1=Boot into recovery=run bootcmd_recovery\0" \ |
| 53 | "bootmenu_2=Boot OpenWrt from NAND=run bootcmd_openwrt_nand\0" |
| 54 | #else |
| 55 | #define DEFAULT_MENU_ENTRIES "" |
| 56 | #endif /* CONFIG_IS_ENABLED(CMD_BOOTMENU) */ |
| 57 | |
Tom Rini | c9edebe | 2022-12-04 10:03:50 -0500 | [diff] [blame] | 58 | #define CFG_EXTRA_ENV_SETTINGS \ |
Mathew McBride | e605fb1 | 2022-01-31 18:34:43 +0530 | [diff] [blame] | 59 | "BOARD=ten64\0" \ |
| 60 | "fdt_addr_r=0x90000000\0" \ |
| 61 | "fdt_high=0xa0000000\0" \ |
| 62 | "kernel_addr_r=0x81000000\0" \ |
| 63 | "load_addr=0xa0000000\0" \ |
| 64 | BOOTENV \ |
Mathew McBride | 2bfac3e | 2023-07-21 04:39:21 +0000 | [diff] [blame] | 65 | OPENWRT_NAND_BOOTCMD \ |
| 66 | "openwrt_active_sys=a\0" \ |
Mathew McBride | e605fb1 | 2022-01-31 18:34:43 +0530 | [diff] [blame] | 67 | "load_efi_dtb=mtd read devicetree $fdt_addr_r && fdt addr $fdt_addr_r && " \ |
| 68 | "fdt resize && fdt boardsetup\0" \ |
Mathew McBride | ed0cd7b | 2023-07-21 04:39:22 +0000 | [diff] [blame] | 69 | "bootcmd_recovery=mtd read recovery 0xa0000000; " \ |
| 70 | "setenv bootargs \"earlycon root=/dev/ram0 ramdisk_size=0x3000000\" && bootm 0xa0000000#ten64\0" \ |
| 71 | DEFAULT_MENU_ENTRIES |
Mathew McBride | e605fb1 | 2022-01-31 18:34:43 +0530 | [diff] [blame] | 72 | |
| 73 | #endif /* __TEN64_H */ |