ASR_BASE
Change-Id: Icf3719cc0afe3eeb3edc7fa80a2eb5199ca9dda1
diff --git a/package/boot/uboot-zynq/patches/010-fix_dtc_compilation_on_host_gcc10.patch b/package/boot/uboot-zynq/patches/010-fix_dtc_compilation_on_host_gcc10.patch
new file mode 100644
index 0000000..a4080e4
--- /dev/null
+++ b/package/boot/uboot-zynq/patches/010-fix_dtc_compilation_on_host_gcc10.patch
@@ -0,0 +1,48 @@
+From e33a814e772cdc36436c8c188d8c42d019fda639 Mon Sep 17 00:00:00 2001
+From: Dirk Mueller <dmueller@suse.com>
+Date: Tue, 14 Jan 2020 18:53:41 +0100
+Subject: [PATCH] scripts/dtc: Remove redundant YYLOC global declaration
+
+gcc 10 will default to -fno-common, which causes this error at link
+time:
+
+ (.text+0x0): multiple definition of `yylloc'; dtc-lexer.lex.o (symbol from plugin):(.text+0x0): first defined here
+
+This is because both dtc-lexer as well as dtc-parser define the same
+global symbol yyloc. Before with -fcommon those were merged into one
+defintion. The proper solution would be to to mark this as "extern",
+however that leads to:
+
+ dtc-lexer.l:26:16: error: redundant redeclaration of 'yylloc' [-Werror=redundant-decls]
+ 26 | extern YYLTYPE yylloc;
+ | ^~~~~~
+In file included from dtc-lexer.l:24:
+dtc-parser.tab.h:127:16: note: previous declaration of 'yylloc' was here
+ 127 | extern YYLTYPE yylloc;
+ | ^~~~~~
+cc1: all warnings being treated as errors
+
+which means the declaration is completely redundant and can just be
+dropped.
+
+Signed-off-by: Dirk Mueller <dmueller@suse.com>
+Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
+[robh: cherry-pick from upstream]
+Cc: stable@vger.kernel.org
+Signed-off-by: Rob Herring <robh@kernel.org>
+---
+ scripts/dtc/dtc-lexer.l | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l
+index 5c6c3fd557d7f..b3b7270300de5 100644
+--- a/scripts/dtc/dtc-lexer.l
++++ b/scripts/dtc/dtc-lexer.l
+@@ -38,7 +38,6 @@ LINECOMMENT "//".*\n
+ #include "srcpos.h"
+ #include "dtc-parser.tab.h"
+
+-YYLTYPE yylloc;
+ extern bool treesource_error;
+
+ /* CAUTION: this will stop working if we ever use yyless() or yyunput() */
diff --git a/package/boot/uboot-zynq/patches/110-zybo-z7-read-mac-address-from-SPI-flash-memory.patch b/package/boot/uboot-zynq/patches/110-zybo-z7-read-mac-address-from-SPI-flash-memory.patch
new file mode 100644
index 0000000..00dce9a
--- /dev/null
+++ b/package/boot/uboot-zynq/patches/110-zybo-z7-read-mac-address-from-SPI-flash-memory.patch
@@ -0,0 +1,103 @@
+From 67db0da72eb7ed87ebaaeb8a26891cb2cf916500 Mon Sep 17 00:00:00 2001
+From: Luis Araneda <luaraneda@gmail.com>
+Date: Sun, 21 Jul 2019 23:24:12 -0400
+Subject: [U-Boot] [PATCH] arm: zynq: read mac address from SPI flash memory
+
+Implement a method for reading the MAC address from an
+SPI flash memory.
+In particular, this method is used by the Zybo Z7 board
+to read the MAC address from the OTP region in the SPI NOR
+memory
+
+Signed-off-by: Luis Araneda <luaraneda@gmail.com>
+---
+As of 2019-08-18, this patch has not been accepted by upstream U-Boot.
+Keep this patch until an alternative is accepted by upstream.
+---
+ board/xilinx/common/board.c | 28 ++++++++++++++++++++++++++++
+ configs/zynq_zybo_z7_defconfig | 3 +++
+ drivers/misc/Kconfig | 17 +++++++++++++++++
+ 3 files changed, 48 insertions(+)
+
+--- a/board/xilinx/common/board.c
++++ b/board/xilinx/common/board.c
+@@ -6,7 +6,10 @@
+
+ #include <common.h>
+ #include <dm/uclass.h>
++#include <dm/device.h>
++#include <dm/device-internal.h>
+ #include <i2c.h>
++#include <spi_flash.h>
+
+ int zynq_board_read_rom_ethaddr(unsigned char *ethaddr)
+ {
+@@ -34,5 +37,30 @@ int zynq_board_read_rom_ethaddr(unsigned
+ debug("%s: I2C EEPROM MAC %pM\n", __func__, ethaddr);
+ #endif
+
++#if defined(CONFIG_MAC_ADDR_IN_SPI_FLASH)
++ struct spi_flash *flash;
++ struct udevice *dev;
++
++ ret = spi_flash_probe_bus_cs(CONFIG_SF_DEFAULT_BUS,
++ CONFIG_SF_DEFAULT_CS,
++ 0, 0, &dev);
++ if (ret) {
++ printf("SPI(bus:%u cs:%u) probe failed\n",
++ CONFIG_SF_DEFAULT_BUS,
++ CONFIG_SF_DEFAULT_CS);
++ return 0;
++ }
++
++ flash = dev_get_uclass_priv(dev);
++ flash->read_opcode = CONFIG_MAC_ADDR_SPI_FLASH_READ_CMD;
++
++ if (spi_flash_read_dm(dev,
++ CONFIG_MAC_ADDR_SPI_FLASH_DATA_OFFSET,
++ 6, ethaddr))
++ printf("SPI MAC address read failed\n");
++
++ device_remove(dev, DM_REMOVE_NORMAL);
++#endif
++
+ return ret;
+ }
+--- a/configs/zynq_zybo_z7_defconfig
++++ b/configs/zynq_zybo_z7_defconfig
+@@ -42,6 +42,9 @@ CONFIG_DFU_RAM=y
+ CONFIG_FPGA_XILINX=y
+ CONFIG_FPGA_ZYNQPL=y
+ CONFIG_DM_GPIO=y
++CONFIG_MAC_ADDR_IN_SPI_FLASH=y
++CONFIG_MAC_ADDR_SPI_FLASH_READ_CMD=0x4b
++CONFIG_MAC_ADDR_SPI_FLASH_DATA_OFFSET=0x20
+ CONFIG_MMC_SDHCI=y
+ CONFIG_MMC_SDHCI_ZYNQ=y
+ CONFIG_SPI_FLASH=y
+--- a/drivers/misc/Kconfig
++++ b/drivers/misc/Kconfig
+@@ -366,6 +366,23 @@ config SYS_I2C_EEPROM_ADDR_OVERFLOW
+
+ endif
+
++config MAC_ADDR_IN_SPI_FLASH
++ bool "MAC address in SPI flash"
++ help
++ Read MAC address from an SPI flash memory
++
++if MAC_ADDR_IN_SPI_FLASH
++
++config MAC_ADDR_SPI_FLASH_READ_CMD
++ hex "Read command for the SPI flash memory"
++ default 0
++
++config MAC_ADDR_SPI_FLASH_DATA_OFFSET
++ hex "Offset of MAC data in SPI flash memory"
++ default 0
++
++endif
++
+ config GDSYS_RXAUI_CTRL
+ bool "Enable gdsys RXAUI control driver"
+ depends on MISC
diff --git a/package/boot/uboot-zynq/patches/210-link-libcrypto-static.patch b/package/boot/uboot-zynq/patches/210-link-libcrypto-static.patch
new file mode 100644
index 0000000..d2e7bf1
--- /dev/null
+++ b/package/boot/uboot-zynq/patches/210-link-libcrypto-static.patch
@@ -0,0 +1,14 @@
+OpenWrt links the libressl statically against mkimage, make sure all the
+needed dependencies are added too.
+
+--- a/tools/Makefile
++++ b/tools/Makefile
+@@ -151,7 +151,7 @@ ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CON
+ HOSTCFLAGS_kwbimage.o += \
+ $(shell pkg-config --cflags libssl libcrypto 2> /dev/null || echo "")
+ HOSTLOADLIBES_mkimage += \
+- $(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto")
++ $(shell pkg-config --libs --static libssl libcrypto 2> /dev/null || echo "-lssl -lpthread -lcrypto")
+
+ # OS X deprecate openssl in favour of CommonCrypto, supress deprecation
+ # warnings on those systems