summaryrefslogtreecommitdiffstats
path: root/recipes-bsp
diff options
context:
space:
mode:
authorJason Wu <jason.wu.misc@gmail.com>2016-04-09 02:16:06 +1000
committerNathan Rossi <nathan@nathanrossi.com>2016-05-03 21:51:05 +1000
commit258f7d63e7a994f2f7e4a5d10076a12ca6e97e5d (patch)
tree31feab9cb122d3deb0fbdaae97abcdf541b802a2 /recipes-bsp
parent9d7e01003326a39020bb9ac1be4fd5dd72a0e38a (diff)
downloadmeta-xilinx-258f7d63e7a994f2f7e4a5d10076a12ca6e97e5d.tar.gz
u-boot_2016.03: Add SPL load bitstream and uEnv.txt support
Adds two patches that supports the follows: - SPL loading bistream support - Loading uEnv.txt via MMC or USB and enable u-boot to load uEnv.txt from MMC when set to MMC boot mode. Signed-off-by: Jason Wu <jason.wu.misc@gmail.com> Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
Diffstat (limited to 'recipes-bsp')
-rw-r--r--recipes-bsp/u-boot/u-boot/configs-zynq-common-Add-uEnv.txt-support.patch66
-rw-r--r--recipes-bsp/u-boot/u-boot/zynq-Add-fpga-support-to-u-boot-SPL.patch130
-rw-r--r--recipes-bsp/u-boot/u-boot_2016.03.bbappend4
3 files changed, 200 insertions, 0 deletions
diff --git a/recipes-bsp/u-boot/u-boot/configs-zynq-common-Add-uEnv.txt-support.patch b/recipes-bsp/u-boot/u-boot/configs-zynq-common-Add-uEnv.txt-support.patch
new file mode 100644
index 00000000..ddc1cddf
--- /dev/null
+++ b/recipes-bsp/u-boot/u-boot/configs-zynq-common-Add-uEnv.txt-support.patch
@@ -0,0 +1,66 @@
1From 4dd0f06c46085cacc607dabbdf288bef6ad67115 Mon Sep 17 00:00:00 2001
2From: Michal Simek <monstr@monstr.eu>
3Date: Fri, 18 Mar 2016 23:43:39 +0100
4Subject: [PATCH] configs: zynq-common: Add uEnv.txt support
5
6preboot macro load the uEnv.txt from mmc 0 when bootmode is mmc. uenvcmd is
7executed after load of uEnv.txt if it is defined in the uEnv.txt env text
8file.
9
10The default importbootenv macro reads the uEnv.txt from mmc.
11
12Additional to this, usb_loadbootenv is added to support loading uEnv.txt
13from usb dev 0.
14
15Upstream-Status: Backport
16
17Signed-off-by: Michal Simek <monstr@monstr.eu>
18Signed-off-by: Jason Wu <jason.wu.misc@gmail.com>
19
20diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h
21index 4cb490b..5e3ce95 100644
22--- a/include/configs/zynq-common.h
23+++ b/include/configs/zynq-common.h
24@@ -206,6 +206,9 @@
25 # define CONFIG_ENV_OFFSET 0xE0000
26 #endif
27
28+/* enable preboot to be loaded before CONFIG_BOOTDELAY */
29+#define CONFIG_PREBOOT
30+
31 /* Default environment */
32 #ifndef CONFIG_EXTRA_ENV_SETTINGS
33 #define CONFIG_EXTRA_ENV_SETTINGS \
34@@ -216,6 +219,29 @@
35 "nor_flash_off=0xE2100000\0" \
36 "fdt_high=0x20000000\0" \
37 "initrd_high=0x20000000\0" \
38+ "loadbootenv_addr=0x2000000\0" \
39+ "bootenv=uEnv.txt\0" \
40+ "bootenv_dev=mmc\0" \
41+ "loadbootenv=load ${bootenv_dev} 0 ${loadbootenv_addr} ${bootenv}\0" \
42+ "importbootenv=echo Importing environment from ${bootenv_dev} ...; " \
43+ "env import -t ${loadbootenv_addr} $filesize\0" \
44+ "bootenv_existence_test=test -e ${bootenv_dev} 0 /${bootenv}\0" \
45+ "setbootenv=if env run bootenv_existence_test; then " \
46+ "if env run loadbootenv; then " \
47+ "env run importbootenv; " \
48+ "fi; " \
49+ "fi; \0" \
50+ "sd_loadbootenv=set bootenv_dev mmc && " \
51+ "run setbootenv \0" \
52+ "usb_loadbootenv=set bootenv_dev usb && usb start && run setbootenv \0" \
53+ "preboot=if test $modeboot = sdboot; then " \
54+ "run sd_loadbootenv; " \
55+ "echo Checking if uenvcmd is set ...; " \
56+ "if test -n $uenvcmd; then " \
57+ "echo Running uenvcmd ...; " \
58+ "run uenvcmd; " \
59+ "fi; " \
60+ "fi; \0" \
61 "norboot=echo Copying FIT from NOR flash to RAM... && " \
62 "cp.b ${nor_flash_off} ${load_addr} ${fit_size} && " \
63 "bootm ${load_addr}\0" \
64--
651.9.1
66
diff --git a/recipes-bsp/u-boot/u-boot/zynq-Add-fpga-support-to-u-boot-SPL.patch b/recipes-bsp/u-boot/u-boot/zynq-Add-fpga-support-to-u-boot-SPL.patch
new file mode 100644
index 00000000..ab355af8
--- /dev/null
+++ b/recipes-bsp/u-boot/u-boot/zynq-Add-fpga-support-to-u-boot-SPL.patch
@@ -0,0 +1,130 @@
1From 14c84972b2c0a32664b3b392d18161998cd1200f Mon Sep 17 00:00:00 2001
2From: Michal Simek <michal.simek@xilinx.com>
3Date: Fri, 18 Mar 2016 17:24:48 +0100
4Subject: [PATCH] zynq: Add fpga support to u-boot SPL
5
6Load bitstream in SPL. "bitstream" can be in bit or bin format.
7
8Upstream-Status: Pending
9
10Signed-off-by: Jason Wu <jason.hy.wu@gmail.com>
11Signed-off-by: Michal Simek <michal.simek@xilinx.com>
12
13diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
14index c27a250..181e40f 100644
15--- a/common/spl/spl_mmc.c
16+++ b/common/spl/spl_mmc.c
17@@ -15,6 +15,9 @@
18 #include <errno.h>
19 #include <mmc.h>
20 #include <image.h>
21+#include <fat.h>
22+#include <fpga.h>
23+#include <xilinx.h>
24
25 DECLARE_GLOBAL_DATA_PTR;
26
27@@ -175,6 +178,39 @@ static int mmc_load_image_raw_os(struct mmc *mmc)
28 }
29 #endif
30
31+#ifdef CONFIG_SPL_FPGA_SUPPORT
32+static int mmc_load_fpga_image_fat(struct mmc *mmc)
33+{
34+ int err;
35+ int devnum = 0;
36+ const fpga_desc *const desc = fpga_get_desc(devnum);
37+ xilinx_desc *desc_xilinx = desc->devdesc;
38+
39+ err = spl_load_image_fat(&mmc->block_dev,
40+ CONFIG_SYS_MMCSD_FS_BOOT_PARTITION,
41+ CONFIG_SPL_FPGA_LOAD_ARGS_NAME);
42+
43+ if (err) {
44+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
45+ printf("spl: error reading image %s, err - %d\n",
46+ CONFIG_SPL_FPGA_LOAD_ARGS_NAME, err);
47+#endif
48+ return -1;
49+ }
50+
51+ err = fpga_loadbitstream(devnum, (char *)spl_image.load_addr,
52+ desc_xilinx->size, BIT_FULL);
53+ if (err) {
54+ printf("spl: fail to load bitstream, err - %d\n", err);
55+ printf("spl: retry fpga_load\n");
56+ err = fpga_load(devnum, (const void *)spl_image.load_addr,
57+ desc_xilinx->size, BIT_FULL);
58+ }
59+
60+ return err;
61+}
62+#endif
63+
64 #ifdef CONFIG_SYS_MMCSD_FS_BOOT_PARTITION
65 int spl_mmc_do_fs_boot(struct mmc *mmc)
66 {
67@@ -288,6 +324,10 @@ int spl_mmc_load_image(u32 boot_device)
68 case MMCSD_MODE_FS:
69 debug("spl: mmc boot mode: fs\n");
70
71+#ifdef CONFIG_SPL_FPGA_SUPPORT
72+ mmc_load_fpga_image_fat(mmc);
73+#endif
74+
75 err = spl_mmc_do_fs_boot(mmc);
76 if (!err)
77 return err;
78diff --git a/drivers/fpga/zynqpl.c b/drivers/fpga/zynqpl.c
79index ef889ea..41d72ce 100644
80--- a/drivers/fpga/zynqpl.c
81+++ b/drivers/fpga/zynqpl.c
82@@ -400,7 +400,7 @@ static int zynq_load(xilinx_desc *desc, const void *buf, size_t bsize,
83 return FPGA_SUCCESS;
84 }
85
86-#if defined(CONFIG_CMD_FPGA_LOADFS)
87+#if defined(CONFIG_CMD_FPGA_LOADFS) && !defined(CONFIG_SPL_BUILD)
88 static int zynq_loadfs(xilinx_desc *desc, const void *buf, size_t bsize,
89 fpga_fs_info *fsinfo)
90 {
91@@ -488,7 +488,7 @@ static int zynq_dump(xilinx_desc *desc, const void *buf, size_t bsize)
92
93 struct xilinx_fpga_op zynq_op = {
94 .load = zynq_load,
95-#if defined(CONFIG_CMD_FPGA_LOADFS)
96+#if defined(CONFIG_CMD_FPGA_LOADFS) && !defined(CONFIG_SPL_BUILD)
97 .loadfs = zynq_loadfs,
98 #endif
99 .dump = zynq_dump,
100diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h
101index 0ddbc99..4cb490b 100644
102--- a/include/configs/zynq-common.h
103+++ b/include/configs/zynq-common.h
104@@ -310,6 +310,11 @@
105
106 #define CONFIG_SPL_LDSCRIPT "arch/arm/mach-zynq/u-boot-spl.lds"
107
108+/* FPGA support */
109+#define CONFIG_SPL_FPGA_SUPPORT
110+#define CONFIG_SPL_FPGA_LOAD_ADDR 0x1000000
111+#define CONFIG_SPL_FPGA_LOAD_ARGS_NAME "bitstream"
112+
113 /* MMC support */
114 #ifdef CONFIG_ZYNQ_SDHCI
115 #define CONFIG_SPL_MMC_SUPPORT
116diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
117index 4424284..3c0d937 100644
118--- a/scripts/Makefile.spl
119+++ b/scripts/Makefile.spl
120@@ -58,6 +58,7 @@ libs-$(CONFIG_SPL_LIBDISK_SUPPORT) += disk/
121 libs-y += drivers/
122 libs-y += dts/
123 libs-y += fs/
124+libs-$(CONFIG_SPL_FPGA_SUPPORT) += drivers/fpga/
125 libs-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/
126 libs-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/
127 libs-$(CONFIG_SPL_NET_SUPPORT) += net/
128--
1291.9.1
130
diff --git a/recipes-bsp/u-boot/u-boot_2016.03.bbappend b/recipes-bsp/u-boot/u-boot_2016.03.bbappend
index 096f42e1..d132ad61 100644
--- a/recipes-bsp/u-boot/u-boot_2016.03.bbappend
+++ b/recipes-bsp/u-boot/u-boot_2016.03.bbappend
@@ -3,6 +3,10 @@ include u-boot-spl-zynq-init.inc
3FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" 3FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
4SRC_URI_append_picozed-zynq7 = " file://ARM-zynq-Configure-picozed-to-use-custom-init.patch" 4SRC_URI_append_picozed-zynq7 = " file://ARM-zynq-Configure-picozed-to-use-custom-init.patch"
5 5
6SRC_URI_append = " file://zynq-Add-fpga-support-to-u-boot-SPL.patch \
7 file://configs-zynq-common-Add-uEnv.txt-support.patch \
8"
9
6# u-boot 2016.03 has support for these 10# u-boot 2016.03 has support for these
7HAS_PS7INIT ?= " \ 11HAS_PS7INIT ?= " \
8 zynq_microzed_config \ 12 zynq_microzed_config \