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