Merge https://source.denx.de/u-boot/custodians/u-boot-spi
[platform/kernel/u-boot.git] / include / configs / socfpga_arria5_secu1.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2017-2020 Hitachi Power Grids
4  *
5  */
6 #ifndef __CONFIG_SOCFPGA_SECU1_H__
7 #define __CONFIG_SOCFPGA_SECU1_H__
8
9 #include <asm/arch/base_addr_ac5.h>
10 #include <linux/stringify.h>
11
12 /* Eternal oscillator */
13 #define CONFIG_SYS_TIMER_RATE   40000000
14
15 /* Memory configurations */
16 #define PHYS_SDRAM_1_SIZE       0x20000000      /* 512MiB on SECU1 */
17
18 /*
19  * We use bootcounter in i2c nvram of the RTC (0x68)
20  * The offset fopr the bootcounter is 0x9e, which are
21  * the last two bytes of the 128 bytes large NVRAM in the
22  * RTC which begin at address 0x20
23  */
24 #define CONFIG_SYS_I2C_RTC_ADDR         0x68
25
26 /* Environment settings */
27
28 /*
29  * FPGA Remote Update related environment
30  *
31  * Note that since those commands access the FPGA, the HPS-to-FPGA
32  * bridges MUST have been previously enabled (for example
33  * with 'bridge enable').
34  */
35 #define FPGA_RMTU_ENV \
36         "rmtu_page=0xFF29000C\0" \
37         "rmtu_reconfig=0xFF290018\0" \
38         "fpga_safebase=0x0\0" \
39         "fpga_userbase=0x2000000\0" \
40         "_fpga_loaduser=echo Loading FPGA USER image..." \
41                 " && mw ${rmtu_page} ${fpga_userbase} && mw ${rmtu_reconfig} 1\0" \
42         "_fpga_loadsafe=echo Loading FPGA SAFE image..." \
43                 " && mw ${rmtu_page} ${fpga_safebase} && mw ${rmtu_reconfig} 1\0" \
44
45 #define CONFIG_KM_NEW_ENV \
46         "newenv=" \
47                 "nand erase 0x100000 0x40000\0"
48
49 #define CONFIG_KM_DEF_ENV_BOOTTARGETS \
50         "release=" \
51                 "run newenv; reset\0" \
52         "develop=" \
53                 "tftp 0x200000 scripts/develop-secu.txt && env import -t 0x200000 ${filesize} && saveenv && reset\0"
54
55 #define CONFIG_EXTRA_ENV_SETTINGS \
56         FPGA_RMTU_ENV \
57         CONFIG_KM_DEF_ENV_BOOTTARGETS \
58         CONFIG_KM_NEW_ENV \
59         "socfpga_legacy_reset_compat=1\0"       \
60         "altbootcmd=run bootcmd;\0"     \
61         "bootlimit=6\0" \
62         "bootnum=1\0" \
63         "bootretry=" __stringify(CONFIG_BOOT_RETRY_TIME) "\0" \
64         "fdt_addr=" __stringify(CONFIG_KM_FDT_ADDR) "\0" \
65         "load=tftpboot ${loadaddr} u-boot-with-nand-spl.sfp\0" \
66         "loadaddr=" __stringify(CONFIG_KM_KERNEL_ADDR) "\0" \
67         "update=nand erase 0x0 0x00100000 && nand write ${loadaddr} 0x0 ${filesize}\0" \
68         "userload=ubi part nand.ubi &&" \
69                 "ubi check rootfs$bootnum &&" \
70                 "ubi read $fdt_addr dtb$bootnum &&" \
71                 "ubi read $loadaddr kernel$bootnum\0" \
72         "userboot=setenv bootargs " CONFIG_BOOTARGS \
73                 " ubi.mtd=1 ubi.block=0,rootfs$bootnum root=/dev/ubiblock0_$ubivolid"   \
74                 " ro rootfstype=squashfs init=sbin/preinit;" \
75                 "bootz ${loadaddr} - ${fdt_addr}\0" \
76         "verify=y\0"
77
78 /* The rest of the configuration is shared */
79 #include <configs/socfpga_common.h>
80
81 #endif  /* __CONFIG_SOCFPGA_SECU1_H__ */