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