blob: 4d8a7c37dec35c162b2a56856f335a5e423eef14 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Marek Behún09e16b82017-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ún09e16b82017-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ún09e16b82017-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ún09e16b82017-06-09 19:28:45 +020019
Marek Behún09e16b82017-06-09 19:28:45 +020020/* USB/EHCI configuration */
Marek Behún372154d2021-10-09 15:27:32 +020021#define CONFIG_USB_EHCI_IS_TDI
Marek Behún09e16b82017-06-09 19:28:45 +020022
23/* Environment in SPI NOR flash */
Marek Behún09e16b82017-06-09 19:28:45 +020024
Marek Behún09e16b82017-06-09 19:28:45 +020025#define PHY_ANEG_TIMEOUT 8000 /* PHY needs a longer aneg time */
26
Marek Behún09e16b82017-06-09 19:28:45 +020027/* Keep device tree and initrd in lower memory so the kernel can access them */
28#define RELOCATION_LIMITS_ENV_SETTINGS \
29 "fdt_high=0x10000000\0" \
30 "initrd_high=0x10000000\0"
31
32/* Defines for SPL */
Marek Behún09e16b82017-06-09 19:28:45 +020033#define CONFIG_SPL_SIZE (140 << 10)
Marek Behún09e16b82017-06-09 19:28:45 +020034#define CONFIG_SPL_MAX_SIZE (CONFIG_SPL_SIZE - 0x0030)
35
36#define CONFIG_SPL_BSS_START_ADDR (0x40000000 + CONFIG_SPL_SIZE)
37#define CONFIG_SPL_BSS_MAX_SIZE (16 << 10)
38
39#ifdef CONFIG_SPL_BUILD
40#define CONFIG_SYS_MALLOC_SIMPLE
41#endif
42
43#define CONFIG_SPL_STACK (0x40000000 + ((192 - 16) << 10))
44#define CONFIG_SPL_BOOTROM_SAVE (CONFIG_SPL_STACK + 4)
Simon Glass284cb9c2021-07-10 21:14:31 -060045#define CONFIG_SPL_DRIVERS_MISC
Marek Behún09e16b82017-06-09 19:28:45 +020046
Baruch Siach8d196a42018-06-18 21:56:24 +030047#ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC
Marek Behún09e16b82017-06-09 19:28:45 +020048/* SPL related MMC defines */
Marek Behún09e16b82017-06-09 19:28:45 +020049# ifdef CONFIG_SPL_BUILD
50# define CONFIG_FIXED_SDHCI_ALIGNED_BUFFER 0x00180000 /* in SDRAM */
51# endif
52#endif
53
54/*
55 * mv-common.h should be defined after CMD configs since it used them
56 * to enable certain macros
57 */
58#include "mv-common.h"
59
60/* Include the common distro boot environment */
61#ifndef CONFIG_SPL_BUILD
Marek Behún09e16b82017-06-09 19:28:45 +020062
63#ifdef CONFIG_MMC
64#define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0)
65#else
66#define BOOT_TARGET_DEVICES_MMC(func)
67#endif
68
69#ifdef CONFIG_USB_STORAGE
70#define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0)
71#else
72#define BOOT_TARGET_DEVICES_USB(func)
73#endif
74
Marek Behúnbd2ab872019-05-02 16:53:29 +020075#ifdef CONFIG_SCSI
76#define BOOT_TARGET_DEVICES_SCSI(func) func(SCSI, scsi, 0)
77#else
78#define BOOT_TARGET_DEVICES_SCSI(func)
79#endif
80
Marek Behún09e16b82017-06-09 19:28:45 +020081#define BOOT_TARGET_DEVICES(func) \
82 BOOT_TARGET_DEVICES_MMC(func) \
Marek Behúnbd2ab872019-05-02 16:53:29 +020083 BOOT_TARGET_DEVICES_SCSI(func) \
Marek Behún8d3c06f2019-05-24 14:57:52 +020084 BOOT_TARGET_DEVICES_USB(func) \
Marek Behún09e16b82017-06-09 19:28:45 +020085 func(PXE, pxe, na) \
86 func(DHCP, dhcp, na)
87
88#define KERNEL_ADDR_R __stringify(0x1000000)
89#define FDT_ADDR_R __stringify(0x2000000)
90#define RAMDISK_ADDR_R __stringify(0x2200000)
91#define SCRIPT_ADDR_R __stringify(0x1800000)
92#define PXEFILE_ADDR_R __stringify(0x1900000)
93
94#define LOAD_ADDRESS_ENV_SETTINGS \
95 "kernel_addr_r=" KERNEL_ADDR_R "\0" \
96 "fdt_addr_r=" FDT_ADDR_R "\0" \
97 "ramdisk_addr_r=" RAMDISK_ADDR_R "\0" \
98 "scriptaddr=" SCRIPT_ADDR_R "\0" \
99 "pxefile_addr_r=" PXEFILE_ADDR_R "\0"
100
101#include <config_distro_bootcmd.h>
102
Marek Behún09f8de22021-05-28 10:00:49 +0200103/*
104 * The factory reset bootcommand on Omnia first sets all the front LEDs to green
105 * and then tries to load the rescue image from SPI flash memory and boot it
106 */
107#define TURRIS_OMNIA_BOOTCMD_RESCUE \
108 "i2c dev 2; " \
109 "i2c mw 0x2a.1 0x3 0x1c 1; " \
110 "i2c mw 0x2a.1 0x4 0x1c 1; " \
111 "mw.l 0x01000000 0x00ff000c; " \
112 "i2c write 0x01000000 0x2a.1 0x5 4 -s; " \
113 "setenv bootargs \"earlyprintk console=ttyS0,115200" \
114 " omniarescue=$omnia_reset rescue_mode=$omnia_reset\"; " \
115 "sf probe; " \
116 "sf read 0x1000000 0x100000 0x700000; " \
117 "lzmadec 0x1000000 0x1700000; " \
118 "if gpio input gpio@71_4; then " \
119 "bootm 0x1700000#sfp; " \
120 "else " \
121 "bootm 0x1700000; " \
122 "fi; " \
123 "bootz 0x1000000"
124
Marek Behún09e16b82017-06-09 19:28:45 +0200125#define CONFIG_EXTRA_ENV_SETTINGS \
126 RELOCATION_LIMITS_ENV_SETTINGS \
127 LOAD_ADDRESS_ENV_SETTINGS \
128 "fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \
129 "console=ttyS0,115200\0" \
Marek Behúnb59ca002019-05-24 14:57:48 +0200130 "ethact=ethernet@34000\0" \
Marek Behún09f8de22021-05-28 10:00:49 +0200131 "bootcmd_rescue=" TURRIS_OMNIA_BOOTCMD_RESCUE "\0" \
Marek Behún09e16b82017-06-09 19:28:45 +0200132 BOOTENV
133
134#endif /* CONFIG_SPL_BUILD */
135
136#endif /* _CONFIG_TURRIS_OMNIA_H */