Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 2 | /* |
Marek Vasut | 13da18c | 2019-06-27 00:19:31 +0200 | [diff] [blame] | 3 | * Copyright (C) 2015-2019 Marek Vasut <marex@denx.de> |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 4 | */ |
Marek Vasut | 13da18c | 2019-06-27 00:19:31 +0200 | [diff] [blame] | 5 | #ifndef __CONFIG_SOFTING_VINING_FPGA_H__ |
| 6 | #define __CONFIG_SOFTING_VINING_FPGA_H__ |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 7 | |
| 8 | #include <asm/arch/base_addr_ac5.h> |
| 9 | |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 10 | /* Memory configurations */ |
| 11 | #define PHYS_SDRAM_1_SIZE 0x40000000 /* 1GiB on VINING_FPGA */ |
| 12 | |
| 13 | /* Booting Linux */ |
Marek Vasut | 82d27a1 | 2019-06-27 00:19:34 +0200 | [diff] [blame] | 14 | #define CONFIG_BOOTFILE "fitImage" |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 15 | #define CONFIG_BOOTCOMMAND "run selboot" |
Marek Vasut | 82d27a1 | 2019-06-27 00:19:34 +0200 | [diff] [blame] | 16 | #define CONFIG_SYS_BOOTM_LEN 0x2000000 /* 32 MiB */ |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 17 | |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 18 | /* Ethernet on SoC (EMAC) */ |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 19 | |
| 20 | /* Extra Environment */ |
Mario Six | 790d844 | 2018-03-28 14:38:20 +0200 | [diff] [blame] | 21 | #define CONFIG_HOSTNAME "socfpga_vining_fpga" |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 22 | |
| 23 | /* |
| 24 | * Active LOW GPIO buttons: |
| 25 | * A: GPIO 77 ... the button between USB B and ethernet |
| 26 | * B: GPIO 78 ... the button between USB A ports |
| 27 | * |
| 28 | * The logic: |
Marek Vasut | 82d27a1 | 2019-06-27 00:19:34 +0200 | [diff] [blame] | 29 | * if button B is pressed, boot recovery system after 10 seconds |
| 30 | * if force_boottype is set, boot system depending on the value in the |
| 31 | * $force_boottype variable after 1 second |
| 32 | * if button B is not pressed and force_boottype is not set, boot normal |
| 33 | * Linux system after 5 seconds |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 34 | */ |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 35 | |
| 36 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
| 37 | "verify=n\0" \ |
| 38 | "consdev=ttyS0\0" \ |
| 39 | "baudrate=115200\0" \ |
| 40 | "bootscript=boot.scr\0" \ |
| 41 | "ubimtdnr=5\0" \ |
| 42 | "ubimtd=rootfs\0" \ |
Marek Vasut | 82d27a1 | 2019-06-27 00:19:34 +0200 | [diff] [blame] | 43 | "ubipart=ubi0:vining-fpga-rootfs\0" \ |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 44 | "ubisfcs=1\0" /* Default is flash at CS#1 */ \ |
| 45 | "netdev=eth0\0" \ |
Marek Vasut | 82d27a1 | 2019-06-27 00:19:34 +0200 | [diff] [blame] | 46 | "hostname=vining_fpga\0" \ |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 47 | "kernel_addr_r=0x10000000\0" \ |
Marek Vasut | 82d27a1 | 2019-06-27 00:19:34 +0200 | [diff] [blame] | 48 | "fdt_addr_r=0x20000000\0" \ |
| 49 | "fdt_high=0xffffffff\0" \ |
| 50 | "initrd_high=0xffffffff\0" \ |
| 51 | "dfu_alt_info=qspi0 sf 0:0;qspi1 sf 0:1\0" \ |
| 52 | "mtdparts_0_16m=ff705000.spi.0:" /* 16MiB+128MiB SF config */ \ |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 53 | "1m(u-boot)," \ |
| 54 | "64k(env1)," \ |
| 55 | "64k(env2)," \ |
Marek Vasut | 13da18c | 2019-06-27 00:19:31 +0200 | [diff] [blame] | 56 | "256k(softing1)," \ |
| 57 | "256k(softing2)," \ |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 58 | "-(rcvrfs)\0" /* Recovery */ \ |
Marek Vasut | 82d27a1 | 2019-06-27 00:19:34 +0200 | [diff] [blame] | 59 | "mtdparts_0_256m=ff705000.spi.0:" /* 256MiB(+256MiB) config */ \ |
| 60 | "1m(u-boot)," \ |
| 61 | "64k(env1)," \ |
| 62 | "64k(env2)," \ |
| 63 | "256k(softing1)," \ |
| 64 | "256k(softing2)," \ |
| 65 | "14720k(rcvrfs)," /* Recovery */ \ |
| 66 | "64m(rootfs)," /* Root */ \ |
| 67 | "-(userfs)\0" /* User */ \ |
| 68 | "mtdparts_1_128m=ff705000.spi.1:" /* 16MiB+128MiB SF config */ \ |
| 69 | "64m(rootfs)," \ |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 70 | "-(userfs)\0" \ |
Marek Vasut | 82d27a1 | 2019-06-27 00:19:34 +0200 | [diff] [blame] | 71 | "mtdparts_1_256m=ff705000.spi.1:" /* 256MiB+256MiB SF config */ \ |
| 72 | "-(userfs2)\0" \ |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 73 | "update_filename=u-boot-with-spl-dtb.sfp\0" \ |
| 74 | "update_qspi_offset=0x0\0" \ |
| 75 | "update_qspi=" /* Update the QSPI firmware */ \ |
| 76 | "if sf probe ; then " \ |
| 77 | "if tftp ${update_filename} ; then " \ |
| 78 | "sf update ${loadaddr} ${update_qspi_offset} ${filesize} ; " \ |
| 79 | "fi ; " \ |
| 80 | "fi\0" \ |
Marek Vasut | 82d27a1 | 2019-06-27 00:19:34 +0200 | [diff] [blame] | 81 | "sf_identify=" \ |
| 82 | "setenv sf_size_0 ; setenv sf_size_1 ; " \ |
| 83 | "sf probe 0:0 && setenv sf_size_0 ${sf_size} ; " \ |
| 84 | "sf probe 0:1 && setenv sf_size_1 ${sf_size} ; " \ |
| 85 | "if test -z \"${sf_size_1}\" ; then " \ |
| 86 | /* 1x256MiB SF */ \ |
| 87 | "setenv mtdparts_0 ${mtdparts_0_256m} ; " \ |
| 88 | "setenv mtdparts_1 ; " \ |
| 89 | "elif test \"${sf_size_0}\" = \"1000000\" ; then " \ |
| 90 | /* 16MiB+128MiB SF */ \ |
| 91 | "setenv mtdparts_0 ${mtdparts_0_16m} ; " \ |
| 92 | "setenv mtdparts_1 ${mtdparts_1_128m} ; " \ |
| 93 | "else " \ |
| 94 | /* 256MiB+256MiB SF */ \ |
| 95 | "setenv mtdparts_0 ${mtdparts_0_256m} ; " \ |
| 96 | "setenv mtdparts_1 ${mtdparts_1_256m} ; " \ |
| 97 | "fi\0" \ |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 98 | "fpga_filename=output_file.rbf\0" \ |
| 99 | "load_fpga=" /* Load FPGA bitstream */ \ |
| 100 | "if tftp ${fpga_filename} ; then " \ |
| 101 | "fpga load 0 $loadaddr $filesize ; " \ |
| 102 | "bridge enable ; " \ |
| 103 | "fi\0" \ |
| 104 | "addcons=" \ |
| 105 | "setenv bootargs ${bootargs} " \ |
| 106 | "console=${consdev},${baudrate}\0" \ |
| 107 | "addip=" \ |
| 108 | "setenv bootargs ${bootargs} " \ |
| 109 | "ip=${ipaddr}:${serverip}:${gatewayip}:" \ |
| 110 | "${netmask}:${hostname}:${netdev}:off\0" \ |
| 111 | "addmisc=" \ |
| 112 | "setenv bootargs ${bootargs} ${miscargs}\0" \ |
| 113 | "addmtd=" \ |
Marek Vasut | 82d27a1 | 2019-06-27 00:19:34 +0200 | [diff] [blame] | 114 | "if test -z \"${sf_size_1}\" ; then " \ |
| 115 | "setenv mtdparts \"${mtdparts_0}\" ; " \ |
| 116 | "else " \ |
| 117 | "setenv mtdparts \"${mtdparts_0};${mtdparts_1}\" ; " \ |
| 118 | "fi ; " \ |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 119 | "setenv bootargs ${bootargs} mtdparts=${mtdparts}\0" \ |
| 120 | "addargs=run addcons addmtd addmisc\0" \ |
| 121 | "ubiload=" \ |
| 122 | "ubi part ${ubimtd} ; ubifsmount ${ubipart} ; " \ |
| 123 | "ubifsload ${kernel_addr_r} /boot/${bootfile}\0" \ |
| 124 | "netload=" \ |
| 125 | "tftp ${kernel_addr_r} ${hostname}/${bootfile}\0" \ |
| 126 | "miscargs=nohlt panic=1\0" \ |
| 127 | "ubiargs=" \ |
| 128 | "setenv bootargs ubi.mtd=${ubimtdnr} " \ |
| 129 | "root=${ubipart} rootfstype=ubifs\0" \ |
| 130 | "nfsargs=" \ |
| 131 | "setenv bootargs root=/dev/nfs rw " \ |
| 132 | "nfsroot=${serverip}:${rootpath},v3,tcp\0" \ |
| 133 | "ubi_sfsel=" \ |
| 134 | "if test \"${boottype}\" = \"rcvr\" ; then " \ |
| 135 | "setenv ubisfcs 0 ; " \ |
| 136 | "setenv ubimtd rcvrfs ; " \ |
| 137 | "setenv ubimtdnr 5 ; " \ |
| 138 | "setenv mtdparts mtdparts=${mtdparts_0} ; " \ |
| 139 | "setenv mtdids nor0=ff705000.spi.0 ; " \ |
Marek Vasut | 82d27a1 | 2019-06-27 00:19:34 +0200 | [diff] [blame] | 140 | "setenv ubipart ubi0:vining-fpga-rootfs ; " \ |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 141 | "else " \ |
Marek Vasut | 82d27a1 | 2019-06-27 00:19:34 +0200 | [diff] [blame] | 142 | "if test \"${sf_size_0}\" = \"1000000\" ; then "\ |
| 143 | /* 16MiB+128MiB SF */ \ |
| 144 | "setenv ubisfcs 1 ; " \ |
| 145 | "setenv ubimtd rootfs ; " \ |
| 146 | "setenv ubimtdnr 6 ; " \ |
| 147 | "setenv mtdparts mtdparts=${mtdparts_1} ; " \ |
| 148 | "setenv mtdids nor0=ff705000.spi.1 ; " \ |
| 149 | "setenv ubipart ubi0:vining-fpga-rootfs ; " \ |
| 150 | "else " \ |
| 151 | /* 256MiB(+256MiB) SF */ \ |
| 152 | "setenv ubisfcs 0 ; " \ |
| 153 | "setenv ubimtd rootfs ; " \ |
| 154 | "setenv ubimtdnr 6 ; " \ |
| 155 | "setenv mtdparts mtdparts=${mtdparts_0} ; " \ |
| 156 | "setenv mtdids nor0=ff705000.spi.0 ; " \ |
| 157 | "setenv ubipart ubi0:vining-fpga-rootfs ; " \ |
| 158 | "fi ; " \ |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 159 | "fi ; " \ |
| 160 | "sf probe 0:${ubisfcs}\0" \ |
Marek Vasut | 82d27a1 | 2019-06-27 00:19:34 +0200 | [diff] [blame] | 161 | "boot_kernel=" \ |
| 162 | "if test -z \"${sf_size_1}\" ; then " /* 1x256MiB SF */ \ |
| 163 | "imxtract ${kernel_addr_r} fdt@1 ${fdt_addr_r} && " \ |
| 164 | "fdt addr ${fdt_addr_r} && " \ |
| 165 | "fdt resize && " \ |
| 166 | "fdt set /soc/spi@ff705000/n25q00@1 status disabled && " \ |
| 167 | "bootm ${kernel_addr_r}:kernel@1 - ${fdt_addr_r} ; " \ |
| 168 | "else " \ |
| 169 | "bootm ${kernel_addr_r} ; " \ |
| 170 | "fi\0" \ |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 171 | "ubi_ubi=" \ |
Marek Vasut | 82d27a1 | 2019-06-27 00:19:34 +0200 | [diff] [blame] | 172 | "run ubi_sfsel ubiload ubiargs addargs boot_kernel\0" \ |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 173 | "ubi_nfs=" \ |
Marek Vasut | 82d27a1 | 2019-06-27 00:19:34 +0200 | [diff] [blame] | 174 | "run ubiload nfsargs addip addargs boot_kernel\0" \ |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 175 | "net_ubi=" \ |
Marek Vasut | 82d27a1 | 2019-06-27 00:19:34 +0200 | [diff] [blame] | 176 | "run netload ubiargs addargs boot_kernel\0" \ |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 177 | "net_nfs=" \ |
Marek Vasut | 82d27a1 | 2019-06-27 00:19:34 +0200 | [diff] [blame] | 178 | "run netload nfsargs addip addargs boot_kernel\0" \ |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 179 | "selboot=" /* Select from where to boot. */ \ |
Marek Vasut | 82d27a1 | 2019-06-27 00:19:34 +0200 | [diff] [blame] | 180 | "run sf_identify ; " \ |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 181 | "if test \"${bootmode}\" = \"qspi\" ; then " \ |
| 182 | "led all off ; " \ |
| 183 | "if test \"${boottype}\" = \"rcvr\" ; then " \ |
| 184 | "echo \"Booting recovery system\" ; " \ |
| 185 | "led 3 on ; " /* Bottom RED */ \ |
| 186 | "fi ; " \ |
| 187 | "led 1 on ; " /* Top RED */ \ |
| 188 | "run ubi_ubi ; " \ |
| 189 | "else echo \"Unsupported boot mode: \"${bootmode} ; " \ |
| 190 | "fi\0" \ |
Simon Goldschmidt | db3c244 | 2019-07-10 22:09:14 +0200 | [diff] [blame] | 191 | "socfpga_legacy_reset_compat=1\0" |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 192 | |
Marek Vasut | ba2ade9 | 2015-12-01 18:09:52 +0100 | [diff] [blame] | 193 | /* Support changing the prompt string */ |
| 194 | #define CONFIG_CMDLINE_PS_SUPPORT |
| 195 | |
| 196 | /* The rest of the configuration is shared */ |
| 197 | #include <configs/socfpga_common.h> |
| 198 | |
Marek Vasut | 13da18c | 2019-06-27 00:19:31 +0200 | [diff] [blame] | 199 | #endif /* __CONFIG_SOFTING_VINING_FPGA_H__ */ |