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