blob: 9013d9a6932589463be989e081bf129ac49b781d [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Marek Behúnb6ee8602017-06-09 19:28:45 +02002/*
3 * Copyright (C) 2017 Marek Behun <marek.behun@nic.cz>
4 * Copyright (C) 2016 Tomas Hlavacek <tomas.hlavacek@nic.cz>
Marek Behúnb6ee8602017-06-09 19:28:45 +02005 */
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únb6ee8602017-06-09 19:28:45 +020014/*
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únb6ee8602017-06-09 19:28:45 +020019
Marek Behúnb6ee8602017-06-09 19:28:45 +020020/* Environment in SPI NOR flash */
Marek Behúnb6ee8602017-06-09 19:28:45 +020021
Marek Behúnb6ee8602017-06-09 19:28:45 +020022#define PHY_ANEG_TIMEOUT 8000 /* PHY needs a longer aneg time */
23
Marek Behúnb6ee8602017-06-09 19:28:45 +020024/* 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
Marek Behúnb6ee8602017-06-09 19:28:45 +020029/*
30 * mv-common.h should be defined after CMD configs since it used them
31 * to enable certain macros
32 */
33#include "mv-common.h"
34
35/* Include the common distro boot environment */
36#ifndef CONFIG_SPL_BUILD
Marek Behúnb6ee8602017-06-09 19:28:45 +020037
Marek Behúnb6ee8602017-06-09 19:28:45 +020038#define BOOT_TARGET_DEVICES(func) \
Pali Rohár9efc5b72022-04-06 11:39:34 +020039 func(MMC, mmc, 0) \
Pali Rohár0ddc1e52022-04-06 11:39:35 +020040 func(NVME, nvme, 0) \
Pali Rohár9efc5b72022-04-06 11:39:34 +020041 func(SCSI, scsi, 0) \
42 func(USB, usb, 0) \
Marek Behúnb6ee8602017-06-09 19:28:45 +020043 func(PXE, pxe, na) \
44 func(DHCP, dhcp, na)
45
46#define KERNEL_ADDR_R __stringify(0x1000000)
47#define FDT_ADDR_R __stringify(0x2000000)
48#define RAMDISK_ADDR_R __stringify(0x2200000)
49#define SCRIPT_ADDR_R __stringify(0x1800000)
50#define PXEFILE_ADDR_R __stringify(0x1900000)
51
52#define LOAD_ADDRESS_ENV_SETTINGS \
53 "kernel_addr_r=" KERNEL_ADDR_R "\0" \
54 "fdt_addr_r=" FDT_ADDR_R "\0" \
55 "ramdisk_addr_r=" RAMDISK_ADDR_R "\0" \
56 "scriptaddr=" SCRIPT_ADDR_R "\0" \
57 "pxefile_addr_r=" PXEFILE_ADDR_R "\0"
58
59#include <config_distro_bootcmd.h>
60
Marek Behún176c3e72021-05-28 10:00:49 +020061/*
62 * The factory reset bootcommand on Omnia first sets all the front LEDs to green
63 * and then tries to load the rescue image from SPI flash memory and boot it
64 */
65#define TURRIS_OMNIA_BOOTCMD_RESCUE \
66 "i2c dev 2; " \
67 "i2c mw 0x2a.1 0x3 0x1c 1; " \
68 "i2c mw 0x2a.1 0x4 0x1c 1; " \
69 "mw.l 0x01000000 0x00ff000c; " \
70 "i2c write 0x01000000 0x2a.1 0x5 4 -s; " \
71 "setenv bootargs \"earlyprintk console=ttyS0,115200" \
72 " omniarescue=$omnia_reset rescue_mode=$omnia_reset\"; " \
73 "sf probe; " \
74 "sf read 0x1000000 0x100000 0x700000; " \
75 "lzmadec 0x1000000 0x1700000; " \
76 "if gpio input gpio@71_4; then " \
77 "bootm 0x1700000#sfp; " \
78 "else " \
79 "bootm 0x1700000; " \
80 "fi; " \
81 "bootz 0x1000000"
82
Marek Behúnb6ee8602017-06-09 19:28:45 +020083#define CONFIG_EXTRA_ENV_SETTINGS \
84 RELOCATION_LIMITS_ENV_SETTINGS \
85 LOAD_ADDRESS_ENV_SETTINGS \
86 "fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \
87 "console=ttyS0,115200\0" \
Marek Behún176c3e72021-05-28 10:00:49 +020088 "bootcmd_rescue=" TURRIS_OMNIA_BOOTCMD_RESCUE "\0" \
Marek Behúnb6ee8602017-06-09 19:28:45 +020089 BOOTENV
90
91#endif /* CONFIG_SPL_BUILD */
92
93#endif /* _CONFIG_TURRIS_OMNIA_H */