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