aboutsummaryrefslogtreecommitdiff
path: root/recipes-bsp/u-boot/files/v2017.03/0002-arm-socfpga-Update-DE0-Nano-SoC-to-support-distro-bo.patch
blob: 66739058cfed3f7d7848e53b8ba7b039fd812857 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
From 52dba58861c7c27659c30ee609c6c3438c7f88bb Mon Sep 17 00:00:00 2001
From: Dalon Westergreen <dwesterg@gmail.com>
Date: Mon, 6 Feb 2017 22:58:15 -0800
Subject: [PATCH 2/6] arm: socfpga: Update DE0 Nano SoC to support distro boot

Remove CONFIG_EXTRA_ENV_SETTINGS and relly on common enironment
defined in socfpga_common.h  This now suports distro boot

Signed-off-by: Dalon Westergreen <dwesterg@gmail.com>
---
 configs/socfpga_de0_nano_soc_defconfig |  4 ++
 include/configs/socfpga_de0_nano_soc.h | 80 +++++++++++++++++++++++++++-------
 2 files changed, 68 insertions(+), 16 deletions(-)

diff --git a/configs/socfpga_de0_nano_soc_defconfig b/configs/socfpga_de0_nano_soc_defconfig
index af41e1e..58139fa 100644
--- a/configs/socfpga_de0_nano_soc_defconfig
+++ b/configs/socfpga_de0_nano_soc_defconfig
@@ -4,6 +4,7 @@ CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_TARGET_SOCFPGA_TERASIC_DE0_NANO=y
 CONFIG_SPL_STACK_R_ADDR=0x00800000
 CONFIG_DEFAULT_DEVICE_TREE="socfpga_cyclone5_de0_nano_soc"
+CONFIG_DEFAULT_FDT_FILE="socfpga_cyclone5_de0_nano_soc.dtb"
 CONFIG_FIT=y
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
@@ -58,3 +59,6 @@ CONFIG_G_DNL_MANUFACTURER="terasic"
 CONFIG_G_DNL_VENDOR_NUM=0x0525
 CONFIG_G_DNL_PRODUCT_NUM=0xa4a5
 CONFIG_USE_TINY_PRINTF=y
+CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE=y
+CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_TYPE=0xa2
+CONFIG_GENERIC_MMC=y
\ No newline at end of file
diff --git a/include/configs/socfpga_de0_nano_soc.h b/include/configs/socfpga_de0_nano_soc.h
index f655972..b5bebbb 100644
--- a/include/configs/socfpga_de0_nano_soc.h
+++ b/include/configs/socfpga_de0_nano_soc.h
@@ -16,9 +16,8 @@
 #define PHYS_SDRAM_1_SIZE		0x40000000	/* 1GiB */
 
 /* Booting Linux */
-#define CONFIG_BOOTFILE		"fitImage"
+#define CONFIG_BOOTFILE		"zImage"
 #define CONFIG_BOOTARGS		"console=ttyS0," __stringify(CONFIG_BAUDRATE)
-#define CONFIG_BOOTCOMMAND	"run mmcload; run mmcboot"
 #define CONFIG_LOADADDR		0x01000000
 #define CONFIG_SYS_LOAD_ADDR	CONFIG_LOADADDR
 
@@ -30,22 +29,71 @@
 
 #define CONFIG_ENV_IS_IN_MMC
 
-/* Extra Environment */
+#ifndef CONFIG_SPL_BUILD
 #define CONFIG_EXTRA_ENV_SETTINGS \
-	"loadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
-	"ramboot=setenv bootargs " CONFIG_BOOTARGS ";" \
-		"bootm ${loadaddr} - ${fdt_addr}\0" \
-	"bootimage=zImage\0" \
+	"verify=n\0" \
+	"bootimage=" CONFIG_BOOTFILE "\0" \
 	"fdt_addr=100\0" \
-	"fdtimage=socfpga.dtb\0" \
-	"bootm ${loadaddr} - ${fdt_addr}\0" \
-	"mmcroot=/dev/mmcblk0p2\0" \
-	"mmcboot=setenv bootargs " CONFIG_BOOTARGS \
-		" root=${mmcroot} rw rootwait;" \
-		"bootz ${loadaddr} - ${fdt_addr}\0" \
-	"mmcload=mmc rescan;" \
-		"load mmc 0:1 ${loadaddr} ${bootimage};" \
-		"load mmc 0:1 ${fdt_addr} ${fdtimage}\0" \
+	"fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
+	"bootm_size=0xa000000\0" \
+	"kernel_addr_r="__stringify(CONFIG_SYS_LOAD_ADDR)"\0" \
+	"fdt_addr_r=0x02000000\0" \
+	"scriptaddr=0x02100000\0" \
+	"pxefile_addr_r=0x02200000\0" \
+	"ramdisk_addr_r=0x02300000\0" \
+	\
+	"fpga_cfg="							\
+		"env exists fpga_files || setenv fpga_files "		\
+			"${board}.rbf; "				\
+		"for target in ${boot_targets}; do "			\
+			"run fpga_cfg_${target}; "			\
+		"done\0"						\
+	\
+	"fpga_cfg_mmc0="						\
+		"setenv devnum 0; "					\
+		"setenv devtype mmc; "					\
+		"run scan_dev_for_boot_part_fpga\0"			\
+	\
+	"scan_dev_for_boot_part_fpga="					\
+		"part list ${devtype} ${devnum} -bootable devplist; "	\
+		"env exists devplist || setenv devplist 1; "		\
+		"for distro_bootpart in ${devplist}; do "		\
+			"if fstype ${devtype} "				\
+					"${devnum}:${distro_bootpart} "	\
+					"bootfstype; then "		\
+				"run scan_dev_for_boot_fpga; "		\
+			"fi; "						\
+		"done\0"						\
+	\
+	"scan_dev_for_boot_fpga="					\
+		"echo Scanning ${devtype} "				\
+			"${devnum}:${distro_bootpart}...; " 		\
+		"for prefix in ${boot_prefixes}; do "			\
+			"run scan_dev_for_fpga; "			\
+		"done\0"						\
+	\
+	"scan_dev_for_fpga="						\
+		"for file in ${fpga_files}; do "			\
+			"if test -e ${devtype} "			\
+					"${devnum}:${distro_bootpart} "	\
+					"${prefix}${file}; then "	\
+				"echo Found FPGA Configuration "	\
+					"${prefix}${file}; "		\
+				"load ${devtype} "			\
+					"${devnum}:${distro_bootpart} " \
+					"${kernel_addr_r} "		\
+					"${prefix}${file}; "		\
+				"fpga load 0 ${kernel_addr_r} "		\
+					"${filesize}; "			\
+				"bridge enable; "			\
+			"fi; "						\
+		"done\0"						\
+	\
+	BOOTENV
+
+#endif
+
+#define CONFIG_BOOTCOMMAND "run fpga_cfg; run distro_bootcmd"
 
 /* The rest of the configuration is shared */
 #include <configs/socfpga_common.h>
-- 
2.7.4