blob: 2553da12097b52d418218db90799b93adb0175ab [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#define CONFIG_SYS_TCLK 250000000 /* 250MHz */
20
Marek Behúnb6ee8602017-06-09 19:28:45 +020021/* USB/EHCI configuration */
22#define CONFIG_EHCI_IS_TDI
23
24/* Environment in SPI NOR flash */
Marek Behúnb6ee8602017-06-09 19:28:45 +020025
Marek Behúnb6ee8602017-06-09 19:28:45 +020026#define PHY_ANEG_TIMEOUT 8000 /* PHY needs a longer aneg time */
27
Marek Behúnb6ee8602017-06-09 19:28:45 +020028/* 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únb6ee8602017-06-09 19:28:45 +020034#define CONFIG_SPL_SIZE (140 << 10)
Marek Behúnb6ee8602017-06-09 19:28:45 +020035#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)
Simon Glass9ca00682021-07-10 21:14:31 -060046#define CONFIG_SPL_DRIVERS_MISC
Marek Behúnb6ee8602017-06-09 19:28:45 +020047
Baruch Siachad105f52018-06-18 21:56:24 +030048#ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC
Marek Behúnb6ee8602017-06-09 19:28:45 +020049/* SPL related MMC defines */
Marek Behúnb6ee8602017-06-09 19:28:45 +020050# ifdef CONFIG_SPL_BUILD
51# define CONFIG_FIXED_SDHCI_ALIGNED_BUFFER 0x00180000 /* in SDRAM */
52# endif
53#endif
54
55/*
56 * mv-common.h should be defined after CMD configs since it used them
57 * to enable certain macros
58 */
59#include "mv-common.h"
60
61/* Include the common distro boot environment */
62#ifndef CONFIG_SPL_BUILD
Marek Behúnb6ee8602017-06-09 19:28:45 +020063
64#ifdef CONFIG_MMC
65#define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0)
66#else
67#define BOOT_TARGET_DEVICES_MMC(func)
68#endif
69
70#ifdef CONFIG_USB_STORAGE
71#define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0)
72#else
73#define BOOT_TARGET_DEVICES_USB(func)
74#endif
75
Marek Behúnf9779f52019-05-02 16:53:29 +020076#ifdef CONFIG_SCSI
77#define BOOT_TARGET_DEVICES_SCSI(func) func(SCSI, scsi, 0)
78#else
79#define BOOT_TARGET_DEVICES_SCSI(func)
80#endif
81
Marek Behúnb6ee8602017-06-09 19:28:45 +020082#define BOOT_TARGET_DEVICES(func) \
83 BOOT_TARGET_DEVICES_MMC(func) \
Marek Behúnf9779f52019-05-02 16:53:29 +020084 BOOT_TARGET_DEVICES_SCSI(func) \
Marek Behún27e3d482019-05-24 14:57:52 +020085 BOOT_TARGET_DEVICES_USB(func) \
Marek Behúnb6ee8602017-06-09 19:28:45 +020086 func(PXE, pxe, na) \
87 func(DHCP, dhcp, na)
88
89#define KERNEL_ADDR_R __stringify(0x1000000)
90#define FDT_ADDR_R __stringify(0x2000000)
91#define RAMDISK_ADDR_R __stringify(0x2200000)
92#define SCRIPT_ADDR_R __stringify(0x1800000)
93#define PXEFILE_ADDR_R __stringify(0x1900000)
94
95#define LOAD_ADDRESS_ENV_SETTINGS \
96 "kernel_addr_r=" KERNEL_ADDR_R "\0" \
97 "fdt_addr_r=" FDT_ADDR_R "\0" \
98 "ramdisk_addr_r=" RAMDISK_ADDR_R "\0" \
99 "scriptaddr=" SCRIPT_ADDR_R "\0" \
100 "pxefile_addr_r=" PXEFILE_ADDR_R "\0"
101
102#include <config_distro_bootcmd.h>
103
Marek Behún176c3e72021-05-28 10:00:49 +0200104/*
105 * The factory reset bootcommand on Omnia first sets all the front LEDs to green
106 * and then tries to load the rescue image from SPI flash memory and boot it
107 */
108#define TURRIS_OMNIA_BOOTCMD_RESCUE \
109 "i2c dev 2; " \
110 "i2c mw 0x2a.1 0x3 0x1c 1; " \
111 "i2c mw 0x2a.1 0x4 0x1c 1; " \
112 "mw.l 0x01000000 0x00ff000c; " \
113 "i2c write 0x01000000 0x2a.1 0x5 4 -s; " \
114 "setenv bootargs \"earlyprintk console=ttyS0,115200" \
115 " omniarescue=$omnia_reset rescue_mode=$omnia_reset\"; " \
116 "sf probe; " \
117 "sf read 0x1000000 0x100000 0x700000; " \
118 "lzmadec 0x1000000 0x1700000; " \
119 "if gpio input gpio@71_4; then " \
120 "bootm 0x1700000#sfp; " \
121 "else " \
122 "bootm 0x1700000; " \
123 "fi; " \
124 "bootz 0x1000000"
125
Marek Behúnb6ee8602017-06-09 19:28:45 +0200126#define CONFIG_EXTRA_ENV_SETTINGS \
127 RELOCATION_LIMITS_ENV_SETTINGS \
128 LOAD_ADDRESS_ENV_SETTINGS \
129 "fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \
130 "console=ttyS0,115200\0" \
Marek Behún1b355e52019-05-24 14:57:48 +0200131 "ethact=ethernet@34000\0" \
Marek Behún176c3e72021-05-28 10:00:49 +0200132 "bootcmd_rescue=" TURRIS_OMNIA_BOOTCMD_RESCUE "\0" \
Marek Behúnb6ee8602017-06-09 19:28:45 +0200133 BOOTENV
134
135#endif /* CONFIG_SPL_BUILD */
136
137#endif /* _CONFIG_TURRIS_OMNIA_H */