1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2017 Marek Behun <marek.behun@nic.cz>
4  * Copyright (C) 2016 Tomas Hlavacek <tomas.hlavacek@nic.cz>
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 
14 #define CONFIG_MISC_INIT_R
15 
16 /*
17  * TEXT_BASE needs to be below 16MiB, since this area is scrubbed
18  * for DDR ECC byte filling in the SPL before loading the main
19  * U-Boot into it.
20  */
21 #define CONFIG_SYS_TCLK		250000000	/* 250MHz */
22 
23 /*
24  * Commands configuration
25  */
26 
27 /* I2C support */
28 #define CONFIG_DM_I2C
29 #define CONFIG_I2C_MUX
30 #define CONFIG_I2C_MUX_PCA954x
31 #define CONFIG_SPL_I2C_MUX
32 #define CONFIG_SYS_I2C_MVTWSI
33 
34 /* Watchdog support */
35 #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT_ORION)
36 # define CONFIG_WATCHDOG
37 #endif
38 
39 /* SPI NOR flash default params, used by sf commands */
40 #define CONFIG_SF_DEFAULT_SPEED		1000000
41 #define CONFIG_SF_DEFAULT_MODE		SPI_MODE_3
42 #define CONFIG_SPI_FLASH
43 #define CONFIG_SPI_FLASH_SPANSION
44 
45 /*
46  * SDIO/MMC Card Configuration
47  */
48 #define CONFIG_SYS_MMC_BASE		MVEBU_SDIO_BASE
49 
50 /*
51  * SATA/SCSI/AHCI configuration
52  */
53 #define CONFIG_SCSI_AHCI_PLAT
54 #define CONFIG_SYS_SCSI_MAX_SCSI_ID	2
55 #define CONFIG_SYS_SCSI_MAX_LUN		1
56 #define CONFIG_SYS_SCSI_MAX_DEVICE	(CONFIG_SYS_SCSI_MAX_SCSI_ID * \
57 					 CONFIG_SYS_SCSI_MAX_LUN)
58 
59 /* USB/EHCI configuration */
60 #define CONFIG_EHCI_IS_TDI
61 
62 /* Environment in SPI NOR flash */
63 #define CONFIG_ENV_OFFSET		(3*(1 << 18)) /* 768KiB in */
64 #define CONFIG_ENV_SIZE			(64 << 10) /* 64KiB */
65 #define CONFIG_ENV_SECT_SIZE		(256 << 10) /* 256KiB sectors */
66 
67 #define PHY_ANEG_TIMEOUT	8000	/* PHY needs a longer aneg time */
68 
69 /* PCIe support */
70 #ifndef CONFIG_SPL_BUILD
71 #define CONFIG_PCI_MVEBU
72 #define CONFIG_PCI_SCAN_SHOW
73 #endif
74 
75 /* Keep device tree and initrd in lower memory so the kernel can access them */
76 #define RELOCATION_LIMITS_ENV_SETTINGS	\
77 	"fdt_high=0x10000000\0"		\
78 	"initrd_high=0x10000000\0"
79 
80 /* Defines for SPL */
81 #define CONFIG_SPL_SIZE			(140 << 10)
82 #define CONFIG_SPL_TEXT_BASE		0x40000030
83 #define CONFIG_SPL_MAX_SIZE		(CONFIG_SPL_SIZE - 0x0030)
84 
85 #define CONFIG_SPL_BSS_START_ADDR	(0x40000000 + CONFIG_SPL_SIZE)
86 #define CONFIG_SPL_BSS_MAX_SIZE		(16 << 10)
87 
88 #ifdef CONFIG_SPL_BUILD
89 #define CONFIG_SYS_MALLOC_SIMPLE
90 #endif
91 
92 #define CONFIG_SPL_STACK		(0x40000000 + ((192 - 16) << 10))
93 #define CONFIG_SPL_BOOTROM_SAVE		(CONFIG_SPL_STACK + 4)
94 #define CONFIG_SPL_DRIVERS_MISC_SUPPORT
95 
96 #ifdef CONFIG_TURRIS_OMNIA_SPL_BOOT_DEVICE_SPI
97 /* SPL related SPI defines */
98 # define CONFIG_SYS_SPI_U_BOOT_OFFS	0x24000
99 # define CONFIG_SYS_U_BOOT_OFFS		CONFIG_SYS_SPI_U_BOOT_OFFS
100 #endif
101 
102 #ifdef CONFIG_TURRIS_OMNIA_SPL_BOOT_DEVICE_MMC
103 /* SPL related MMC defines */
104 # define CONFIG_SYS_MMC_U_BOOT_OFFS		(160 << 10)
105 # define CONFIG_SYS_U_BOOT_OFFS			CONFIG_SYS_MMC_U_BOOT_OFFS
106 # ifdef CONFIG_SPL_BUILD
107 #  define CONFIG_FIXED_SDHCI_ALIGNED_BUFFER	0x00180000	/* in SDRAM */
108 # endif
109 #endif
110 
111 /*
112  * mv-common.h should be defined after CMD configs since it used them
113  * to enable certain macros
114  */
115 #include "mv-common.h"
116 
117 /* Include the common distro boot environment */
118 #ifndef CONFIG_SPL_BUILD
119 
120 #ifdef CONFIG_MMC
121 #define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0)
122 #else
123 #define BOOT_TARGET_DEVICES_MMC(func)
124 #endif
125 
126 #ifdef CONFIG_USB_STORAGE
127 #define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0)
128 #else
129 #define BOOT_TARGET_DEVICES_USB(func)
130 #endif
131 
132 #define BOOT_TARGET_DEVICES(func) \
133 	BOOT_TARGET_DEVICES_MMC(func) \
134 	BOOT_TARGET_DEVICES_USB(func) \
135 	func(PXE, pxe, na) \
136 	func(DHCP, dhcp, na)
137 
138 #define KERNEL_ADDR_R	__stringify(0x1000000)
139 #define FDT_ADDR_R	__stringify(0x2000000)
140 #define RAMDISK_ADDR_R	__stringify(0x2200000)
141 #define SCRIPT_ADDR_R	__stringify(0x1800000)
142 #define PXEFILE_ADDR_R	__stringify(0x1900000)
143 
144 #define LOAD_ADDRESS_ENV_SETTINGS \
145 	"kernel_addr_r=" KERNEL_ADDR_R "\0" \
146 	"fdt_addr_r=" FDT_ADDR_R "\0" \
147 	"ramdisk_addr_r=" RAMDISK_ADDR_R "\0" \
148 	"scriptaddr=" SCRIPT_ADDR_R "\0" \
149 	"pxefile_addr_r=" PXEFILE_ADDR_R "\0"
150 
151 #include <config_distro_bootcmd.h>
152 
153 #define CONFIG_EXTRA_ENV_SETTINGS \
154 	RELOCATION_LIMITS_ENV_SETTINGS \
155 	LOAD_ADDRESS_ENV_SETTINGS \
156 	"fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \
157 	"console=ttyS0,115200\0" \
158 	BOOTENV
159 
160 #endif /* CONFIG_SPL_BUILD */
161 
162 #endif /* _CONFIG_TURRIS_OMNIA_H */
163