xref: /openbmc/u-boot/include/configs/helios4.h (revision cd71b1d5)
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2018 Dennis Gilmore <dgilmore@redhat.com>
4  */
5 
6 #ifndef _CONFIG_HELIOS4_H
7 #define _CONFIG_HELIOS4_H
8 
9 #include <linux/sizes.h>
10 
11 /*
12  * High Level Configuration Options (easy to change)
13  */
14 
15 /*
16  * TEXT_BASE needs to be below 16MiB, since this area is scrubbed
17  * for DDR ECC byte filling in the SPL before loading the main
18  * U-Boot into it.
19  */
20 #define CONFIG_SYS_TCLK		250000000	/* 250MHz */
21 
22 /*
23  * Commands configuration
24  */
25 
26 /* SPI NOR flash default params, used by sf commands */
27 #define CONFIG_SF_DEFAULT_BUS		1
28 #define CONFIG_SF_DEFAULT_CS		0
29 #define CONFIG_SF_DEFAULT_SPEED		104000000
30 #define CONFIG_SF_DEFAULT_MODE		SPI_MODE_3
31 
32 /*
33  * SDIO/MMC Card Configuration
34  */
35 #define CONFIG_SYS_MMC_BASE		MVEBU_SDIO_BASE
36 
37 /* USB/EHCI configuration */
38 #define CONFIG_EHCI_IS_TDI
39 
40 #define CONFIG_ENV_MIN_ENTRIES		128
41 
42 /*
43  * SATA/SCSI/AHCI configuration
44  */
45 #define CONFIG_SCSI_AHCI_PLAT
46 #define CONFIG_SYS_SCSI_MAX_SCSI_ID     2
47 #define CONFIG_SYS_SCSI_MAX_LUN         2
48 #define CONFIG_SYS_SCSI_MAX_DEVICE      (CONFIG_SYS_SCSI_MAX_SCSI_ID * \
49 					CONFIG_SYS_SCSI_MAX_LUN)
50 
51 #ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_SPI
52 /*
53  * SPI Flash configuration for the environment access
54  */
55 #define CONFIG_ENV_SPI_BUS		CONFIG_SF_DEFAULT_BUS
56 #define CONFIG_ENV_SPI_CS		CONFIG_SF_DEFAULT_CS
57 #define CONFIG_ENV_SPI_MAX_HZ		CONFIG_SF_DEFAULT_SPEED
58 
59 /* Environment in SPI NOR flash */
60 #define CONFIG_ENV_SECT_SIZE		SZ_64K
61 #define CONFIG_ENV_SIZE			CONFIG_ENV_SECT_SIZE
62 #define CONFIG_ENV_OFFSET		SZ_1M
63 #endif
64 
65 #ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC
66 /* Environment in MMC */
67 #define CONFIG_SYS_MMC_ENV_DEV		0
68 #define CONFIG_ENV_SECT_SIZE		0x200
69 #define CONFIG_ENV_SIZE			0x2000
70 /* stay within first 1M */
71 #define CONFIG_ENV_OFFSET		(SZ_1M - CONFIG_ENV_SIZE)
72 #define CONFIG_ENV_ADDR			CONFIG_ENV_OFFSET
73 #endif
74 
75 #define CONFIG_PHY_MARVELL		/* there is a marvell phy */
76 #define PHY_ANEG_TIMEOUT	8000	/* PHY needs a longer aneg time */
77 
78 /* Keep device tree and initrd in lower memory so the kernel can access them */
79 #define RELOCATION_LIMITS_ENV_SETTINGS	\
80 	"fdt_high=0x10000000\0"		\
81 	"initrd_high=0x10000000\0"
82 
83 /* SPL */
84 /*
85  * Select the boot device here
86  *
87  * Currently supported are:
88  * SPL_BOOT_SPI_NOR_FLASH	- Booting via SPI NOR flash
89  * SPL_BOOT_SDIO_MMC_CARD	- Booting via SDIO/MMC card (partition 1)
90  */
91 #define SPL_BOOT_SPI_NOR_FLASH		1
92 #define SPL_BOOT_SDIO_MMC_CARD		2
93 
94 #ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_SPI
95 #define CONFIG_SPL_BOOT_DEVICE		SPL_BOOT_SPI_NOR_FLASH
96 #endif
97 #ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC
98 #define CONFIG_SPL_BOOT_DEVICE		SPL_BOOT_SDIO_MMC_CARD
99 #endif
100 
101 /* Defines for SPL */
102 #define CONFIG_SPL_SIZE			(140 << 10)
103 #define CONFIG_SPL_TEXT_BASE		0x40000030
104 #define CONFIG_SPL_MAX_SIZE		(CONFIG_SPL_SIZE - 0x0030)
105 
106 #define CONFIG_SPL_BSS_START_ADDR	(0x40000000 + CONFIG_SPL_SIZE)
107 #define CONFIG_SPL_BSS_MAX_SIZE		(16 << 10)
108 
109 #ifdef CONFIG_SPL_BUILD
110 #define CONFIG_SYS_MALLOC_SIMPLE
111 #endif
112 
113 #define CONFIG_SPL_STACK		(0x40000000 + ((192 - 16) << 10))
114 #define CONFIG_SPL_BOOTROM_SAVE		(CONFIG_SPL_STACK + 4)
115 
116 #if CONFIG_SPL_BOOT_DEVICE == SPL_BOOT_SPI_NOR_FLASH
117 /* SPL related SPI defines */
118 #define CONFIG_SPL_SPI_FLASH_SUPPORT
119 #define CONFIG_SPL_SPI_LOAD
120 #define CONFIG_SPL_SPI_SUPPORT
121 #define CONFIG_SYS_SPI_U_BOOT_OFFS	0x20000
122 #define CONFIG_SYS_U_BOOT_OFFS		CONFIG_SYS_SPI_U_BOOT_OFFS
123 #endif
124 
125 #if CONFIG_SPL_BOOT_DEVICE == SPL_BOOT_SDIO_MMC_CARD
126 /* SPL related MMC defines */
127 #define CONFIG_SPL_MMC_SUPPORT
128 #define CONFIG_SYS_MMC_U_BOOT_OFFS		(160 << 10)
129 #define CONFIG_SYS_U_BOOT_OFFS			CONFIG_SYS_MMC_U_BOOT_OFFS
130 #ifdef CONFIG_SPL_BUILD
131 #define CONFIG_FIXED_SDHCI_ALIGNED_BUFFER	0x00180000	/* in SDRAM */
132 #endif
133 #endif
134 /*
135  * mv-common.h should be defined after CMD configs since it used them
136  * to enable certain macros
137  */
138 #include "mv-common.h"
139 
140 /* Include the common distro boot environment */
141 #ifndef CONFIG_SPL_BUILD
142 
143 #ifdef CONFIG_MMC
144 #define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0)
145 #else
146 #define BOOT_TARGET_DEVICES_MMC(func)
147 #endif
148 
149 #ifdef CONFIG_USB_STORAGE
150 #define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0)
151 #else
152 #define BOOT_TARGET_DEVICES_USB(func)
153 #endif
154 
155 #ifdef CONFIG_SATA
156 #define BOOT_TARGET_DEVICES_SATA(func) func(SATA, sata, 0)
157 #else
158 #define BOOT_TARGET_DEVICES_SATA(func)
159 #endif
160 
161 #define BOOT_TARGET_DEVICES(func) \
162 	BOOT_TARGET_DEVICES_MMC(func) \
163 	BOOT_TARGET_DEVICES_USB(func) \
164 	BOOT_TARGET_DEVICES_SATA(func) \
165 	func(PXE, pxe, na) \
166 	func(DHCP, dhcp, na)
167 
168 #define KERNEL_ADDR_R	__stringify(0x800000)
169 #define FDT_ADDR_R	__stringify(0x100000)
170 #define RAMDISK_ADDR_R	__stringify(0x1800000)
171 #define SCRIPT_ADDR_R	__stringify(0x200000)
172 #define PXEFILE_ADDR_R	__stringify(0x300000)
173 
174 #define LOAD_ADDRESS_ENV_SETTINGS \
175 	"kernel_addr_r=" KERNEL_ADDR_R "\0" \
176 	"fdt_addr_r=" FDT_ADDR_R "\0" \
177 	"ramdisk_addr_r=" RAMDISK_ADDR_R "\0" \
178 	"scriptaddr=" SCRIPT_ADDR_R "\0" \
179 	"pxefile_addr_r=" PXEFILE_ADDR_R "\0"
180 
181 #include <config_distro_bootcmd.h>
182 
183 #define CONFIG_EXTRA_ENV_SETTINGS \
184 	RELOCATION_LIMITS_ENV_SETTINGS \
185 	LOAD_ADDRESS_ENV_SETTINGS \
186 	"fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \
187 	"console=ttyS0,115200\0" \
188 	BOOTENV
189 
190 #endif /* CONFIG_SPL_BUILD */
191 
192 #endif /* _CONFIG_HELIOS4_H */
193