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