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