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