1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 /* 3 * Copyright (C) 2015 Marek Vasut <marex@denx.de> 4 */ 5 #ifndef __CONFIG_SAMTEC_VINING_FPGA_H__ 6 #define __CONFIG_SAMTEC_VINING_FPGA_H__ 7 8 #include <asm/arch/base_addr_ac5.h> 9 10 /* Memory configurations */ 11 #define PHYS_SDRAM_1_SIZE 0x40000000 /* 1GiB on VINING_FPGA */ 12 13 /* Booting Linux */ 14 #define CONFIG_BOOTFILE "openwrt-socfpga-socfpga_cyclone5_vining_fpga-fit-uImage.itb" 15 #define CONFIG_BOOTCOMMAND "run selboot" 16 #define CONFIG_LOADADDR 0x01000000 17 #define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR 18 19 /* I2C EEPROM */ 20 #ifdef CONFIG_CMD_EEPROM 21 #define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 22 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1 23 #define CONFIG_SYS_I2C_EEPROM_BUS 0 24 #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3 25 #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 70 26 #endif 27 28 /* 29 * Status LEDs: 30 * 0 ... Top Green 31 * 1 ... Top Red 32 * 2 ... Bottom Green 33 * 3 ... Bottom Red 34 */ 35 36 /* Ethernet on SoC (EMAC) */ 37 #if defined(CONFIG_CMD_NET) 38 #define CONFIG_BOOTP_SEND_HOSTNAME 39 /* PHY */ 40 #endif 41 42 /* Extra Environment */ 43 #define CONFIG_HOSTNAME "socfpga_vining_fpga" 44 45 /* 46 * Active LOW GPIO buttons: 47 * A: GPIO 77 ... the button between USB B and ethernet 48 * B: GPIO 78 ... the button between USB A ports 49 * 50 * The logic: 51 * if button B is not pressed, boot normal Linux system immediatelly 52 * if button B is pressed, wait $bootdelay and boot recovery system 53 */ 54 #define CONFIG_PREBOOT \ 55 "setenv hostname vining-${unit_serial} ; " \ 56 "setenv PS1 \"${unit_ident} (${unit_serial}) => \" ; " \ 57 "if gpio input 78 ; then " \ 58 "setenv bootdelay 10 ; " \ 59 "setenv boottype rcvr ; " \ 60 "else " \ 61 "setenv bootdelay 5 ; " \ 62 "setenv boottype norm ; " \ 63 "fi" 64 65 #define CONFIG_EXTRA_ENV_SETTINGS \ 66 "verify=n\0" \ 67 "consdev=ttyS0\0" \ 68 "baudrate=115200\0" \ 69 "bootscript=boot.scr\0" \ 70 "ubimtdnr=5\0" \ 71 "ubimtd=rootfs\0" \ 72 "ubipart=ubi0:rootfs\0" \ 73 "ubisfcs=1\0" /* Default is flash at CS#1 */ \ 74 "netdev=eth0\0" \ 75 "hostname=vining_fpga\0" \ 76 "kernel_addr_r=0x10000000\0" \ 77 "mtdparts_0=ff705000.spi.0:" \ 78 "1m(u-boot)," \ 79 "64k(env1)," \ 80 "64k(env2)," \ 81 "256k(samtec1)," \ 82 "256k(samtec2)," \ 83 "-(rcvrfs)\0" /* Recovery */ \ 84 "mtdparts_1=ff705000.spi.1:" \ 85 "32m(rootfs)," \ 86 "-(userfs)\0" \ 87 "update_filename=u-boot-with-spl-dtb.sfp\0" \ 88 "update_qspi_offset=0x0\0" \ 89 "update_qspi=" /* Update the QSPI firmware */ \ 90 "if sf probe ; then " \ 91 "if tftp ${update_filename} ; then " \ 92 "sf update ${loadaddr} ${update_qspi_offset} ${filesize} ; " \ 93 "fi ; " \ 94 "fi\0" \ 95 "fpga_filename=output_file.rbf\0" \ 96 "load_fpga=" /* Load FPGA bitstream */ \ 97 "if tftp ${fpga_filename} ; then " \ 98 "fpga load 0 $loadaddr $filesize ; " \ 99 "bridge enable ; " \ 100 "fi\0" \ 101 "addcons=" \ 102 "setenv bootargs ${bootargs} " \ 103 "console=${consdev},${baudrate}\0" \ 104 "addip=" \ 105 "setenv bootargs ${bootargs} " \ 106 "ip=${ipaddr}:${serverip}:${gatewayip}:" \ 107 "${netmask}:${hostname}:${netdev}:off\0" \ 108 "addmisc=" \ 109 "setenv bootargs ${bootargs} ${miscargs}\0" \ 110 "addmtd=" \ 111 "setenv mtdparts \"${mtdparts_0};${mtdparts_1}\" ; " \ 112 "setenv bootargs ${bootargs} mtdparts=${mtdparts}\0" \ 113 "addargs=run addcons addmtd addmisc\0" \ 114 "ubiload=" \ 115 "ubi part ${ubimtd} ; ubifsmount ${ubipart} ; " \ 116 "ubifsload ${kernel_addr_r} /boot/${bootfile}\0" \ 117 "netload=" \ 118 "tftp ${kernel_addr_r} ${hostname}/${bootfile}\0" \ 119 "miscargs=nohlt panic=1\0" \ 120 "ubiargs=" \ 121 "setenv bootargs ubi.mtd=${ubimtdnr} " \ 122 "root=${ubipart} rootfstype=ubifs\0" \ 123 "nfsargs=" \ 124 "setenv bootargs root=/dev/nfs rw " \ 125 "nfsroot=${serverip}:${rootpath},v3,tcp\0" \ 126 "ubi_sfsel=" \ 127 "if test \"${boottype}\" = \"rcvr\" ; then " \ 128 "setenv ubisfcs 0 ; " \ 129 "setenv ubimtd rcvrfs ; " \ 130 "setenv ubimtdnr 5 ; " \ 131 "setenv mtdparts mtdparts=${mtdparts_0} ; " \ 132 "setenv mtdids nor0=ff705000.spi.0 ; " \ 133 "setenv ubipart ubi0:rootfs ; " \ 134 "else " \ 135 "setenv ubisfcs 1 ; " \ 136 "setenv ubimtd rootfs ; " \ 137 "setenv ubimtdnr 6 ; " \ 138 "setenv mtdparts mtdparts=${mtdparts_1} ; " \ 139 "setenv mtdids nor0=ff705000.spi.1 ; " \ 140 "setenv ubipart ubi0:rootfs ; " \ 141 "fi ; " \ 142 "sf probe 0:${ubisfcs}\0" \ 143 "ubi_ubi=" \ 144 "run ubi_sfsel ubiload ubiargs addargs ; " \ 145 "bootm ${kernel_addr_r}\0" \ 146 "ubi_nfs=" \ 147 "run ubiload nfsargs addip addargs ; " \ 148 "bootm ${kernel_addr_r}\0" \ 149 "net_ubi=" \ 150 "run netload ubiargs addargs ; " \ 151 "bootm ${kernel_addr_r}\0" \ 152 "net_nfs=" \ 153 "run netload nfsargs addip addargs ; " \ 154 "bootm ${kernel_addr_r}\0" \ 155 "selboot=" /* Select from where to boot. */ \ 156 "if test \"${bootmode}\" = \"qspi\" ; then " \ 157 "led all off ; " \ 158 "if test \"${boottype}\" = \"rcvr\" ; then " \ 159 "echo \"Booting recovery system\" ; " \ 160 "led 3 on ; " /* Bottom RED */ \ 161 "fi ; " \ 162 "led 1 on ; " /* Top RED */ \ 163 "run ubi_ubi ; " \ 164 "else echo \"Unsupported boot mode: \"${bootmode} ; " \ 165 "fi\0" \ 166 167 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT 168 #define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE 169 #define CONFIG_ENV_SECT_SIZE (64 * 1024) 170 #define CONFIG_ENV_OFFSET 0x100000 171 #define CONFIG_ENV_OFFSET_REDUND \ 172 (CONFIG_ENV_OFFSET + CONFIG_ENV_SECT_SIZE) 173 174 #define CONFIG_MISC_INIT_R 175 176 /* Support changing the prompt string */ 177 #define CONFIG_CMDLINE_PS_SUPPORT 178 179 /* The rest of the configuration is shared */ 180 #include <configs/socfpga_common.h> 181 182 #endif /* __CONFIG_SAMTEC_VINING_FPGA_H__ */ 183