Holger Brunck | ddef889 | 2020-02-19 19:55:14 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 | /* |
Holger Brunck | 7216252 | 2020-10-08 12:27:22 +0200 | [diff] [blame] | 3 | * Copyright (C) 2017-2020 Hitachi Power Grids |
Holger Brunck | ddef889 | 2020-02-19 19:55:14 +0100 | [diff] [blame] | 4 | * |
| 5 | */ |
| 6 | #ifndef __CONFIG_SOCFPGA_SECU1_H__ |
| 7 | #define __CONFIG_SOCFPGA_SECU1_H__ |
| 8 | |
| 9 | #include <asm/arch/base_addr_ac5.h> |
Simon Glass | fb64e36 | 2020-05-10 11:40:09 -0600 | [diff] [blame] | 10 | #include <linux/stringify.h> |
Holger Brunck | ddef889 | 2020-02-19 19:55:14 +0100 | [diff] [blame] | 11 | |
Holger Brunck | ddef889 | 2020-02-19 19:55:14 +0100 | [diff] [blame] | 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 | |
Holger Brunck | ddef889 | 2020-02-19 19:55:14 +0100 | [diff] [blame] | 26 | #define CONFIG_SYS_BOOTM_LEN (64 << 20) |
| 27 | |
| 28 | /* Environment settings */ |
Holger Brunck | ddef889 | 2020-02-19 19:55:14 +0100 | [diff] [blame] | 29 | |
| 30 | /* |
Holger Brunck | ddef889 | 2020-02-19 19:55:14 +0100 | [diff] [blame] | 31 | * FPGA Remote Update related environment |
| 32 | * |
| 33 | * Note that since those commands access the FPGA, the HPS-to-FPGA |
| 34 | * bridges MUST have been previously enabled (for example |
| 35 | * with 'bridge enable'). |
| 36 | */ |
| 37 | #define FPGA_RMTU_ENV \ |
| 38 | "rmtu_page=0xFF29000C\0" \ |
| 39 | "rmtu_reconfig=0xFF290018\0" \ |
| 40 | "fpga_safebase=0x0\0" \ |
| 41 | "fpga_userbase=0x2000000\0" \ |
| 42 | "_fpga_loaduser=echo Loading FPGA USER image..." \ |
| 43 | " && mw ${rmtu_page} ${fpga_userbase} && mw ${rmtu_reconfig} 1\0" \ |
| 44 | "_fpga_loadsafe=echo Loading FPGA SAFE image..." \ |
| 45 | " && mw ${rmtu_page} ${fpga_safebase} && mw ${rmtu_reconfig} 1\0" \ |
| 46 | |
| 47 | #define CONFIG_KM_NEW_ENV \ |
| 48 | "newenv=" \ |
| 49 | "nand erase 0x100000 0x40000\0" |
| 50 | |
| 51 | #define CONFIG_KM_DEF_ENV_BOOTTARGETS \ |
| 52 | "release=" \ |
| 53 | "run newenv; reset\0" \ |
| 54 | "develop=" \ |
| 55 | "tftp 0x200000 scripts/develop-secu.txt && env import -t 0x200000 ${filesize} && saveenv && reset\0" |
| 56 | |
| 57 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
| 58 | FPGA_RMTU_ENV \ |
| 59 | CONFIG_KM_DEF_ENV_BOOTTARGETS \ |
| 60 | CONFIG_KM_NEW_ENV \ |
| 61 | "socfpga_legacy_reset_compat=1\0" \ |
| 62 | "altbootcmd=run bootcmd;\0" \ |
| 63 | "bootlimit=6\0" \ |
| 64 | "bootnum=1\0" \ |
| 65 | "bootretry=" __stringify(CONFIG_BOOT_RETRY_TIME) "\0" \ |
| 66 | "fdt_addr=" __stringify(CONFIG_KM_FDT_ADDR) "\0" \ |
| 67 | "load=tftpboot ${loadaddr} u-boot-with-nand-spl.sfp\0" \ |
| 68 | "loadaddr=" __stringify(CONFIG_KM_KERNEL_ADDR) "\0" \ |
| 69 | "mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \ |
| 70 | "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \ |
| 71 | "update=nand erase 0x0 0x00100000 && nand write ${loadaddr} 0x0 ${filesize}\0" \ |
| 72 | "userload=ubi part nand.ubi &&" \ |
| 73 | "ubi check rootfs$bootnum &&" \ |
| 74 | "ubi read $fdt_addr dtb$bootnum &&" \ |
| 75 | "ubi read $loadaddr kernel$bootnum\0" \ |
| 76 | "userboot=setenv bootargs " CONFIG_BOOTARGS \ |
| 77 | " ubi.mtd=1 ubi.block=0,rootfs$bootnum root=/dev/ubiblock0_$ubivolid" \ |
| 78 | " ro rootfstype=squashfs init=sbin/preinit;" \ |
| 79 | "bootz ${loadaddr} - ${fdt_addr}\0" \ |
| 80 | "verify=y\0" |
| 81 | |
| 82 | /* The rest of the configuration is shared */ |
| 83 | #include <configs/socfpga_common.h> |
| 84 | |
Holger Brunck | ddef889 | 2020-02-19 19:55:14 +0100 | [diff] [blame] | 85 | #endif /* __CONFIG_SOCFPGA_SECU1_H__ */ |