diff options
| author | Jason Wu <jason.wu.misc@gmail.com> | 2016-04-09 02:16:06 +1000 |
|---|---|---|
| committer | Nathan Rossi <nathan@nathanrossi.com> | 2016-05-03 21:51:05 +1000 |
| commit | 258f7d63e7a994f2f7e4a5d10076a12ca6e97e5d (patch) | |
| tree | 31feab9cb122d3deb0fbdaae97abcdf541b802a2 /recipes-bsp | |
| parent | 9d7e01003326a39020bb9ac1be4fd5dd72a0e38a (diff) | |
| download | meta-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')
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 @@ | |||
| 1 | From 4dd0f06c46085cacc607dabbdf288bef6ad67115 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Michal Simek <monstr@monstr.eu> | ||
| 3 | Date: Fri, 18 Mar 2016 23:43:39 +0100 | ||
| 4 | Subject: [PATCH] configs: zynq-common: Add uEnv.txt support | ||
| 5 | |||
| 6 | preboot macro load the uEnv.txt from mmc 0 when bootmode is mmc. uenvcmd is | ||
| 7 | executed after load of uEnv.txt if it is defined in the uEnv.txt env text | ||
| 8 | file. | ||
| 9 | |||
| 10 | The default importbootenv macro reads the uEnv.txt from mmc. | ||
| 11 | |||
| 12 | Additional to this, usb_loadbootenv is added to support loading uEnv.txt | ||
| 13 | from usb dev 0. | ||
| 14 | |||
| 15 | Upstream-Status: Backport | ||
| 16 | |||
| 17 | Signed-off-by: Michal Simek <monstr@monstr.eu> | ||
| 18 | Signed-off-by: Jason Wu <jason.wu.misc@gmail.com> | ||
| 19 | |||
| 20 | diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h | ||
| 21 | index 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 | -- | ||
| 65 | 1.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 @@ | |||
| 1 | From 14c84972b2c0a32664b3b392d18161998cd1200f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Michal Simek <michal.simek@xilinx.com> | ||
| 3 | Date: Fri, 18 Mar 2016 17:24:48 +0100 | ||
| 4 | Subject: [PATCH] zynq: Add fpga support to u-boot SPL | ||
| 5 | |||
| 6 | Load bitstream in SPL. "bitstream" can be in bit or bin format. | ||
| 7 | |||
| 8 | Upstream-Status: Pending | ||
| 9 | |||
| 10 | Signed-off-by: Jason Wu <jason.hy.wu@gmail.com> | ||
| 11 | Signed-off-by: Michal Simek <michal.simek@xilinx.com> | ||
| 12 | |||
| 13 | diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c | ||
| 14 | index 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; | ||
| 78 | diff --git a/drivers/fpga/zynqpl.c b/drivers/fpga/zynqpl.c | ||
| 79 | index 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, | ||
| 100 | diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h | ||
| 101 | index 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 | ||
| 116 | diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl | ||
| 117 | index 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 | -- | ||
| 129 | 1.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 | |||
| 3 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" | 3 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" |
| 4 | SRC_URI_append_picozed-zynq7 = " file://ARM-zynq-Configure-picozed-to-use-custom-init.patch" | 4 | SRC_URI_append_picozed-zynq7 = " file://ARM-zynq-Configure-picozed-to-use-custom-init.patch" |
| 5 | 5 | ||
| 6 | SRC_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 |
| 7 | HAS_PS7INIT ?= " \ | 11 | HAS_PS7INIT ?= " \ |
| 8 | zynq_microzed_config \ | 12 | zynq_microzed_config \ |
