1 /*
2  * Copyright (C) 2015 Stefan Roese <sr@denx.de>
3  *
4  * SPDX-License-Identifier:	GPL-2.0+
5  */
6 #ifndef __CONFIG_SOCFPGA_SR1500_H__
7 #define __CONFIG_SOCFPGA_SR1500_H__
8 
9 #include <asm/arch/base_addr_ac5.h>
10 
11 #define CONFIG_BOARD_EARLY_INIT_F
12 
13 #define CONFIG_SYS_NO_FLASH
14 #define CONFIG_DOS_PARTITION
15 #define CONFIG_FAT_WRITE
16 
17 #define CONFIG_HW_WATCHDOG
18 
19 /* Memory configurations */
20 #define PHYS_SDRAM_1_SIZE		0x40000000	/* 1GiB on SR1500 */
21 
22 /* Booting Linux */
23 #define CONFIG_BOOTDELAY	3
24 #define CONFIG_BOOTFILE		"uImage"
25 #define CONFIG_BOOTARGS		"console=ttyS0" __stringify(CONFIG_BAUDRATE)
26 #define CONFIG_BOOTCOMMAND	"run mmcload; run mmcboot"
27 #define CONFIG_LOADADDR		0x01000000
28 #define CONFIG_SYS_LOAD_ADDR	CONFIG_LOADADDR
29 #define CONFIG_SYS_CONSOLE_INFO_QUIET	/* don't print console @ startup */
30 
31 /* Ethernet on SoC (EMAC) */
32 #define CONFIG_PHY_INTERFACE_MODE	PHY_INTERFACE_MODE_RGMII
33 /* The PHY is autodetected, so no MII PHY address is needed here */
34 #define CONFIG_PHY_MARVELL
35 #define PHY_ANEG_TIMEOUT	8000
36 
37 #define CONFIG_EXTRA_ENV_SETTINGS \
38 	"verify=n\0" \
39 	"loadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
40 	"ramboot=setenv bootargs " CONFIG_BOOTARGS ";" \
41 		"bootm ${loadaddr} - ${fdt_addr}\0" \
42 	"bootimage=zImage\0" \
43 	"fdt_addr=100\0" \
44 	"fdtimage=socfpga.dtb\0" \
45 		"fsloadcmd=ext2load\0" \
46 	"bootm ${loadaddr} - ${fdt_addr}\0" \
47 	"mmcroot=/dev/mmcblk0p2\0" \
48 	"mmcboot=setenv bootargs " CONFIG_BOOTARGS \
49 		" root=${mmcroot} rw rootwait;" \
50 		"bootz ${loadaddr} - ${fdt_addr}\0" \
51 	"mmcload=mmc rescan;" \
52 		"load mmc 0:1 ${loadaddr} ${bootimage};" \
53 		"load mmc 0:1 ${fdt_addr} ${fdtimage}\0" \
54 	"qspiload=sf probe && mtdparts default && run ubiload\0" \
55 	"qspiboot=setenv bootargs " CONFIG_BOOTARGS \
56 		" ubi.mtd=1,64 root=ubi0:rootfs rw rootfstype=ubifs;"\
57 		"bootz ${loadaddr} - ${fdt_addr}\0" \
58 	"ubiload=ubi part UBI && ubifsmount ubi0 && " \
59 		"ubifsload ${loadaddr} /boot/${bootimage} && " \
60 		"ubifsload ${fdt_addr} /boot/${fdtimage}\0"
61 
62 /* Environment */
63 #define CONFIG_ENV_IS_IN_SPI_FLASH
64 
65 /* Enable SPI NOR flash reset, needed for SPI booting */
66 #define CONFIG_SPI_N25Q256A_RESET
67 
68 /*
69  * Bootcounter
70  */
71 #define CONFIG_BOOTCOUNT_LIMIT
72 /* last 2 lwords in OCRAM */
73 #define CONFIG_SYS_BOOTCOUNT_ADDR	0xfffffff8
74 #define CONFIG_SYS_BOOTCOUNT_BE
75 
76 /* Environment setting for SPI flash */
77 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
78 #define CONFIG_ENV_SECT_SIZE	(64 * 1024)
79 #define CONFIG_ENV_SIZE		(16 * 1024)
80 #define CONFIG_ENV_OFFSET	0x000e0000
81 #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + CONFIG_ENV_SECT_SIZE)
82 #define CONFIG_ENV_SPI_BUS	0
83 #define CONFIG_ENV_SPI_CS	0
84 #define CONFIG_ENV_SPI_MODE	SPI_MODE_3
85 #define CONFIG_ENV_SPI_MAX_HZ	100000000	/* Use max of 100MHz */
86 #define CONFIG_SF_DEFAULT_SPEED	100000000
87 
88 /*
89  * The QSPI NOR flash layout on SR1500:
90  *
91  * 0000.0000 - 0003.ffff: SPL (4 times)
92  * 0004.0000 - 000d.ffff: U-Boot
93  * 000e.0000 - 000e.ffff: env1
94  * 000f.0000 - 000f.ffff: env2
95  */
96 
97 /* The rest of the configuration is shared */
98 #include <configs/socfpga_common.h>
99 
100 #endif	/* __CONFIG_SOCFPGA_SR1500_H__ */
101