Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Marek Behún | 09e16b8 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 2 | /* |
Marek Behún | d63726e | 2022-06-01 17:17:06 +0200 | [diff] [blame] | 3 | * Copyright (C) 2017 Marek Behún <kabel@kernel.org> |
Marek Behún | 09e16b8 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 4 | * Copyright (C) 2016 Tomas Hlavacek <tomas.hlavacek@nic.cz> |
Marek Behún | 09e16b8 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef _CONFIG_TURRIS_OMNIA_H |
| 8 | #define _CONFIG_TURRIS_OMNIA_H |
| 9 | |
| 10 | /* |
| 11 | * High Level Configuration Options (easy to change) |
| 12 | */ |
| 13 | |
Marek Behún | 09e16b8 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 14 | /* |
| 15 | * TEXT_BASE needs to be below 16MiB, since this area is scrubbed |
| 16 | * for DDR ECC byte filling in the SPL before loading the main |
| 17 | * U-Boot into it. |
| 18 | */ |
Marek Behún | 09e16b8 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 19 | |
Marek Behún | 09e16b8 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 20 | /* Environment in SPI NOR flash */ |
Marek Behún | 09e16b8 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 21 | |
Marek Behún | 09e16b8 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 22 | /* Keep device tree and initrd in lower memory so the kernel can access them */ |
| 23 | #define RELOCATION_LIMITS_ENV_SETTINGS \ |
| 24 | "fdt_high=0x10000000\0" \ |
| 25 | "initrd_high=0x10000000\0" |
| 26 | |
Marek Behún | 09e16b8 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 27 | /* |
| 28 | * mv-common.h should be defined after CMD configs since it used them |
| 29 | * to enable certain macros |
| 30 | */ |
| 31 | #include "mv-common.h" |
| 32 | |
| 33 | /* Include the common distro boot environment */ |
| 34 | #ifndef CONFIG_SPL_BUILD |
Marek Behún | 09e16b8 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 35 | |
Marek Behún | 09e16b8 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 36 | #define BOOT_TARGET_DEVICES(func) \ |
Pali Rohár | d25ded8 | 2022-04-06 11:39:34 +0200 | [diff] [blame] | 37 | func(MMC, mmc, 0) \ |
Pali Rohár | 8213d62 | 2022-04-06 11:39:35 +0200 | [diff] [blame] | 38 | func(NVME, nvme, 0) \ |
Pali Rohár | d25ded8 | 2022-04-06 11:39:34 +0200 | [diff] [blame] | 39 | func(SCSI, scsi, 0) \ |
| 40 | func(USB, usb, 0) \ |
Marek Behún | 09e16b8 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 41 | func(PXE, pxe, na) \ |
| 42 | func(DHCP, dhcp, na) |
| 43 | |
| 44 | #define KERNEL_ADDR_R __stringify(0x1000000) |
| 45 | #define FDT_ADDR_R __stringify(0x2000000) |
| 46 | #define RAMDISK_ADDR_R __stringify(0x2200000) |
| 47 | #define SCRIPT_ADDR_R __stringify(0x1800000) |
| 48 | #define PXEFILE_ADDR_R __stringify(0x1900000) |
| 49 | |
| 50 | #define LOAD_ADDRESS_ENV_SETTINGS \ |
| 51 | "kernel_addr_r=" KERNEL_ADDR_R "\0" \ |
| 52 | "fdt_addr_r=" FDT_ADDR_R "\0" \ |
| 53 | "ramdisk_addr_r=" RAMDISK_ADDR_R "\0" \ |
| 54 | "scriptaddr=" SCRIPT_ADDR_R "\0" \ |
| 55 | "pxefile_addr_r=" PXEFILE_ADDR_R "\0" |
| 56 | |
| 57 | #include <config_distro_bootcmd.h> |
| 58 | |
Marek Behún | 09f8de2 | 2021-05-28 10:00:49 +0200 | [diff] [blame] | 59 | /* |
| 60 | * The factory reset bootcommand on Omnia first sets all the front LEDs to green |
| 61 | * and then tries to load the rescue image from SPI flash memory and boot it |
| 62 | */ |
| 63 | #define TURRIS_OMNIA_BOOTCMD_RESCUE \ |
| 64 | "i2c dev 2; " \ |
| 65 | "i2c mw 0x2a.1 0x3 0x1c 1; " \ |
| 66 | "i2c mw 0x2a.1 0x4 0x1c 1; " \ |
| 67 | "mw.l 0x01000000 0x00ff000c; " \ |
| 68 | "i2c write 0x01000000 0x2a.1 0x5 4 -s; " \ |
| 69 | "setenv bootargs \"earlyprintk console=ttyS0,115200" \ |
| 70 | " omniarescue=$omnia_reset rescue_mode=$omnia_reset\"; " \ |
| 71 | "sf probe; " \ |
| 72 | "sf read 0x1000000 0x100000 0x700000; " \ |
| 73 | "lzmadec 0x1000000 0x1700000; " \ |
| 74 | "if gpio input gpio@71_4; then " \ |
| 75 | "bootm 0x1700000#sfp; " \ |
| 76 | "else " \ |
| 77 | "bootm 0x1700000; " \ |
| 78 | "fi; " \ |
| 79 | "bootz 0x1000000" |
| 80 | |
Tom Rini | c9edebe | 2022-12-04 10:03:50 -0500 | [diff] [blame] | 81 | #define CFG_EXTRA_ENV_SETTINGS \ |
Marek Behún | 09e16b8 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 82 | RELOCATION_LIMITS_ENV_SETTINGS \ |
| 83 | LOAD_ADDRESS_ENV_SETTINGS \ |
| 84 | "fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \ |
| 85 | "console=ttyS0,115200\0" \ |
Marek Behún | 09f8de2 | 2021-05-28 10:00:49 +0200 | [diff] [blame] | 86 | "bootcmd_rescue=" TURRIS_OMNIA_BOOTCMD_RESCUE "\0" \ |
Marek Behún | 09e16b8 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 87 | BOOTENV |
| 88 | |
| 89 | #endif /* CONFIG_SPL_BUILD */ |
| 90 | |
| 91 | #endif /* _CONFIG_TURRIS_OMNIA_H */ |