arm: socfpga: move vining_fpga to DM_I2C
[oweals/u-boot.git] / include / configs / socfpga_vining_fpga.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2015 Marek Vasut <marex@denx.de>
4  */
5 #ifndef __CONFIG_SAMTEC_VINING_FPGA_H__
6 #define __CONFIG_SAMTEC_VINING_FPGA_H__
7
8 #include <asm/arch/base_addr_ac5.h>
9
10 /* Memory configurations */
11 #define PHYS_SDRAM_1_SIZE               0x40000000      /* 1GiB on VINING_FPGA */
12
13 /* Booting Linux */
14 #define CONFIG_BOOTFILE         "openwrt-socfpga-socfpga_cyclone5_vining_fpga-fit-uImage.itb"
15 #define CONFIG_BOOTCOMMAND      "run selboot"
16 #define CONFIG_LOADADDR         0x01000000
17 #define CONFIG_SYS_LOAD_ADDR    CONFIG_LOADADDR
18
19 /*
20  * Status LEDs:
21  *   0 ... Top Green
22  *   1 ... Top Red
23  *   2 ... Bottom Green
24  *   3 ... Bottom Red
25  */
26
27 /* Ethernet on SoC (EMAC) */
28 #if defined(CONFIG_CMD_NET)
29 #define CONFIG_BOOTP_SEND_HOSTNAME
30 /* PHY */
31 #endif
32
33 /* Extra Environment */
34 #define CONFIG_HOSTNAME                 "socfpga_vining_fpga"
35
36 /*
37  * Active LOW GPIO buttons:
38  * A: GPIO 77 ... the button between USB B and ethernet
39  * B: GPIO 78 ... the button between USB A ports
40  *
41  * The logic:
42  *  if button B is not pressed, boot normal Linux system immediatelly
43  *  if button B is pressed, wait $bootdelay and boot recovery system
44  */
45 #define CONFIG_PREBOOT                                          \
46         "setenv hostname vining-${unit_serial} ; "              \
47         "setenv PS1 \"${unit_ident} (${unit_serial}) => \" ; "  \
48         "if gpio input 78 ; then "                      \
49                 "setenv bootdelay 10 ; "                \
50                 "setenv boottype rcvr ; "               \
51         "else "                                         \
52                 "setenv bootdelay 5 ; "                 \
53                 "setenv boottype norm ; "               \
54         "fi"
55
56 #define CONFIG_EXTRA_ENV_SETTINGS \
57         "verify=n\0" \
58         "consdev=ttyS0\0"                                               \
59         "baudrate=115200\0"                                             \
60         "bootscript=boot.scr\0"                                         \
61         "ubimtdnr=5\0"                                                  \
62         "ubimtd=rootfs\0"                                               \
63         "ubipart=ubi0:rootfs\0"                                         \
64         "ubisfcs=1\0"           /* Default is flash at CS#1 */          \
65         "netdev=eth0\0"                                                 \
66         "hostname=vining_fpga\0"                                                \
67         "kernel_addr_r=0x10000000\0"                                    \
68         "mtdparts_0=ff705000.spi.0:"                                    \
69                 "1m(u-boot),"                                           \
70                 "64k(env1),"                                            \
71                 "64k(env2),"                                            \
72                 "256k(samtec1),"                                        \
73                 "256k(samtec2),"                                        \
74                 "-(rcvrfs)\0"   /* Recovery */                          \
75         "mtdparts_1=ff705000.spi.1:"                                    \
76                 "32m(rootfs),"                                          \
77                 "-(userfs)\0"                                           \
78         "update_filename=u-boot-with-spl-dtb.sfp\0"                     \
79         "update_qspi_offset=0x0\0"                                      \
80         "update_qspi="          /* Update the QSPI firmware */          \
81                 "if sf probe ; then "                                   \
82                 "if tftp ${update_filename} ; then "                    \
83                 "sf update ${loadaddr} ${update_qspi_offset} ${filesize} ; " \
84                 "fi ; "                                                 \
85                 "fi\0"                                                  \
86         "fpga_filename=output_file.rbf\0"                               \
87         "load_fpga="            /* Load FPGA bitstream */               \
88                 "if tftp ${fpga_filename} ; then "                      \
89                 "fpga load 0 $loadaddr $filesize ; "                    \
90                 "bridge enable ; "                                      \
91                 "fi\0"                                                  \
92         "addcons="                                                      \
93                 "setenv bootargs ${bootargs} "                          \
94                 "console=${consdev},${baudrate}\0"                      \
95         "addip="                                                        \
96                 "setenv bootargs ${bootargs} "                          \
97                 "ip=${ipaddr}:${serverip}:${gatewayip}:"                \
98                         "${netmask}:${hostname}:${netdev}:off\0"        \
99         "addmisc="                                                      \
100                 "setenv bootargs ${bootargs} ${miscargs}\0"             \
101         "addmtd="                                                       \
102                 "setenv mtdparts \"${mtdparts_0};${mtdparts_1}\" ; "    \
103                 "setenv bootargs ${bootargs} mtdparts=${mtdparts}\0"    \
104         "addargs=run addcons addmtd addmisc\0"                          \
105         "ubiload="                                                      \
106                 "ubi part ${ubimtd} ; ubifsmount ${ubipart} ; "         \
107                 "ubifsload ${kernel_addr_r} /boot/${bootfile}\0"        \
108         "netload="                                                      \
109                 "tftp ${kernel_addr_r} ${hostname}/${bootfile}\0"       \
110         "miscargs=nohlt panic=1\0"                                      \
111         "ubiargs="                                                      \
112                 "setenv bootargs ubi.mtd=${ubimtdnr} "                  \
113                 "root=${ubipart} rootfstype=ubifs\0"                    \
114         "nfsargs="                                                      \
115                 "setenv bootargs root=/dev/nfs rw "                     \
116                         "nfsroot=${serverip}:${rootpath},v3,tcp\0"      \
117         "ubi_sfsel="                                                    \
118                 "if test \"${boottype}\" = \"rcvr\" ; then "            \
119                         "setenv ubisfcs 0 ; "                           \
120                         "setenv ubimtd rcvrfs ; "                       \
121                         "setenv ubimtdnr 5 ; "                          \
122                         "setenv mtdparts mtdparts=${mtdparts_0} ; "     \
123                         "setenv mtdids nor0=ff705000.spi.0 ; "          \
124                         "setenv ubipart ubi0:rootfs ; "                 \
125                 "else "                                                 \
126                         "setenv ubisfcs 1 ; "                           \
127                         "setenv ubimtd rootfs ; "                       \
128                         "setenv ubimtdnr 6 ; "                          \
129                         "setenv mtdparts mtdparts=${mtdparts_1} ; "     \
130                         "setenv mtdids nor0=ff705000.spi.1 ; "          \
131                         "setenv ubipart ubi0:rootfs ; "                 \
132                 "fi ; "                                                 \
133                 "sf probe 0:${ubisfcs}\0"                               \
134         "ubi_ubi="                                                      \
135                 "run ubi_sfsel ubiload ubiargs addargs ; "              \
136                 "bootm ${kernel_addr_r}\0"                              \
137         "ubi_nfs="                                                      \
138                 "run ubiload nfsargs addip addargs ; "                  \
139                 "bootm ${kernel_addr_r}\0"                              \
140         "net_ubi="                                                      \
141                 "run netload ubiargs addargs ; "                        \
142                 "bootm ${kernel_addr_r}\0"                              \
143         "net_nfs="                                                      \
144                 "run netload nfsargs addip addargs ; "                  \
145                 "bootm ${kernel_addr_r}\0"                              \
146         "selboot="      /* Select from where to boot. */                \
147                 "if test \"${bootmode}\" = \"qspi\" ; then "            \
148                         "led all off ; "                                \
149                         "if test \"${boottype}\" = \"rcvr\" ; then "    \
150                                 "echo \"Booting recovery system\" ; "   \
151                                 "led 3 on ; "   /* Bottom RED */        \
152                         "fi ; "                                         \
153                         "led 1 on ; "           /* Top RED */           \
154                         "run ubi_ubi ; "                                \
155                 "else echo \"Unsupported boot mode: \"${bootmode} ; "   \
156                 "fi\0"                                                  \
157
158 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
159 #define CONFIG_ENV_SIZE_REDUND          CONFIG_ENV_SIZE
160 #define CONFIG_ENV_SECT_SIZE            (64 * 1024)
161 #define CONFIG_ENV_OFFSET               0x100000
162 #define CONFIG_ENV_OFFSET_REDUND        \
163         (CONFIG_ENV_OFFSET + CONFIG_ENV_SECT_SIZE)
164
165 /* Support changing the prompt string */
166 #define CONFIG_CMDLINE_PS_SUPPORT
167
168 /* The rest of the configuration is shared */
169 #include <configs/socfpga_common.h>
170
171 #endif  /* __CONFIG_SAMTEC_VINING_FPGA_H__ */