Convert CONFIG_FLASH_SHOW_PROGRESS to Kconfig
[platform/kernel/u-boot.git] / include / configs / p1_p2_rdb_pc.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright 2010-2011 Freescale Semiconductor, Inc.
4  * Copyright 2020 NXP
5  */
6
7 /*
8  * QorIQ RDB boards configuration file
9  */
10 #ifndef __CONFIG_H
11 #define __CONFIG_H
12
13 #include <linux/stringify.h>
14
15 #if defined(CONFIG_TARGET_P1020RDB_PC)
16 #define CONFIG_SLIC
17 #define __SW_BOOT_MASK          0x03
18 #define __SW_BOOT_NOR           0x5c
19 #define __SW_BOOT_SPI           0x1c
20 #define __SW_BOOT_SD            0x9c
21 #define __SW_BOOT_NAND          0xec
22 #define __SW_BOOT_PCIE          0x6c
23 #define __SW_NOR_BANK_MASK      0xfd
24 #define __SW_NOR_BANK_UP        0x00
25 #define __SW_NOR_BANK_LO        0x02
26 #define __SW_BOOT_NOR_BANK_UP   0x5c /* (__SW_BOOT_NOR | __SW_NOR_BANK_UP) */
27 #define __SW_BOOT_NOR_BANK_LO   0x5e /* (__SW_BOOT_NOR | __SW_NOR_BANK_LO) */
28 #define __SW_BOOT_NOR_BANK_MASK 0x01 /* (__SW_BOOT_MASK & __SW_NOR_BANK_MASK) */
29 #endif
30
31 /*
32  * P1020RDB-PD board has user selectable switches for evaluating different
33  * frequency and boot options for the P1020 device. The table that
34  * follow describe the available options. The front six binary number was in
35  * accordance with SW3[1:6].
36  * 111101 533 533 267 667 NOR Core0 boot; Core1 hold-off
37  * 101101 667 667 333 667 NOR Core0 boot; Core1 hold-off
38  * 011001 800 800 400 667 NOR Core0 boot; Core1 hold-off
39  * 001001 800 800 400 667 SD/MMC Core0 boot; Core1 hold-off
40  * 001101 800 800 400 667 SPI Core0 boot; Core1 hold-off
41  * 010001 800 800 400 667 NAND Core0 boot; Core1 hold-off
42  * 011101 800 800 400 667 PCIe-2 Core0 boot; Core1 hold-off
43  */
44 #if defined(CONFIG_TARGET_P1020RDB_PD)
45 #define CONFIG_SLIC
46 #define __SW_BOOT_MASK          0x03
47 #define __SW_BOOT_NOR           0x64
48 #define __SW_BOOT_SPI           0x34
49 #define __SW_BOOT_SD            0x24
50 #define __SW_BOOT_NAND          0x44
51 #define __SW_BOOT_PCIE          0x74
52 #define __SW_NOR_BANK_MASK      0xfd
53 #define __SW_NOR_BANK_UP        0x00
54 #define __SW_NOR_BANK_LO        0x02
55 #define __SW_BOOT_NOR_BANK_UP   0x64 /* (__SW_BOOT_NOR | __SW_NOR_BANK_UP) */
56 #define __SW_BOOT_NOR_BANK_LO   0x66 /* (__SW_BOOT_NOR | __SW_NOR_BANK_LO) */
57 #define __SW_BOOT_NOR_BANK_MASK 0x01 /* (__SW_BOOT_MASK & __SW_NOR_BANK_MASK) */
58 /*
59  * Dynamic MTD Partition support with mtdparts
60  */
61 #endif
62
63 #if defined(CONFIG_TARGET_P2020RDB)
64 #define __SW_BOOT_MASK          0x03
65 #define __SW_BOOT_NOR           0xc8
66 #define __SW_BOOT_SPI           0x28
67 #define __SW_BOOT_SD            0x68
68 #define __SW_BOOT_SD2           0x18
69 #define __SW_BOOT_NAND          0xe8
70 #define __SW_BOOT_PCIE          0xa8
71 #define __SW_NOR_BANK_MASK      0xfd
72 #define __SW_NOR_BANK_UP        0x00
73 #define __SW_NOR_BANK_LO        0x02
74 #define __SW_BOOT_NOR_BANK_UP   0xc8 /* (__SW_BOOT_NOR | __SW_NOR_BANK_UP) */
75 #define __SW_BOOT_NOR_BANK_LO   0xca /* (__SW_BOOT_NOR | __SW_NOR_BANK_LO) */
76 #define __SW_BOOT_NOR_BANK_MASK 0x01 /* (__SW_BOOT_MASK & __SW_NOR_BANK_MASK) */
77 /*
78  * Dynamic MTD Partition support with mtdparts
79  */
80 #endif
81
82 #ifdef CONFIG_SDCARD
83 #define CFG_SYS_MMC_U_BOOT_SIZE (768 << 10)
84 #define CFG_SYS_MMC_U_BOOT_DST  CONFIG_TEXT_BASE
85 #define CFG_SYS_MMC_U_BOOT_START        CONFIG_TEXT_BASE
86 #ifdef CONFIG_FSL_PREPBL_ESDHC_BOOT_SECTOR
87 #define CFG_SYS_MMC_U_BOOT_OFFS (CONFIG_SPL_PAD_TO - CONFIG_FSL_PREPBL_ESDHC_BOOT_SECTOR_DATA*512)
88 #else
89 #define CFG_SYS_MMC_U_BOOT_OFFS CONFIG_SPL_PAD_TO
90 #endif
91 #elif defined(CONFIG_SPIFLASH)
92 #define CFG_SYS_SPI_FLASH_U_BOOT_SIZE   (768 << 10)
93 #define CFG_SYS_SPI_FLASH_U_BOOT_DST            CONFIG_TEXT_BASE
94 #define CFG_SYS_SPI_FLASH_U_BOOT_START  CONFIG_TEXT_BASE
95 #define CFG_SYS_SPI_FLASH_U_BOOT_OFFS   CONFIG_SPL_PAD_TO
96 #elif defined(CONFIG_MTD_RAW_NAND)
97 #ifdef CONFIG_TPL_BUILD
98 #define CFG_SYS_NAND_U_BOOT_SIZE        (832 << 10)
99 #define CFG_SYS_NAND_U_BOOT_DST (0x11000000)
100 #define CFG_SYS_NAND_U_BOOT_START       (0x11000000)
101 #elif defined(CONFIG_SPL_BUILD)
102 #define CFG_SYS_NAND_U_BOOT_SIZE        (128 << 10)
103 #define CFG_SYS_NAND_U_BOOT_DST 0xf8f80000
104 #define CFG_SYS_NAND_U_BOOT_START       0xf8f80000
105 #endif /* not CONFIG_TPL_BUILD */
106 #endif
107
108 #ifndef CONFIG_RESET_VECTOR_ADDRESS
109 #define CONFIG_RESET_VECTOR_ADDRESS     0xeffffffc
110 #endif
111
112 /*
113  * These can be toggled for performance analysis, otherwise use default.
114  */
115 #define CONFIG_L2_CACHE
116
117 #define CFG_SYS_CCSRBAR         0xffe00000
118 #define CFG_SYS_CCSRBAR_PHYS_LOW        CFG_SYS_CCSRBAR
119
120 /* DDR Setup */
121 #define SPD_EEPROM_ADDRESS 0x52
122
123 #if defined(CONFIG_TARGET_P1020RDB_PD)
124 #define CFG_SYS_SDRAM_SIZE_LAW  LAW_SIZE_2G
125 #else
126 #define CFG_SYS_SDRAM_SIZE_LAW  LAW_SIZE_1G
127 #endif
128 #define CFG_SYS_SDRAM_SIZE              (1u << (CFG_SYS_SDRAM_SIZE_LAW - 19))
129 #define CFG_SYS_DDR_SDRAM_BASE  0x00000000
130 #define CFG_SYS_SDRAM_BASE              CFG_SYS_DDR_SDRAM_BASE
131
132 /* Default settings for DDR3 */
133 #ifndef CONFIG_TARGET_P2020RDB
134 #define CFG_SYS_DDR_CS0_BNDS            0x0000003f
135 #define CFG_SYS_DDR_CS0_CONFIG  0x80014302
136 #define CFG_SYS_DDR_CS0_CONFIG_2        0x00000000
137 #define CFG_SYS_DDR_CS1_BNDS            0x0040007f
138 #define CFG_SYS_DDR_CS1_CONFIG  0x80014302
139 #define CFG_SYS_DDR_CS1_CONFIG_2        0x00000000
140
141 #define CFG_SYS_DDR_INIT_ADDR   0x00000000
142 #define CFG_SYS_DDR_INIT_EXT_ADDR       0x00000000
143 #define CFG_SYS_DDR_MODE_CONTROL        0x00000000
144
145 #define CFG_SYS_DDR_ZQ_CONTROL  0x89080600
146 #define CFG_SYS_DDR_WRLVL_CONTROL       0x8655A608
147 #define CFG_SYS_DDR_SR_CNTR             0x00000000
148 #define CFG_SYS_DDR_RCW_1               0x00000000
149 #define CFG_SYS_DDR_RCW_2               0x00000000
150 #define CFG_SYS_DDR_CONTROL             0xC70C0000      /* Type = DDR3  */
151 #define CFG_SYS_DDR_CONTROL_2   0x04401050
152 #define CFG_SYS_DDR_TIMING_4            0x00220001
153 #define CFG_SYS_DDR_TIMING_5            0x03402400
154
155 #define CFG_SYS_DDR_TIMING_3            0x00020000
156 #define CFG_SYS_DDR_TIMING_0            0x00330004
157 #define CFG_SYS_DDR_TIMING_1            0x6f6B4846
158 #define CFG_SYS_DDR_TIMING_2            0x0FA8C8CF
159 #define CFG_SYS_DDR_CLK_CTRL            0x03000000
160 #define CFG_SYS_DDR_MODE_1              0x40461520
161 #define CFG_SYS_DDR_MODE_2              0x8000c000
162 #define CFG_SYS_DDR_INTERVAL            0x0C300000
163 #endif
164
165 /*
166  * Memory map
167  *
168  * 0x0000_0000 0x7fff_ffff      DDR             Up to 2GB cacheable
169  * 0x8000_0000 0xdfff_ffff      PCI Express Mem 1.5G non-cacheable(PCIe * 3)
170  * 0xec00_0000 0xefff_ffff      NOR flash       Up to 64M non-cacheable CS0/1
171  * 0xf8f8_0000 0xf8ff_ffff      L2 SRAM         Up to 512K cacheable
172  *   (early boot only)
173  * 0xff80_0000 0xff80_7fff      NAND flash      32K non-cacheable       CS1/0
174  * 0xffa0_0000 0xffaf_ffff      CPLD            1M non-cacheable        CS3
175  * 0xffb0_0000 0xffbf_ffff      VSC7385 switch  1M non-cacheable        CS2
176  * 0xffc0_0000 0xffc3_ffff      PCI IO range    256k non-cacheable
177  * 0xffd0_0000 0xffd0_3fff      L1 for stack    16K cacheable
178  * 0xffe0_0000 0xffef_ffff      CCSR            1M non-cacheable
179  */
180
181 /*
182  * Local Bus Definitions
183  */
184 #if defined(CONFIG_TARGET_P1020RDB_PD)
185 #define CFG_SYS_FLASH_BASE              0xec000000
186 #else
187 #define CFG_SYS_FLASH_BASE              0xef000000
188 #endif
189
190 #ifdef CONFIG_PHYS_64BIT
191 #define CFG_SYS_FLASH_BASE_PHYS (0xf00000000ull | CFG_SYS_FLASH_BASE)
192 #else
193 #define CFG_SYS_FLASH_BASE_PHYS CFG_SYS_FLASH_BASE
194 #endif
195
196 #define CONFIG_FLASH_BR_PRELIM (BR_PHYS_ADDR(CFG_SYS_FLASH_BASE_PHYS) \
197         | BR_PS_16 | BR_V)
198
199 #define CONFIG_FLASH_OR_PRELIM  0xfc000ff7
200
201 #define CFG_SYS_FLASH_BANKS_LIST        {CFG_SYS_FLASH_BASE_PHYS}
202
203 /* Nand Flash */
204 #ifdef CONFIG_NAND_FSL_ELBC
205 #define CFG_SYS_NAND_BASE               0xff800000
206 #ifdef CONFIG_PHYS_64BIT
207 #define CFG_SYS_NAND_BASE_PHYS  0xfff800000ull
208 #else
209 #define CFG_SYS_NAND_BASE_PHYS  CFG_SYS_NAND_BASE
210 #endif
211
212 #define CFG_SYS_NAND_BASE_LIST  { CFG_SYS_NAND_BASE }
213
214 #define CFG_SYS_NAND_BR_PRELIM (BR_PHYS_ADDR(CFG_SYS_NAND_BASE_PHYS) \
215         | (2<<BR_DECC_SHIFT)    /* Use HW ECC */ \
216         | BR_PS_8       /* Port Size = 8 bit */ \
217         | BR_MS_FCM     /* MSEL = FCM */ \
218         | BR_V) /* valid */
219 #if defined(CONFIG_TARGET_P1020RDB_PD)
220 #define CFG_SYS_NAND_OR_PRELIM  (OR_AM_32KB \
221         | OR_FCM_PGS    /* Large Page*/ \
222         | OR_FCM_CSCT \
223         | OR_FCM_CST \
224         | OR_FCM_CHT \
225         | OR_FCM_SCY_1 \
226         | OR_FCM_TRLX \
227         | OR_FCM_EHTR)
228 #else
229 #define CFG_SYS_NAND_OR_PRELIM  (OR_AM_32KB     /* small page */ \
230         | OR_FCM_CSCT \
231         | OR_FCM_CST \
232         | OR_FCM_CHT \
233         | OR_FCM_SCY_1 \
234         | OR_FCM_TRLX \
235         | OR_FCM_EHTR)
236 #endif
237 #endif /* CONFIG_NAND_FSL_ELBC */
238
239 #define CFG_SYS_INIT_RAM_ADDR   0xffd00000 /* stack in RAM */
240 #ifdef CONFIG_PHYS_64BIT
241 #define CFG_SYS_INIT_RAM_ADDR_PHYS_HIGH 0xf
242 #define CFG_SYS_INIT_RAM_ADDR_PHYS_LOW CFG_SYS_INIT_RAM_ADDR
243 /* The assembler doesn't like typecast */
244 #define CFG_SYS_INIT_RAM_ADDR_PHYS \
245         ((CFG_SYS_INIT_RAM_ADDR_PHYS_HIGH * 1ull << 32) | \
246           CFG_SYS_INIT_RAM_ADDR_PHYS_LOW)
247 #else
248 /* Initial L1 address */
249 #define CFG_SYS_INIT_RAM_ADDR_PHYS      CFG_SYS_INIT_RAM_ADDR
250 #define CFG_SYS_INIT_RAM_ADDR_PHYS_HIGH 0
251 #define CFG_SYS_INIT_RAM_ADDR_PHYS_LOW CFG_SYS_INIT_RAM_ADDR_PHYS
252 #endif
253 /* Size of used area in RAM */
254 #define CFG_SYS_INIT_RAM_SIZE   0x00004000
255
256 #define CFG_SYS_INIT_SP_OFFSET  (CFG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
257
258 #define CFG_SYS_CPLD_BASE       0xffa00000
259 #ifdef CONFIG_PHYS_64BIT
260 #define CFG_SYS_CPLD_BASE_PHYS  0xfffa00000ull
261 #else
262 #define CFG_SYS_CPLD_BASE_PHYS  CFG_SYS_CPLD_BASE
263 #endif
264 /* CPLD config size: 1Mb */
265
266 /* Vsc7385 switch */
267 #ifdef CONFIG_VSC7385_ENET
268 #define __VSCFW_ADDR                    "vscfw_addr=ef000000\0"
269 #define CFG_SYS_VSC7385_BASE            0xffb00000
270
271 #ifdef CONFIG_PHYS_64BIT
272 #define CFG_SYS_VSC7385_BASE_PHYS       0xfffb00000ull
273 #else
274 #define CFG_SYS_VSC7385_BASE_PHYS       CFG_SYS_VSC7385_BASE
275 #endif
276
277 /* The size of the VSC7385 firmware image */
278 #define CONFIG_VSC7385_IMAGE_SIZE       8192
279 #endif
280
281 #ifndef __VSCFW_ADDR
282 #define __VSCFW_ADDR ""
283 #endif
284
285 /*
286  * Config the L2 Cache as L2 SRAM
287 */
288 #if defined(CONFIG_SPL_BUILD)
289 #if defined(CONFIG_SDCARD) || defined(CONFIG_SPIFLASH)
290 #define CFG_SYS_INIT_L2_ADDR            0xf8f80000
291 #define CFG_SYS_INIT_L2_ADDR_PHYS       CFG_SYS_INIT_L2_ADDR
292 #define CFG_SYS_INIT_L2_END     (CFG_SYS_INIT_L2_ADDR + CONFIG_SYS_L2_SIZE)
293 #elif defined(CONFIG_MTD_RAW_NAND)
294 #ifdef CONFIG_TPL_BUILD
295 #define CFG_SYS_INIT_L2_ADDR            0xf8f80000
296 #define CFG_SYS_INIT_L2_ADDR_PHYS       CFG_SYS_INIT_L2_ADDR
297 #define CFG_SYS_INIT_L2_END     (CFG_SYS_INIT_L2_ADDR + CONFIG_SYS_L2_SIZE)
298 #else
299 #define CFG_SYS_INIT_L2_ADDR            0xf8f80000
300 #define CFG_SYS_INIT_L2_ADDR_PHYS       CFG_SYS_INIT_L2_ADDR
301 #define CFG_SYS_INIT_L2_END     (CFG_SYS_INIT_L2_ADDR + CONFIG_SYS_L2_SIZE)
302 #endif /* CONFIG_TPL_BUILD */
303 #endif
304 #endif
305
306 /* Serial Port - controlled on board with jumper J8
307  * open - index 2
308  * shorted - index 1
309  */
310 #undef CONFIG_SERIAL_SOFTWARE_FIFO
311 #define CFG_SYS_NS16550_CLK             get_bus_freq(0)
312
313 #define CFG_SYS_BAUDRATE_TABLE  \
314         {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
315
316 #define CFG_SYS_NS16550_COM1    (CFG_SYS_CCSRBAR+0x4500)
317 #define CFG_SYS_NS16550_COM2    (CFG_SYS_CCSRBAR+0x4600)
318
319 /* I2C */
320 #if !CONFIG_IS_ENABLED(DM_I2C)
321 #define CFG_SYS_I2C_NOPROBES            { {0, 0x29} }
322 #endif
323
324 /*
325  * I2C2 EEPROM
326  */
327
328 #define CFG_SYS_I2C_RTC_ADDR            0x68
329 #define CFG_SYS_I2C_PCA9557_ADDR        0x18
330
331 /* enable read and write access to EEPROM */
332
333 #if defined(CONFIG_PCI)
334 /*
335  * General PCI
336  * Memory space is mapped 1-1, but I/O space must start from 0.
337  */
338
339 /* controller 2, direct to uli, tgtid 2, Base address 9000 */
340 #define CFG_SYS_PCIE2_MEM_VIRT  0xa0000000
341 #ifdef CONFIG_PHYS_64BIT
342 #define CFG_SYS_PCIE2_MEM_PHYS  0xc20000000ull
343 #else
344 #define CFG_SYS_PCIE2_MEM_PHYS  0xa0000000
345 #endif
346 #define CFG_SYS_PCIE2_IO_VIRT   0xffc10000
347 #ifdef CONFIG_PHYS_64BIT
348 #define CFG_SYS_PCIE2_IO_PHYS   0xfffc10000ull
349 #else
350 #define CFG_SYS_PCIE2_IO_PHYS   0xffc10000
351 #endif
352
353 /* controller 1, Slot 2, tgtid 1, Base address a000 */
354 #define CFG_SYS_PCIE1_MEM_VIRT  0x80000000
355 #ifdef CONFIG_PHYS_64BIT
356 #define CFG_SYS_PCIE1_MEM_PHYS  0xc00000000ull
357 #else
358 #define CFG_SYS_PCIE1_MEM_PHYS  0x80000000
359 #endif
360 #define CFG_SYS_PCIE1_IO_VIRT   0xffc00000
361 #ifdef CONFIG_PHYS_64BIT
362 #define CFG_SYS_PCIE1_IO_PHYS   0xfffc00000ull
363 #else
364 #define CFG_SYS_PCIE1_IO_PHYS   0xffc00000
365 #endif
366 #endif /* CONFIG_PCI */
367
368 /*
369  * Environment
370  */
371 #if defined(CONFIG_MTD_RAW_NAND)
372 #ifdef CONFIG_TPL_BUILD
373 #define SPL_ENV_ADDR            (CFG_SYS_INIT_L2_ADDR + (160 << 10))
374 #endif
375 #endif
376
377 /*
378  * USB
379  */
380
381 #ifdef CONFIG_MMC
382 #define CFG_SYS_FSL_ESDHC_ADDR  CFG_SYS_MPC85xx_ESDHC_ADDR
383 #endif
384
385 /*
386  * Miscellaneous configurable options
387  */
388
389 /*
390  * For booting Linux, the board info and command line data
391  * have to be in the first 64 MB of memory, since this is
392  * the maximum mapped by the Linux kernel during initialization.
393  */
394 #define CFG_SYS_BOOTMAPSZ       (64 << 20)      /* Initial Memory for Linux*/
395
396 /*
397  * Environment Configuration
398  */
399 #define CONFIG_HOSTNAME         "unknown"
400 #define CONFIG_ROOTPATH         "/opt/nfsroot"
401 #define CONFIG_UBOOTPATH        u-boot.bin /* U-Boot image on TFTP server */
402
403 #include "p1_p2_bootsrc.h"
404
405 #define CONFIG_EXTRA_ENV_SETTINGS       \
406 "netdev=eth0\0" \
407 "uboot=" __stringify(CONFIG_UBOOTPATH) "\0"     \
408 "loadaddr=1000000\0"    \
409 "bootfile=uImage\0"     \
410 "tftpflash=tftpboot $loadaddr $uboot; " \
411         "protect off " __stringify(CONFIG_TEXT_BASE) " +$filesize; " \
412         "erase " __stringify(CONFIG_TEXT_BASE) " +$filesize; "  \
413         "cp.b $loadaddr " __stringify(CONFIG_TEXT_BASE) " $filesize; " \
414         "protect on " __stringify(CONFIG_TEXT_BASE) " +$filesize; "     \
415         "cmp.b $loadaddr " __stringify(CONFIG_TEXT_BASE) " $filesize\0" \
416 "hwconfig=usb1:dr_mode=host,phy_type=ulpi\0"    \
417 "consoledev=ttyS0\0"    \
418 "ramdiskaddr=2000000\0" \
419 "ramdiskfile=rootfs.ext2.gz.uboot\0"    \
420 "fdtaddr=1e00000\0"     \
421 "bdev=sda1\0" \
422 "jffs2nor=mtdblock3\0"  \
423 "norbootaddr=ef080000\0"        \
424 "norfdtaddr=ef040000\0" \
425 "jffs2nand=mtdblock9\0" \
426 "nandbootaddr=100000\0" \
427 "nandfdtaddr=80000\0"           \
428 "ramdisk_size=120000\0" \
429 __VSCFW_ADDR    \
430 MAP_NOR_LO_CMD(map_lowernorbank) \
431 MAP_NOR_UP_CMD(map_uppernorbank) \
432 RST_NOR_CMD(norboot) \
433 RST_NOR_LO_CMD(norlowerboot) \
434 RST_NOR_UP_CMD(norupperboot) \
435 RST_SPI_CMD(spiboot) \
436 RST_SD_CMD(sdboot) \
437 RST_SD2_CMD(sd2boot) \
438 RST_NAND_CMD(nandboot) \
439 RST_PCIE_CMD(pciboot) \
440 RST_DEF_CMD(defboot) \
441 ""
442
443 #endif /* __CONFIG_H */