Convert CONFIG_SYS_CBSIZE to Kconfig
[platform/kernel/u-boot.git] / include / configs / socfpga_soc64_common.h
1 /* SPDX-License-Identifier: GPL-2.0
2  *
3  * Copyright (C) 2017-2019 Intel Corporation <www.intel.com>
4  *
5  */
6
7 #ifndef __CONFIG_SOCFPGA_SOC64_COMMON_H__
8 #define __CONFIG_SOCFPGA_SOC64_COMMON_H__
9
10 #include <asm/arch/base_addr_soc64.h>
11 #include <asm/arch/handoff_soc64.h>
12 #include <linux/stringify.h>
13
14 /*
15  * U-Boot general configurations
16  */
17 /* sysmgr.boot_scratch_cold4 & 5 (64bit) will be used for PSCI_CPU_ON call */
18 #define CPU_RELEASE_ADDR                0xFFD12210
19
20 /*
21  * U-Boot console configurations
22  */
23 #define CONFIG_SYS_BARGSIZE             CONFIG_SYS_CBSIZE
24
25 /* Extend size of kernel image for uncompression */
26 #define CONFIG_SYS_BOOTM_LEN            (32 * 1024 * 1024)
27
28 /*
29  * U-Boot run time memory configurations
30  */
31 #define CONFIG_SYS_INIT_RAM_ADDR        0xFFE00000
32 #define CONFIG_SYS_INIT_RAM_SIZE        0x40000
33 #ifdef CONFIG_SPL_BUILD
34 #define CONFIG_SYS_INIT_SP_ADDR         (CONFIG_SYS_INIT_RAM_ADDR  \
35                                         + CONFIG_SYS_INIT_RAM_SIZE \
36                                         - SOC64_HANDOFF_SIZE)
37 #else
38 #define CONFIG_SYS_INIT_SP_ADDR         (CONFIG_SYS_TEXT_BASE \
39                                         + 0x100000)
40 #endif
41 #define CONFIG_SYS_INIT_SP_OFFSET       (CONFIG_SYS_INIT_SP_ADDR)
42
43 /*
44  * U-Boot environment configurations
45  */
46
47 /*
48  * QSPI support
49  */
50  #ifdef CONFIG_CADENCE_QSPI
51 /* Enable it if you want to use dual-stacked mode */
52 /*#define CONFIG_QSPI_RBF_ADDR          0x720000*/
53
54 /* Flash device info */
55
56 #ifndef CONFIG_SPL_BUILD
57 #define MTDIDS_DEFAULT                  "nor0=ff705000.spi.0"
58 #endif /* CONFIG_SPL_BUILD */
59
60 #endif /* CONFIG_CADENCE_QSPI */
61
62 /*
63  * Environment variable
64  */
65 #define CONFIG_EXTRA_ENV_SETTINGS \
66         "loadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
67         "bootfile=" CONFIG_BOOTFILE "\0" \
68         "fdt_addr=8000000\0" \
69         "fdtimage=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \
70         "mmcroot=/dev/mmcblk0p2\0" \
71         "mmcboot=setenv bootargs " CONFIG_BOOTARGS \
72                 " root=${mmcroot} rw rootwait;" \
73                 "booti ${loadaddr} - ${fdt_addr}\0" \
74         "mmcload=mmc rescan;" \
75                 "load mmc 0:1 ${loadaddr} ${bootfile};" \
76                 "load mmc 0:1 ${fdt_addr} ${fdtimage}\0" \
77         "mmcfitboot=setenv bootargs " CONFIG_BOOTARGS \
78                 " root=${mmcroot} rw rootwait;" \
79                 "bootm ${loadaddr}\0" \
80         "mmcfitload=mmc rescan;" \
81                 "load mmc 0:1 ${loadaddr} ${bootfile}\0" \
82         "linux_qspi_enable=if sf probe; then " \
83                 "echo Enabling QSPI at Linux DTB...;" \
84                 "fdt addr ${fdt_addr}; fdt resize;" \
85                 "fdt set /soc/spi@ff8d2000 status okay;" \
86                 "fdt set /soc/clkmgr/clocks/qspi_clk clock-frequency " \
87                 " ${qspi_clock}; fi; \0" \
88         "scriptaddr=0x02100000\0" \
89         "scriptfile=u-boot.scr\0" \
90         "fatscript=if fatload mmc 0:1 ${scriptaddr} ${scriptfile};" \
91                    "then source ${scriptaddr}; fi\0" \
92         "socfpga_legacy_reset_compat=1\0"
93
94 /*
95  * External memory configurations
96  */
97 #define PHYS_SDRAM_1                    0x0
98 #define PHYS_SDRAM_1_SIZE               (1 * 1024 * 1024 * 1024)
99 #define CONFIG_SYS_SDRAM_BASE           0
100
101 /*
102  * Serial / UART configurations
103  */
104 #define CONFIG_SYS_NS16550_CLK          100000000
105 #define CONFIG_SYS_NS16550_MEM32
106
107 /*
108  * SDMMC configurations
109  */
110 #ifdef CONFIG_CMD_MMC
111 #define CONFIG_SYS_MMC_MAX_BLK_COUNT    256
112 #endif
113 /*
114  * Flash configurations
115  */
116
117 /* Ethernet on SoC (EMAC) */
118 #if defined(CONFIG_CMD_NET)
119 #define CONFIG_DW_ALTDESCRIPTOR
120 #endif /* CONFIG_CMD_NET */
121
122 /*
123  * L4 Watchdog
124  */
125 #define CONFIG_DW_WDT_BASE              SOCFPGA_L4WD0_ADDRESS
126 #ifdef CONFIG_TARGET_SOCFPGA_STRATIX10
127 #ifndef __ASSEMBLY__
128 unsigned int cm_get_l4_sys_free_clk_hz(void);
129 #define CONFIG_DW_WDT_CLOCK_KHZ         (cm_get_l4_sys_free_clk_hz() / 1000)
130 #endif
131 #else
132 #define CONFIG_DW_WDT_CLOCK_KHZ         100000
133 #endif
134
135 /*
136  * SPL memory layout
137  *
138  * On chip RAM
139  * 0xFFE0_0000 ...... Start of OCRAM
140  * SPL code, rwdata
141  * empty space
142  * 0xFFEx_xxxx ...... Top of stack (grows down)
143  * 0xFFEy_yyyy ...... Global Data
144  * 0xFFEz_zzzz ...... Malloc prior relocation (size CONFIG_SYS_MALLOC_F_LEN)
145  * 0xFFE3_F000 ...... Hardware handdoff blob (size 4KB)
146  * 0xFFE3_FFFF ...... End of OCRAM
147  *
148  * SDRAM
149  * 0x0000_0000 ...... Start of SDRAM_1
150  * unused / empty space for image loading
151  * Size 64MB   ...... MALLOC (size CONFIG_SYS_SPL_MALLOC_SIZE)
152  * Size 1MB    ...... BSS (size CONFIG_SPL_BSS_MAX_SIZE)
153  * 0x8000_0000 ...... End of SDRAM_1 (assume 2GB)
154  *
155  */
156 #define CONFIG_SPL_TARGET               "spl/u-boot-spl-dtb.hex"
157 #define CONFIG_SPL_MAX_SIZE             CONFIG_SYS_INIT_RAM_SIZE
158 #define CONFIG_SPL_STACK                CONFIG_SYS_INIT_SP_ADDR
159 #define CONFIG_SPL_BSS_MAX_SIZE         0x100000        /* 1 MB */
160 #define CONFIG_SPL_BSS_START_ADDR       (PHYS_SDRAM_1 + PHYS_SDRAM_1_SIZE \
161                                         - CONFIG_SPL_BSS_MAX_SIZE)
162 #define CONFIG_SYS_SPL_MALLOC_SIZE      (CONFIG_SYS_MALLOC_LEN)
163 #define CONFIG_SYS_SPL_MALLOC_START     (CONFIG_SPL_BSS_START_ADDR \
164                                         - CONFIG_SYS_SPL_MALLOC_SIZE)
165
166 /* SPL SDMMC boot support */
167 #ifdef CONFIG_SPL_LOAD_FIT
168 #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME         "u-boot.itb"
169 #else
170 #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME         "u-boot.img"
171 #endif
172
173 #endif  /* __CONFIG_SOCFPGA_SOC64_COMMON_H__ */