Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Marek Behún | b6ee860 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2017 Marek Behun <marek.behun@nic.cz> |
| 4 | * Copyright (C) 2016 Tomas Hlavacek <tomas.hlavacek@nic.cz> |
Marek Behún | b6ee860 | 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 | b6ee860 | 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 | b6ee860 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 19 | |
Marek Behún | b6ee860 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 20 | /* Environment in SPI NOR flash */ |
Marek Behún | b6ee860 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 21 | |
Marek Behún | b6ee860 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 22 | #define PHY_ANEG_TIMEOUT 8000 /* PHY needs a longer aneg time */ |
| 23 | |
Marek Behún | b6ee860 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 24 | /* Keep device tree and initrd in lower memory so the kernel can access them */ |
| 25 | #define RELOCATION_LIMITS_ENV_SETTINGS \ |
| 26 | "fdt_high=0x10000000\0" \ |
| 27 | "initrd_high=0x10000000\0" |
| 28 | |
| 29 | /* Defines for SPL */ |
Marek Behún | b6ee860 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 30 | #define CONFIG_SPL_SIZE (140 << 10) |
Marek Behún | b6ee860 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 31 | #define CONFIG_SPL_MAX_SIZE (CONFIG_SPL_SIZE - 0x0030) |
| 32 | |
| 33 | #define CONFIG_SPL_BSS_START_ADDR (0x40000000 + CONFIG_SPL_SIZE) |
| 34 | #define CONFIG_SPL_BSS_MAX_SIZE (16 << 10) |
| 35 | |
Marek Behún | b6ee860 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 36 | #define CONFIG_SPL_STACK (0x40000000 + ((192 - 16) << 10)) |
| 37 | #define CONFIG_SPL_BOOTROM_SAVE (CONFIG_SPL_STACK + 4) |
Marek Behún | b6ee860 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 38 | |
Baruch Siach | ad105f5 | 2018-06-18 21:56:24 +0300 | [diff] [blame] | 39 | #ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC |
Marek Behún | b6ee860 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 40 | /* SPL related MMC defines */ |
Marek Behún | b6ee860 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 41 | # ifdef CONFIG_SPL_BUILD |
| 42 | # define CONFIG_FIXED_SDHCI_ALIGNED_BUFFER 0x00180000 /* in SDRAM */ |
| 43 | # endif |
| 44 | #endif |
| 45 | |
| 46 | /* |
| 47 | * mv-common.h should be defined after CMD configs since it used them |
| 48 | * to enable certain macros |
| 49 | */ |
| 50 | #include "mv-common.h" |
| 51 | |
| 52 | /* Include the common distro boot environment */ |
| 53 | #ifndef CONFIG_SPL_BUILD |
Marek Behún | b6ee860 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 54 | |
| 55 | #ifdef CONFIG_MMC |
| 56 | #define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) |
| 57 | #else |
| 58 | #define BOOT_TARGET_DEVICES_MMC(func) |
| 59 | #endif |
| 60 | |
| 61 | #ifdef CONFIG_USB_STORAGE |
| 62 | #define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0) |
| 63 | #else |
| 64 | #define BOOT_TARGET_DEVICES_USB(func) |
| 65 | #endif |
| 66 | |
Marek Behún | f9779f5 | 2019-05-02 16:53:29 +0200 | [diff] [blame] | 67 | #ifdef CONFIG_SCSI |
| 68 | #define BOOT_TARGET_DEVICES_SCSI(func) func(SCSI, scsi, 0) |
| 69 | #else |
| 70 | #define BOOT_TARGET_DEVICES_SCSI(func) |
| 71 | #endif |
| 72 | |
Marek Behún | b6ee860 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 73 | #define BOOT_TARGET_DEVICES(func) \ |
| 74 | BOOT_TARGET_DEVICES_MMC(func) \ |
Marek Behún | f9779f5 | 2019-05-02 16:53:29 +0200 | [diff] [blame] | 75 | BOOT_TARGET_DEVICES_SCSI(func) \ |
Marek Behún | 27e3d48 | 2019-05-24 14:57:52 +0200 | [diff] [blame] | 76 | BOOT_TARGET_DEVICES_USB(func) \ |
Marek Behún | b6ee860 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 77 | func(PXE, pxe, na) \ |
| 78 | func(DHCP, dhcp, na) |
| 79 | |
| 80 | #define KERNEL_ADDR_R __stringify(0x1000000) |
| 81 | #define FDT_ADDR_R __stringify(0x2000000) |
| 82 | #define RAMDISK_ADDR_R __stringify(0x2200000) |
| 83 | #define SCRIPT_ADDR_R __stringify(0x1800000) |
| 84 | #define PXEFILE_ADDR_R __stringify(0x1900000) |
| 85 | |
| 86 | #define LOAD_ADDRESS_ENV_SETTINGS \ |
| 87 | "kernel_addr_r=" KERNEL_ADDR_R "\0" \ |
| 88 | "fdt_addr_r=" FDT_ADDR_R "\0" \ |
| 89 | "ramdisk_addr_r=" RAMDISK_ADDR_R "\0" \ |
| 90 | "scriptaddr=" SCRIPT_ADDR_R "\0" \ |
| 91 | "pxefile_addr_r=" PXEFILE_ADDR_R "\0" |
| 92 | |
| 93 | #include <config_distro_bootcmd.h> |
| 94 | |
Marek Behún | 176c3e7 | 2021-05-28 10:00:49 +0200 | [diff] [blame] | 95 | /* |
| 96 | * The factory reset bootcommand on Omnia first sets all the front LEDs to green |
| 97 | * and then tries to load the rescue image from SPI flash memory and boot it |
| 98 | */ |
| 99 | #define TURRIS_OMNIA_BOOTCMD_RESCUE \ |
| 100 | "i2c dev 2; " \ |
| 101 | "i2c mw 0x2a.1 0x3 0x1c 1; " \ |
| 102 | "i2c mw 0x2a.1 0x4 0x1c 1; " \ |
| 103 | "mw.l 0x01000000 0x00ff000c; " \ |
| 104 | "i2c write 0x01000000 0x2a.1 0x5 4 -s; " \ |
| 105 | "setenv bootargs \"earlyprintk console=ttyS0,115200" \ |
| 106 | " omniarescue=$omnia_reset rescue_mode=$omnia_reset\"; " \ |
| 107 | "sf probe; " \ |
| 108 | "sf read 0x1000000 0x100000 0x700000; " \ |
| 109 | "lzmadec 0x1000000 0x1700000; " \ |
| 110 | "if gpio input gpio@71_4; then " \ |
| 111 | "bootm 0x1700000#sfp; " \ |
| 112 | "else " \ |
| 113 | "bootm 0x1700000; " \ |
| 114 | "fi; " \ |
| 115 | "bootz 0x1000000" |
| 116 | |
Marek Behún | b6ee860 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 117 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
| 118 | RELOCATION_LIMITS_ENV_SETTINGS \ |
| 119 | LOAD_ADDRESS_ENV_SETTINGS \ |
| 120 | "fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \ |
| 121 | "console=ttyS0,115200\0" \ |
Marek Behún | 1b355e5 | 2019-05-24 14:57:48 +0200 | [diff] [blame] | 122 | "ethact=ethernet@34000\0" \ |
Marek Behún | 176c3e7 | 2021-05-28 10:00:49 +0200 | [diff] [blame] | 123 | "bootcmd_rescue=" TURRIS_OMNIA_BOOTCMD_RESCUE "\0" \ |
Marek Behún | b6ee860 | 2017-06-09 19:28:45 +0200 | [diff] [blame] | 124 | BOOTENV |
| 125 | |
| 126 | #endif /* CONFIG_SPL_BUILD */ |
| 127 | |
| 128 | #endif /* _CONFIG_TURRIS_OMNIA_H */ |